diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/mac/SkNSView.h | 4 | ||||
-rw-r--r-- | src/utils/mac/SkNSView.mm | 9 | ||||
-rw-r--r-- | src/utils/mac/SkOSWindow_Mac.mm | 4 | ||||
-rw-r--r-- | src/utils/mac/SkSampleNSView.h | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/utils/mac/SkNSView.h b/src/utils/mac/SkNSView.h index 87c2727d18..6b8989a713 100644 --- a/src/utils/mac/SkNSView.h +++ b/src/utils/mac/SkNSView.h @@ -42,7 +42,7 @@ class SkEvent; - (void)postInvalWithRect:(const SkIRect*)rectOrNil; - (BOOL)onHandleEvent:(const SkEvent&)event; -- (void)attachGL; +- (bool)attachGL; - (void)detachGL; - (void)presentGL; -@end
\ No newline at end of file +@end diff --git a/src/utils/mac/SkNSView.mm b/src/utils/mac/SkNSView.mm index c498bf5f09..b520dd5f7f 100644 --- a/src/utils/mac/SkNSView.mm +++ b/src/utils/mac/SkNSView.mm @@ -265,9 +265,13 @@ CGLContextObj createGLContext() { [fGLContext setView:self]; } } -- (void)attachGL { - if (nil == fGLContext) +- (bool)attachGL { + if (nil == fGLContext) { fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:createGLContext()]; + if (NULL == fGLContext) { + return false; + } + } [fGLContext makeCurrentContext]; @@ -275,6 +279,7 @@ CGLContextObj createGLContext() { glClearColor(0, 0, 0, 0); glClearStencil(0); glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + return true; } - (void)detachGL { diff --git a/src/utils/mac/SkOSWindow_Mac.mm b/src/utils/mac/SkOSWindow_Mac.mm index def95f5bc3..7ac36d54a7 100644 --- a/src/utils/mac/SkOSWindow_Mac.mm +++ b/src/utils/mac/SkOSWindow_Mac.mm @@ -64,7 +64,7 @@ void SkOSWindow::onUpdateMenu(const SkOSMenu* menu) { } bool SkOSWindow::attachGL() { - [(SkNSView*)fHWND attachGL]; + return [(SkNSView*)fHWND attachGL]; } void SkOSWindow::detachGL() { @@ -75,4 +75,4 @@ void SkOSWindow::presentGL() { [(SkNSView*)fHWND presentGL]; } -#endif
\ No newline at end of file +#endif diff --git a/src/utils/mac/SkSampleNSView.h b/src/utils/mac/SkSampleNSView.h index 6e38851efe..d3aca9a735 100644 --- a/src/utils/mac/SkSampleNSView.h +++ b/src/utils/mac/SkSampleNSView.h @@ -9,4 +9,4 @@ #import "SkNSView.h" @interface SkSampleNSView : SkNSView - (id)initWithDefaults; -@end
\ No newline at end of file +@end |