Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: gm/gm.h

Issue 680533002: add gm: colorwheel (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: refactor checkerboard() fn for simplicity Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/colorwheel.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
28 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \
29 class SK_MACRO_CONCAT(NAME, _GM) : public skiagm::GM { \
30 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE; \
31 virtual SkISize onISize() SK_OVERRIDE { \
32 return SkISize::Make((W), (H)); \
33 } \
34 virtual SkString onShortName() SK_OVERRIDE { \
35 return SkString(#NAME); \
36 } \
37 }; \
38 DEF_GM( return SkNEW(SK_MACRO_CONCAT(NAME, _GM)); ) \
39 void SK_MACRO_CONCAT(NAME, _GM)::onDraw(SkCanvas* CANVAS)
40
27 namespace skiagm { 41 namespace skiagm {
28 42
29 class GM { 43 class GM {
30 public: 44 public:
31 GM(); 45 GM();
32 virtual ~GM(); 46 virtual ~GM();
33 47
34 enum Flags { 48 enum Flags {
35 kSkipPDF_Flag = 1 << 0, 49 kSkipPDF_Flag = 1 << 0,
36 kSkipPicture_Flag = 1 << 1, 50 kSkipPicture_Flag = 1 << 1,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 SkColor fBGColor; 132 SkColor fBGColor;
119 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp 133 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp
120 bool fHaveCalledOnceBeforeDraw; 134 bool fHaveCalledOnceBeforeDraw;
121 SkMatrix fStarterMatrix; 135 SkMatrix fStarterMatrix;
122 }; 136 };
123 137
124 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; 138 typedef SkTRegistry<GM*(*)(void*)> GMRegistry;
125 } 139 }
126 140
127 #endif 141 #endif
OLDNEW
« no previous file with comments | « gm/colorwheel.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698