Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: tools/viewer/sk_app/android/GLWindowContext_android.cpp

Issue 2066743003: If we fail to create a window surface with sRGB, try again without. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/android/GLWindowContext_android.cpp
diff --git a/tools/viewer/sk_app/android/GLWindowContext_android.cpp b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
index 5ff641d2e416c35c265e6fa1fc8843631b8cb4f0..79425b41155237a207f19683492267a6ab6da4f2 100644
--- a/tools/viewer/sk_app/android/GLWindowContext_android.cpp
+++ b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
@@ -86,6 +86,10 @@ void GLWindowContext_android::onInitializeContext(void* platformData, const Disp
fDisplay, surfaceConfig, nullptr, kEGLContextAttribsForOpenGLES);
SkASSERT(EGL_NO_CONTEXT != fEGLContext);
+// SkDebugf("EGL: %d.%d", majorVersion, minorVersion);
+// SkDebugf("Vendor: %s", eglQueryString(fDisplay, EGL_VENDOR));
+// SkDebugf("Extensions: %s", eglQueryString(fDisplay, EGL_EXTENSIONS));
+
// These values are the same as the corresponding VG colorspace attributes,
// which were accepted starting in EGL 1.2. For some reason in 1.4, sRGB
// became hidden behind an extension, but it looks like devices aren't
@@ -99,8 +103,11 @@ void GLWindowContext_android::onInitializeContext(void* platformData, const Disp
windowAttribs = srgbWindowAttribs;
}
- fSurface = eglCreateWindowSurface(
- fDisplay, surfaceConfig, fNativeWindow, windowAttribs);
+ fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, windowAttribs);
+ if (EGL_NO_SURFACE == fSurface && windowAttribs) {
+ // Try again without sRGB
+ fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, nullptr);
+ }
SkASSERT(EGL_NO_SURFACE != fSurface);
SkAssertResult(eglMakeCurrent(fDisplay, fSurface, fSurface, fEGLContext));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698