2009-01-05 03:34:50 +00:00
|
|
|
#include "SkBenchmark.h"
|
2009-01-19 20:08:35 +00:00
|
|
|
#include "SkPaint.h"
|
|
|
|
|
2009-01-26 23:15:37 +00:00
|
|
|
template BenchRegistry* BenchRegistry::gHead;
|
|
|
|
|
2009-09-02 21:12:42 +00:00
|
|
|
SkBenchmark::SkBenchmark(void* defineDict) {
|
|
|
|
fDict = reinterpret_cast<const SkTDict<const char*>*>(defineDict);
|
2009-01-19 20:08:35 +00:00
|
|
|
fForceAlpha = 0xFF;
|
|
|
|
fForceAA = true;
|
2009-10-19 17:39:46 +00:00
|
|
|
fDither = SkTriState::kDefault;
|
2009-01-19 20:08:35 +00:00
|
|
|
}
|
2009-01-05 03:34:50 +00:00
|
|
|
|
|
|
|
const char* SkBenchmark::getName() {
|
|
|
|
return this->onGetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
SkIPoint SkBenchmark::getSize() {
|
|
|
|
return this->onGetSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkBenchmark::draw(SkCanvas* canvas) {
|
|
|
|
this->onDraw(canvas);
|
|
|
|
}
|
|
|
|
|
2009-01-19 20:08:35 +00:00
|
|
|
void SkBenchmark::setupPaint(SkPaint* paint) {
|
|
|
|
paint->setAlpha(fForceAlpha);
|
|
|
|
paint->setAntiAlias(fForceAA);
|
2009-08-04 18:17:15 +00:00
|
|
|
paint->setFilterBitmap(fForceFilter);
|
2009-10-19 17:39:46 +00:00
|
|
|
|
|
|
|
if (SkTriState::kDefault != fDither) {
|
|
|
|
paint->setDither(SkTriState::kTrue == fDither);
|
|
|
|
}
|
2009-01-19 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 21:12:42 +00:00
|
|
|
const char* SkBenchmark::findDefine(const char* key) const {
|
|
|
|
if (fDict) {
|
|
|
|
const char* value;
|
|
|
|
if (fDict->find(key, &value)) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-26 23:15:37 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2009-01-19 20:08:35 +00:00
|
|
|
|
2009-01-26 23:15:37 +00:00
|
|
|
SkIPoint SkBenchmark::onGetSize() {
|
|
|
|
return SkMakeIPoint(640, 480);
|
|
|
|
}
|