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

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

Issue 452673003: Revert of Add layer counting to SkPictureRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/SkPictureContentInfo.h ('k') | src/core/SkPictureData.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 * 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 "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkPathEffect.h" 9 #include "SkPathEffect.h"
10 #include "SkPictureContentInfo.h" 10 #include "SkPictureContentInfo.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 } 65 }
66 } 66 }
67 67
68 void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) { 68 void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) {
69 if (NULL != paint && NULL != paint->getPathEffect()) { 69 if (NULL != paint && NULL != paint->getPathEffect()) {
70 ++fNumPaintWithPathEffectUses; 70 ++fNumPaintWithPathEffectUses;
71 } 71 }
72 } 72 }
73 73
74 void SkPictureContentInfo::onSaveLayer() {
75 *fSaveStack.append() = kSaveLayer_Flag;
76 }
77
78 void SkPictureContentInfo::onSave() {
79 *fSaveStack.append() = kSave_Flag;
80 }
81
82 void SkPictureContentInfo::onRestore() {
83 SkASSERT(fSaveStack.count() > 0);
84
85 bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag;
86
87 if (fSaveStack.top() & kSaveLayer_Flag) {
88 ++fNumLayers;
89 if (containedSaveLayer) {
90 ++fNumInteriorLayers;
91 } else {
92 ++fNumLeafLayers;
93 }
94 containedSaveLayer = true;
95 }
96
97 fSaveStack.pop();
98
99 if (containedSaveLayer && fSaveStack.count() > 0) {
100 fSaveStack.top() |= kContainedSaveLayer_Flag;
101 }
102 }
103
104 void SkPictureContentInfo::rescindLastSave() {
105 SkASSERT(fSaveStack.count() > 0);
106 SkASSERT(fSaveStack.top() & kSave_Flag);
107
108 bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag;
109
110 fSaveStack.pop();
111
112 if (containedSaveLayer && fSaveStack.count() > 0) {
113 fSaveStack.top() |= kContainedSaveLayer_Flag;
114 }
115 }
116
117 void SkPictureContentInfo::rescindLastSaveLayer() {
118 SkASSERT(fSaveStack.count() > 0);
119 SkASSERT(fSaveStack.top() & kSaveLayer_Flag);
120
121 bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag;
122
123 fSaveStack.pop();
124
125 if (containedSaveLayer && fSaveStack.count() > 0) {
126 fSaveStack.top() |= kContainedSaveLayer_Flag;
127 }
128 }
129
130 void SkPictureContentInfo::set(const SkPictureContentInfo& src) { 74 void SkPictureContentInfo::set(const SkPictureContentInfo& src) {
131 fNumOperations = src.fNumOperations; 75 fNumOperations = src.fNumOperations;
132 fNumTexts = src.fNumTexts; 76 fNumTexts = src.fNumTexts;
133 fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses; 77 fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses;
134 fNumFastPathDashEffects = src.fNumFastPathDashEffects; 78 fNumFastPathDashEffects = src.fNumFastPathDashEffects;
135 fNumAAConcavePaths = src.fNumAAConcavePaths; 79 fNumAAConcavePaths = src.fNumAAConcavePaths;
136 fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; 80 fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths;
137 fNumLayers = src.fNumLayers;
138 fNumInteriorLayers = src.fNumInteriorLayers;
139 fNumLeafLayers = src.fNumLeafLayers;
140 fSaveStack = src.fSaveStack;
141 } 81 }
142 82
143 void SkPictureContentInfo::reset() { 83 void SkPictureContentInfo::reset() {
144 fNumOperations = 0; 84 fNumOperations = 0;
145 fNumTexts = 0; 85 fNumTexts = 0;
146 fNumPaintWithPathEffectUses = 0; 86 fNumPaintWithPathEffectUses = 0;
147 fNumFastPathDashEffects = 0; 87 fNumFastPathDashEffects = 0;
148 fNumAAConcavePaths = 0; 88 fNumAAConcavePaths = 0;
149 fNumAAHairlineConcavePaths = 0; 89 fNumAAHairlineConcavePaths = 0;
150 fNumLayers = 0;
151 fNumInteriorLayers = 0;
152 fNumLeafLayers = 0;
153 fSaveStack.rewind();
154 } 90 }
155 91
156 void SkPictureContentInfo::swap(SkPictureContentInfo* other) { 92 void SkPictureContentInfo::swap(SkPictureContentInfo* other) {
157 SkTSwap(fNumOperations, other->fNumOperations); 93 SkTSwap(fNumOperations, other->fNumOperations);
158 SkTSwap(fNumTexts, other->fNumTexts); 94 SkTSwap(fNumTexts, other->fNumTexts);
159 SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses); 95 SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses);
160 SkTSwap(fNumFastPathDashEffects, other->fNumFastPathDashEffects); 96 SkTSwap(fNumFastPathDashEffects, other->fNumFastPathDashEffects);
161 SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); 97 SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths);
162 SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); 98 SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths);
163 SkTSwap(fNumLayers, other->fNumLayers);
164 SkTSwap(fNumInteriorLayers, other->fNumInteriorLayers);
165 SkTSwap(fNumLeafLayers, other->fNumLeafLayers);
166 fSaveStack.swap(other->fSaveStack);
167 } 99 }
OLDNEW
« no previous file with comments | « src/core/SkPictureContentInfo.h ('k') | src/core/SkPictureData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698