| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef skiagm_DEFINED | 8 #ifndef skiagm_DEFINED |
| 9 #define skiagm_DEFINED | 9 #define skiagm_DEFINED |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 kBench_Mode, | 46 kBench_Mode, |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 void setMode(Mode mode) { fMode = mode; } | 49 void setMode(Mode mode) { fMode = mode; } |
| 50 Mode getMode() const { return fMode; } | 50 Mode getMode() const { return fMode; } |
| 51 | 51 |
| 52 void draw(SkCanvas*); | 52 void draw(SkCanvas*); |
| 53 void drawBackground(SkCanvas*); | 53 void drawBackground(SkCanvas*); |
| 54 void drawContent(SkCanvas*); | 54 void drawContent(SkCanvas*); |
| 55 | 55 |
| 56 SkISize getISize() { | 56 SkISize getISize() { return this->onISize(); } |
| 57 SkISize size = this->onISize(); | |
| 58 // Sanity cap on GM dimensions. | |
| 59 SkASSERT(size.width() * size.height() <= 2359296 && // 2.25 megapix
els | |
| 60 size.width() <= 2048 && // Typical GPU
max dimension. | |
| 61 size.height() <= 2048); | |
| 62 return size; | |
| 63 } | |
| 64 const char* getName(); | 57 const char* getName(); |
| 65 | 58 |
| 66 virtual bool runAsBench() const { return false; } | 59 virtual bool runAsBench() const { return false; } |
| 67 | 60 |
| 68 SkScalar width() { | 61 SkScalar width() { |
| 69 return SkIntToScalar(this->getISize().width()); | 62 return SkIntToScalar(this->getISize().width()); |
| 70 } | 63 } |
| 71 SkScalar height() { | 64 SkScalar height() { |
| 72 return SkIntToScalar(this->getISize().height()); | 65 return SkIntToScalar(this->getISize().height()); |
| 73 } | 66 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 SkISize onISize() SK_OVERRIDE; | 123 SkISize onISize() SK_OVERRIDE; |
| 131 SkString onShortName() SK_OVERRIDE; | 124 SkString onShortName() SK_OVERRIDE; |
| 132 private: | 125 private: |
| 133 SkString fName; | 126 SkString fName; |
| 134 void (*fDrawProc)(SkCanvas*); | 127 void (*fDrawProc)(SkCanvas*); |
| 135 SkISize fSize; | 128 SkISize fSize; |
| 136 }; | 129 }; |
| 137 } | 130 } |
| 138 | 131 |
| 139 #endif | 132 #endif |
| OLD | NEW |