Index: src/core/SkMatrixClipStateMgr.h |
=================================================================== |
--- src/core/SkMatrixClipStateMgr.h (revision 13495) |
+++ src/core/SkMatrixClipStateMgr.h (working copy) |
@@ -120,7 +120,6 @@ |
newClip->fOp = op; |
newClip->fDoAA = doAA; |
newClip->fMatrixID = matrixID; |
- newClip->fOffset = kInvalidJumpOffset; |
return false; |
} |
@@ -134,7 +133,6 @@ |
newClip->fOp = op; |
newClip->fDoAA = doAA; |
newClip->fMatrixID = matrixID; |
- newClip->fOffset = kInvalidJumpOffset; |
return false; |
} |
@@ -147,19 +145,10 @@ |
int regionID, |
SkRegion::Op op, |
int matrixID); |
- void writeClip(int* curMatID, |
- SkMatrixClipStateMgr* mgr, |
- bool* overrideFirstOp); |
- void fillInSkips(SkWriter32* writer, int32_t restoreOffset); |
+ void writeClip(int* curMatID, SkMatrixClipStateMgr* mgr); |
-#ifdef SK_DEBUG |
- void checkOffsetNotEqual(int32_t offset) { |
- for (int i = 0; i < fClips.count(); ++i) { |
- ClipOp& curClip = fClips[i]; |
- SkASSERT(offset != curClip.fOffset); |
- } |
- } |
-#endif |
+ SkDEBUGCODE(int numClips() const { return fClips.count(); }) |
+ |
private: |
enum ClipType { |
kRect_ClipType, |
@@ -168,8 +157,6 @@ |
kRegion_ClipType |
}; |
- static const int kInvalidJumpOffset = -1; |
- |
class ClipOp { |
public: |
ClipType fClipType; |
@@ -185,10 +172,6 @@ |
// The CTM in effect when this clip call was issued |
int fMatrixID; |
- |
- // The offset of this clipOp's "jump-to-offset" location in the skp. |
- // -1 means the offset hasn't been written. |
- int32_t fOffset; |
}; |
SkTDArray<ClipOp> fClips; |
@@ -249,7 +232,7 @@ |
// The next two fields are only valid when fIsSaveLayer is set. |
int32_t fSaveLayerBaseStateID; |
- bool fSaveLayerBracketed; |
+ SkTDArray<int>* fSavedSkipOffsets; |
#ifdef SK_DEBUG |
MatrixClipState* fPrev; // debugging aid |
@@ -347,18 +330,8 @@ |
bool call(CallType callType); |
- void fillInSkips(SkWriter32* writer, int32_t restoreOffset) { |
- // Since we write out the entire clip stack at each block start we |
- // need to update the skips for the entire stack each time too. |
- SkDeque::F2BIter iter(fMatrixClipStack); |
+ void fillInSkips(SkWriter32* writer, int32_t restoreOffset); |
- for (const MatrixClipState* state = (const MatrixClipState*) iter.next(); |
- state != NULL; |
- state = (const MatrixClipState*) iter.next()) { |
- state->fClipInfo->fillInSkips(writer, restoreOffset); |
- } |
- } |
- |
void finish(); |
protected: |
@@ -379,9 +352,23 @@ |
// The MCStateID of the state currently in effect in the byte stream. 0 if none. |
int32_t fCurOpenStateID; |
+ // The skip offsets for the current open state. These are the locations in the |
+ // skp that must be filled in when the current open state is closed. These are |
+ // here rather then distributed across the MatrixClipState's because saveLayers |
+ // can cause MC states to be nested. |
+ SkTDArray<int32_t> *fSkipOffsets; |
SkDEBUGCODE(void validate();) |
+ int MCStackPush(SkCanvas::SaveFlags flags); |
+ |
+ void addClipOffset(int offset) { |
+ SkASSERT(NULL != fSkipOffsets); |
+ SkASSERT(kIdentityWideOpenStateID != fCurOpenStateID); |
+ |
+ *fSkipOffsets->append() = offset; |
+ } |
+ |
void writeDeltaMat(int currentMatID, int desiredMatID); |
static int32_t NewMCStateID(); |