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 #define DEF_SIMPLE_GM(F, W, H) \ | |
mtklein
2014/10/24 16:47:48
Let's do this like DEF_TEST?
#define DEF_SIMPLE_G
hal.canary
2014/10/24 17:22:01
Done.
| |
28 class SK_MACRO_CONCAT(F, _GM) : public skiagm::GM { \ | |
29 protected: \ | |
30 virtual void onDraw(SkCanvas* canvas) { (F)(canvas); } \ | |
31 virtual SkISize onISize() { return SkISize::Make((W), (H)); } \ | |
32 virtual SkString onShortName() { return SkString(#F); } \ | |
33 }; \ | |
34 DEF_GM( return SkNEW(SK_MACRO_CONCAT(F, _GM)); ) | |
35 | |
27 namespace skiagm { | 36 namespace skiagm { |
28 | 37 |
29 class GM { | 38 class GM { |
30 public: | 39 public: |
31 GM(); | 40 GM(); |
32 virtual ~GM(); | 41 virtual ~GM(); |
33 | 42 |
34 enum Flags { | 43 enum Flags { |
35 kSkipPDF_Flag = 1 << 0, | 44 kSkipPDF_Flag = 1 << 0, |
36 kSkipPicture_Flag = 1 << 1, | 45 kSkipPicture_Flag = 1 << 1, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 SkColor fBGColor; | 127 SkColor fBGColor; |
119 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 128 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
120 bool fHaveCalledOnceBeforeDraw; | 129 bool fHaveCalledOnceBeforeDraw; |
121 SkMatrix fStarterMatrix; | 130 SkMatrix fStarterMatrix; |
122 }; | 131 }; |
123 | 132 |
124 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 133 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
125 } | 134 } |
126 | 135 |
127 #endif | 136 #endif |
OLD | NEW |