4469938e92
This reverts commit 1e787c38fa71f2a21fd728f1b1d620b9b09b0d3d. BUG= Review URL: https://codereview.chromium.org/54603004 git-svn-id: http://skia.googlecode.com/svn/trunk@12057 2bbb7eff-a529-9590-31e7-b0007b416f81
68 lines
1.5 KiB
C++
68 lines
1.5 KiB
C++
/*
|
|
* Copyright 2011 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
#include "SkBenchmark.h"
|
|
#include "SkPaint.h"
|
|
#include "SkParse.h"
|
|
|
|
const char* SkTriState::Name[] = { "default", "true", "false" };
|
|
|
|
SK_DEFINE_INST_COUNT(SkBenchmark)
|
|
|
|
template BenchRegistry* BenchRegistry::gHead;
|
|
|
|
SkString SkBenchmark::gResourcePath;
|
|
|
|
SkBenchmark::SkBenchmark() {
|
|
fForceAlpha = 0xFF;
|
|
fForceAA = true;
|
|
fForceFilter = false;
|
|
fDither = SkTriState::kDefault;
|
|
fIsRendering = true;
|
|
fOrMask = fClearMask = 0;
|
|
fLoops = 1;
|
|
}
|
|
|
|
const char* SkBenchmark::getName() {
|
|
return this->onGetName();
|
|
}
|
|
|
|
SkIPoint SkBenchmark::getSize() {
|
|
return this->onGetSize();
|
|
}
|
|
|
|
void SkBenchmark::preDraw() {
|
|
this->onPreDraw();
|
|
}
|
|
|
|
void SkBenchmark::draw(SkCanvas* canvas) {
|
|
this->onDraw(canvas);
|
|
}
|
|
|
|
void SkBenchmark::postDraw() {
|
|
this->onPostDraw();
|
|
}
|
|
|
|
void SkBenchmark::setupPaint(SkPaint* paint) {
|
|
paint->setAlpha(fForceAlpha);
|
|
paint->setAntiAlias(fForceAA);
|
|
paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel
|
|
: SkPaint::kNone_FilterLevel);
|
|
|
|
paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
|
|
|
|
if (SkTriState::kDefault != fDither) {
|
|
paint->setDither(SkTriState::kTrue == fDither);
|
|
}
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
SkIPoint SkBenchmark::onGetSize() {
|
|
return SkIPoint::Make(640, 480);
|
|
}
|