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

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

Issue 2054223002: Request an sRGB FBO0 on Android. Fixes sRGB GL mode. (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 0b3363354b5c235d1947b89f90426c2ec7b19094..5ff641d2e416c35c265e6fa1fc8843631b8cb4f0 100644
--- a/tools/viewer/sk_app/android/GLWindowContext_android.cpp
+++ b/tools/viewer/sk_app/android/GLWindowContext_android.cpp
@@ -86,8 +86,21 @@ void GLWindowContext_android::onInitializeContext(void* platformData, const Disp
fDisplay, surfaceConfig, nullptr, kEGLContextAttribsForOpenGLES);
SkASSERT(EGL_NO_CONTEXT != fEGLContext);
+ // 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
+ // advertising that extension (including Nexus 5X). So just check version?
+ const EGLint srgbWindowAttribs[] = {
+ /*EGL_GL_COLORSPACE_KHR*/ 0x309D, /*EGL_GL_COLORSPACE_SRGB_KHR*/ 0x3089,
+ EGL_NONE,
+ };
+ const EGLint* windowAttribs = nullptr;
+ if (kSRGB_SkColorProfileType == params.fProfileType && majorVersion == 1 && minorVersion >= 2) {
+ windowAttribs = srgbWindowAttribs;
+ }
+
fSurface = eglCreateWindowSurface(
- fDisplay, surfaceConfig, fNativeWindow, nullptr);
+ fDisplay, surfaceConfig, fNativeWindow, windowAttribs);
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