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

Side by Side Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 2358433004: Cleanup some sRGB TODOs, mostly around setting GrPaint flags correctly (Closed)
Patch Set: 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/effects/SkMorphologyImageFilter.cpp ('k') | no next file » | 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 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
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 "SkXfermodeImageFilter.h" 8 #include "SkXfermodeImageFilter.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 if (background) { 173 if (background) {
174 backgroundTex = background->asTextureRef(context); 174 backgroundTex = background->asTextureRef(context);
175 } 175 }
176 176
177 if (foreground) { 177 if (foreground) {
178 foregroundTex = foreground->asTextureRef(context); 178 foregroundTex = foreground->asTextureRef(context);
179 } 179 }
180 180
181 GrPaint paint; 181 GrPaint paint;
182 // SRGBTODO: AllowSRGBInputs?
183 sk_sp<GrFragmentProcessor> bgFP; 182 sk_sp<GrFragmentProcessor> bgFP;
184 183
185 if (backgroundTex) { 184 if (backgroundTex) {
186 SkMatrix backgroundMatrix; 185 SkMatrix backgroundMatrix;
187 backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height() ); 186 backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height() );
188 backgroundMatrix.preTranslate(-SkIntToScalar(backgroundOffset.fX), 187 backgroundMatrix.preTranslate(-SkIntToScalar(backgroundOffset.fX),
189 -SkIntToScalar(backgroundOffset.fY)); 188 -SkIntToScalar(backgroundOffset.fY));
190 bgFP = GrTextureDomainEffect::Make( 189 bgFP = GrTextureDomainEffect::Make(
191 backgroundTex.get(), nullptr, backgroundMatrix, 190 backgroundTex.get(), nullptr, backgroundMatrix,
192 GrTextureDomain::MakeTexelDomain(backgroundTex.get() , 191 GrTextureDomain::MakeTexelDomain(backgroundTex.get() ,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 240
242 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 241 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
243 242
244 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApp rox, 243 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApp rox,
245 bounds.width(), bo unds.height(), 244 bounds.width(), bo unds.height(),
246 kSkia8888_GrPixelC onfig, 245 kSkia8888_GrPixelC onfig,
247 sk_ref_sp(source-> getColorSpace()))); 246 sk_ref_sp(source-> getColorSpace())));
248 if (!drawContext) { 247 if (!drawContext) {
249 return nullptr; 248 return nullptr;
250 } 249 }
250 paint.setAllowSRGBInputs(drawContext->isGammaCorrect());
251 251
252 SkMatrix matrix; 252 SkMatrix matrix;
253 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); 253 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ()));
254 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); 254 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
255 255
256 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he ight()), 256 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he ight()),
257 kNeedNewImageUniqueID_SpecialImage, 257 kNeedNewImageUniqueID_SpecialImage,
258 drawContext->asTexture(), 258 drawContext->asTexture(),
259 sk_ref_sp(drawContext->getColorSpace())); 259 sk_ref_sp(drawContext->getColorSpace()));
260 } 260 }
261 261
262 #endif 262 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698