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

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 267293007: Fix rendering artifacts in pull-saveLayers-forward mode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix bug in unit test Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureStateTree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
===================================================================
--- src/core/SkPicturePlayback.cpp (revision 14658)
+++ src/core/SkPicturePlayback.cpp (working copy)
@@ -896,15 +896,15 @@
if (NULL != temp) {
SkASSERT(NULL != temp->fBM);
SkASSERT(NULL != temp->fPaint);
+ canvas.save();
+ canvas.setMatrix(initialMatrix);
canvas.drawBitmap(*temp->fBM, temp->fPos.fX, temp->fPos.fY, temp->fPaint);
+ canvas.restore();
if (it.isValid()) {
// This save is needed since the BBH will automatically issue
// a restore to balanced the saveLayer we're skipping
canvas.save();
- // Note: This skipping only works if the client only issues
- // well behaved saveLayer calls (i.e., doesn't use
- // kMatrix_SaveFlag or kClip_SaveFlag in isolation)
// At this point we know that the PictureStateTree was aiming
// for some draw op within temp's saveLayer (although potentially
@@ -912,17 +912,32 @@
// We need to skip all the operations inside temp's range
// along with all the associated state changes but update
// the state tree to the first operation outside temp's range.
- SkASSERT(it.peekDraw() >= temp->fStart && it.peekDraw() <= temp->fStop);
- while (kDrawComplete != it.peekDraw() && it.peekDraw() <= temp->fStop) {
- it.skipDraw();
- }
+ uint32_t skipTo;
+ do {
+ skipTo = it.nextDraw();
+ if (kDrawComplete == skipTo) {
+ break;
+ }
- if (kDrawComplete == it.peekDraw()) {
+ if (skipTo <= temp->fStop) {
+ reader.setOffset(skipTo);
+ uint32_t size;
+ DrawType op = read_op_and_size(&reader, &size);
+ // Since we are relying on the normal SkPictureStateTree
+ // playback we need to convert any nested saveLayer calls
+ // it may issue into saves (so that all its internal
+ // restores will be balanced).
+ if (SAVE_LAYER == op) {
+ canvas.save();
+ }
+ }
+ } while (skipTo <= temp->fStop);
+
+ if (kDrawComplete == skipTo) {
break;
}
- uint32_t skipTo = it.nextDraw();
reader.setOffset(skipTo);
} else {
reader.setOffset(temp->fStop);
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureStateTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698