| OLD | NEW |
| 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 Loading... |
| 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 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 102 if (kSRGB_SkColorProfileType == params.fProfileType && majorVersion == 1 &&
minorVersion >= 2) { |
| 103 if (srgbColorSpace == params.fColorSpace && majorVersion == 1 && minorVersio
n >= 2) { | |
| 104 windowAttribs = srgbWindowAttribs; | 103 windowAttribs = srgbWindowAttribs; |
| 105 } | 104 } |
| 106 | 105 |
| 107 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, wi
ndowAttribs); | 106 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow, wi
ndowAttribs); |
| 108 if (EGL_NO_SURFACE == fSurface && windowAttribs) { | 107 if (EGL_NO_SURFACE == fSurface && windowAttribs) { |
| 109 // Try again without sRGB | 108 // Try again without sRGB |
| 110 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow
, nullptr); | 109 fSurface = eglCreateWindowSurface(fDisplay, surfaceConfig, fNativeWindow
, nullptr); |
| 111 } | 110 } |
| 112 SkASSERT(EGL_NO_SURFACE != fSurface); | 111 SkASSERT(EGL_NO_SURFACE != fSurface); |
| 113 | 112 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 140 fSurface = EGL_NO_SURFACE; | 139 fSurface = EGL_NO_SURFACE; |
| 141 } | 140 } |
| 142 | 141 |
| 143 void GLWindowContext_android::onSwapBuffers() { | 142 void GLWindowContext_android::onSwapBuffers() { |
| 144 if (fDisplay && fEGLContext && fSurface) { | 143 if (fDisplay && fEGLContext && fSurface) { |
| 145 eglSwapBuffers(fDisplay, fSurface); | 144 eglSwapBuffers(fDisplay, fSurface); |
| 146 } | 145 } |
| 147 } | 146 } |
| 148 | 147 |
| 149 } | 148 } |
| OLD | NEW |