Reduce internal explicit SaveFlags usage.
Most of these are either redundant/defaults or (hopefully)
unnecessarily specific.
R=reed@google.com, robertphillips@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/241453003
git-svn-id: http://skia.googlecode.com/svn/trunk@14253 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 569e9e5..c57ae9a 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1631,12 +1631,13 @@
SkIRect deviceIBounds;
this->getDevice()->getGlobalBounds(&deviceIBounds);
deviceBounds = SkRect::Make(deviceIBounds);
- this->SkCanvas::save(SkCanvas::kMatrix_SaveFlag);
+
// set the clip in device space
+ SkMatrix savedMatrix = this->getTotalMatrix();
this->SkCanvas::setMatrix(SkMatrix::I());
this->SkCanvas::onClipRect(deviceBounds, SkRegion::kReplace_Op,
kHard_ClipEdgeStyle);
- this->SkCanvas::restore(); //pop the matrix, but keep the clip
+ this->setMatrix(savedMatrix);
break;
}
default:
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 0a55e73..bea3442 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -770,7 +770,7 @@
// we have to call this *after* our constructor, to ensure that it gets
// recorded. This is balanced by restoreToCount() call from endRecording,
// which in-turn calls our overridden restore(), so those get recorded too.
- fInitialSaveCount = this->save(kMatrixClip_SaveFlag);
+ fInitialSaveCount = this->save();
}
void SkPictureRecord::endRecording() {
diff --git a/src/core/SkPictureStateTree.cpp b/src/core/SkPictureStateTree.cpp
index ca3032d..891d04c 100644
--- a/src/core/SkPictureStateTree.cpp
+++ b/src/core/SkPictureStateTree.cpp
@@ -124,7 +124,7 @@
Node* targetNode = draw->fNode;
if (fSave) {
- fCanvas->save(SkCanvas::kClip_SaveFlag);
+ fCanvas->save();
fSave = false;
}
@@ -162,6 +162,9 @@
fCanvas->restore();
}
if (targetNode != ancestor) {
+ // FIXME: the save below depends on soon-to-be-deprecated
+ // SaveFlags behavior: it relies on matrix changes persisting
+ // after restore.
fCanvas->save(SkCanvas::kClip_SaveFlag);
}
}