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

Side by Side Diff: src/core/SkRecordDraw.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/core/SkReadBuffer.h ('k') | src/core/SkRecordOpts.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 2014 Google Inc. 2 * Copyright 2014 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 "SkRecordDraw.h" 8 #include "SkRecordDraw.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 10
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 this->pushControl(); 334 this->pushControl();
335 } 335 }
336 336
337 static bool PaintMayAffectTransparentBlack(const SkPaint* paint) { 337 static bool PaintMayAffectTransparentBlack(const SkPaint* paint) {
338 if (paint) { 338 if (paint) {
339 // FIXME: this is very conservative 339 // FIXME: this is very conservative
340 if (paint->getImageFilter() || paint->getColorFilter()) { 340 if (paint->getImageFilter() || paint->getColorFilter()) {
341 return true; 341 return true;
342 } 342 }
343 343
344 // Unusual Xfermodes require us to process a saved layer 344 // Unusual blendmodes require us to process a saved layer
345 // even with operations outisde the clip. 345 // even with operations outisde the clip.
346 // For example, DstIn is used by masking layers. 346 // For example, DstIn is used by masking layers.
347 // https://code.google.com/p/skia/issues/detail?id=1291 347 // https://code.google.com/p/skia/issues/detail?id=1291
348 // https://crbug.com/401593 348 // https://crbug.com/401593
349 SkXfermode* xfermode = paint->getXfermode(); 349 switch (paint->getBlendMode()) {
350 SkXfermode::Mode mode; 350 // For each of the following transfer modes, if the source
351 // SrcOver is ok, and is also the common case with a nullptr xfermod e. 351 // alpha is zero (our transparent black), the resulting
352 // So we should make that the fast path and bypass the mode extracti on 352 // blended alpha is not necessarily equal to the original
353 // and test. 353 // destination alpha.
354 if (xfermode && xfermode->asMode(&mode)) { 354 case SkBlendMode::kClear:
355 switch (mode) { 355 case SkBlendMode::kSrc:
356 // For each of the following transfer modes, if the source 356 case SkBlendMode::kSrcIn:
357 // alpha is zero (our transparent black), the resulting 357 case SkBlendMode::kDstIn:
358 // blended alpha is not necessarily equal to the original 358 case SkBlendMode::kSrcOut:
359 // destination alpha. 359 case SkBlendMode::kDstATop:
360 case SkXfermode::kClear_Mode: 360 case SkBlendMode::kModulate:
361 case SkXfermode::kSrc_Mode: 361 return true;
362 case SkXfermode::kSrcIn_Mode: 362 break;
363 case SkXfermode::kDstIn_Mode: 363 default:
364 case SkXfermode::kSrcOut_Mode: 364 break;
365 case SkXfermode::kDstATop_Mode:
366 case SkXfermode::kModulate_Mode:
367 return true;
368 break;
369 default:
370 break;
371 }
372 } 365 }
373 } 366 }
374 return false; 367 return false;
375 } 368 }
376 369
377 Bounds popSaveBlock() { 370 Bounds popSaveBlock() {
378 // We're done the Save block. Apply the block's bounds to all control o ps inside it. 371 // We're done the Save block. Apply the block's bounds to all control o ps inside it.
379 SaveBounds sb; 372 SaveBounds sb;
380 fSaveStack.pop(&sb); 373 fSaveStack.pop(&sb);
381 374
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 624
632 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b ounds[]) { 625 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b ounds[]) {
633 SkRecords::FillBounds visitor(cullRect, record, bounds); 626 SkRecords::FillBounds visitor(cullRect, record, bounds);
634 for (int curOp = 0; curOp < record.count(); curOp++) { 627 for (int curOp = 0; curOp < record.count(); curOp++) {
635 visitor.setCurrentOp(curOp); 628 visitor.setCurrentOp(curOp);
636 record.visit(curOp, visitor); 629 record.visit(curOp, visitor);
637 } 630 }
638 visitor.cleanUp(); 631 visitor.cleanUp();
639 } 632 }
640 633
OLDNEW
« no previous file with comments | « src/core/SkReadBuffer.h ('k') | src/core/SkRecordOpts.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698