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

Side by Side Diff: src/utils/debugger/SkDrawCommand.h

Issue 708333002: Revert of Revert of SkDrawCommand scrubbing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/utils/debugger/SkDebugCanvas.cpp ('k') | src/utils/debugger/SkDrawCommand.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #ifndef SKDRAWCOMMAND_H_ 9 #ifndef SKDRAWCOMMAND_H_
10 #define SKDRAWCOMMAND_H_ 10 #define SKDRAWCOMMAND_H_
11 11
12 #include "SkPictureFlat.h" 12 #include "SkPictureFlat.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkString.h" 14 #include "SkString.h"
15 15
16 class SK_API SkDrawCommand { 16 class SK_API SkDrawCommand {
17 public: 17 public:
18 /* TODO(chudy): Remove subclasses. */
19 SkDrawCommand(DrawType drawType); 18 SkDrawCommand(DrawType drawType);
20 SkDrawCommand();
21 19
22 virtual ~SkDrawCommand(); 20 virtual ~SkDrawCommand();
23 21
24 virtual SkString toString(); 22 virtual SkString toString() const;
25 23
26 void setOffset(size_t offset) { fOffset = offset; } 24 void setOffset(size_t offset) { fOffset = offset; }
27 virtual size_t offset() { return fOffset; } 25 size_t offset() const { return fOffset; }
28 26
29 virtual const char* toCString() { 27 virtual const char* toCString() const {
30 return GetCommandString(fDrawType); 28 return GetCommandString(fDrawType);
31 } 29 }
32 30
33 bool isVisible() const { 31 bool isVisible() const {
34 return fVisible; 32 return fVisible;
35 } 33 }
36 34
37 void setVisible(bool toggle) { 35 void setVisible(bool toggle) {
38 fVisible = toggle; 36 fVisible = toggle;
39 } 37 }
40 38
41 SkTDArray<SkString*>* Info() {return &fInfo; }; 39 const SkTDArray<SkString*>* Info() const { return &fInfo; }
42 virtual void execute(SkCanvas* canvas) = 0; 40 virtual void execute(SkCanvas*) const = 0;
43 virtual void vizExecute(SkCanvas* canvas) { }; 41 virtual void vizExecute(SkCanvas*) const {}
44 42
45 virtual void setUserMatrix(const SkMatrix& userMtx) { }; 43 virtual void setUserMatrix(const SkMatrix&) {}
46 44
47 /** Does nothing by default, but used by save() and restore()-type 45 /** Does nothing by default, but used by save() and restore()-type
48 subclasses to track unresolved save() calls. */ 46 subclasses to track unresolved save() calls. */
49 virtual void trackSaveState(int* state) { }; 47 virtual void trackSaveState(int* state) {}
50 48
51 // The next "active" system is only used by save, saveLayer, restore, 49 // The next "active" system is only used by save, saveLayer, restore,
52 // pushCull and popCull. It is used in two ways: 50 // pushCull and popCull. It is used in two ways:
53 // To determine which saveLayers are currently active (at a 51 // To determine which saveLayers are currently active (at a
54 // given point in the rendering). 52 // given point in the rendering).
55 // saves just return a kPushLayer action but don't track active state 53 // saves just return a kPushLayer action but don't track active state
56 // restores just return a kPopLayer action 54 // restores just return a kPopLayer action
57 // saveLayers return kPushLayer but also track the active state 55 // saveLayers return kPushLayer but also track the active state
58 // To determine which culls are currently active (at a given point) 56 // To determine which culls are currently active (at a given point)
59 // in the rendering). 57 // in the rendering).
60 // pushCulls return a kPushCull action 58 // pushCulls return a kPushCull action
61 // popCulls return a kPopCull action 59 // popCulls return a kPopCull action
62 enum Action { 60 enum Action {
63 kNone_Action, 61 kNone_Action,
64 kPopLayer_Action, 62 kPopLayer_Action,
65 kPushLayer_Action, 63 kPushLayer_Action,
66 kPopCull_Action, 64 kPopCull_Action,
67 kPushCull_Action 65 kPushCull_Action
68 }; 66 };
69 virtual Action action() const { return kNone_Action; } 67 virtual Action action() const { return kNone_Action; }
70 virtual void setActive(bool active) {} 68 virtual void setActive(bool active) {}
71 virtual bool active() const { return false; } 69 virtual bool active() const { return false; }
72 70
73 DrawType getType() { return fDrawType; }; 71 DrawType getType() const { return fDrawType; }
74 72
75 virtual bool render(SkCanvas* canvas) const { return false; } 73 virtual bool render(SkCanvas* canvas) const { return false; }
76 74
77 static const char* GetCommandString(DrawType type); 75 static const char* GetCommandString(DrawType type);
78 76
79 protected: 77 protected:
80 SkTDArray<SkString*> fInfo; 78 SkTDArray<SkString*> fInfo;
81 79
82 private: 80 private:
83 DrawType fDrawType; 81 DrawType fDrawType;
84 size_t fOffset; 82 size_t fOffset;
85 bool fVisible; 83 bool fVisible;
86 }; 84 };
87 85
88 class SkRestoreCommand : public SkDrawCommand { 86 class SkRestoreCommand : public SkDrawCommand {
89 public: 87 public:
90 SkRestoreCommand(); 88 SkRestoreCommand();
91 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 89 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
92 virtual void trackSaveState(int* state) SK_OVERRIDE; 90 virtual void trackSaveState(int* state) SK_OVERRIDE;
93 virtual Action action() const SK_OVERRIDE { return kPopLayer_Action; } 91 virtual Action action() const SK_OVERRIDE { return kPopLayer_Action; }
94 92
95 private: 93 private:
96 typedef SkDrawCommand INHERITED; 94 typedef SkDrawCommand INHERITED;
97 }; 95 };
98 96
99 class SkClearCommand : public SkDrawCommand { 97 class SkClearCommand : public SkDrawCommand {
100 public: 98 public:
101 SkClearCommand(SkColor color); 99 SkClearCommand(SkColor color);
102 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 100 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
103 private: 101 private:
104 SkColor fColor; 102 SkColor fColor;
105 103
106 typedef SkDrawCommand INHERITED; 104 typedef SkDrawCommand INHERITED;
107 }; 105 };
108 106
109 class SkClipPathCommand : public SkDrawCommand { 107 class SkClipPathCommand : public SkDrawCommand {
110 public: 108 public:
111 SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA); 109 SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA);
112 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 110 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
113 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 111 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
114 private: 112 private:
115 SkPath fPath; 113 SkPath fPath;
116 SkRegion::Op fOp; 114 SkRegion::Op fOp;
117 bool fDoAA; 115 bool fDoAA;
118 116
119 typedef SkDrawCommand INHERITED; 117 typedef SkDrawCommand INHERITED;
120 }; 118 };
121 119
122 class SkClipRegionCommand : public SkDrawCommand { 120 class SkClipRegionCommand : public SkDrawCommand {
123 public: 121 public:
124 SkClipRegionCommand(const SkRegion& region, SkRegion::Op op); 122 SkClipRegionCommand(const SkRegion& region, SkRegion::Op op);
125 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 123 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
126 private: 124 private:
127 SkRegion fRegion; 125 SkRegion fRegion;
128 SkRegion::Op fOp; 126 SkRegion::Op fOp;
129 127
130 typedef SkDrawCommand INHERITED; 128 typedef SkDrawCommand INHERITED;
131 }; 129 };
132 130
133 class SkClipRectCommand : public SkDrawCommand { 131 class SkClipRectCommand : public SkDrawCommand {
134 public: 132 public:
135 SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA); 133 SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA);
136 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 134 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
137 135
138 const SkRect& rect() const { return fRect; } 136 const SkRect& rect() const { return fRect; }
139 SkRegion::Op op() const { return fOp; } 137 SkRegion::Op op() const { return fOp; }
140 bool doAA() const { return fDoAA; } 138 bool doAA() const { return fDoAA; }
141 139
142 private: 140 private:
143 SkRect fRect; 141 SkRect fRect;
144 SkRegion::Op fOp; 142 SkRegion::Op fOp;
145 bool fDoAA; 143 bool fDoAA;
146 144
147 typedef SkDrawCommand INHERITED; 145 typedef SkDrawCommand INHERITED;
148 }; 146 };
149 147
150 class SkClipRRectCommand : public SkDrawCommand { 148 class SkClipRRectCommand : public SkDrawCommand {
151 public: 149 public:
152 SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA); 150 SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA);
153 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 151 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
154 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 152 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
155 153
156 const SkRRect& rrect() const { return fRRect; } 154 const SkRRect& rrect() const { return fRRect; }
157 SkRegion::Op op() const { return fOp; } 155 SkRegion::Op op() const { return fOp; }
158 bool doAA() const { return fDoAA; } 156 bool doAA() const { return fDoAA; }
159 157
160 private: 158 private:
161 SkRRect fRRect; 159 SkRRect fRRect;
162 SkRegion::Op fOp; 160 SkRegion::Op fOp;
163 bool fDoAA; 161 bool fDoAA;
164 162
165 typedef SkDrawCommand INHERITED; 163 typedef SkDrawCommand INHERITED;
166 }; 164 };
167 165
168 class SkConcatCommand : public SkDrawCommand { 166 class SkConcatCommand : public SkDrawCommand {
169 public: 167 public:
170 SkConcatCommand(const SkMatrix& matrix); 168 SkConcatCommand(const SkMatrix& matrix);
171 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 169 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
172 private: 170 private:
173 SkMatrix fMatrix; 171 SkMatrix fMatrix;
174 172
175 typedef SkDrawCommand INHERITED; 173 typedef SkDrawCommand INHERITED;
176 }; 174 };
177 175
178 class SkDrawBitmapCommand : public SkDrawCommand { 176 class SkDrawBitmapCommand : public SkDrawCommand {
179 public: 177 public:
180 SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, 178 SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
181 const SkPaint* paint); 179 const SkPaint* paint);
182 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 180 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
183 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 181 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
184 private: 182 private:
185 SkBitmap fBitmap; 183 SkBitmap fBitmap;
186 SkScalar fLeft; 184 SkScalar fLeft;
187 SkScalar fTop; 185 SkScalar fTop;
188 SkPaint fPaint; 186 SkPaint fPaint;
189 SkPaint* fPaintPtr; 187 SkPaint* fPaintPtr;
190 188
191 typedef SkDrawCommand INHERITED; 189 typedef SkDrawCommand INHERITED;
192 }; 190 };
193 191
194 class SkDrawBitmapMatrixCommand : public SkDrawCommand { 192 class SkDrawBitmapMatrixCommand : public SkDrawCommand {
195 public: 193 public:
196 SkDrawBitmapMatrixCommand(const SkBitmap& bitmap, const SkMatrix& matrix, 194 SkDrawBitmapMatrixCommand(const SkBitmap& bitmap, const SkMatrix& matrix,
197 const SkPaint* paint); 195 const SkPaint* paint);
198 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 196 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
199 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 197 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
200 private: 198 private:
201 SkBitmap fBitmap; 199 SkBitmap fBitmap;
202 SkMatrix fMatrix; 200 SkMatrix fMatrix;
203 SkPaint fPaint; 201 SkPaint fPaint;
204 SkPaint* fPaintPtr; 202 SkPaint* fPaintPtr;
205 203
206 typedef SkDrawCommand INHERITED; 204 typedef SkDrawCommand INHERITED;
207 }; 205 };
208 206
209 class SkDrawBitmapNineCommand : public SkDrawCommand { 207 class SkDrawBitmapNineCommand : public SkDrawCommand {
210 public: 208 public:
211 SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center, 209 SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center,
212 const SkRect& dst, const SkPaint* paint); 210 const SkRect& dst, const SkPaint* paint);
213 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 211 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
214 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 212 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
215 private: 213 private:
216 SkBitmap fBitmap; 214 SkBitmap fBitmap;
217 SkIRect fCenter; 215 SkIRect fCenter;
218 SkRect fDst; 216 SkRect fDst;
219 SkPaint fPaint; 217 SkPaint fPaint;
220 SkPaint* fPaintPtr; 218 SkPaint* fPaintPtr;
221 219
222 typedef SkDrawCommand INHERITED; 220 typedef SkDrawCommand INHERITED;
223 }; 221 };
224 222
225 class SkDrawBitmapRectCommand : public SkDrawCommand { 223 class SkDrawBitmapRectCommand : public SkDrawCommand {
226 public: 224 public:
227 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, 225 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src,
228 const SkRect& dst, const SkPaint* paint, 226 const SkRect& dst, const SkPaint* paint,
229 SkCanvas::DrawBitmapRectFlags flags); 227 SkCanvas::DrawBitmapRectFlags flags);
230 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 228 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
231 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 229 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
232 230
233 const SkBitmap& bitmap() const { return fBitmap; } 231 const SkBitmap& bitmap() const { return fBitmap; }
234 232
235 // The non-const 'paint' method allows modification of this object's 233 // The non-const 'paint' method allows modification of this object's
236 // SkPaint. For this reason the ctor and setPaint method make a local copy. 234 // SkPaint. For this reason the ctor and setPaint method make a local copy.
237 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid 235 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid
238 // (since only an SkPaint* is passed into the ctor). 236 // (since only an SkPaint* is passed into the ctor).
239 const SkPaint* paint() const { return fPaintPtr; } 237 const SkPaint* paint() const { return fPaintPtr; }
240 SkPaint* paint() { return fPaintPtr; } 238 SkPaint* paint() { return fPaintPtr; }
(...skipping 17 matching lines...) Expand all
258 SkPaint* fPaintPtr; 256 SkPaint* fPaintPtr;
259 SkCanvas::DrawBitmapRectFlags fFlags; 257 SkCanvas::DrawBitmapRectFlags fFlags;
260 258
261 typedef SkDrawCommand INHERITED; 259 typedef SkDrawCommand INHERITED;
262 }; 260 };
263 261
264 class SkDrawDataCommand : public SkDrawCommand { 262 class SkDrawDataCommand : public SkDrawCommand {
265 public: 263 public:
266 SkDrawDataCommand(const void* data, size_t length); 264 SkDrawDataCommand(const void* data, size_t length);
267 virtual ~SkDrawDataCommand() { delete [] fData; } 265 virtual ~SkDrawDataCommand() { delete [] fData; }
268 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 266 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
269 private: 267 private:
270 char* fData; 268 char* fData;
271 size_t fLength; 269 size_t fLength;
272 270
273 typedef SkDrawCommand INHERITED; 271 typedef SkDrawCommand INHERITED;
274 }; 272 };
275 273
276 class SkBeginCommentGroupCommand : public SkDrawCommand { 274 class SkBeginCommentGroupCommand : public SkDrawCommand {
277 public: 275 public:
278 SkBeginCommentGroupCommand(const char* description); 276 SkBeginCommentGroupCommand(const char* description);
279 virtual void execute(SkCanvas* canvas) SK_OVERRIDE { 277 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE {
280 canvas->beginCommentGroup(fDescription.c_str()); 278 canvas->beginCommentGroup(fDescription.c_str());
281 }; 279 };
282 private: 280 private:
283 SkString fDescription; 281 SkString fDescription;
284 282
285 typedef SkDrawCommand INHERITED; 283 typedef SkDrawCommand INHERITED;
286 }; 284 };
287 285
288 class SkCommentCommand : public SkDrawCommand { 286 class SkCommentCommand : public SkDrawCommand {
289 public: 287 public:
290 SkCommentCommand(const char* kywd, const char* value); 288 SkCommentCommand(const char* kywd, const char* value);
291 virtual void execute(SkCanvas* canvas) SK_OVERRIDE { 289 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE {
292 canvas->addComment(fKywd.c_str(), fValue.c_str()); 290 canvas->addComment(fKywd.c_str(), fValue.c_str());
293 }; 291 };
294 private: 292 private:
295 SkString fKywd; 293 SkString fKywd;
296 SkString fValue; 294 SkString fValue;
297 295
298 typedef SkDrawCommand INHERITED; 296 typedef SkDrawCommand INHERITED;
299 }; 297 };
300 298
301 class SkEndCommentGroupCommand : public SkDrawCommand { 299 class SkEndCommentGroupCommand : public SkDrawCommand {
302 public: 300 public:
303 SkEndCommentGroupCommand(); 301 SkEndCommentGroupCommand();
304 virtual void execute(SkCanvas* canvas) SK_OVERRIDE { 302 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE {
305 canvas->endCommentGroup(); 303 canvas->endCommentGroup();
306 }; 304 };
307 private: 305 private:
308 typedef SkDrawCommand INHERITED; 306 typedef SkDrawCommand INHERITED;
309 }; 307 };
310 308
311 class SkDrawOvalCommand : public SkDrawCommand { 309 class SkDrawOvalCommand : public SkDrawCommand {
312 public: 310 public:
313 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); 311 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint);
314 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 312 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
315 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 313 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
316 private: 314 private:
317 SkRect fOval; 315 SkRect fOval;
318 SkPaint fPaint; 316 SkPaint fPaint;
319 317
320 typedef SkDrawCommand INHERITED; 318 typedef SkDrawCommand INHERITED;
321 }; 319 };
322 320
323 class SkDrawPaintCommand : public SkDrawCommand { 321 class SkDrawPaintCommand : public SkDrawCommand {
324 public: 322 public:
325 SkDrawPaintCommand(const SkPaint& paint); 323 SkDrawPaintCommand(const SkPaint& paint);
326 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 324 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
327 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 325 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
328 private: 326 private:
329 SkPaint fPaint; 327 SkPaint fPaint;
330 328
331 typedef SkDrawCommand INHERITED; 329 typedef SkDrawCommand INHERITED;
332 }; 330 };
333 331
334 class SkDrawPathCommand : public SkDrawCommand { 332 class SkDrawPathCommand : public SkDrawCommand {
335 public: 333 public:
336 SkDrawPathCommand(const SkPath& path, const SkPaint& paint); 334 SkDrawPathCommand(const SkPath& path, const SkPaint& paint);
337 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 335 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
338 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 336 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
339 337
340 private: 338 private:
341 SkPath fPath; 339 SkPath fPath;
342 SkPaint fPaint; 340 SkPaint fPaint;
343 341
344 typedef SkDrawCommand INHERITED; 342 typedef SkDrawCommand INHERITED;
345 }; 343 };
346 344
347 class SkDrawPictureCommand : public SkDrawCommand { 345 class SkDrawPictureCommand : public SkDrawCommand {
348 public: 346 public:
349 SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint); 347 SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint);
350 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 348 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
351 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 349 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
352 350
353 private: 351 private:
354 SkAutoTUnref<const SkPicture> fPicture; 352 SkAutoTUnref<const SkPicture> fPicture;
355 SkMatrix fMatrix; 353 SkMatrix fMatrix;
356 SkMatrix* fMatrixPtr; 354 SkMatrix* fMatrixPtr;
357 SkPaint fPaint; 355 SkPaint fPaint;
358 SkPaint* fPaintPtr; 356 SkPaint* fPaintPtr;
359 357
360 typedef SkDrawCommand INHERITED; 358 typedef SkDrawCommand INHERITED;
361 }; 359 };
362 360
363 class SkDrawPointsCommand : public SkDrawCommand { 361 class SkDrawPointsCommand : public SkDrawCommand {
364 public: 362 public:
365 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt s[], 363 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt s[],
366 const SkPaint& paint); 364 const SkPaint& paint);
367 virtual ~SkDrawPointsCommand() { delete [] fPts; } 365 virtual ~SkDrawPointsCommand() { delete [] fPts; }
368 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 366 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
369 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 367 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
370 private: 368 private:
371 SkCanvas::PointMode fMode; 369 SkCanvas::PointMode fMode;
372 size_t fCount; 370 size_t fCount;
373 SkPoint* fPts; 371 SkPoint* fPts;
374 SkPaint fPaint; 372 SkPaint fPaint;
375 373
376 typedef SkDrawCommand INHERITED; 374 typedef SkDrawCommand INHERITED;
377 }; 375 };
378 376
379 class SkDrawTextCommand : public SkDrawCommand { 377 class SkDrawTextCommand : public SkDrawCommand {
380 public: 378 public:
381 SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y, 379 SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y,
382 const SkPaint& paint); 380 const SkPaint& paint);
383 virtual ~SkDrawTextCommand() { delete [] fText; } 381 virtual ~SkDrawTextCommand() { delete [] fText; }
384 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 382 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
385 private: 383 private:
386 char* fText; 384 char* fText;
387 size_t fByteLength; 385 size_t fByteLength;
388 SkScalar fX; 386 SkScalar fX;
389 SkScalar fY; 387 SkScalar fY;
390 SkPaint fPaint; 388 SkPaint fPaint;
391 389
392 typedef SkDrawCommand INHERITED; 390 typedef SkDrawCommand INHERITED;
393 }; 391 };
394 392
395 class SkDrawPosTextCommand : public SkDrawCommand { 393 class SkDrawPosTextCommand : public SkDrawCommand {
396 public: 394 public:
397 SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[ ], 395 SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[ ],
398 const SkPaint& paint); 396 const SkPaint& paint);
399 virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; } 397 virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; }
400 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 398 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
401 private: 399 private:
402 char* fText; 400 char* fText;
403 size_t fByteLength; 401 size_t fByteLength;
404 SkPoint* fPos; 402 SkPoint* fPos;
405 SkPaint fPaint; 403 SkPaint fPaint;
406 404
407 typedef SkDrawCommand INHERITED; 405 typedef SkDrawCommand INHERITED;
408 }; 406 };
409 407
410 class SkDrawTextOnPathCommand : public SkDrawCommand { 408 class SkDrawTextOnPathCommand : public SkDrawCommand {
411 public: 409 public:
412 SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& p ath, 410 SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& p ath,
413 const SkMatrix* matrix, const SkPaint& paint); 411 const SkMatrix* matrix, const SkPaint& paint);
414 virtual ~SkDrawTextOnPathCommand() { delete [] fText; } 412 virtual ~SkDrawTextOnPathCommand() { delete [] fText; }
415 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 413 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
416 private: 414 private:
417 char* fText; 415 char* fText;
418 size_t fByteLength; 416 size_t fByteLength;
419 SkPath fPath; 417 SkPath fPath;
420 SkMatrix fMatrix; 418 SkMatrix fMatrix;
421 SkPaint fPaint; 419 SkPaint fPaint;
422 420
423 typedef SkDrawCommand INHERITED; 421 typedef SkDrawCommand INHERITED;
424 }; 422 };
425 423
426 class SkDrawPosTextHCommand : public SkDrawCommand { 424 class SkDrawPosTextHCommand : public SkDrawCommand {
427 public: 425 public:
428 SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xp os[], 426 SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xp os[],
429 SkScalar constY, const SkPaint& paint); 427 SkScalar constY, const SkPaint& paint);
430 virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } 428 virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; }
431 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 429 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
432 private: 430 private:
433 SkScalar* fXpos; 431 SkScalar* fXpos;
434 char* fText; 432 char* fText;
435 size_t fByteLength; 433 size_t fByteLength;
436 SkScalar fConstY; 434 SkScalar fConstY;
437 SkPaint fPaint; 435 SkPaint fPaint;
438 436
439 typedef SkDrawCommand INHERITED; 437 typedef SkDrawCommand INHERITED;
440 }; 438 };
441 439
442 class SkDrawTextBlobCommand : public SkDrawCommand { 440 class SkDrawTextBlobCommand : public SkDrawCommand {
443 public: 441 public:
444 SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint); 442 SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint);
445 443
446 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 444 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
447 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 445 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
448 446
449 private: 447 private:
450 SkAutoTUnref<const SkTextBlob> fBlob; 448 SkAutoTUnref<const SkTextBlob> fBlob;
451 SkScalar fXPos; 449 SkScalar fXPos;
452 SkScalar fYPos; 450 SkScalar fYPos;
453 SkPaint fPaint; 451 SkPaint fPaint;
454 452
455 typedef SkDrawCommand INHERITED; 453 typedef SkDrawCommand INHERITED;
456 }; 454 };
457 455
458 class SkDrawRectCommand : public SkDrawCommand { 456 class SkDrawRectCommand : public SkDrawCommand {
459 public: 457 public:
460 SkDrawRectCommand(const SkRect& rect, const SkPaint& paint); 458 SkDrawRectCommand(const SkRect& rect, const SkPaint& paint);
461 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 459 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
462 460
463 const SkRect& rect() const { return fRect; } 461 const SkRect& rect() const { return fRect; }
464 const SkPaint& paint() const { return fPaint; } 462 const SkPaint& paint() const { return fPaint; }
465 private: 463 private:
466 SkRect fRect; 464 SkRect fRect;
467 SkPaint fPaint; 465 SkPaint fPaint;
468 466
469 typedef SkDrawCommand INHERITED; 467 typedef SkDrawCommand INHERITED;
470 }; 468 };
471 469
472 class SkDrawRRectCommand : public SkDrawCommand { 470 class SkDrawRRectCommand : public SkDrawCommand {
473 public: 471 public:
474 SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint); 472 SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint);
475 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 473 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
476 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 474 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
477 private: 475 private:
478 SkRRect fRRect; 476 SkRRect fRRect;
479 SkPaint fPaint; 477 SkPaint fPaint;
480 478
481 typedef SkDrawCommand INHERITED; 479 typedef SkDrawCommand INHERITED;
482 }; 480 };
483 481
484 class SkDrawDRRectCommand : public SkDrawCommand { 482 class SkDrawDRRectCommand : public SkDrawCommand {
485 public: 483 public:
486 SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, 484 SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner,
487 const SkPaint& paint); 485 const SkPaint& paint);
488 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 486 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
489 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 487 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
490 private: 488 private:
491 SkRRect fOuter; 489 SkRRect fOuter;
492 SkRRect fInner; 490 SkRRect fInner;
493 SkPaint fPaint; 491 SkPaint fPaint;
494 492
495 typedef SkDrawCommand INHERITED; 493 typedef SkDrawCommand INHERITED;
496 }; 494 };
497 495
498 class SkDrawSpriteCommand : public SkDrawCommand { 496 class SkDrawSpriteCommand : public SkDrawCommand {
499 public: 497 public:
500 SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint * paint); 498 SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint * paint);
501 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 499 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
502 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; 500 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
503 private: 501 private:
504 SkBitmap fBitmap; 502 SkBitmap fBitmap;
505 int fLeft; 503 int fLeft;
506 int fTop; 504 int fTop;
507 SkPaint fPaint; 505 SkPaint fPaint;
508 SkPaint* fPaintPtr; 506 SkPaint* fPaintPtr;
509 507
510 typedef SkDrawCommand INHERITED; 508 typedef SkDrawCommand INHERITED;
511 }; 509 };
512 510
513 class SkDrawVerticesCommand : public SkDrawCommand { 511 class SkDrawVerticesCommand : public SkDrawCommand {
514 public: 512 public:
515 SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount, 513 SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount,
516 const SkPoint vertices[], const SkPoint texs[], 514 const SkPoint vertices[], const SkPoint texs[],
517 const SkColor colors[], SkXfermode* xfermode, 515 const SkColor colors[], SkXfermode* xfermode,
518 const uint16_t indices[], int indexCount, 516 const uint16_t indices[], int indexCount,
519 const SkPaint& paint); 517 const SkPaint& paint);
520 virtual ~SkDrawVerticesCommand(); 518 virtual ~SkDrawVerticesCommand();
521 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 519 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
522 private: 520 private:
523 SkCanvas::VertexMode fVmode; 521 SkCanvas::VertexMode fVmode;
524 int fVertexCount; 522 int fVertexCount;
525 SkPoint* fVertices; 523 SkPoint* fVertices;
526 SkPoint* fTexs; 524 SkPoint* fTexs;
527 SkColor* fColors; 525 SkColor* fColors;
528 SkXfermode* fXfermode; 526 SkXfermode* fXfermode;
529 uint16_t* fIndices; 527 uint16_t* fIndices;
530 int fIndexCount; 528 int fIndexCount;
531 SkPaint fPaint; 529 SkPaint fPaint;
532 530
533 typedef SkDrawCommand INHERITED; 531 typedef SkDrawCommand INHERITED;
534 }; 532 };
535 533
536 class SkRotateCommand : public SkDrawCommand { 534 class SkRotateCommand : public SkDrawCommand {
537 public: 535 public:
538 SkRotateCommand(SkScalar degrees); 536 SkRotateCommand(SkScalar degrees);
539 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 537 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
540 private: 538 private:
541 SkScalar fDegrees; 539 SkScalar fDegrees;
542 540
543 typedef SkDrawCommand INHERITED; 541 typedef SkDrawCommand INHERITED;
544 }; 542 };
545 543
546 class SkSaveCommand : public SkDrawCommand { 544 class SkSaveCommand : public SkDrawCommand {
547 public: 545 public:
548 SkSaveCommand(); 546 SkSaveCommand();
549 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 547 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
550 virtual void trackSaveState(int* state) SK_OVERRIDE; 548 virtual void trackSaveState(int* state) SK_OVERRIDE;
551 virtual Action action() const SK_OVERRIDE { return kPushLayer_Action; } 549 virtual Action action() const SK_OVERRIDE { return kPushLayer_Action; }
552 private: 550 private:
553 typedef SkDrawCommand INHERITED; 551 typedef SkDrawCommand INHERITED;
554 }; 552 };
555 553
556 class SkSaveLayerCommand : public SkDrawCommand { 554 class SkSaveLayerCommand : public SkDrawCommand {
557 public: 555 public:
558 SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, 556 SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint,
559 SkCanvas::SaveFlags flags); 557 SkCanvas::SaveFlags flags);
560 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 558 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
561 virtual void vizExecute(SkCanvas* canvas) SK_OVERRIDE; 559 virtual void vizExecute(SkCanvas* canvas) const SK_OVERRIDE;
562 virtual void trackSaveState(int* state) SK_OVERRIDE; 560 virtual void trackSaveState(int* state) SK_OVERRIDE;
563 virtual Action action() const SK_OVERRIDE{ return kPushLayer_Action; } 561 virtual Action action() const SK_OVERRIDE{ return kPushLayer_Action; }
564 virtual void setActive(bool active) SK_OVERRIDE { fActive = active; } 562 virtual void setActive(bool active) SK_OVERRIDE { fActive = active; }
565 virtual bool active() const SK_OVERRIDE { return fActive; } 563 virtual bool active() const SK_OVERRIDE { return fActive; }
566 564
567 const SkPaint* paint() const { return fPaintPtr; } 565 const SkPaint* paint() const { return fPaintPtr; }
568 566
569 private: 567 private:
570 SkRect fBounds; 568 SkRect fBounds;
571 SkPaint fPaint; 569 SkPaint fPaint;
572 SkPaint* fPaintPtr; 570 SkPaint* fPaintPtr;
573 SkCanvas::SaveFlags fFlags; 571 SkCanvas::SaveFlags fFlags;
574 572
575 bool fActive; 573 bool fActive;
576 574
577 typedef SkDrawCommand INHERITED; 575 typedef SkDrawCommand INHERITED;
578 }; 576 };
579 577
580 class SkScaleCommand : public SkDrawCommand { 578 class SkScaleCommand : public SkDrawCommand {
581 public: 579 public:
582 SkScaleCommand(SkScalar sx, SkScalar sy); 580 SkScaleCommand(SkScalar sx, SkScalar sy);
583 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 581 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
584 582
585 SkScalar x() const { return fSx; } 583 SkScalar x() const { return fSx; }
586 SkScalar y() const { return fSy; } 584 SkScalar y() const { return fSy; }
587 585
588 private: 586 private:
589 SkScalar fSx; 587 SkScalar fSx;
590 SkScalar fSy; 588 SkScalar fSy;
591 589
592 typedef SkDrawCommand INHERITED; 590 typedef SkDrawCommand INHERITED;
593 }; 591 };
594 592
595 class SkSetMatrixCommand : public SkDrawCommand { 593 class SkSetMatrixCommand : public SkDrawCommand {
596 public: 594 public:
597 SkSetMatrixCommand(const SkMatrix& matrix); 595 SkSetMatrixCommand(const SkMatrix& matrix);
598 virtual void setUserMatrix(const SkMatrix&) SK_OVERRIDE; 596 virtual void setUserMatrix(const SkMatrix&) SK_OVERRIDE;
599 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 597 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
600 private: 598 private:
601 SkMatrix fUserMatrix; 599 SkMatrix fUserMatrix;
602 SkMatrix fMatrix; 600 SkMatrix fMatrix;
603 601
604 typedef SkDrawCommand INHERITED; 602 typedef SkDrawCommand INHERITED;
605 }; 603 };
606 604
607 class SkSkewCommand : public SkDrawCommand { 605 class SkSkewCommand : public SkDrawCommand {
608 public: 606 public:
609 SkSkewCommand(SkScalar sx, SkScalar sy); 607 SkSkewCommand(SkScalar sx, SkScalar sy);
610 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 608 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
611 private: 609 private:
612 SkScalar fSx; 610 SkScalar fSx;
613 SkScalar fSy; 611 SkScalar fSy;
614 612
615 typedef SkDrawCommand INHERITED; 613 typedef SkDrawCommand INHERITED;
616 }; 614 };
617 615
618 class SkTranslateCommand : public SkDrawCommand { 616 class SkTranslateCommand : public SkDrawCommand {
619 public: 617 public:
620 SkTranslateCommand(SkScalar dx, SkScalar dy); 618 SkTranslateCommand(SkScalar dx, SkScalar dy);
621 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 619 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
622 620
623 SkScalar x() const { return fDx; } 621 SkScalar x() const { return fDx; }
624 SkScalar y() const { return fDy; } 622 SkScalar y() const { return fDy; }
625 623
626 private: 624 private:
627 SkScalar fDx; 625 SkScalar fDx;
628 SkScalar fDy; 626 SkScalar fDy;
629 627
630 typedef SkDrawCommand INHERITED; 628 typedef SkDrawCommand INHERITED;
631 }; 629 };
632 630
633 class SkPushCullCommand : public SkDrawCommand { 631 class SkPushCullCommand : public SkDrawCommand {
634 public: 632 public:
635 SkPushCullCommand(const SkRect&); 633 SkPushCullCommand(const SkRect&);
636 virtual void execute(SkCanvas*) SK_OVERRIDE; 634 virtual void execute(SkCanvas*) const SK_OVERRIDE;
637 virtual void vizExecute(SkCanvas* canvas) SK_OVERRIDE; 635 virtual void vizExecute(SkCanvas* canvas) const SK_OVERRIDE;
638 virtual Action action() const { return kPushCull_Action; } 636 virtual Action action() const { return kPushCull_Action; }
639 virtual void setActive(bool active) { fActive = active; } 637 virtual void setActive(bool active) { fActive = active; }
640 virtual bool active() const { return fActive; } 638 virtual bool active() const { return fActive; }
641 private: 639 private:
642 SkRect fCullRect; 640 SkRect fCullRect;
643 bool fActive; 641 bool fActive;
644 642
645 typedef SkDrawCommand INHERITED; 643 typedef SkDrawCommand INHERITED;
646 }; 644 };
647 645
648 class SkPopCullCommand : public SkDrawCommand { 646 class SkPopCullCommand : public SkDrawCommand {
649 public: 647 public:
650 SkPopCullCommand(); 648 SkPopCullCommand();
651 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 649 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE;
652 virtual Action action() const { return kPopCull_Action; } 650 virtual Action action() const { return kPopCull_Action; }
653 private: 651 private:
654 typedef SkDrawCommand INHERITED; 652 typedef SkDrawCommand INHERITED;
655 }; 653 };
656 654
657 #endif 655 #endif
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.cpp ('k') | src/utils/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698