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

Side by Side Diff: src/core/SkPictureStateTree.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPictureStateTree.h ('k') | src/gpu/GrPictureUtils.h » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPictureStateTree.h" 9 #include "SkPictureStateTree.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 // The matrix is in recording space, but we also inherit 109 // The matrix is in recording space, but we also inherit
110 // a playback matrix from out target canvas. 110 // a playback matrix from out target canvas.
111 SkMatrix m = *matrix; 111 SkMatrix m = *matrix;
112 m.postConcat(fPlaybackMatrix); 112 m.postConcat(fPlaybackMatrix);
113 fCanvas->setMatrix(m); 113 fCanvas->setMatrix(m);
114 fCurrentMatrix = matrix; 114 fCurrentMatrix = matrix;
115 } 115 }
116 116
117 uint32_t SkPictureStateTree::Iterator::peekDraw() {
118 SkASSERT(this->isValid());
119 if (fPlaybackIndex >= fDraws->count()) {
120 return kDrawComplete;
121 }
122
123 Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]);
124 return draw->fOffset;
125 }
126
127 uint32_t SkPictureStateTree::Iterator::skipDraw() {
128 SkASSERT(this->isValid());
129 if (fPlaybackIndex >= fDraws->count()) {
130 return this->finish();
131 }
132
133 Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]);
134
135 if (fSave) {
136 fCanvas->save();
137 fSave = false;
138 }
139
140 fNodes.rewind();
141
142 ++fPlaybackIndex;
143 return draw->fOffset;
144 }
145
146 uint32_t SkPictureStateTree::Iterator::finish() { 117 uint32_t SkPictureStateTree::Iterator::finish() {
147 if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) { 118 if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) {
148 fCanvas->restore(); 119 fCanvas->restore();
149 } 120 }
150 121
151 for (fCurrentNode = fCurrentNode->fParent; fCurrentNode; 122 for (fCurrentNode = fCurrentNode->fParent; fCurrentNode;
152 fCurrentNode = fCurrentNode->fParent) { 123 fCurrentNode = fCurrentNode->fParent) {
153 // Note: we call restore() twice when both flags are set. 124 // Note: we call restore() twice when both flags are set.
154 if (fCurrentNode->fFlags & Node::kSave_Flag) { 125 if (fCurrentNode->fFlags & Node::kSave_Flag) {
155 fCanvas->restore(); 126 fCanvas->restore();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 207 }
237 } 208 }
238 209
239 // If we got this far, the clip/saveLayer state is all set, so we can procee d to set the matrix 210 // If we got this far, the clip/saveLayer state is all set, so we can procee d to set the matrix
240 // for the draw, and return its offset. 211 // for the draw, and return its offset.
241 this->setCurrentMatrix(draw->fMatrix); 212 this->setCurrentMatrix(draw->fMatrix);
242 213
243 ++fPlaybackIndex; 214 ++fPlaybackIndex;
244 return draw->fOffset; 215 return draw->fOffset;
245 } 216 }
OLDNEW
« no previous file with comments | « src/core/SkPictureStateTree.h ('k') | src/gpu/GrPictureUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698