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

Side by Side Diff: src/core/SkRecordDraw.cpp

Issue 568073004: Fix recording of saveLayout with unusual Xfermodes. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 6 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
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 void pushSaveBlock(const SkPaint* paint) { 224 void pushSaveBlock(const SkPaint* paint) {
225 // Starting a new Save block. Push a new entry to represent that. 225 // Starting a new Save block. Push a new entry to represent that.
226 SaveBounds sb = { 0, Bounds::MakeEmpty(), paint }; 226 SaveBounds sb = { 0, Bounds::MakeEmpty(), paint };
227 fSaveStack.push(sb); 227 fSaveStack.push(sb);
228 this->pushControl(); 228 this->pushControl();
229 } 229 }
230 230
231 static bool PaintMayAffectTransparentBlack(const SkPaint* paint) { 231 static bool PaintMayAffectTransparentBlack(const SkPaint* paint) {
232 // FIXME: this is very conservative 232 if (paint) {
233 return paint && (paint->getImageFilter() || paint->getColorFilter()); 233 // FIXME: this is very conservative
234 if (paint->getImageFilter() || paint->getColorFilter())
mtklein 2014/09/12 19:20:08 Please add {}
dneto 2014/09/12 20:41:42 Done.
235 return true;
236
237 SkXfermode* xfermode = paint->getXfermode();
dneto 2014/09/12 18:23:03 This codepath is not the default for Chromium, but
mtklein 2014/09/12 19:20:08 Sync up! :P
dneto 2014/09/12 20:41:42 Acknowledged. Yeah, that's outta my control. I te
238 SkXfermode::Mode mode;
239 // SrcOver is ok, and is also the common case with a NULL xfermode.
240 // So we should make that the fast path and bypass the mode extracti on
241 // and test.
242 if (xfermode && xfermode->asMode(&mode)) {
243 switch (mode) {
244 case SkXfermode::kClear_Mode:
245 case SkXfermode::kSrc_Mode:
246 case SkXfermode::kSrcIn_Mode:
247 case SkXfermode::kDstIn_Mode:
248 case SkXfermode::kSrcOut_Mode:
249 case SkXfermode::kDstATop_Mode:
250 case SkXfermode::kModulate_Mode:
251 return true;
252 break;
253 default:
254 break;
255 }
256 }
257 }
258 return false;
234 } 259 }
235 260
236 Bounds popSaveBlock() { 261 Bounds popSaveBlock() {
237 // We're done the Save block. Apply the block's bounds to all control o ps inside it. 262 // We're done the Save block. Apply the block's bounds to all control o ps inside it.
238 SaveBounds sb; 263 SaveBounds sb;
239 fSaveStack.pop(&sb); 264 fSaveStack.pop(&sb);
240 265
241 // If the paint affects transparent black, we can't trust any of our cal culated bounds. 266 // If the paint affects transparent black, we can't trust any of our cal culated bounds.
242 const Bounds& bounds = 267 const Bounds& bounds =
243 PaintMayAffectTransparentBlack(sb.paint) ? fCurrentClipBounds : sb.b ounds; 268 PaintMayAffectTransparentBlack(sb.paint) ? fCurrentClipBounds : sb.b ounds;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 497 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
473 SkTDArray<SaveBounds> fSaveStack; 498 SkTDArray<SaveBounds> fSaveStack;
474 SkTDArray<unsigned> fControlIndices; 499 SkTDArray<unsigned> fControlIndices;
475 }; 500 };
476 501
477 } // namespace SkRecords 502 } // namespace SkRecords
478 503
479 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 504 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
480 SkRecords::FillBounds(record, bbh); 505 SkRecords::FillBounds(record, bbh);
481 } 506 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698