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

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

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More progress & refactoring Created 4 years, 5 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/SkMagnifierImageFilter.cpp ('k') | src/gpu/GrBlurUtils.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 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 GrPaint paint; 181 GrPaint paint;
182 // SRGBTODO: AllowSRGBInputs? 182 // SRGBTODO: AllowSRGBInputs?
183 sk_sp<GrFragmentProcessor> bgFP; 183 sk_sp<GrFragmentProcessor> bgFP;
184 184
185 if (backgroundTex) { 185 if (backgroundTex) {
186 SkMatrix backgroundMatrix; 186 SkMatrix backgroundMatrix;
187 backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height() ); 187 backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height() );
188 backgroundMatrix.preTranslate(SkIntToScalar(-backgroundOffset.fX), 188 backgroundMatrix.preTranslate(SkIntToScalar(-backgroundOffset.fX),
189 SkIntToScalar(-backgroundOffset.fY)); 189 SkIntToScalar(-backgroundOffset.fY));
190 bgFP = GrTextureDomainEffect::Make( 190 bgFP = GrTextureDomainEffect::Make(
191 backgroundTex.get(), backgroundMatrix, 191 backgroundTex.get(), nullptr, backgroundMatrix,
192 GrTextureDomain::MakeTexelDomain(backgroundTex.get() , 192 GrTextureDomain::MakeTexelDomain(backgroundTex.get() ,
193 background->subset( )), 193 background->subset( )),
194 GrTextureDomain::kDecal_Mode, 194 GrTextureDomain::kDecal_Mode,
195 GrTextureParams::kNone_FilterMode); 195 GrTextureParams::kNone_FilterMode);
196 } else { 196 } else {
197 bgFP = GrConstColorProcessor::Make(GrColor_TRANSPARENT_BLACK, 197 bgFP = GrConstColorProcessor::Make(GrColor_TRANSPARENT_BLACK,
198 GrConstColorProcessor::kIgnore_Inpu tMode); 198 GrConstColorProcessor::kIgnore_Inpu tMode);
199 } 199 }
200 200
201 if (foregroundTex) { 201 if (foregroundTex) {
202 SkMatrix foregroundMatrix; 202 SkMatrix foregroundMatrix;
203 foregroundMatrix.setIDiv(foregroundTex->width(), foregroundTex->height() ); 203 foregroundMatrix.setIDiv(foregroundTex->width(), foregroundTex->height() );
204 foregroundMatrix.preTranslate(SkIntToScalar(-foregroundOffset.fX), 204 foregroundMatrix.preTranslate(SkIntToScalar(-foregroundOffset.fX),
205 SkIntToScalar(-foregroundOffset.fY)); 205 SkIntToScalar(-foregroundOffset.fY));
206 206
207 sk_sp<GrFragmentProcessor> foregroundFP; 207 sk_sp<GrFragmentProcessor> foregroundFP;
208 208
209 foregroundFP = GrTextureDomainEffect::Make( 209 foregroundFP = GrTextureDomainEffect::Make(
210 foregroundTex.get(), foregroundMatrix, 210 foregroundTex.get(), nullptr, foregroundMatrix,
211 GrTextureDomain::MakeTexelDomain(foregroundTex.get() , 211 GrTextureDomain::MakeTexelDomain(foregroundTex.get() ,
212 foreground->subset( )), 212 foreground->subset( )),
213 GrTextureDomain::kDecal_Mode, 213 GrTextureDomain::kDecal_Mode,
214 GrTextureParams::kNone_FilterMode); 214 GrTextureParams::kNone_FilterMode);
215 215
216 paint.addColorFragmentProcessor(std::move(foregroundFP)); 216 paint.addColorFragmentProcessor(std::move(foregroundFP));
217 217
218 // A null fMode is interpreted to mean kSrcOver_Mode (to match raster). 218 // A null fMode is interpreted to mean kSrcOver_Mode (to match raster).
219 SkAutoTUnref<SkXfermode> mode(SkSafeRef(fMode.get())); 219 SkAutoTUnref<SkXfermode> mode(SkSafeRef(fMode.get()));
220 if (!mode) { 220 if (!mode) {
(...skipping 30 matching lines...) Expand all
251 SkMatrix matrix; 251 SkMatrix matrix;
252 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); 252 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ()));
253 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); 253 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
254 254
255 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he ight()), 255 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he ight()),
256 kNeedNewImageUniqueID_SpecialImage, 256 kNeedNewImageUniqueID_SpecialImage,
257 drawContext->asTexture()); 257 drawContext->asTexture());
258 } 258 }
259 259
260 #endif 260 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/gpu/GrBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698