1 #include "SkBenchmark.h" 2 #include "SkPaint.h" 3 4 template BenchRegistry* BenchRegistry::gHead; 5 SkBenchmark(void * defineDict)6SkBenchmark::SkBenchmark(void* defineDict) { 7 fDict = reinterpret_cast<const SkTDict<const char*>*>(defineDict); 8 fForceAlpha = 0xFF; 9 fForceAA = true; 10 } 11 getName()12const char* SkBenchmark::getName() { 13 return this->onGetName(); 14 } 15 getSize()16SkIPoint SkBenchmark::getSize() { 17 return this->onGetSize(); 18 } 19 draw(SkCanvas * canvas)20void SkBenchmark::draw(SkCanvas* canvas) { 21 this->onDraw(canvas); 22 } 23 setupPaint(SkPaint * paint)24void SkBenchmark::setupPaint(SkPaint* paint) { 25 paint->setAlpha(fForceAlpha); 26 paint->setAntiAlias(fForceAA); 27 paint->setFilterBitmap(fForceFilter); 28 } 29 findDefine(const char * key) const30const 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()42SkIPoint SkBenchmark::onGetSize() { 43 return SkMakeIPoint(640, 480); 44 } 45