| 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 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 Loading... |
| 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 } |
| OLD | NEW |