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

Unified Diff: include/core/SkCanvas.h

Issue 26848013: save/restore the canvas around every bench draw call (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: always initialize fSaveCount Created 7 years, 2 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 | « bench/benchmain.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index cfc252fccfc191c64804b4edfd172ba2e9b066e1..dc3953ed4b1df71634992a1bec5bd1d7a85450e3 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1145,11 +1145,12 @@ private:
*/
class SkAutoCanvasRestore : SkNoncopyable {
public:
- SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas) {
- SkASSERT(canvas);
- fSaveCount = canvas->getSaveCount();
- if (doSave) {
- canvas->save();
+ SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveCount(0) {
+ if (fCanvas) {
+ fSaveCount = canvas->getSaveCount();
+ if (doSave) {
+ canvas->save();
+ }
}
}
~SkAutoCanvasRestore() {
« no previous file with comments | « bench/benchmain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698