OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Skia | 2 * Copyright 2011 Skia |
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 SampleApp_DEFINED | 8 #ifndef SampleApp_DEFINED |
9 #define SampleApp_DEFINED | 9 #define SampleApp_DEFINED |
10 | 10 |
11 #include "SkOSMenu.h" | 11 #include "SkOSMenu.h" |
12 #include "SkPath.h" | 12 #include "SkPath.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
14 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
15 #include "SkScalar.h" | 15 #include "SkScalar.h" |
16 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
17 #include "SkTouchGesture.h" | 17 #include "SkTouchGesture.h" |
18 #include "SkWindow.h" | 18 #include "SkWindow.h" |
19 | 19 |
20 class GrContext; | 20 class GrContext; |
21 class GrRenderTarget; | 21 class GrRenderTarget; |
22 | 22 |
23 class SkCanvas; | 23 class SkCanvas; |
24 class SkData; | 24 class SkData; |
| 25 class SkDocument; |
25 class SkEvent; | 26 class SkEvent; |
26 class SkTypeface; | 27 class SkTypeface; |
27 class SkViewFactory; | 28 class SkViewFactory; |
28 | 29 |
29 class SampleWindow : public SkOSWindow { | 30 class SampleWindow : public SkOSWindow { |
30 SkTDArray<const SkViewFactory*> fSamples; | 31 SkTDArray<const SkViewFactory*> fSamples; |
31 public: | 32 public: |
32 enum DeviceType { | 33 enum DeviceType { |
33 kRaster_DeviceType, | 34 kRaster_DeviceType, |
34 kPicture_DeviceType, | 35 kPicture_DeviceType, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void setZoomCenter(float x, float y); | 126 void setZoomCenter(float x, float y); |
126 void changeZoomLevel(float delta); | 127 void changeZoomLevel(float delta); |
127 bool nextSample(); | 128 bool nextSample(); |
128 bool previousSample(); | 129 bool previousSample(); |
129 bool goToSample(int i); | 130 bool goToSample(int i); |
130 SkString getSampleTitle(int i); | 131 SkString getSampleTitle(int i); |
131 int sampleCount(); | 132 int sampleCount(); |
132 bool handleTouch(int ownerId, float x, float y, | 133 bool handleTouch(int ownerId, float x, float y, |
133 SkView::Click::State state); | 134 SkView::Click::State state); |
134 void saveToPdf(); | 135 void saveToPdf(); |
135 SkData* getPDFData() { return fPDFData; } | |
136 void postInvalDelay(); | 136 void postInvalDelay(); |
137 | 137 |
138 DeviceType getDeviceType() const { return fDeviceType; } | 138 DeviceType getDeviceType() const { return fDeviceType; } |
139 | 139 |
140 protected: | 140 protected: |
141 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE; | 141 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE; |
142 virtual bool onHandleKey(SkKey key) SK_OVERRIDE; | 142 virtual bool onHandleKey(SkKey key) SK_OVERRIDE; |
143 virtual bool onHandleChar(SkUnichar) SK_OVERRIDE; | 143 virtual bool onHandleChar(SkUnichar) SK_OVERRIDE; |
144 virtual void onSizeChange() SK_OVERRIDE; | 144 virtual void onSizeChange() SK_OVERRIDE; |
145 | 145 |
(...skipping 20 matching lines...) Expand all Loading... |
166 SkPath fClipPath; | 166 SkPath fClipPath; |
167 | 167 |
168 SkTouchGesture fGesture; | 168 SkTouchGesture fGesture; |
169 SkScalar fZoomLevel; | 169 SkScalar fZoomLevel; |
170 SkScalar fZoomScale; | 170 SkScalar fZoomScale; |
171 | 171 |
172 DeviceType fDeviceType; | 172 DeviceType fDeviceType; |
173 DeviceManager* fDevManager; | 173 DeviceManager* fDevManager; |
174 | 174 |
175 bool fSaveToPdf; | 175 bool fSaveToPdf; |
176 SkCanvas* fPdfCanvas; | 176 SkAutoTUnref<SkDocument> fPDFDocument; |
177 SkData* fPDFData; | |
178 | 177 |
179 bool fUseClip; | 178 bool fUseClip; |
180 bool fNClip; | 179 bool fNClip; |
181 bool fAnimating; | 180 bool fAnimating; |
182 bool fRotate; | 181 bool fRotate; |
183 SkScalar fRotateAnimTime; | 182 SkScalar fRotateAnimTime; |
184 bool fPerspAnim; | 183 bool fPerspAnim; |
185 SkScalar fPerspAnimTime; | 184 SkScalar fPerspAnimTime; |
186 bool fRequestGrabImage; | 185 bool fRequestGrabImage; |
187 bool fMeasureFPS; | 186 bool fMeasureFPS; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 //Stores global settings | 218 //Stores global settings |
220 SkOSMenu* fAppMenu; // We pass ownership to SkWindow, when we call addMenu | 219 SkOSMenu* fAppMenu; // We pass ownership to SkWindow, when we call addMenu |
221 //Stores slide specific settings | 220 //Stores slide specific settings |
222 SkOSMenu* fSlideMenu; // We pass ownership to SkWindow, when we call addMenu | 221 SkOSMenu* fSlideMenu; // We pass ownership to SkWindow, when we call addMenu |
223 | 222 |
224 int fTransitionNext; | 223 int fTransitionNext; |
225 int fTransitionPrev; | 224 int fTransitionPrev; |
226 | 225 |
227 void loadView(SkView*); | 226 void loadView(SkView*); |
228 void updateTitle(); | 227 void updateTitle(); |
| 228 bool getRawTitle(SkString*); |
229 | 229 |
230 bool zoomIn(); | 230 bool zoomIn(); |
231 bool zoomOut(); | 231 bool zoomOut(); |
232 void updatePointer(int x, int y); | 232 void updatePointer(int x, int y); |
233 void magnify(SkCanvas* canvas); | 233 void magnify(SkCanvas* canvas); |
234 void showZoomer(SkCanvas* canvas); | 234 void showZoomer(SkCanvas* canvas); |
235 void updateMatrix(); | 235 void updateMatrix(); |
236 void postAnimatingEvent(); | 236 void postAnimatingEvent(); |
237 void installDrawFilter(SkCanvas*); | 237 void installDrawFilter(SkCanvas*); |
238 int findByTitle(const char*); | 238 int findByTitle(const char*); |
239 void listTitles(); | 239 void listTitles(); |
240 SkSize tileSize() const; | 240 SkSize tileSize() const; |
241 | 241 |
242 typedef SkOSWindow INHERITED; | 242 typedef SkOSWindow INHERITED; |
243 }; | 243 }; |
244 | 244 |
245 #endif | 245 #endif |
OLD | NEW |