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

Side by Side Diff: gm/gm.h

Issue 894083003: add SkAnimTimer, SPACE = pause/resume, ESP = stop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months 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
« gm/SkAnimTimer.h ('K') | « gm/addarc.cpp ('k') | gm/gm.cpp » ('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 class SkAnimTimer;
20
19 #if SK_SUPPORT_GPU 21 #if SK_SUPPORT_GPU
20 #include "GrContext.h" 22 #include "GrContext.h"
21 #endif 23 #endif
22 24
23 #define DEF_GM(code) \ 25 #define DEF_GM(code) \
24 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \ 26 static skiagm::GM* SK_MACRO_APPEND_LINE(F_)(void*) { code; } \
25 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_ )); 27 static skiagm::GMRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_ ));
26 28
27 // See colorwheel.cpp for example usage. 29 // See colorwheel.cpp for example usage.
28 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \ 30 #define DEF_SIMPLE_GM(NAME, CANVAS, W, H) \
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 bool isCanvasDeferred() const { return fCanvasIsDeferred; } 87 bool isCanvasDeferred() const { return fCanvasIsDeferred; }
86 void setCanvasIsDeferred(bool isDeferred) { 88 void setCanvasIsDeferred(bool isDeferred) {
87 fCanvasIsDeferred = isDeferred; 89 fCanvasIsDeferred = isDeferred;
88 } 90 }
89 91
90 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } 92 const SkMatrix& getStarterMatrix() { return fStarterMatrix; }
91 void setStarterMatrix(const SkMatrix& matrix) { 93 void setStarterMatrix(const SkMatrix& matrix) {
92 fStarterMatrix = matrix; 94 fStarterMatrix = matrix;
93 } 95 }
94 96
95 bool animatePulse(SkMSec curr, SkMSec prev); 97 bool animate(const SkAnimTimer&);
96 98
97 protected: 99 protected:
98 /** draws a standard message that the GM is only intended to be used wit h the GPU.*/ 100 /** draws a standard message that the GM is only intended to be used wit h the GPU.*/
99 void drawGpuOnlyMessage(SkCanvas*); 101 void drawGpuOnlyMessage(SkCanvas*);
100 virtual void onOnceBeforeDraw() {} 102 virtual void onOnceBeforeDraw() {}
101 virtual void onDraw(SkCanvas*) = 0; 103 virtual void onDraw(SkCanvas*) = 0;
102 virtual void onDrawBackground(SkCanvas*); 104 virtual void onDrawBackground(SkCanvas*);
103 virtual SkISize onISize() = 0; 105 virtual SkISize onISize() = 0;
104 virtual SkString onShortName() = 0; 106 virtual SkString onShortName() = 0;
105 107
106 virtual bool onAnimatePulse(SkMSec curr, SkMSec prev) { return false; } 108 virtual bool onAnimate(const SkAnimTimer&) { return false; }
107 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } 109 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); }
108 110
109 private: 111 private:
110 Mode fMode; 112 Mode fMode;
111 SkString fShortName; 113 SkString fShortName;
112 SkColor fBGColor; 114 SkColor fBGColor;
113 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp 115 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp
114 bool fHaveCalledOnceBeforeDraw; 116 bool fHaveCalledOnceBeforeDraw;
115 SkMatrix fStarterMatrix; 117 SkMatrix fStarterMatrix;
116 }; 118 };
(...skipping 11 matching lines...) Expand all
128 SkISize onISize() SK_OVERRIDE; 130 SkISize onISize() SK_OVERRIDE;
129 SkString onShortName() SK_OVERRIDE; 131 SkString onShortName() SK_OVERRIDE;
130 private: 132 private:
131 SkString fName; 133 SkString fName;
132 void (*fDrawProc)(SkCanvas*); 134 void (*fDrawProc)(SkCanvas*);
133 SkISize fSize; 135 SkISize fSize;
134 }; 136 };
135 } 137 }
136 138
137 #endif 139 #endif
OLDNEW
« gm/SkAnimTimer.h ('K') | « gm/addarc.cpp ('k') | gm/gm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698