[aseprite] 173/250: Catch exceptions if GL context cannot be created on Skia/OSX
Tobias Hansen
thansen at moszumanska.debian.org
Sun Dec 20 15:27:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 2e5f051e7d346eeddb87dbfc2184e3ac76204504
Author: David Capello <davidcapello at gmail.com>
Date: Wed Oct 14 13:32:15 2015 -0300
Catch exceptions if GL context cannot be created on Skia/OSX
---
src/she/skia/skia_window_osx.mm | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/she/skia/skia_window_osx.mm b/src/she/skia/skia_window_osx.mm
index 2e36962..c936725 100644
--- a/src/she/skia/skia_window_osx.mm
+++ b/src/she/skia/skia_window_osx.mm
@@ -37,7 +37,10 @@ public:
int width, int height, int scale)
: m_display(display)
, m_backend(Backend::NONE)
- , m_nsGL(nil) {
+#if SK_SUPPORT_GPU
+ , m_nsGL(nil)
+#endif
+ {
m_closing = false;
m_window = [[OSXWindow alloc] initWithImpl:this
width:width
@@ -166,24 +169,33 @@ public:
}
void onWindowChanged() override {
+#ifdef SK_SUPPORT_GPU
if (m_nsGL)
[m_nsGL setView:[m_window contentView]];
+#endif
}
private:
#if SK_SUPPORT_GPU
bool attachGL() {
if (!m_glCtx) {
- auto ctx = new GLContextSkia<GLContextCGL>(nullptr);
+ try {
+ auto ctx = new GLContextSkia<GLContextCGL>(nullptr);
- m_glCtx.reset(ctx);
- m_grCtx.reset(GrContext::Create(kOpenGL_GrBackend,
- (GrBackendContext)m_glCtx->gl()));
+ m_glCtx.reset(ctx);
+ m_grCtx.reset(GrContext::Create(kOpenGL_GrBackend,
+ (GrBackendContext)m_glCtx->gl()));
- m_nsGL = [[NSOpenGLContext alloc]
- initWithCGLContextObj:m_glCtx->cglContext()];
+ m_nsGL = [[NSOpenGLContext alloc]
+ initWithCGLContextObj:m_glCtx->cglContext()];
- [m_nsGL setView:[m_window contentView]];
+ [m_nsGL setView:m_window.contentView];
+ }
+ catch (const std::exception& ex) {
+ LOG("Cannot create GL context: %s\n", ex.what());
+ detachGL();
+ return false;
+ }
}
return true;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list