| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 SkASSERT(nullptr == fContext); | 41 SkASSERT(nullptr == fContext); |
| 42 fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fBackendCo
ntext.get()); | 42 fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fBackendCo
ntext.get()); |
| 43 | 43 |
| 44 // We may not have real sRGB support (ANGLE, in particular), so check for | 44 // We may not have real sRGB support (ANGLE, in particular), so check for |
| 45 // that, and fall back to L32: | 45 // that, and fall back to L32: |
| 46 // | 46 // |
| 47 // ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversi
on on write, | 47 // ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversi
on on write, |
| 48 // so pretend that it's non-sRGB 8888: | 48 // so pretend that it's non-sRGB 8888: |
| 49 fPixelConfig = fContext->caps()->srgbSupport() && | 49 fPixelConfig = fContext->caps()->srgbSupport() && |
| 50 SkColorAndColorSpaceAreGammaCorrect(fDisplayParams.fColorType
, | 50 SkColorAndProfileAreGammaCorrect(fDisplayParams.fColorType, |
| 51 fDisplayParams.fColorSpac
e.get()) && | 51 fDisplayParams.fProfileType)
&& |
| 52 (fColorBits != 30) ? kSkiaGamma8888_GrPixelConfig : kSkia8888
_GrPixelConfig; | 52 (fColorBits != 30) ? kSkiaGamma8888_GrPixelConfig : kSkia8888
_GrPixelConfig; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void GLWindowContext::destroyContext() { | 55 void GLWindowContext::destroyContext() { |
| 56 fSurface.reset(nullptr); | 56 fSurface.reset(nullptr); |
| 57 fRenderTarget.reset(nullptr); | 57 fRenderTarget.reset(nullptr); |
| 58 | 58 |
| 59 if (fContext) { | 59 if (fContext) { |
| 60 // in case we have outstanding refs to this guy (lua?) | 60 // in case we have outstanding refs to this guy (lua?) |
| 61 fContext->abandonContext(); | 61 fContext->abandonContext(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 this->initializeContext(nullptr, fDisplayParams); | 103 this->initializeContext(nullptr, fDisplayParams); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GLWindowContext::setDisplayParams(const DisplayParams& params) { | 106 void GLWindowContext::setDisplayParams(const DisplayParams& params) { |
| 107 this->destroyContext(); | 107 this->destroyContext(); |
| 108 | 108 |
| 109 this->initializeContext(nullptr, params); | 109 this->initializeContext(nullptr, params); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } //namespace sk_app | 112 } //namespace sk_app |
| OLD | NEW |