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

Unified Diff: src/core/SkPictureStateTree.cpp

Issue 261663003: First pass at pre-rendering saveLayers for GPU (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Reduce size of PlaybackReplacements in SkPicturePlayback.h 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/SkPictureStateTree.h ('k') | src/gpu/GrPictureUtils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureStateTree.cpp
===================================================================
--- src/core/SkPictureStateTree.cpp (revision 14614)
+++ src/core/SkPictureStateTree.cpp (working copy)
@@ -114,27 +114,60 @@
fCurrentMatrix = matrix;
}
-uint32_t SkPictureStateTree::Iterator::nextDraw() {
+uint32_t SkPictureStateTree::Iterator::peekDraw() {
SkASSERT(this->isValid());
if (fPlaybackIndex >= fDraws->count()) {
+ return kDrawComplete;
+ }
+
+ Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]);
+ return draw->fOffset;
+}
+
+uint32_t SkPictureStateTree::Iterator::skipDraw() {
+ SkASSERT(this->isValid());
+ if (fPlaybackIndex >= fDraws->count()) {
+ return this->finish();
+ }
+
+ Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]);
+
+ if (fSave) {
+ fCanvas->save();
+ fSave = false;
+ }
+
+ fNodes.rewind();
+
+ ++fPlaybackIndex;
+ return draw->fOffset;
+}
+
+uint32_t SkPictureStateTree::Iterator::finish() {
+ if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) {
+ fCanvas->restore();
+ }
+
+ for (fCurrentNode = fCurrentNode->fParent; fCurrentNode;
+ fCurrentNode = fCurrentNode->fParent) {
+ // Note: we call restore() twice when both flags are set.
+ if (fCurrentNode->fFlags & Node::kSave_Flag) {
+ fCanvas->restore();
+ }
if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) {
fCanvas->restore();
}
+ }
- for (fCurrentNode = fCurrentNode->fParent; fCurrentNode;
- fCurrentNode = fCurrentNode->fParent) {
- // Note: we call restore() twice when both flags are set.
- if (fCurrentNode->fFlags & Node::kSave_Flag) {
- fCanvas->restore();
- }
- if (fCurrentNode->fFlags & Node::kSaveLayer_Flag) {
- fCanvas->restore();
- }
- }
+ fCanvas->setMatrix(fPlaybackMatrix);
+ fCurrentMatrix = NULL;
+ return kDrawComplete;
+}
- fCanvas->setMatrix(fPlaybackMatrix);
- fCurrentMatrix = NULL;
- return kDrawComplete;
+uint32_t SkPictureStateTree::Iterator::nextDraw() {
+ SkASSERT(this->isValid());
+ if (fPlaybackIndex >= fDraws->count()) {
+ return this->finish();
}
Draw* draw = static_cast<Draw*>((*fDraws)[fPlaybackIndex]);
« 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