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

Unified Diff: src/core/SkMatrixClipStateMgr.cpp

Issue 161143002: add region to dictionary in SkMatrixClipStackMgr (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: base files missing retry 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 | « src/core/SkMatrixClipStateMgr.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrixClipStateMgr.cpp
===================================================================
--- src/core/SkMatrixClipStateMgr.cpp (revision 13422)
+++ src/core/SkMatrixClipStateMgr.cpp (working copy)
@@ -15,28 +15,28 @@
int matrixID) {
int pathID = picRecord->addPathToHeap(path);
- ClipOp& newClip = fClips.push_back();
- newClip.fClipType = kPath_ClipType;
- newClip.fGeom.fPathID = pathID;
- newClip.fOp = op;
- newClip.fDoAA = doAA;
- newClip.fMatrixID = matrixID;
- newClip.fOffset = kInvalidJumpOffset;
+ ClipOp* newClip = fClips.append();
+ newClip->fClipType = kPath_ClipType;
+ newClip->fGeom.fPathID = pathID;
+ newClip->fOp = op;
+ newClip->fDoAA = doAA;
+ newClip->fMatrixID = matrixID;
+ newClip->fOffset = kInvalidJumpOffset;
return false;
}
bool SkMatrixClipStateMgr::MatrixClipState::ClipInfo::clipRegion(SkPictureRecord* picRecord,
- const SkRegion& region,
+ int regionID,
SkRegion::Op op,
int matrixID) {
// TODO: add a region dictionary so we don't have to copy the region in here
- ClipOp& newClip = fClips.push_back();
- newClip.fClipType = kRegion_ClipType;
- newClip.fGeom.fRegion = SkNEW(SkRegion(region));
- newClip.fOp = op;
- newClip.fDoAA = true; // not necessary but sanity preserving
- newClip.fMatrixID = matrixID;
- newClip.fOffset = kInvalidJumpOffset;
+ ClipOp* newClip = fClips.append();
+ newClip->fClipType = kRegion_ClipType;
+ newClip->fGeom.fRegionID = regionID;
+ newClip->fOp = op;
+ newClip->fDoAA = true; // not necessary but sanity preserving
+ newClip->fMatrixID = matrixID;
+ newClip->fOffset = kInvalidJumpOffset;
return false;
}
@@ -92,9 +92,11 @@
curClip.fOffset = mgr->getPicRecord()->recordClipPath(curClip.fGeom.fPathID, op,
curClip.fDoAA);
break;
- case kRegion_ClipType:
- curClip.fOffset = mgr->getPicRecord()->recordClipRegion(*curClip.fGeom.fRegion, op);
+ case kRegion_ClipType: {
+ const SkRegion* region = mgr->lookupRegion(curClip.fGeom.fRegionID);
+ curClip.fOffset = mgr->getPicRecord()->recordClipRegion(*region, op);
break;
+ }
default:
SkASSERT(0);
}
@@ -131,7 +133,13 @@
new (fCurMCState) MatrixClipState(NULL, 0); // balanced in restore()
}
+SkMatrixClipStateMgr::~SkMatrixClipStateMgr() {
+ for (int i = 0; i < fRegionDict.count(); ++i) {
+ SkDELETE(fRegionDict[i]);
+ }
+}
+
int SkMatrixClipStateMgr::save(SkCanvas::SaveFlags flags) {
SkDEBUGCODE(this->validate();)
@@ -268,6 +276,12 @@
}
#endif
+int SkMatrixClipStateMgr::addRegionToDict(const SkRegion& region) {
+ int index = fRegionDict.count();
+ *fRegionDict.append() = SkNEW(SkRegion(region));
+ return index;
+}
+
int SkMatrixClipStateMgr::addMatToDict(const SkMatrix& mat) {
if (mat.isIdentity()) {
return kIdentityMatID;
« no previous file with comments | « src/core/SkMatrixClipStateMgr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698