| 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() { return this->onISize(); } | 56 SkISize getISize() { |
| 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 } |
| 57 const char* getName(); | 64 const char* getName(); |
| 58 | 65 |
| 59 virtual bool runAsBench() const { return false; } | 66 virtual bool runAsBench() const { return false; } |
| 60 | 67 |
| 61 SkScalar width() { | 68 SkScalar width() { |
| 62 return SkIntToScalar(this->getISize().width()); | 69 return SkIntToScalar(this->getISize().width()); |
| 63 } | 70 } |
| 64 SkScalar height() { | 71 SkScalar height() { |
| 65 return SkIntToScalar(this->getISize().height()); | 72 return SkIntToScalar(this->getISize().height()); |
| 66 } | 73 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 SkISize onISize() SK_OVERRIDE; | 130 SkISize onISize() SK_OVERRIDE; |
| 124 SkString onShortName() SK_OVERRIDE; | 131 SkString onShortName() SK_OVERRIDE; |
| 125 private: | 132 private: |
| 126 SkString fName; | 133 SkString fName; |
| 127 void (*fDrawProc)(SkCanvas*); | 134 void (*fDrawProc)(SkCanvas*); |
| 128 SkISize fSize; | 135 SkISize fSize; |
| 129 }; | 136 }; |
| 130 } | 137 } |
| 131 | 138 |
| 132 #endif | 139 #endif |
| OLD | NEW |