skia2/bench/Benchmark.cpp
mtklein 962890568d Distinguish common and unique names for skiaperf.com.
Turns out we tack on the size post-facto in ResultsWriter::bench(), so the only
place we need getUniqueName() to differ from getName() is SKPBench.

BUG=skia:
R=jcgregorio@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/552303004
2014-09-10 12:05:59 -07:00

58 lines
1.2 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 "Benchmark.h"
#include "SkPaint.h"
#include "SkParse.h"
const char* SkTriState::Name[] = { "default", "true", "false" };
template BenchRegistry* BenchRegistry::gHead;
Benchmark::Benchmark() {
fForceAlpha = 0xFF;
fDither = SkTriState::kDefault;
fOrMask = fClearMask = 0;
}
const char* Benchmark::getName() {
return this->onGetName();
}
const char* Benchmark::getUniqueName() {
return this->onGetUniqueName();
}
SkIPoint Benchmark::getSize() {
return this->onGetSize();
}
void Benchmark::preDraw() {
this->onPreDraw();
}
void Benchmark::draw(const int loops, SkCanvas* canvas) {
this->onDraw(loops, canvas);
}
void Benchmark::setupPaint(SkPaint* paint) {
paint->setAlpha(fForceAlpha);
paint->setAntiAlias(true);
paint->setFilterLevel(SkPaint::kNone_FilterLevel);
paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
if (SkTriState::kDefault != fDither) {
paint->setDither(SkTriState::kTrue == fDither);
}
}
SkIPoint Benchmark::onGetSize() {
return SkIPoint::Make(640, 480);
}