2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
10 GMBench::GMBench(skiagm::GM* gm) : fGM(gm) {
11 fName.printf("GM_%s", gm->getName());
14 GMBench::~GMBench() { delete fGM; }
16 const char* GMBench::onGetName() {
20 bool GMBench::isSuitableFor(Backend backend) {
21 uint32_t flags = fGM->getFlags();
24 return !(skiagm::GM::kSkipGPU_Flag & flags);
26 return !(skiagm::GM::kSkipPDF_Flag & flags);
28 // GM doesn't have an equivalent flag. If the GM has known issues with 565 then
29 // we skip it for ALL raster configs in bench.
30 return !(skiagm::GM::kSkip565_Flag & flags);
31 case kNonRendering_Backend:
34 SkDEBUGFAIL("Unexpected backend type.");
39 void GMBench::onDraw(const int loops, SkCanvas* canvas) {
40 // Do we care about timing the draw of the background (once)?
41 // Does the GM ever rely on drawBackground to lazily compute something?
42 fGM->drawBackground(canvas);
43 for (int i = 0; i < loops; ++i) {
44 fGM->drawContent(canvas);
48 SkIPoint GMBench::onGetSize() {
49 SkISize size = fGM->getISize();
50 return SkIPoint::Make(size.fWidth, size.fHeight);