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

Side by Side Diff: tools/viewer/sk_app/android/GLWindowContext_android.cpp

Issue 2069173002: Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bad assert 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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 // These values are the same as the corresponding VG colorspace attributes, 93 // These values are the same as the corresponding VG colorspace attributes,
94 // which were accepted starting in EGL 1.2. For some reason in 1.4, sRGB 94 // which were accepted starting in EGL 1.2. For some reason in 1.4, sRGB
95 // became hidden behind an extension, but it looks like devices aren't 95 // became hidden behind an extension, but it looks like devices aren't
96 // advertising that extension (including Nexus 5X). So just check version? 96 // advertising that extension (including Nexus 5X). So just check version?
97 const EGLint srgbWindowAttribs[] = { 97 const EGLint srgbWindowAttribs[] = {
98 /*EGL_GL_COLORSPACE_KHR*/ 0x309D, /*EGL_GL_COLORSPACE_SRGB_KHR*/ 0x3089, 98 /*EGL_GL_COLORSPACE_KHR*/ 0x309D, /*EGL_GL_COLORSPACE_SRGB_KHR*/ 0x3089,
99 EGL_NONE, 99 EGL_NONE,
100 }; 100 };
101 const EGLint* windowAttribs = nullptr; 101 const EGLint* windowAttribs = nullptr;
102 if (kSRGB_SkColorProfileType == params.fProfileType && majorVersion == 1 && minorVersion >= 2) { 102 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
103 if (srgbColorSpace == params.fColorSpace && majorVersion == 1 && minorVersio n >= 2) {
103 windowAttribs = srgbWindowAttribs; 104 windowAttribs = srgbWindowAttribs;
104 } 105 }
105 106
106 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, wi ndowAttribs); 107 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, wi ndowAttribs);
107 if (EGL_NO_SURFACE == fSurface && windowAttribs) { 108 if (EGL_NO_SURFACE == fSurface && windowAttribs) {
108 // Try again without sRGB 109 // Try again without sRGB
109 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow , nullptr); 110 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow , nullptr);
110 } 111 }
111 SkASSERT(EGL_NO_SURFACE != fSurface); 112 SkASSERT(EGL_NO_SURFACE != fSurface);
112 113
(...skipping 26 matching lines...) Expand all
139 fSurface = EGL_NO_SURFACE; 140 fSurface = EGL_NO_SURFACE;
140 } 141 }
141 142
142 void GLWindowContext_android::onSwapBuffers() { 143 void GLWindowContext_android::onSwapBuffers() {
143 if (fDisplay && fEGLContext && fSurface) { 144 if (fDisplay && fEGLContext && fSurface) {
144 eglSwapBuffers(fDisplay, fSurface); 145 eglSwapBuffers(fDisplay, fSurface);
145 } 146 }
146 } 147 }
147 148
148 } 149 }
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/WindowContext.cpp ('k') | tools/viewer/sk_app/android/RasterWindowContext_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698