Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Commit ff2bc4f

Browse files
committed
Revert "Merge github.com:Advanced-Effects/Rendering-Lab-App"
This reverts commit 94f9029, reversing changes made to f8979db.
1 parent 94f9029 commit ff2bc4f

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/ISkiaGLWindow.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
#include "ISkiaGLWindow.h"
22

33
#include "include/gpu/gl/GrGLInterface.h"
4+
#include "include/gpu/GrContext.h"
45
#include "include/core/SkImageInfo.h"
56
#include "include/core/SkGraphics.h"
67

78
// The Skia Surface is the object we use to talk to the GPU
89
// In order to render to an OpenGL context, we need to obtain the
910
// SkSurface from the GL context directly.
1011
// Ref: https://skia.org/docs/user/api/skcanvas_creation/
11-
sk_sp<SkSurface> ISkiaGLWindow::obtainSkiaSurfaceFromCurrentGLContext() {
12-
auto glContext = m_glWindow->glContext();
12+
sk_sp<SkSurface> obtainSkiaSurfaceFromCurrentGLContext(GLWindow *glWindow) {
13+
auto glContext = glWindow->glContext();
1314

1415
// Grabs the OpenGL context that is currently set as "current"
1516
// (we set it with `glfwMakeContextCurrent` in `main.cpp`)
1617
auto interface = GrGLMakeNativeInterface();
1718

1819
const GrContextOptions &grOptions = GrContextOptions();
19-
m_graphicsContext = GrContext::MakeGL(interface, grOptions);
20+
auto grContext = GrContext::MakeGL(interface, grOptions);
2021

21-
int width = m_glWindow->width();
22-
int height = m_glWindow->height();
22+
int width = glWindow->width();
23+
int height = glWindow->height();
2324
SkImageInfo imageInformation = SkImageInfo::MakeN32Premul(width, height);
2425

2526

2627
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
2728

2829
// Create the Skia Surface from the GL context
2930
return SkSurface::MakeRenderTarget(
30-
m_graphicsContext.get(),
31+
grContext.get(),
3132
SkBudgeted::kNo,
3233
imageInformation,
3334
kTopLeft_GrSurfaceOrigin,
@@ -39,7 +40,7 @@ sk_sp<SkSurface> ISkiaGLWindow::obtainSkiaSurfaceFromCurrentGLContext() {
3940
SkCanvas* ISkiaGLWindow::obtainSkCanvas() {
4041
// NOTE: We put SkiaSurface in a class field to keep it in memory
4142
// So we can keep drawing (either it crashes)
42-
m_skiaSurface = obtainSkiaSurfaceFromCurrentGLContext();
43+
m_skiaSurface = obtainSkiaSurfaceFromCurrentGLContext(m_glWindow);
4344
if (!m_skiaSurface) {
4445
return nullptr;
4546
}
@@ -56,8 +57,6 @@ void ISkiaGLWindow::requestPaint() {
5657
if (!m_skiaContext || !m_skiaSurface) return;
5758

5859
paintThisFrame(m_skiaContext);
59-
// Tell Skia to render stuff to GPU
60-
m_graphicsContext->flush();
6160
};
6261

6362
ISkiaGLWindow::ISkiaGLWindow(GLWindow *glWindow)

src/ISkiaGLWindow.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "GLWindow.h"
44
#include "include/core/SkCanvas.h"
55
#include "include/core/SkSurface.h"
6-
#include "include/gpu/GrContext.h"
76

87
// This object connects the Skia library to the OpenGL window,
98
// and provides a method to draw.
@@ -21,12 +20,9 @@ class ISkiaGLWindow {
2120

2221
// Skia Canvas is the object we use to draw shapes
2322
SkCanvas* m_skiaContext = nullptr;
24-
sk_sp<SkSurface> obtainSkiaSurfaceFromCurrentGLContext();
2523
SkCanvas* obtainSkCanvas();
2624
// we store skia surface here to keep it in memory
2725
sk_sp<SkSurface> m_skiaSurface;
28-
// portal between software and the gpu
29-
sk_sp<GrContext> m_graphicsContext = nullptr;
3026

3127
// Call this function when something happens on the canvas and needs to be redrawn.
3228
// (An object changes, a new keyframe is selected, zoom in/out...)

0 commit comments

Comments
 (0)