aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_app/mac/GLWindowContext_mac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sk_app/mac/GLWindowContext_mac.cpp')
-rw-r--r--tools/sk_app/mac/GLWindowContext_mac.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/tools/sk_app/mac/GLWindowContext_mac.cpp b/tools/sk_app/mac/GLWindowContext_mac.cpp
index 67fb853fee..f7e56ccb62 100644
--- a/tools/sk_app/mac/GLWindowContext_mac.cpp
+++ b/tools/sk_app/mac/GLWindowContext_mac.cpp
@@ -27,7 +27,7 @@ public:
void onSwapBuffers() override;
sk_sp<const GrGLInterface> onInitializeContext() override;
- void onDestroyContext() override;
+ void onDestroyContext() override {}
private:
SDL_Window* fWindow;
@@ -39,7 +39,7 @@ private:
GLWindowContext_mac::GLWindowContext_mac(const MacWindowInfo& info, const DisplayParams& params)
: INHERITED(params)
, fWindow(info.fWindow)
- , fGLContext(nullptr) {
+ , fGLContext(info.fGLContext) {
// any config code here (particularly for msaa)?
@@ -52,12 +52,7 @@ GLWindowContext_mac::~GLWindowContext_mac() {
sk_sp<const GrGLInterface> GLWindowContext_mac::onInitializeContext() {
SkASSERT(fWindow);
-
- fGLContext = SDL_GL_CreateContext(fWindow);
- if (!fGLContext) {
- SkDebugf("%s\n", SDL_GetError());
- return nullptr;
- }
+ SkASSERT(fGLContext);
if (0 == SDL_GL_MakeCurrent(fWindow, fGLContext)) {
glClearStencil(0);
@@ -77,15 +72,6 @@ sk_sp<const GrGLInterface> GLWindowContext_mac::onInitializeContext() {
return GrGLMakeNativeInterface();
}
-void GLWindowContext_mac::onDestroyContext() {
- if (!fWindow || !fGLContext) {
- return;
- }
- SDL_GL_DeleteContext(fGLContext);
- fGLContext = nullptr;
-}
-
-
void GLWindowContext_mac::onSwapBuffers() {
if (fWindow && fGLContext) {
SDL_GL_SwapWindow(fWindow);