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

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 2318663003: Delete SkColorSpace::gammaNamed() from public API (Closed) Base URL: https://skia.googlesource.com/skia.git@delunknownnamed
Patch Set: Rebase Created 4 years, 3 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 | « src/core/SkColorSpace_ICC.cpp ('k') | src/image/SkSurface_Raster.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSurface_Gpu.h" 8 #include "SkSurface_Gpu.h"
9 9
10 #include "GrContextPriv.h" 10 #include "GrContextPriv.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 void SkSurface_Gpu::onPrepareForExternalIO() { 130 void SkSurface_Gpu::onPrepareForExternalIO() {
131 fDevice->flush(); 131 fDevice->flush();
132 } 132 }
133 133
134 /////////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////////
135 135
136 bool SkSurface_Gpu::Valid(const SkImageInfo& info) { 136 bool SkSurface_Gpu::Valid(const SkImageInfo& info) {
137 switch (info.colorType()) { 137 switch (info.colorType()) {
138 case kRGBA_F16_SkColorType: 138 case kRGBA_F16_SkColorType:
139 return info.colorSpace() && 139 return info.colorSpace() && info.colorSpace()->gammaIsLinear();
140 SkColorSpace::kLinear_GammaNamed == info.colorSpace()->gammaN amed();
141 case kRGBA_8888_SkColorType: 140 case kRGBA_8888_SkColorType:
142 case kBGRA_8888_SkColorType: 141 case kBGRA_8888_SkColorType:
143 return !info.colorSpace() || info.colorSpace()->gammaCloseToSRGB(); 142 return !info.colorSpace() || info.colorSpace()->gammaCloseToSRGB();
144 default: 143 default:
145 return !info.colorSpace(); 144 return !info.colorSpace();
146 } 145 }
147 } 146 }
148 147
149 bool SkSurface_Gpu::Valid(GrContext* context, GrPixelConfig config, SkColorSpace * colorSpace) { 148 bool SkSurface_Gpu::Valid(GrContext* context, GrPixelConfig config, SkColorSpace * colorSpace) {
150 switch (config) { 149 switch (config) {
151 case kRGBA_half_GrPixelConfig: 150 case kRGBA_half_GrPixelConfig:
152 return colorSpace && SkColorSpace::kLinear_GammaNamed == colorSpace- >gammaNamed(); 151 return colorSpace && colorSpace->gammaIsLinear();
153 case kSRGBA_8888_GrPixelConfig: 152 case kSRGBA_8888_GrPixelConfig:
154 case kSBGRA_8888_GrPixelConfig: 153 case kSBGRA_8888_GrPixelConfig:
155 return context->caps()->srgbSupport() && colorSpace && colorSpace->g ammaCloseToSRGB(); 154 return context->caps()->srgbSupport() && colorSpace && colorSpace->g ammaCloseToSRGB();
156 case kRGBA_8888_GrPixelConfig: 155 case kRGBA_8888_GrPixelConfig:
157 case kBGRA_8888_GrPixelConfig: 156 case kBGRA_8888_GrPixelConfig:
158 // If we don't have sRGB support, we may get here with a color space . It still needs 157 // If we don't have sRGB support, we may get here with a color space . It still needs
159 // to be sRGB-like (so that the application will work correctly on s RGB devices.) 158 // to be sRGB-like (so that the application will work correctly on s RGB devices.)
160 return !colorSpace || 159 return !colorSpace ||
161 (!context->caps()->srgbSupport() && colorSpace->gammaCloseToSRGB ()); 160 (!context->caps()->srgbSupport() && colorSpace->gammaCloseToSRGB ());
162 default: 161 default:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 258
260 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(dc), desc.fWidth, desc .fHeight, 259 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(dc), desc.fWidth, desc .fHeight,
261 SkGpuDevice::kUninit_InitContent s)); 260 SkGpuDevice::kUninit_InitContent s));
262 if (!device) { 261 if (!device) {
263 return nullptr; 262 return nullptr;
264 } 263 }
265 return sk_make_sp<SkSurface_Gpu>(std::move(device)); 264 return sk_make_sp<SkSurface_Gpu>(std::move(device));
266 } 265 }
267 266
268 #endif 267 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorSpace_ICC.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698