410e6e80f0
While I was doing massive sed-ing, I also converted every bench to use DEF_BENCH instead of registering the ugly manual way. BUG= R=scroggo@google.com Review URL: https://codereview.chromium.org/23876006 git-svn-id: http://skia.googlecode.com/svn/trunk@11263 2bbb7eff-a529-9590-31e7-b0007b416f81
65 lines
1.3 KiB
C++
65 lines
1.3 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;
|
|
|
|
SkBenchmark::SkBenchmark() {
|
|
fForceAlpha = 0xFF;
|
|
fForceAA = true;
|
|
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->setFilterBitmap(fForceFilter);
|
|
|
|
paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
|
|
|
|
if (SkTriState::kDefault != fDither) {
|
|
paint->setDither(SkTriState::kTrue == fDither);
|
|
}
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
SkIPoint SkBenchmark::onGetSize() {
|
|
return SkIPoint::Make(640, 480);
|
|
}
|