OLD | NEW |
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 "SkMatrixClipStateMgr.h" | 8 #include "SkMatrixClipStateMgr.h" |
9 #include "SkPictureRecord.h" | 9 #include "SkPictureRecord.h" |
10 | 10 |
11 bool SkMatrixClipStateMgr::MatrixClipState::ClipInfo::clipPath(SkPictureRecord*
picRecord, | 11 bool SkMatrixClipStateMgr::MatrixClipState::ClipInfo::clipPath(SkPictureRecord*
picRecord, |
12 const SkPath& pat
h, | 12 const SkPath& pat
h, |
13 SkRegion::Op op, | 13 SkRegion::Op op, |
14 bool doAA, | 14 bool doAA, |
15 int matrixID) { | 15 int matrixID) { |
16 int pathID = picRecord->addPathToHeap(path); | 16 int pathID = picRecord->addPathToHeap(path); |
17 | 17 |
18 ClipOp* newClip = fClips.append(); | 18 ClipOp* newClip = fClips.append(); |
19 newClip->fClipType = kPath_ClipType; | 19 newClip->fClipType = kPath_ClipType; |
20 newClip->fGeom.fPathID = pathID; | 20 newClip->fGeom.fPathID = pathID; |
21 newClip->fOp = op; | 21 newClip->fOp = op; |
22 newClip->fDoAA = doAA; | 22 newClip->fDoAA = doAA; |
23 newClip->fMatrixID = matrixID; | 23 newClip->fMatrixID = matrixID; |
24 newClip->fOffset = kInvalidJumpOffset; | |
25 return false; | 24 return false; |
26 } | 25 } |
27 | 26 |
28 bool SkMatrixClipStateMgr::MatrixClipState::ClipInfo::clipRegion(SkPictureRecord
* picRecord, | 27 bool SkMatrixClipStateMgr::MatrixClipState::ClipInfo::clipRegion(SkPictureRecord
* picRecord, |
29 int regionID, | 28 int regionID, |
30 SkRegion::Op op
, | 29 SkRegion::Op op
, |
31 int matrixID) { | 30 int matrixID) { |
32 // TODO: add a region dictionary so we don't have to copy the region in here | 31 // TODO: add a region dictionary so we don't have to copy the region in here |
33 ClipOp* newClip = fClips.append(); | 32 ClipOp* newClip = fClips.append(); |
34 newClip->fClipType = kRegion_ClipType; | 33 newClip->fClipType = kRegion_ClipType; |
35 newClip->fGeom.fRegionID = regionID; | 34 newClip->fGeom.fRegionID = regionID; |
36 newClip->fOp = op; | 35 newClip->fOp = op; |
37 newClip->fDoAA = true; // not necessary but sanity preserving | 36 newClip->fDoAA = true; // not necessary but sanity preserving |
38 newClip->fMatrixID = matrixID; | 37 newClip->fMatrixID = matrixID; |
39 newClip->fOffset = kInvalidJumpOffset; | |
40 return false; | 38 return false; |
41 } | 39 } |
42 | 40 |
43 void SkMatrixClipStateMgr::writeDeltaMat(int currentMatID, int desiredMatID) { | 41 void SkMatrixClipStateMgr::writeDeltaMat(int currentMatID, int desiredMatID) { |
44 const SkMatrix& current = this->lookupMat(currentMatID); | 42 const SkMatrix& current = this->lookupMat(currentMatID); |
45 const SkMatrix& desired = this->lookupMat(desiredMatID); | 43 const SkMatrix& desired = this->lookupMat(desiredMatID); |
46 | 44 |
47 SkMatrix delta; | 45 SkMatrix delta; |
48 bool result = current.invert(&delta); | 46 bool result = current.invert(&delta); |
49 if (result) { | 47 if (result) { |
50 delta.preConcat(desired); | 48 delta.preConcat(desired); |
51 } | 49 } |
52 fPicRecord->recordConcat(delta); | 50 fPicRecord->recordConcat(delta); |
53 } | 51 } |
54 | 52 |
55 // Note: this only writes out the clips for the current save state. To get the | 53 // Note: this only writes out the clips for the current save state. To get the |
56 // entire clip stack requires iterating of the entire matrix/clip stack. | 54 // entire clip stack requires iterating of the entire matrix/clip stack. |
57 void SkMatrixClipStateMgr::MatrixClipState::ClipInfo::writeClip(int* curMatID, | 55 void SkMatrixClipStateMgr::MatrixClipState::ClipInfo::writeClip(int* curMatID, |
58 SkMatrixClipStat
eMgr* mgr, | 56 SkMatrixClipStat
eMgr* mgr) { |
59 bool* overrideFi
rstOp) { | |
60 for (int i = 0; i < fClips.count(); ++i) { | 57 for (int i = 0; i < fClips.count(); ++i) { |
61 ClipOp& curClip = fClips[i]; | 58 ClipOp& curClip = fClips[i]; |
62 | 59 |
63 SkRegion::Op op = curClip.fOp; | |
64 if (*overrideFirstOp) { | |
65 op = SkRegion::kReplace_Op; | |
66 *overrideFirstOp = false; | |
67 } | |
68 | |
69 // TODO: use the matrix ID to skip writing the identity matrix | 60 // TODO: use the matrix ID to skip writing the identity matrix |
70 // over and over, i.e.: | 61 // over and over, i.e.: |
71 // if (*curMatID != curClip.fMatrixID) { | 62 // if (*curMatID != curClip.fMatrixID) { |
72 // mgr->writeDeltaMat... | 63 // mgr->writeDeltaMat... |
73 // *curMatID... | 64 // *curMatID... |
74 // } | 65 // } |
75 // Right now this optimization would throw off the testing harness. | 66 // Right now this optimization would throw off the testing harness. |
76 // TODO: right now we're writing out the delta matrix from the prior | 67 // TODO: right now we're writing out the delta matrix from the prior |
77 // matrix state. This is a side-effect of writing out the entire | 68 // matrix state. This is a side-effect of writing out the entire |
78 // clip stack and should be resolved when that is fixed. | 69 // clip stack and should be resolved when that is fixed. |
79 mgr->writeDeltaMat(*curMatID, curClip.fMatrixID); | 70 mgr->writeDeltaMat(*curMatID, curClip.fMatrixID); |
80 *curMatID = curClip.fMatrixID; | 71 *curMatID = curClip.fMatrixID; |
81 | 72 |
| 73 int offset = 0; |
| 74 |
82 switch (curClip.fClipType) { | 75 switch (curClip.fClipType) { |
83 case kRect_ClipType: | 76 case kRect_ClipType: |
84 curClip.fOffset = mgr->getPicRecord()->recordClipRect(curClip.fGeom.
fRRect.rect(), | 77 offset = mgr->getPicRecord()->recordClipRect(curClip.fGeom.fRRect.re
ct(), |
85 op, curClip.fD
oAA); | 78 curClip.fOp, curClip.fD
oAA); |
86 break; | 79 break; |
87 case kRRect_ClipType: | 80 case kRRect_ClipType: |
88 curClip.fOffset = mgr->getPicRecord()->recordClipRRect(curClip.fGeom
.fRRect, op, | 81 offset = mgr->getPicRecord()->recordClipRRect(curClip.fGeom.fRRect,
curClip.fOp, |
89 curClip.fDoAA
); | 82 curClip.fDoAA); |
90 break; | 83 break; |
91 case kPath_ClipType: | 84 case kPath_ClipType: |
92 curClip.fOffset = mgr->getPicRecord()->recordClipPath(curClip.fGeom.
fPathID, op, | 85 offset = mgr->getPicRecord()->recordClipPath(curClip.fGeom.fPathID,
curClip.fOp, |
93 curClip.fDoAA)
; | 86 curClip.fDoAA); |
94 break; | 87 break; |
95 case kRegion_ClipType: { | 88 case kRegion_ClipType: { |
96 const SkRegion* region = mgr->lookupRegion(curClip.fGeom.fRegionID); | 89 const SkRegion* region = mgr->lookupRegion(curClip.fGeom.fRegionID); |
97 curClip.fOffset = mgr->getPicRecord()->recordClipRegion(*region, op)
; | 90 offset = mgr->getPicRecord()->recordClipRegion(*region, curClip.fOp)
; |
98 break; | 91 break; |
99 } | 92 } |
100 default: | 93 default: |
101 SkASSERT(0); | 94 SkASSERT(0); |
102 } | 95 } |
| 96 |
| 97 mgr->addClipOffset(offset); |
103 } | 98 } |
104 } | 99 } |
105 | 100 |
106 // Fill in the skip offsets for all the clips written in the current block | |
107 void SkMatrixClipStateMgr::MatrixClipState::ClipInfo::fillInSkips(SkWriter32* wr
iter, | |
108 int32_t restor
eOffset) { | |
109 for (int i = 0; i < fClips.count(); ++i) { | |
110 ClipOp& curClip = fClips[i]; | |
111 | |
112 if (-1 == curClip.fOffset) { | |
113 continue; | |
114 } | |
115 // SkDEBUGCODE(uint32_t peek = writer->read32At(curClip.fOffset);) | |
116 // SkASSERT(-1 == peek); | |
117 writer->overwriteTAt(curClip.fOffset, restoreOffset); | |
118 SkDEBUGCODE(curClip.fOffset = -1;) | |
119 } | |
120 } | |
121 | |
122 SkMatrixClipStateMgr::SkMatrixClipStateMgr() | 101 SkMatrixClipStateMgr::SkMatrixClipStateMgr() |
123 : fPicRecord(NULL) | 102 : fPicRecord(NULL) |
124 , fMatrixClipStack(sizeof(MatrixClipState), | 103 , fMatrixClipStack(sizeof(MatrixClipState), |
125 fMatrixClipStackStorage, | 104 fMatrixClipStackStorage, |
126 sizeof(fMatrixClipStackStorage)) | 105 sizeof(fMatrixClipStackStorage)) |
127 , fCurOpenStateID(kIdentityWideOpenStateID) { | 106 , fCurOpenStateID(kIdentityWideOpenStateID) { |
128 | 107 |
| 108 fSkipOffsets = SkNEW(SkTDArray<int>); |
| 109 |
129 // The first slot in the matrix dictionary is reserved for the identity matr
ix | 110 // The first slot in the matrix dictionary is reserved for the identity matr
ix |
130 fMatrixDict.append()->reset(); | 111 fMatrixDict.append()->reset(); |
131 | 112 |
132 fCurMCState = (MatrixClipState*)fMatrixClipStack.push_back(); | 113 fCurMCState = (MatrixClipState*)fMatrixClipStack.push_back(); |
133 new (fCurMCState) MatrixClipState(NULL, 0); // balanced in restore() | 114 new (fCurMCState) MatrixClipState(NULL, 0); // balanced in restore() |
134 } | 115 } |
135 | 116 |
136 SkMatrixClipStateMgr::~SkMatrixClipStateMgr() { | 117 SkMatrixClipStateMgr::~SkMatrixClipStateMgr() { |
137 for (int i = 0; i < fRegionDict.count(); ++i) { | 118 for (int i = 0; i < fRegionDict.count(); ++i) { |
138 SkDELETE(fRegionDict[i]); | 119 SkDELETE(fRegionDict[i]); |
139 } | 120 } |
| 121 |
| 122 SkDELETE(fSkipOffsets); |
140 } | 123 } |
141 | 124 |
142 | 125 |
143 int SkMatrixClipStateMgr::save(SkCanvas::SaveFlags flags) { | 126 int SkMatrixClipStateMgr::MCStackPush(SkCanvas::SaveFlags flags) { |
144 SkDEBUGCODE(this->validate();) | |
145 | |
146 MatrixClipState* newTop = (MatrixClipState*)fMatrixClipStack.push_back(); | 127 MatrixClipState* newTop = (MatrixClipState*)fMatrixClipStack.push_back(); |
147 new (newTop) MatrixClipState(fCurMCState, flags); // balanced in restore() | 128 new (newTop) MatrixClipState(fCurMCState, flags); // balanced in restore() |
148 fCurMCState = newTop; | 129 fCurMCState = newTop; |
149 | 130 |
150 SkDEBUGCODE(this->validate();) | 131 SkDEBUGCODE(this->validate();) |
151 | 132 |
152 return fMatrixClipStack.count(); | 133 return fMatrixClipStack.count(); |
153 } | 134 } |
154 | 135 |
| 136 int SkMatrixClipStateMgr::save(SkCanvas::SaveFlags flags) { |
| 137 SkDEBUGCODE(this->validate();) |
| 138 |
| 139 return this->MCStackPush(flags); |
| 140 } |
| 141 |
155 int SkMatrixClipStateMgr::saveLayer(const SkRect* bounds, const SkPaint* paint, | 142 int SkMatrixClipStateMgr::saveLayer(const SkRect* bounds, const SkPaint* paint, |
156 SkCanvas::SaveFlags flags) { | 143 SkCanvas::SaveFlags flags) { |
157 int result = this->save(flags); | 144 // Since the saveLayer call draws something we need to potentially dump |
| 145 // out the MC state |
| 146 this->call(kOther_CallType); |
| 147 |
| 148 int result = this->MCStackPush(flags); |
158 ++fCurMCState->fLayerID; | 149 ++fCurMCState->fLayerID; |
159 fCurMCState->fIsSaveLayer = true; | 150 fCurMCState->fIsSaveLayer = true; |
160 | 151 |
161 fCurMCState->fSaveLayerBracketed = this->call(kOther_CallType); | |
162 fCurMCState->fSaveLayerBaseStateID = fCurOpenStateID; | 152 fCurMCState->fSaveLayerBaseStateID = fCurOpenStateID; |
| 153 fCurMCState->fSavedSkipOffsets = fSkipOffsets; |
| 154 |
| 155 // TODO: recycle these rather then new & deleting them on every saveLayer/ |
| 156 // restore |
| 157 fSkipOffsets = SkNEW(SkTDArray<int>); |
| 158 |
163 fPicRecord->recordSaveLayer(bounds, paint, | 159 fPicRecord->recordSaveLayer(bounds, paint, |
164 (SkCanvas::SaveFlags)(flags| SkCanvas::kMatrixCl
ip_SaveFlag)); | 160 (SkCanvas::SaveFlags)(flags| SkCanvas::kMatrixCl
ip_SaveFlag)); |
165 return result; | 161 return result; |
166 } | 162 } |
167 | 163 |
168 void SkMatrixClipStateMgr::restore() { | 164 void SkMatrixClipStateMgr::restore() { |
169 SkDEBUGCODE(this->validate();) | 165 SkDEBUGCODE(this->validate();) |
170 | 166 |
171 if (fCurMCState->fIsSaveLayer) { | 167 if (fCurMCState->fIsSaveLayer) { |
172 if (fCurMCState->fSaveLayerBaseStateID != fCurOpenStateID) { | 168 if (fCurMCState->fSaveLayerBaseStateID != fCurOpenStateID) { |
173 fPicRecord->recordRestore(); // Close the open block | 169 fPicRecord->recordRestore(); // Close the open block inside the save
Layer |
174 } | 170 } |
175 // The saveLayer's don't carry any matrix or clip state in the | 171 // The saveLayer's don't carry any matrix or clip state in the |
176 // new scheme so make sure the saveLayer's recordRestore doesn't | 172 // new scheme so make sure the saveLayer's recordRestore doesn't |
177 // try to finalize them (i.e., fill in their skip offsets). | 173 // try to finalize them (i.e., fill in their skip offsets). |
178 fPicRecord->recordRestore(false); // close of saveLayer | 174 fPicRecord->recordRestore(false); // close of saveLayer |
179 | 175 |
180 // Close the Save that brackets the saveLayer. TODO: this doesn't handle | 176 fCurOpenStateID = fCurMCState->fSaveLayerBaseStateID; |
181 // the skip offsets correctly | |
182 if (fCurMCState->fSaveLayerBracketed) { | |
183 fPicRecord->recordRestore(false); | |
184 } | |
185 | 177 |
186 // MC states can be allowed to fuse across saveLayer/restore boundaries | 178 SkASSERT(0 == fSkipOffsets->count()); |
187 fCurOpenStateID = kIdentityWideOpenStateID; | 179 SkASSERT(NULL != fCurMCState->fSavedSkipOffsets); |
| 180 |
| 181 SkDELETE(fSkipOffsets); |
| 182 fSkipOffsets = fCurMCState->fSavedSkipOffsets; |
188 } | 183 } |
189 | 184 |
190 fCurMCState->~MatrixClipState(); // balanced in save() | 185 fCurMCState->~MatrixClipState(); // balanced in save() |
191 fMatrixClipStack.pop_back(); | 186 fMatrixClipStack.pop_back(); |
192 fCurMCState = (MatrixClipState*)fMatrixClipStack.back(); | 187 fCurMCState = (MatrixClipState*)fMatrixClipStack.back(); |
193 | 188 |
194 SkDEBUGCODE(this->validate();) | 189 SkDEBUGCODE(this->validate();) |
195 } | 190 } |
196 | 191 |
197 // kIdentityWideOpenStateID (0) is reserved for the identity/wide-open clip stat
e | 192 // kIdentityWideOpenStateID (0) is reserved for the identity/wide-open clip stat
e |
(...skipping 15 matching lines...) Expand all Loading... |
213 } | 208 } |
214 | 209 |
215 SkASSERT(kOther_CallType == callType); | 210 SkASSERT(kOther_CallType == callType); |
216 | 211 |
217 if (fCurMCState->fMCStateID == fCurOpenStateID) { | 212 if (fCurMCState->fMCStateID == fCurOpenStateID) { |
218 // Required MC state is already active one - nothing to do | 213 // Required MC state is already active one - nothing to do |
219 SkDEBUGCODE(this->validate();) | 214 SkDEBUGCODE(this->validate();) |
220 return false; | 215 return false; |
221 } | 216 } |
222 | 217 |
223 if (kIdentityWideOpenStateID != fCurOpenStateID) { | 218 if (kIdentityWideOpenStateID != fCurOpenStateID && |
| 219 (!fCurMCState->fIsSaveLayer || |
| 220 fCurMCState->fSaveLayerBaseStateID != fCurOpenStateID)) { |
| 221 // Don't write a restore if the open state is one in which a saveLayer |
| 222 // is nested. The save after the saveLayer's restore will close it. |
224 fPicRecord->recordRestore(); // Close the open block | 223 fPicRecord->recordRestore(); // Close the open block |
225 } | 224 } |
226 | 225 |
227 // Install the required MC state as the active one | 226 // Install the required MC state as the active one |
228 fCurOpenStateID = fCurMCState->fMCStateID; | 227 fCurOpenStateID = fCurMCState->fMCStateID; |
229 | 228 |
230 fPicRecord->recordSave(SkCanvas::kMatrixClip_SaveFlag); | 229 fPicRecord->recordSave(SkCanvas::kMatrixClip_SaveFlag); |
231 | 230 |
232 // write out clips | 231 // write out clips |
233 SkDeque::F2BIter iter(fMatrixClipStack); | 232 SkDeque::Iter iter(fMatrixClipStack, SkDeque::Iter::kBack_IterStart); |
234 bool firstClip = true; | 233 const MatrixClipState* state; |
| 234 // Loop back across the MC states until the last saveLayer. The MC |
| 235 // state in front of the saveLayer has already been written out. |
| 236 for (state = (const MatrixClipState*) iter.prev(); |
| 237 state != NULL; |
| 238 state = (const MatrixClipState*) iter.prev()) { |
| 239 if (state->fIsSaveLayer) { |
| 240 break; |
| 241 } |
| 242 } |
235 | 243 |
236 int curMatID = kIdentityMatID; | 244 if (NULL == state) { |
237 for (const MatrixClipState* state = (const MatrixClipState*) iter.next(); | 245 // There was no saveLayer in the MC stack so we need to output them all |
238 state != NULL; | 246 iter.reset(fMatrixClipStack, SkDeque::Iter::kFront_IterStart); |
239 state = (const MatrixClipState*) iter.next()) { | 247 state = (const MatrixClipState*) iter.next(); |
240 state->fClipInfo->writeClip(&curMatID, this, &firstClip); | 248 } else { |
| 249 // SkDeque's iterators actually return the previous location so we |
| 250 // need to reverse and go forward one to get back on track. |
| 251 iter.next(); |
| 252 SkDEBUGCODE(const MatrixClipState* test = (const MatrixClipState*)) iter
.next(); |
| 253 SkASSERT(test == state); |
| 254 } |
| 255 |
| 256 int curMatID = NULL != state ? state->fMatrixInfo->getID(this) : kIdentityMa
tID; |
| 257 for ( ; state != NULL; state = (const MatrixClipState*) iter.next()) { |
| 258 state->fClipInfo->writeClip(&curMatID, this); |
241 } | 259 } |
242 | 260 |
243 // write out matrix | 261 // write out matrix |
| 262 // TODO: this test isn't quite right. It should be: |
| 263 // if (curMatID != fCurMCState->fMatrixInfo->getID(this)) { |
| 264 // but right now the testing harness always expects a matrix if |
| 265 // the matrices are non-I |
244 if (kIdentityMatID != fCurMCState->fMatrixInfo->getID(this)) { | 266 if (kIdentityMatID != fCurMCState->fMatrixInfo->getID(this)) { |
245 // TODO: writing out the delta matrix here is an artifact of the writing | 267 // TODO: writing out the delta matrix here is an artifact of the writing |
246 // out of the entire clip stack (with its matrices). Ultimately we will | 268 // out of the entire clip stack (with its matrices). Ultimately we will |
247 // write out the CTM here when the clip state is collapsed to a single p
ath. | 269 // write out the CTM here when the clip state is collapsed to a single p
ath. |
248 this->writeDeltaMat(curMatID, fCurMCState->fMatrixInfo->getID(this)); | 270 this->writeDeltaMat(curMatID, fCurMCState->fMatrixInfo->getID(this)); |
249 } | 271 } |
250 | 272 |
251 SkDEBUGCODE(this->validate();) | 273 SkDEBUGCODE(this->validate();) |
252 | 274 |
253 return true; | 275 return true; |
254 } | 276 } |
255 | 277 |
| 278 // Fill in the skip offsets for all the clips written in the current block |
| 279 void SkMatrixClipStateMgr::fillInSkips(SkWriter32* writer, int32_t restoreOffset
) { |
| 280 for (int i = 0; i < fSkipOffsets->count(); ++i) { |
| 281 SkDEBUGCODE(int32_t peek = writer->readTAt<int32_t>((*fSkipOffsets)[i]);
) |
| 282 SkASSERT(-1 == peek); |
| 283 writer->overwriteTAt<int32_t>((*fSkipOffsets)[i], restoreOffset); |
| 284 } |
| 285 |
| 286 fSkipOffsets->rewind(); |
| 287 } |
| 288 |
256 void SkMatrixClipStateMgr::finish() { | 289 void SkMatrixClipStateMgr::finish() { |
257 if (kIdentityWideOpenStateID != fCurOpenStateID) { | 290 if (kIdentityWideOpenStateID != fCurOpenStateID) { |
258 fPicRecord->recordRestore(); // Close the open block | 291 fPicRecord->recordRestore(); // Close the open block |
259 fCurOpenStateID = kIdentityWideOpenStateID; | 292 fCurOpenStateID = kIdentityWideOpenStateID; |
260 } | 293 } |
261 } | 294 } |
262 | 295 |
263 #ifdef SK_DEBUG | 296 #ifdef SK_DEBUG |
264 void SkMatrixClipStateMgr::validate() { | 297 void SkMatrixClipStateMgr::validate() { |
265 if (fCurOpenStateID == fCurMCState->fMCStateID) { | 298 if (fCurOpenStateID == fCurMCState->fMCStateID && |
266 // The current state is the active one so all its skip offsets should | 299 (!fCurMCState->fIsSaveLayer || |
267 // still be -1 | 300 fCurOpenStateID != fCurMCState->fSaveLayerBaseStateID)) { |
268 SkDeque::F2BIter iter(fMatrixClipStack); | 301 // The current state is the active one so it should have a skip |
| 302 // offset for each clip |
| 303 SkDeque::Iter iter(fMatrixClipStack, SkDeque::Iter::kBack_IterStart); |
| 304 int clipCount = 0; |
| 305 for (const MatrixClipState* state = (const MatrixClipState*) iter.prev()
; |
| 306 state != NULL; |
| 307 state = (const MatrixClipState*) iter.prev()) { |
| 308 clipCount += state->fClipInfo->numClips(); |
| 309 if (state->fIsSaveLayer) { |
| 310 break; |
| 311 } |
| 312 } |
269 | 313 |
270 for (const MatrixClipState* state = (const MatrixClipState*) iter.next()
; | 314 SkASSERT(fSkipOffsets->count() == clipCount); |
271 state != NULL; | |
272 state = (const MatrixClipState*) iter.next()) { | |
273 state->fClipInfo->checkOffsetNotEqual(-1); | |
274 } | |
275 } | 315 } |
276 } | 316 } |
277 #endif | 317 #endif |
278 | 318 |
279 int SkMatrixClipStateMgr::addRegionToDict(const SkRegion& region) { | 319 int SkMatrixClipStateMgr::addRegionToDict(const SkRegion& region) { |
280 int index = fRegionDict.count(); | 320 int index = fRegionDict.count(); |
281 *fRegionDict.append() = SkNEW(SkRegion(region)); | 321 *fRegionDict.append() = SkNEW(SkRegion(region)); |
282 return index; | 322 return index; |
283 } | 323 } |
284 | 324 |
285 int SkMatrixClipStateMgr::addMatToDict(const SkMatrix& mat) { | 325 int SkMatrixClipStateMgr::addMatToDict(const SkMatrix& mat) { |
286 if (mat.isIdentity()) { | 326 if (mat.isIdentity()) { |
287 return kIdentityMatID; | 327 return kIdentityMatID; |
288 } | 328 } |
289 | 329 |
290 *fMatrixDict.append() = mat; | 330 *fMatrixDict.append() = mat; |
291 return fMatrixDict.count()-1; | 331 return fMatrixDict.count()-1; |
292 } | 332 } |
OLD | NEW |