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

Side by Side Diff: src/gpu/effects/GrConfigConversionEffect.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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/gpu/SkGr.cpp ('k') | src/gpu/text/GrTextUtils.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 "GrConfigConversionEffect.h" 8 #include "GrConfigConversionEffect.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 GrPaint paint2; 222 GrPaint paint2;
223 GrPaint paint3; 223 GrPaint paint3;
224 sk_sp<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect( 224 sk_sp<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
225 dataTex, GrSwizzle::RGBA(), *pmToUPMRule, SkMatrix::I())); 225 dataTex, GrSwizzle::RGBA(), *pmToUPMRule, SkMatrix::I()));
226 sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect( 226 sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
227 readDC->asTexture().get(), GrSwizzle::RGBA(), *upmToPMRule, SkMa trix::I())); 227 readDC->asTexture().get(), GrSwizzle::RGBA(), *upmToPMRule, SkMa trix::I()));
228 sk_sp<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect( 228 sk_sp<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
229 tempDC->asTexture().get(), GrSwizzle::RGBA(), *pmToUPMRule, SkMa trix::I())); 229 tempDC->asTexture().get(), GrSwizzle::RGBA(), *pmToUPMRule, SkMa trix::I()));
230 230
231 paint1.addColorFragmentProcessor(std::move(pmToUPM1)); 231 paint1.addColorFragmentProcessor(std::move(pmToUPM1));
232 paint1.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 232 paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
233 233
234 readDC->fillRectToRect(GrNoClip(), paint1, SkMatrix::I(), kDstRect, kSrc Rect); 234 readDC->fillRectToRect(GrNoClip(), paint1, SkMatrix::I(), kDstRect, kSrc Rect);
235 235
236 readDC->asTexture()->readPixels(0, 0, kSize, kSize, kConfig, firstRead); 236 readDC->asTexture()->readPixels(0, 0, kSize, kSize, kConfig, firstRead);
237 237
238 paint2.addColorFragmentProcessor(std::move(upmToPM)); 238 paint2.addColorFragmentProcessor(std::move(upmToPM));
239 paint2.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 239 paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
240 240
241 tempDC->fillRectToRect(GrNoClip(), paint2, SkMatrix::I(), kDstRect, kSrc Rect); 241 tempDC->fillRectToRect(GrNoClip(), paint2, SkMatrix::I(), kDstRect, kSrc Rect);
242 242
243 paint3.addColorFragmentProcessor(std::move(pmToUPM2)); 243 paint3.addColorFragmentProcessor(std::move(pmToUPM2));
244 paint3.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 244 paint3.setPorterDuffXPFactory(SkBlendMode::kSrc);
245 245
246 readDC->fillRectToRect(GrNoClip(), paint3, SkMatrix::I(), kDstRect, kSrc Rect); 246 readDC->fillRectToRect(GrNoClip(), paint3, SkMatrix::I(), kDstRect, kSrc Rect);
247 247
248 readDC->asTexture()->readPixels(0, 0, kSize, kSize, kConfig, secondRead) ; 248 readDC->asTexture()->readPixels(0, 0, kSize, kSize, kConfig, secondRead) ;
249 249
250 failed = false; 250 failed = false;
251 for (int y = 0; y < kSize && !failed; ++y) { 251 for (int y = 0; y < kSize && !failed; ++y) {
252 for (int x = 0; x <= y; ++x) { 252 for (int x = 0; x <= y; ++x) {
253 if (firstRead[kSize * y + x] != secondRead[kSize * y + x]) { 253 if (firstRead[kSize * y + x] != secondRead[kSize * y + x]) {
254 failed = true; 254 failed = true;
(...skipping 21 matching lines...) Expand all
276 if (kRGBA_8888_GrPixelConfig != texture->config() && 276 if (kRGBA_8888_GrPixelConfig != texture->config() &&
277 kBGRA_8888_GrPixelConfig != texture->config() && 277 kBGRA_8888_GrPixelConfig != texture->config() &&
278 kNone_PMConversion != pmConversion) { 278 kNone_PMConversion != pmConversion) {
279 // The PM conversions assume colors are 0..255 279 // The PM conversions assume colors are 0..255
280 return nullptr; 280 return nullptr;
281 } 281 }
282 return sk_sp<GrFragmentProcessor>( 282 return sk_sp<GrFragmentProcessor>(
283 new GrConfigConversionEffect(texture, swizzle, pmConversion, matrix) ); 283 new GrConfigConversionEffect(texture, swizzle, pmConversion, matrix) );
284 } 284 }
285 } 285 }
OLDNEW
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/gpu/text/GrTextUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698