| 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 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkPaint.h" | 13 #include "SkPaint.h" |
| 14 #include "SkSize.h" | 14 #include "SkSize.h" |
| 15 #include "SkString.h" | 15 #include "SkString.h" |
| 16 #include "SkTRegistry.h" | 16 #include "SkTRegistry.h" |
| 17 #include "sk_tool_utils.h" | 17 #include "sk_tool_utils.h" |
| 18 | 18 |
| 19 class SkAnimTimer; | 19 class SkAnimTimer; |
| 20 | 20 struct GrContextOptions; |
| 21 #if SK_SUPPORT_GPU | |
| 22 #include "GrContext.h" | |
| 23 #endif | |
| 24 | 21 |
| 25 #define DEF_GM(code) \ | 22 #define DEF_GM(code) \ |
| 26 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ | 23 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ |
| 27 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_
)); | 24 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_
)); |
| 28 | 25 |
| 29 // See colorwheel.cpp for example usage. | 26 // See colorwheel.cpp for example usage. |
| 30 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \ | 27 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \ |
| 31 static void SK_MACRO_CONCAT(NAME, _GM)(SkCanvas* CANVAS); \ | 28 static void SK_MACRO_CONCAT(NAME, _GM)(SkCanvas* CANVAS); \ |
| 32 DEF_GM( return SkNEW_ARGS(skiagm::SimpleGM, \ | 29 DEF_GM( return SkNEW_ARGS(skiagm::SimpleGM, \ |
| 33 (SkString(#NAME), \ | 30 (SkString(#NAME), \ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 fCanvasIsDeferred = isDeferred; | 86 fCanvasIsDeferred = isDeferred; |
| 90 } | 87 } |
| 91 | 88 |
| 92 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } | 89 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } |
| 93 void setStarterMatrix(const SkMatrix& matrix) { | 90 void setStarterMatrix(const SkMatrix& matrix) { |
| 94 fStarterMatrix = matrix; | 91 fStarterMatrix = matrix; |
| 95 } | 92 } |
| 96 | 93 |
| 97 bool animate(const SkAnimTimer&); | 94 bool animate(const SkAnimTimer&); |
| 98 | 95 |
| 96 virtual void modifyGrContextOptions(GrContextOptions* options) {} |
| 97 |
| 99 protected: | 98 protected: |
| 100 /** draws a standard message that the GM is only intended to be used wit
h the GPU.*/ | 99 /** draws a standard message that the GM is only intended to be used wit
h the GPU.*/ |
| 101 void drawGpuOnlyMessage(SkCanvas*); | 100 void drawGpuOnlyMessage(SkCanvas*); |
| 102 virtual void onOnceBeforeDraw() {} | 101 virtual void onOnceBeforeDraw() {} |
| 103 virtual void onDraw(SkCanvas*) = 0; | 102 virtual void onDraw(SkCanvas*) = 0; |
| 104 virtual void onDrawBackground(SkCanvas*); | 103 virtual void onDrawBackground(SkCanvas*); |
| 105 virtual SkISize onISize() = 0; | 104 virtual SkISize onISize() = 0; |
| 106 virtual SkString onShortName() = 0; | 105 virtual SkString onShortName() = 0; |
| 107 | 106 |
| 108 virtual bool onAnimate(const SkAnimTimer&) { return false; } | 107 virtual bool onAnimate(const SkAnimTimer&) { return false; } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 SkISize onISize() override; | 129 SkISize onISize() override; |
| 131 SkString onShortName() override; | 130 SkString onShortName() override; |
| 132 private: | 131 private: |
| 133 SkString fName; | 132 SkString fName; |
| 134 void (*fDrawProc)(SkCanvas*); | 133 void (*fDrawProc)(SkCanvas*); |
| 135 SkISize fSize; | 134 SkISize fSize; |
| 136 }; | 135 }; |
| 137 } | 136 } |
| 138 | 137 |
| 139 #endif | 138 #endif |
| OLD | NEW |