1c4029296f
Depends on https://codereview.chromium.org/873753002/ Thumbs up to CLion for refactoring this for me. BUG=skia: Review URL: https://codereview.chromium.org/867963004
38 lines
892 B
C++
38 lines
892 B
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "GMBench.h"
|
|
|
|
GMBench::GMBench(skiagm::GM* gm) : fGM(gm) {
|
|
fName.printf("GM_%s", gm->getName());
|
|
}
|
|
|
|
GMBench::~GMBench() { delete fGM; }
|
|
|
|
const char* GMBench::onGetName() {
|
|
return fName.c_str();
|
|
}
|
|
|
|
bool GMBench::isSuitableFor(Backend backend) {
|
|
return kNonRendering_Backend != backend;
|
|
}
|
|
|
|
void GMBench::onDraw(const int loops, SkCanvas* canvas) {
|
|
// Do we care about timing the draw of the background (once)?
|
|
// Does the GM ever rely on drawBackground to lazily compute something?
|
|
fGM->drawBackground(canvas);
|
|
for (int i = 0; i < loops; ++i) {
|
|
fGM->drawContent(canvas);
|
|
}
|
|
}
|
|
|
|
SkIPoint GMBench::onGetSize() {
|
|
SkISize size = fGM->getISize();
|
|
return SkIPoint::Make(size.fWidth, size.fHeight);
|
|
}
|
|
|