Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "SkGMBench.h" | |
| 9 | |
| 10 SkGMBench::SkGMBench(skiagm::GM* gm) : fGM(gm) { | |
| 11 fName.printf("GM:%s", gm->shortName()); | |
| 12 } | |
| 13 | |
| 14 SkGMBench::~SkGMBench() { delete fGM; } | |
| 15 | |
| 16 const char* SkGMBench::onGetName() { | |
| 17 return fName.c_str(); | |
| 18 } | |
| 19 | |
| 20 bool SkGMBench::isSuitableFor(Backend backend) { | |
| 21 uint32_t flags = fGM->getFlags(); | |
| 22 switch (backend) { | |
| 23 case kGPU_Backend: | |
| 24 return !(skiagm::GM::kSkipGPU_Flag & flags); | |
| 25 case kPDF_Backend: | |
| 26 return !(skiagm::GM::kSkipPDF_Flag & flags); | |
| 27 case kRaster_Backend: | |
| 28 // GM doesn't have an equivalent flag. If the GM has known issues wi th 565 then | |
| 29 // we skip it for ALL raster configs in bench. | |
| 30 return !(skiagm::GM::kSkip565_Flag & flags); | |
| 31 case kNonRendering_Backend: | |
| 32 return false; | |
| 33 default: | |
| 34 SkDEBUGFAIL("Unexpected backend type."); | |
| 35 return false; | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 void SkGMBench::onDraw(const int loops, SkCanvas* canvas) { | |
| 40 fGM->drawBackground(canvas); // necessary? | |
| 41 for (int i = 0; i < loops; ++i) { | |
| 42 fGM->draw(canvas); | |
|
reed1
2014/02/03 13:20:42
I think the draw == drawBackground + drawContent.
bsalomon
2014/02/03 14:02:45
Ah.. didn't realize that.
| |
| 43 } | |
| 44 } | |
| 45 | |
| 46 SkIPoint SkGMBench::onGetSize() { | |
|
reed1
2014/02/03 13:20:42
clearly we need to change the signature of onGetSi
bsalomon
2014/02/03 14:02:45
yup
| |
| 47 SkISize size = fGM->getISize(); | |
| 48 return SkIPoint::Make(size.fWidth, size.fHeight); | |
| 49 } | |
| OLD | NEW |