2 * Copyright 2011 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
13 const char* SkTriState::Name[] = { "default", "true", "false" };
15 template BenchRegistry* BenchRegistry::gHead;
17 Benchmark::Benchmark() {
19 fDither = SkTriState::kDefault;
20 fOrMask = fClearMask = 0;
23 const char* Benchmark::getName() {
24 return this->onGetName();
27 const char* Benchmark::getUniqueName() {
28 return this->onGetUniqueName();
31 SkIPoint Benchmark::getSize() {
32 return this->onGetSize();
35 void Benchmark::preDraw() {
39 void Benchmark::draw(const int loops, SkCanvas* canvas) {
40 this->onDraw(loops, canvas);
43 void Benchmark::setupPaint(SkPaint* paint) {
44 paint->setAlpha(fForceAlpha);
45 paint->setAntiAlias(true);
46 paint->setFilterLevel(SkPaint::kNone_FilterLevel);
48 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
50 if (SkTriState::kDefault != fDither) {
51 paint->setDither(SkTriState::kTrue == fDither);
55 SkIPoint Benchmark::onGetSize() {
56 return SkIPoint::Make(640, 480);