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

Unified Diff: src/core/SkMatrixClipStateMgr.h

Issue 164823003: Improve saveLayer handling in SkMatrixClipStateMgr (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix another compiler issue Created 6 years, 10 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 | « no previous file | src/core/SkMatrixClipStateMgr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | src/core/SkMatrixClipStateMgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698