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

Side by Side Diff: samplecode/SampleApp.h

Issue 634293004: use SkDocument to capture pdfs from SampleApp 'e' (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | samplecode/SampleApp.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 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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698