| 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 #if SK_SUPPORT_GPU | 19 #if SK_SUPPORT_GPU |
| 20 #include "GrContext.h" | 20 #include "GrContext.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #define DEF_GM(code) \ | 23 #define DEF_GM(code) \ |
| 24 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ | 24 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ |
| 25 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_
)); | 25 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_
)); |
| 26 | 26 |
| 27 // See colorwheel.cpp for example usage. | 27 // See colorwheel.cpp for example usage. |
| 28 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \ | 28 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \ |
| 29 class SK_MACRO_CONCAT(NAME, _GM) : public skiagm::GM { \ | 29 class SK_MACRO_CONCAT(NAME, _GM) : public skiagm::GM { \ |
| 30 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE; \ | 30 void onDraw(SkCanvas* canvas) SK_OVERRIDE; \ |
| 31 virtual SkISize onISize() SK_OVERRIDE { \ | 31 SkISize onISize() SK_OVERRIDE { \ |
| 32 return SkISize::Make((W), (H)); \ | 32 return SkISize::Make((W), (H)); \ |
| 33 } \ | 33 } \ |
| 34 virtual SkString onShortName() SK_OVERRIDE { \ | 34 SkString onShortName() SK_OVERRIDE { \ |
| 35 return SkString(#NAME); \ | 35 return SkString(#NAME); \ |
| 36 } \ | 36 } \ |
| 37 }; \ | 37 }; \ |
| 38 DEF_GM( return SkNEW(SK_MACRO_CONCAT(NAME, _GM)); ) \ | 38 DEF_GM( return SkNEW(SK_MACRO_CONCAT(NAME, _GM)); ) \ |
| 39 void SK_MACRO_CONCAT(NAME, _GM)::onDraw(SkCanvas* CANVAS) | 39 void SK_MACRO_CONCAT(NAME, _GM)::onDraw(SkCanvas* CANVAS) |
| 40 | 40 |
| 41 namespace skiagm { | 41 namespace skiagm { |
| 42 | 42 |
| 43 class GM { | 43 class GM { |
| 44 public: | 44 public: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 SkColor fBGColor; | 132 SkColor fBGColor; |
| 133 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 133 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
| 134 bool fHaveCalledOnceBeforeDraw; | 134 bool fHaveCalledOnceBeforeDraw; |
| 135 SkMatrix fStarterMatrix; | 135 SkMatrix fStarterMatrix; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 138 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
| 139 } | 139 } |
| 140 | 140 |
| 141 #endif | 141 #endif |
| OLD | NEW |