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

Side by Side Diff: tools/viewer/sk_app/GLWindowContext.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
« no previous file with comments | « tools/viewer/sk_app/DisplayParams.h ('k') | tools/viewer/sk_app/VulkanWindowContext.cpp » ('j') | 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 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
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 SkColorAndProfileAreGammaCorrect(fDisplayParams.fColorType, 50 SkColorAndColorSpaceAreGammaCorrect(fDisplayParams.fColorType ,
51 fDisplayParams.fProfileType) && 51 fDisplayParams.fColorSpac e.get()) &&
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
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
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/DisplayParams.h ('k') | tools/viewer/sk_app/VulkanWindowContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698