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

Side by Side Diff: src/gpu/GrDrawingManager.cpp

Issue 2270823002: Some tests around surface creation and snapshotting with color space (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Test wrapped backend textures, too. Make those tests pass. Fix problems when sRGB support is missin… 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 | « no previous file | src/gpu/SkGpuDevice.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "GrDrawContext.h" 8 #include "GrDrawContext.h"
9 #include "GrDrawingManager.h" 9 #include "GrDrawingManager.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (!pr && allowSW) { 177 if (!pr && allowSW) {
178 if (!fSoftwarePathRenderer) { 178 if (!fSoftwarePathRenderer) {
179 fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext->texture Provider()); 179 fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext->texture Provider());
180 } 180 }
181 pr = fSoftwarePathRenderer; 181 pr = fSoftwarePathRenderer;
182 } 182 }
183 183
184 return pr; 184 return pr;
185 } 185 }
186 186
187 static bool checkConfigAndColorSpace(GrPixelConfig config, SkColorSpace* colorSp ace) {
Brian Osman 2016/08/23 19:54:46 I'm sad that I have this code in three places, now
188 switch (config) {
189 case kRGBA_half_GrPixelConfig:
190 return colorSpace && SkColorSpace::kLinear_GammaNamed == colorSpace- >gammaNamed();
191 case kSRGBA_8888_GrPixelConfig:
192 case kSBGRA_8888_GrPixelConfig:
193 return colorSpace && colorSpace->gammaCloseToSRGB();
194 default:
195 return !colorSpace;
196 }
197 }
198
187 sk_sp<GrDrawContext> GrDrawingManager::makeDrawContext(sk_sp<GrRenderTarget> rt, 199 sk_sp<GrDrawContext> GrDrawingManager::makeDrawContext(sk_sp<GrRenderTarget> rt,
188 sk_sp<SkColorSpace> color Space, 200 sk_sp<SkColorSpace> color Space,
189 const SkSurfaceProps* sur faceProps) { 201 const SkSurfaceProps* sur faceProps) {
190 if (this->wasAbandoned()) { 202 if (this->wasAbandoned()) {
191 return nullptr; 203 return nullptr;
192 } 204 }
193 205
206 if (!checkConfigAndColorSpace(rt->config(), colorSpace.get())) {
207 return nullptr;
208 }
194 209
195 bool useDIF = false; 210 bool useDIF = false;
196 if (surfaceProps) { 211 if (surfaceProps) {
197 useDIF = surfaceProps->isUseDeviceIndependentFonts(); 212 useDIF = surfaceProps->isUseDeviceIndependentFonts();
198 } 213 }
199 214
200 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && 215 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() &&
201 rt->isStencilBufferMultisampled()) { 216 rt->isStencilBufferMultisampled()) {
202 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt achment(rt.get()); 217 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt achment(rt.get());
203 if (sb) { 218 if (sb) {
204 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( 219 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext(
205 fContext, this, std::mov e(rt), 220 fContext, this, std::mov e(rt),
206 std::move(colorSpace), s urfaceProps, 221 std::move(colorSpace), s urfaceProps,
207 fContext->getAuditTrail( ), fSingleOwner)); 222 fContext->getAuditTrail( ), fSingleOwner));
208 } 223 }
209 } 224 }
210 225
211 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 226 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
212 std::move(colorSpace), surface Props, 227 std::move(colorSpace), surface Props,
213 fContext->getAuditTrail(), 228 fContext->getAuditTrail(),
214 fSingleOwner)); 229 fSingleOwner));
215 } 230 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698