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

Side by Side Diff: samplecode/SampleCode.h

Issue 888283002: allow GMs to animate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SPACE to toggle animations 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/gm.h ('K') | « samplecode/SampleApp.cpp ('k') | no next file » | 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 /* 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 8
9 9
10 #ifndef SampleCode_DEFINED 10 #ifndef SampleCode_DEFINED
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 class SampleView : public SkView { 111 class SampleView : public SkView {
112 public: 112 public:
113 SampleView() 113 SampleView()
114 : fPipeState(SkOSMenu::kOffState) 114 : fPipeState(SkOSMenu::kOffState)
115 , fBGColor(SK_ColorWHITE) 115 , fBGColor(SK_ColorWHITE)
116 , fRepeatCount(1) 116 , fRepeatCount(1)
117 {} 117 {}
118 118
119 void setBGColor(SkColor color) { fBGColor = color; } 119 void setBGColor(SkColor color) { fBGColor = color; }
120 bool animatePulse(SkMSec time) { return this->onAnimatePulse(time); }
120 121
121 static bool IsSampleView(SkView*); 122 static bool IsSampleView(SkView*);
122 static bool SetRepeatDraw(SkView*, int count); 123 static bool SetRepeatDraw(SkView*, int count);
123 static bool SetUsePipe(SkView*, SkOSMenu::TriState); 124 static bool SetUsePipe(SkView*, SkOSMenu::TriState);
124 125
125 /** 126 /**
126 * Call this to request menu items from a SampleView. 127 * Call this to request menu items from a SampleView.
127 * Subclassing notes: A subclass of SampleView can overwrite this method 128 * Subclassing notes: A subclass of SampleView can overwrite this method
128 * to add new items of various types to the menu and change its title. 129 * to add new items of various types to the menu and change its title.
129 * The events attached to any new menu items must be handled in its onEvent 130 * The events attached to any new menu items must be handled in its onEvent
130 * method. See SkOSMenu.h for helper functions. 131 * method. See SkOSMenu.h for helper functions.
131 */ 132 */
132 virtual void requestMenu(SkOSMenu* menu) {} 133 virtual void requestMenu(SkOSMenu* menu) {}
133 134
134 virtual void onTileSizeChanged(const SkSize& tileSize) {} 135 virtual void onTileSizeChanged(const SkSize& tileSize) {}
135 136
136 protected: 137 protected:
137 virtual void onDrawBackground(SkCanvas*); 138 virtual void onDrawBackground(SkCanvas*);
138 virtual void onDrawContent(SkCanvas*) = 0; 139 virtual void onDrawContent(SkCanvas*) = 0;
140 virtual bool onAnimatePulse(SkMSec) { return false; }
139 141
140 // overrides 142 // overrides
141 virtual bool onEvent(const SkEvent& evt); 143 virtual bool onEvent(const SkEvent& evt);
142 virtual bool onQuery(SkEvent* evt); 144 virtual bool onQuery(SkEvent* evt);
143 virtual void draw(SkCanvas*); 145 virtual void draw(SkCanvas*);
144 virtual void onDraw(SkCanvas*); 146 virtual void onDraw(SkCanvas*);
145 147
146 SkOSMenu::TriState fPipeState; 148 SkOSMenu::TriState fPipeState;
147 SkColor fBGColor; 149 SkColor fBGColor;
148 150
149 private: 151 private:
150 int fRepeatCount; 152 int fRepeatCount;
151 153
152 typedef SkView INHERITED; 154 typedef SkView INHERITED;
153 }; 155 };
154 156
155 #endif 157 #endif
OLDNEW
« gm/gm.h ('K') | « samplecode/SampleApp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698