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

Unified Diff: src/core/SkCanvas.cpp

Issue 340403003: SaveFlags be-gone (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: One more baseurl attempt Created 6 years, 6 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/SkBBoxHierarchyRecord.cpp ('k') | src/core/SkMatrixClipStateMgr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 2fb5c951249d54c1905107e0a1c6161e1461281a..c35f28443284035391587b802c74d12ec0f39d88 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -189,7 +189,6 @@ private:
*/
class SkCanvas::MCRec {
public:
- int fFlags;
SkMatrix* fMatrix; // points to either fMatrixStorage or prev MCRec
SkRasterClip* fRasterClip; // points to either fRegionStorage or prev MCRec
SkDrawFilter* fFilter; // the current filter (or null)
@@ -203,21 +202,13 @@ public:
*/
DeviceCM* fTopLayer;
- MCRec(const MCRec* prev, int flags) : fFlags(flags) {
+ MCRec(const MCRec* prev) {
if (NULL != prev) {
- if (flags & SkCanvas::kMatrix_SaveFlag) {
- fMatrixStorage = *prev->fMatrix;
- fMatrix = &fMatrixStorage;
- } else {
- fMatrix = prev->fMatrix;
- }
+ fMatrixStorage = *prev->fMatrix;
+ fMatrix = &fMatrixStorage;
- if (flags & SkCanvas::kClip_SaveFlag) {
- fRasterClipStorage = *prev->fRasterClip;
- fRasterClip = &fRasterClipStorage;
- } else {
- fRasterClip = prev->fRasterClip;
- }
+ fRasterClipStorage = *prev->fRasterClip;
+ fRasterClip = &fRasterClipStorage;
fFilter = prev->fFilter;
SkSafeRef(fFilter);
@@ -449,7 +440,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device) {
fMetaData = NULL;
fMCRec = (MCRec*)fMCStack.push_back();
- new (fMCRec) MCRec(NULL, 0);
+ new (fMCRec) MCRec(NULL);
fMCRec->fLayer = SkNEW_ARGS(DeviceCM, (NULL, 0, 0, NULL, NULL));
fMCRec->fTopLayer = fMCRec->fLayer;
@@ -786,30 +777,21 @@ void SkCanvas::updateDeviceCMCache() {
///////////////////////////////////////////////////////////////////////////////
-int SkCanvas::internalSave(SaveFlags flags) {
+int SkCanvas::internalSave() {
int saveCount = this->getSaveCount(); // record this before the actual save
MCRec* newTop = (MCRec*)fMCStack.push_back();
- new (newTop) MCRec(fMCRec, flags); // balanced in restore()
-
+ new (newTop) MCRec(fMCRec); // balanced in restore()
fMCRec = newTop;
- if (SkCanvas::kClip_SaveFlag & flags) {
- fClipStack.save();
- }
+ fClipStack.save();
return saveCount;
}
int SkCanvas::save() {
- this->willSave(kMatrixClip_SaveFlag);
- return this->internalSave(kMatrixClip_SaveFlag);
-}
-
-int SkCanvas::save(SaveFlags flags) {
- this->willSave(flags);
- // call shared impl
- return this->internalSave(flags);
+ this->willSave();
+ return this->internalSave();
}
static bool bounds_affects_clip(SkCanvas::SaveFlags flags) {
@@ -889,7 +871,7 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Save
// do this before we create the layer. We don't call the public save() since
// that would invoke a possibly overridden virtual
- int count = this->internalSave(flags);
+ int count = this->internalSave();
fDeviceCMDirty = true;
@@ -974,9 +956,7 @@ void SkCanvas::internalRestore() {
fDeviceCMDirty = true;
fCachedLocalClipBoundsDirty = true;
- if (SkCanvas::kClip_SaveFlag & fMCRec->fFlags) {
- fClipStack.restore();
- }
+ fClipStack.restore();
// reserve our layer (if any)
DeviceCM* layer = fMCRec->fLayer; // may be null
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.cpp ('k') | src/core/SkMatrixClipStateMgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698