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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include <GLES/gl.h> 9 #include <GLES/gl.h>
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 SkASSERT(numConfigs > 0); 79 SkASSERT(numConfigs > 0);
80 80
81 static const EGLint kEGLContextAttribsForOpenGLES[] = { 81 static const EGLint kEGLContextAttribsForOpenGLES[] = {
82 EGL_CONTEXT_CLIENT_VERSION, 2, 82 EGL_CONTEXT_CLIENT_VERSION, 2,
83 EGL_NONE 83 EGL_NONE
84 }; 84 };
85 fEGLContext = eglCreateContext( 85 fEGLContext = eglCreateContext(
86 fDisplay, surfaceConfig, nullptr, kEGLContextAttribsForOpenGLES); 86 fDisplay, surfaceConfig, nullptr, kEGLContextAttribsForOpenGLES);
87 SkASSERT(EGL_NO_CONTEXT != fEGLContext); 87 SkASSERT(EGL_NO_CONTEXT != fEGLContext);
88 88
89 // These values are the same as the corresponding VG colorspace attributes,
90 // which were accepted starting in EGL 1.2. For some reason in 1.4, sRGB
91 // became hidden behind an extension, but it looks like devices aren't
92 // advertising that extension (including Nexus 5X). So just check version?
93 const EGLint srgbWindowAttribs[] = {
94 /*EGL_GL_COLORSPACE_KHR*/ 0x309D, /*EGL_GL_COLORSPACE_SRGB_KHR*/ 0x3089,
95 EGL_NONE,
96 };
97 const EGLint* windowAttribs = nullptr;
98 if (kSRGB_SkColorProfileType == params.fProfileType && majorVersion == 1 && minorVersion >= 2) {
99 windowAttribs = srgbWindowAttribs;
100 }
101
89 fSurface = eglCreateWindowSurface( 102 fSurface = eglCreateWindowSurface(
90 fDisplay, surfaceConfig, fNativeWindow, nullptr); 103 fDisplay, surfaceConfig, fNativeWindow, windowAttribs);
91 SkASSERT(EGL_NO_SURFACE != fSurface); 104 SkASSERT(EGL_NO_SURFACE != fSurface);
92 105
93 SkAssertResult(eglMakeCurrent(fDisplay, fSurface, fSurface, fEGLContext)); 106 SkAssertResult(eglMakeCurrent(fDisplay, fSurface, fSurface, fEGLContext));
94 // GLWindowContext::initializeContext will call GrGLCreateNativeInterface so we 107 // GLWindowContext::initializeContext will call GrGLCreateNativeInterface so we
95 // won't call it here. 108 // won't call it here.
96 109
97 glClearStencil(0); 110 glClearStencil(0);
98 glClearColor(0, 0, 0, 0); 111 glClearColor(0, 0, 0, 0);
99 glStencilMask(0xffffffff); 112 glStencilMask(0xffffffff);
100 glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); 113 glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
(...skipping 18 matching lines...) Expand all
119 fSurface = EGL_NO_SURFACE; 132 fSurface = EGL_NO_SURFACE;
120 } 133 }
121 134
122 void GLWindowContext_android::onSwapBuffers() { 135 void GLWindowContext_android::onSwapBuffers() {
123 if (fDisplay && fEGLContext && fSurface) { 136 if (fDisplay && fEGLContext && fSurface) {
124 eglSwapBuffers(fDisplay, fSurface); 137 eglSwapBuffers(fDisplay, fSurface);
125 } 138 }
126 } 139 }
127 140
128 } 141 }
OLDNEW
« 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