1 /* 2 * Copyright 2011 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "Benchmark.h" 9 10 #include "SkCanvas.h" 11 #include "SkPaint.h" 12 #include "SkParse.h" 13 14 template BenchRegistry* BenchRegistry::gHead; 15 16 Benchmark::Benchmark() {} 17 18 const char* Benchmark::getName() { 19 return this->onGetName(); 20 } 21 22 const char* Benchmark::getUniqueName() { 23 return this->onGetUniqueName(); 24 } 25 26 SkIPoint Benchmark::getSize() { 27 return this->onGetSize(); 28 } 29 30 void Benchmark::delayedSetup() { 31 this->onDelayedSetup(); 32 } 33 34 void Benchmark::perCanvasPreDraw(SkCanvas* canvas) { 35 this->onPerCanvasPreDraw(canvas); 36 } 37 38 void Benchmark::preDraw(SkCanvas* canvas) { 39 this->onPreDraw(canvas); 40 } 41 42 void Benchmark::postDraw(SkCanvas* canvas) { 43 this->onPostDraw(canvas); 44 } 45 46 void Benchmark::perCanvasPostDraw(SkCanvas* canvas) { 47 this->onPerCanvasPostDraw(canvas); 48 } 49 50 void Benchmark::draw(int loops, SkCanvas* canvas) { 51 SkAutoCanvasRestore ar(canvas, true/*save now*/); 52 this->onDraw(loops, canvas); 53 } 54 55 void Benchmark::setupPaint(SkPaint* paint) { 56 paint->setAntiAlias(true); 57 } 58 59 SkIPoint Benchmark::onGetSize() { 60 return SkIPoint::Make(640, 480); 61 } 62