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

Side by Side Diff: bench/DeferredCanvasBench.cpp

Issue 241453003: Reduce internal explicit SaveFlags usage. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Re-added needed save flag in SkPictureStateTree::Iterator::draw() Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gm/xfermodes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkBenchmark.h" 7 #include "SkBenchmark.h"
8 #include "SkDeferredCanvas.h" 8 #include "SkDeferredCanvas.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE { 77 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE {
78 canvas->setNotificationClient(&fNotificationClient); 78 canvas->setNotificationClient(&fNotificationClient);
79 } 79 }
80 80
81 virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas) SK_OVERRIDE { 81 virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas) SK_OVERRIDE {
82 SkRect rect; 82 SkRect rect;
83 rect.setXYWH(0, 0, 10, 10); 83 rect.setXYWH(0, 0, 10, 10);
84 SkPaint paint; 84 SkPaint paint;
85 for (int i = 0; i < loops; i++) { 85 for (int i = 0; i < loops; i++) {
86 canvas->save(SkCanvas::kMatrixClip_SaveFlag); 86 canvas->save();
87 canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScala r(i * 13 % CANVAS_HEIGHT)); 87 canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScala r(i * 13 % CANVAS_HEIGHT));
88 canvas->drawRect(rect, paint); 88 canvas->drawRect(rect, paint);
89 canvas->restore(); 89 canvas->restore();
90 } 90 }
91 } 91 }
92 92
93 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE { 93 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE {
94 canvas->clear(0x0); 94 canvas->clear(0x0);
95 canvas->setNotificationClient(NULL); 95 canvas->setNotificationClient(NULL);
96 } 96 }
97 97
98 private: 98 private:
99 typedef DeferredCanvasBench INHERITED; 99 typedef DeferredCanvasBench INHERITED;
100 SimpleNotificationClient fNotificationClient; 100 SimpleNotificationClient fNotificationClient;
101 }; 101 };
102 102
103 103
104 /////////////////////////////////////////////////////////////////////////////// 104 ///////////////////////////////////////////////////////////////////////////////
105 105
106 DEF_BENCH( return new DeferredRecordBench(); ) 106 DEF_BENCH( return new DeferredRecordBench(); )
OLDNEW
« no previous file with comments | « no previous file | gm/xfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698