• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "SkBenchmark.h"
2 #include "SkPaint.h"
3 
4 template BenchRegistry* BenchRegistry::gHead;
5 
SkBenchmark(void * defineDict)6 SkBenchmark::SkBenchmark(void* defineDict) {
7     fDict = reinterpret_cast<const SkTDict<const char*>*>(defineDict);
8     fForceAlpha = 0xFF;
9     fForceAA = true;
10 }
11 
getName()12 const char* SkBenchmark::getName() {
13     return this->onGetName();
14 }
15 
getSize()16 SkIPoint SkBenchmark::getSize() {
17     return this->onGetSize();
18 }
19 
draw(SkCanvas * canvas)20 void SkBenchmark::draw(SkCanvas* canvas) {
21     this->onDraw(canvas);
22 }
23 
setupPaint(SkPaint * paint)24 void SkBenchmark::setupPaint(SkPaint* paint) {
25     paint->setAlpha(fForceAlpha);
26     paint->setAntiAlias(fForceAA);
27     paint->setFilterBitmap(fForceFilter);
28 }
29 
findDefine(const char * key) const30 const char* SkBenchmark::findDefine(const char* key) const {
31     if (fDict) {
32         const char* value;
33         if (fDict->find(key, &value)) {
34             return value;
35         }
36     }
37     return NULL;
38 }
39 
40 ///////////////////////////////////////////////////////////////////////////////
41 
onGetSize()42 SkIPoint SkBenchmark::onGetSize() {
43     return SkMakeIPoint(640, 480);
44 }
45