OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
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 "SkBitmapDevice.h" | 12 #include "SkBitmapDevice.h" |
13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkSize.h" | 15 #include "SkSize.h" |
16 #include "SkString.h" | 16 #include "SkString.h" |
17 #include "SkTRegistry.h" | 17 #include "SkTRegistry.h" |
18 | 18 |
| 19 #if SK_SUPPORT_GPU |
| 20 #include "GrContext.h" |
| 21 #endif |
| 22 |
19 #define DEF_GM(code) \ | 23 #define DEF_GM(code) \ |
20 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ | 24 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ |
21 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_
)); |
22 | 26 |
23 namespace skiagm { | 27 namespace skiagm { |
24 | 28 |
25 static inline SkISize make_isize(int w, int h) { | 29 static inline SkISize make_isize(int w, int h) { |
26 SkISize sz; | 30 SkISize sz; |
27 sz.set(w, h); | 31 sz.set(w, h); |
28 return sz; | 32 return sz; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 90 |
87 static SkString& GetResourcePath() { | 91 static SkString& GetResourcePath() { |
88 return gResourcePath; | 92 return gResourcePath; |
89 } | 93 } |
90 | 94 |
91 bool isCanvasDeferred() const { return fCanvasIsDeferred; } | 95 bool isCanvasDeferred() const { return fCanvasIsDeferred; } |
92 void setCanvasIsDeferred(bool isDeferred) { | 96 void setCanvasIsDeferred(bool isDeferred) { |
93 fCanvasIsDeferred = isDeferred; | 97 fCanvasIsDeferred = isDeferred; |
94 } | 98 } |
95 | 99 |
| 100 #if SK_SUPPORT_GPU |
| 101 static GrContext* GetGr(/*very nearly const*/ SkCanvas*); |
| 102 #endif |
| 103 |
96 protected: | 104 protected: |
97 static SkString gResourcePath; | 105 static SkString gResourcePath; |
98 | 106 |
99 virtual void onOnceBeforeDraw() {} | 107 virtual void onOnceBeforeDraw() {} |
100 virtual void onDraw(SkCanvas*) = 0; | 108 virtual void onDraw(SkCanvas*) = 0; |
101 virtual void onDrawBackground(SkCanvas*); | 109 virtual void onDrawBackground(SkCanvas*); |
102 virtual SkISize onISize() = 0; | 110 virtual SkISize onISize() = 0; |
103 virtual SkString onShortName() = 0; | 111 virtual SkString onShortName() = 0; |
104 virtual uint32_t onGetFlags() const { return 0; } | 112 virtual uint32_t onGetFlags() const { return 0; } |
105 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 113 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
106 | 114 |
107 private: | 115 private: |
108 SkString fShortName; | 116 SkString fShortName; |
109 SkColor fBGColor; | 117 SkColor fBGColor; |
110 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 118 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
111 bool fHaveCalledOnceBeforeDraw; | 119 bool fHaveCalledOnceBeforeDraw; |
112 }; | 120 }; |
113 | 121 |
114 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 122 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
115 } | 123 } |
116 | 124 |
117 #endif | 125 #endif |
OLD | NEW |