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

Side by Side Diff: bench/Benchmark.cpp

Issue 619353002: Save/Restore around bench runs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: include Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 9
10 #include "SkCanvas.h"
10 #include "SkPaint.h" 11 #include "SkPaint.h"
11 #include "SkParse.h" 12 #include "SkParse.h"
12 13
13 const char* SkTriState::Name[] = { "default", "true", "false" }; 14 const char* SkTriState::Name[] = { "default", "true", "false" };
14 15
15 template BenchRegistry* BenchRegistry::gHead; 16 template BenchRegistry* BenchRegistry::gHead;
16 17
17 Benchmark::Benchmark() { 18 Benchmark::Benchmark() {
18 fForceAlpha = 0xFF; 19 fForceAlpha = 0xFF;
19 fDither = SkTriState::kDefault; 20 fDither = SkTriState::kDefault;
(...skipping 10 matching lines...) Expand all
30 31
31 SkIPoint Benchmark::getSize() { 32 SkIPoint Benchmark::getSize() {
32 return this->onGetSize(); 33 return this->onGetSize();
33 } 34 }
34 35
35 void Benchmark::preDraw() { 36 void Benchmark::preDraw() {
36 this->onPreDraw(); 37 this->onPreDraw();
37 } 38 }
38 39
39 void Benchmark::draw(const int loops, SkCanvas* canvas) { 40 void Benchmark::draw(const int loops, SkCanvas* canvas) {
41 SkAutoCanvasRestore ar(canvas, true/*save now*/);
40 this->onDraw(loops, canvas); 42 this->onDraw(loops, canvas);
41 } 43 }
42 44
43 void Benchmark::setupPaint(SkPaint* paint) { 45 void Benchmark::setupPaint(SkPaint* paint) {
44 paint->setAlpha(fForceAlpha); 46 paint->setAlpha(fForceAlpha);
45 paint->setAntiAlias(true); 47 paint->setAntiAlias(true);
46 paint->setFilterLevel(SkPaint::kNone_FilterLevel); 48 paint->setFilterLevel(SkPaint::kNone_FilterLevel);
47 49
48 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); 50 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
49 51
50 if (SkTriState::kDefault != fDither) { 52 if (SkTriState::kDefault != fDither) {
51 paint->setDither(SkTriState::kTrue == fDither); 53 paint->setDither(SkTriState::kTrue == fDither);
52 } 54 }
53 } 55 }
54 56
55 SkIPoint Benchmark::onGetSize() { 57 SkIPoint Benchmark::onGetSize() {
56 return SkIPoint::Make(640, 480); 58 return SkIPoint::Make(640, 480);
57 } 59 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698