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

Unified Diff: bench/benchmain.cpp

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 | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/benchmain.cpp
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 6b52508163b79950f21e37f53b1a00f9b7a5002f..944b114c51e698b1078f1409a2de482b685170bf 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -598,9 +598,9 @@ int tool_main(int argc, char** argv) {
// as we can flush and/or swap buffers to keep the GPU from
// queuing up too much work.
for (int loopCount = loopsPerIter; loopCount > 0; ) {
- if (NULL != canvas) {
- canvas->save();
- }
+ // Save and restore around each call to draw() to guarantee a pristine canvas.
+ SkAutoCanvasRestore saveRestore(canvas, true/*also save*/);
+
if (frameIntervalComputed && loopCount > loopsPerFrame) {
bench->setLoops(loopsPerFrame);
loopCount -= loopsPerFrame;
@@ -628,9 +628,6 @@ int tool_main(int argc, char** argv) {
glContext->swapBuffers();
}
#endif
- if (NULL != canvas) {
- canvas->restore();
- }
}
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698