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 "bench/Benchmark.h" 9 10 #include "include/core/SkCanvas.h" 11 #include "include/core/SkPaint.h" 12 #include "include/utils/SkParse.h" 13 14 template BenchRegistry* BenchRegistry::gHead; 15 Benchmark()16Benchmark::Benchmark() {} 17 getName()18const char* Benchmark::getName() { 19 return this->onGetName(); 20 } 21 getUniqueName()22const char* Benchmark::getUniqueName() { 23 return this->onGetUniqueName(); 24 } 25 getSize()26SkIPoint Benchmark::getSize() { 27 return this->onGetSize(); 28 } 29 delayedSetup()30void Benchmark::delayedSetup() { 31 this->onDelayedSetup(); 32 } 33 perCanvasPreDraw(SkCanvas * canvas)34void Benchmark::perCanvasPreDraw(SkCanvas* canvas) { 35 this->onPerCanvasPreDraw(canvas); 36 } 37 preDraw(SkCanvas * canvas)38void Benchmark::preDraw(SkCanvas* canvas) { 39 this->onPreDraw(canvas); 40 } 41 postDraw(SkCanvas * canvas)42void Benchmark::postDraw(SkCanvas* canvas) { 43 this->onPostDraw(canvas); 44 } 45 perCanvasPostDraw(SkCanvas * canvas)46void Benchmark::perCanvasPostDraw(SkCanvas* canvas) { 47 this->onPerCanvasPostDraw(canvas); 48 } 49 draw(int loops,SkCanvas * canvas)50void Benchmark::draw(int loops, SkCanvas* canvas) { 51 SkAutoCanvasRestore ar(canvas, true/*save now*/); 52 this->onDraw(loops, canvas); 53 } 54 setupPaint(SkPaint * paint)55void Benchmark::setupPaint(SkPaint* paint) { 56 paint->setAntiAlias(true); 57 } 58 onGetSize()59SkIPoint Benchmark::onGetSize() { 60 return SkIPoint::Make(640, 480); 61 } 62