OLD | NEW |
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_ |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 private: | 73 private: |
74 DrawType fDrawType; | 74 DrawType fDrawType; |
75 size_t fOffset; | 75 size_t fOffset; |
76 bool fVisible; | 76 bool fVisible; |
77 }; | 77 }; |
78 | 78 |
79 class SkRestoreCommand : public SkDrawCommand { | 79 class SkRestoreCommand : public SkDrawCommand { |
80 public: | 80 public: |
81 SkRestoreCommand(); | 81 SkRestoreCommand(); |
82 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 82 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
83 virtual void trackSaveState(int* state) SK_OVERRIDE; | 83 void trackSaveState(int* state) SK_OVERRIDE; |
84 virtual Action action() const SK_OVERRIDE { return kPopLayer_Action; } | 84 Action action() const SK_OVERRIDE { return kPopLayer_Action; } |
85 | 85 |
86 private: | 86 private: |
87 typedef SkDrawCommand INHERITED; | 87 typedef SkDrawCommand INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 class SkClearCommand : public SkDrawCommand { | 90 class SkClearCommand : public SkDrawCommand { |
91 public: | 91 public: |
92 SkClearCommand(SkColor color); | 92 SkClearCommand(SkColor color); |
93 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 93 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
94 private: | 94 private: |
95 SkColor fColor; | 95 SkColor fColor; |
96 | 96 |
97 typedef SkDrawCommand INHERITED; | 97 typedef SkDrawCommand INHERITED; |
98 }; | 98 }; |
99 | 99 |
100 class SkClipPathCommand : public SkDrawCommand { | 100 class SkClipPathCommand : public SkDrawCommand { |
101 public: | 101 public: |
102 SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA); | 102 SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA); |
103 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 103 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
104 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 104 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
105 private: | 105 private: |
106 SkPath fPath; | 106 SkPath fPath; |
107 SkRegion::Op fOp; | 107 SkRegion::Op fOp; |
108 bool fDoAA; | 108 bool fDoAA; |
109 | 109 |
110 typedef SkDrawCommand INHERITED; | 110 typedef SkDrawCommand INHERITED; |
111 }; | 111 }; |
112 | 112 |
113 class SkClipRegionCommand : public SkDrawCommand { | 113 class SkClipRegionCommand : public SkDrawCommand { |
114 public: | 114 public: |
115 SkClipRegionCommand(const SkRegion& region, SkRegion::Op op); | 115 SkClipRegionCommand(const SkRegion& region, SkRegion::Op op); |
116 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 116 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
117 private: | 117 private: |
118 SkRegion fRegion; | 118 SkRegion fRegion; |
119 SkRegion::Op fOp; | 119 SkRegion::Op fOp; |
120 | 120 |
121 typedef SkDrawCommand INHERITED; | 121 typedef SkDrawCommand INHERITED; |
122 }; | 122 }; |
123 | 123 |
124 class SkClipRectCommand : public SkDrawCommand { | 124 class SkClipRectCommand : public SkDrawCommand { |
125 public: | 125 public: |
126 SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA); | 126 SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA); |
127 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 127 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
128 | 128 |
129 const SkRect& rect() const { return fRect; } | 129 const SkRect& rect() const { return fRect; } |
130 SkRegion::Op op() const { return fOp; } | 130 SkRegion::Op op() const { return fOp; } |
131 bool doAA() const { return fDoAA; } | 131 bool doAA() const { return fDoAA; } |
132 | 132 |
133 private: | 133 private: |
134 SkRect fRect; | 134 SkRect fRect; |
135 SkRegion::Op fOp; | 135 SkRegion::Op fOp; |
136 bool fDoAA; | 136 bool fDoAA; |
137 | 137 |
138 typedef SkDrawCommand INHERITED; | 138 typedef SkDrawCommand INHERITED; |
139 }; | 139 }; |
140 | 140 |
141 class SkClipRRectCommand : public SkDrawCommand { | 141 class SkClipRRectCommand : public SkDrawCommand { |
142 public: | 142 public: |
143 SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA); | 143 SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
144 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 144 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
145 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 145 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
146 | 146 |
147 const SkRRect& rrect() const { return fRRect; } | 147 const SkRRect& rrect() const { return fRRect; } |
148 SkRegion::Op op() const { return fOp; } | 148 SkRegion::Op op() const { return fOp; } |
149 bool doAA() const { return fDoAA; } | 149 bool doAA() const { return fDoAA; } |
150 | 150 |
151 private: | 151 private: |
152 SkRRect fRRect; | 152 SkRRect fRRect; |
153 SkRegion::Op fOp; | 153 SkRegion::Op fOp; |
154 bool fDoAA; | 154 bool fDoAA; |
155 | 155 |
156 typedef SkDrawCommand INHERITED; | 156 typedef SkDrawCommand INHERITED; |
157 }; | 157 }; |
158 | 158 |
159 class SkConcatCommand : public SkDrawCommand { | 159 class SkConcatCommand : public SkDrawCommand { |
160 public: | 160 public: |
161 SkConcatCommand(const SkMatrix& matrix); | 161 SkConcatCommand(const SkMatrix& matrix); |
162 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 162 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
163 private: | 163 private: |
164 SkMatrix fMatrix; | 164 SkMatrix fMatrix; |
165 | 165 |
166 typedef SkDrawCommand INHERITED; | 166 typedef SkDrawCommand INHERITED; |
167 }; | 167 }; |
168 | 168 |
169 class SkDrawBitmapCommand : public SkDrawCommand { | 169 class SkDrawBitmapCommand : public SkDrawCommand { |
170 public: | 170 public: |
171 SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, | 171 SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
172 const SkPaint* paint); | 172 const SkPaint* paint); |
173 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 173 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
174 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 174 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
175 private: | 175 private: |
176 SkBitmap fBitmap; | 176 SkBitmap fBitmap; |
177 SkScalar fLeft; | 177 SkScalar fLeft; |
178 SkScalar fTop; | 178 SkScalar fTop; |
179 SkPaint fPaint; | 179 SkPaint fPaint; |
180 SkPaint* fPaintPtr; | 180 SkPaint* fPaintPtr; |
181 | 181 |
182 typedef SkDrawCommand INHERITED; | 182 typedef SkDrawCommand INHERITED; |
183 }; | 183 }; |
184 | 184 |
185 class SkDrawBitmapNineCommand : public SkDrawCommand { | 185 class SkDrawBitmapNineCommand : public SkDrawCommand { |
186 public: | 186 public: |
187 SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center, | 187 SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center, |
188 const SkRect& dst, const SkPaint* paint); | 188 const SkRect& dst, const SkPaint* paint); |
189 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 189 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
190 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 190 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
191 private: | 191 private: |
192 SkBitmap fBitmap; | 192 SkBitmap fBitmap; |
193 SkIRect fCenter; | 193 SkIRect fCenter; |
194 SkRect fDst; | 194 SkRect fDst; |
195 SkPaint fPaint; | 195 SkPaint fPaint; |
196 SkPaint* fPaintPtr; | 196 SkPaint* fPaintPtr; |
197 | 197 |
198 typedef SkDrawCommand INHERITED; | 198 typedef SkDrawCommand INHERITED; |
199 }; | 199 }; |
200 | 200 |
201 class SkDrawBitmapRectCommand : public SkDrawCommand { | 201 class SkDrawBitmapRectCommand : public SkDrawCommand { |
202 public: | 202 public: |
203 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, | 203 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, |
204 const SkRect& dst, const SkPaint* paint, | 204 const SkRect& dst, const SkPaint* paint, |
205 SkCanvas::DrawBitmapRectFlags flags); | 205 SkCanvas::DrawBitmapRectFlags flags); |
206 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 206 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
207 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 207 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
208 | 208 |
209 const SkBitmap& bitmap() const { return fBitmap; } | 209 const SkBitmap& bitmap() const { return fBitmap; } |
210 | 210 |
211 // The non-const 'paint' method allows modification of this object's | 211 // The non-const 'paint' method allows modification of this object's |
212 // SkPaint. For this reason the ctor and setPaint method make a local copy. | 212 // SkPaint. For this reason the ctor and setPaint method make a local copy. |
213 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid | 213 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
214 // (since only an SkPaint* is passed into the ctor). | 214 // (since only an SkPaint* is passed into the ctor). |
215 const SkPaint* paint() const { return fPaintPtr; } | 215 const SkPaint* paint() const { return fPaintPtr; } |
216 SkPaint* paint() { return fPaintPtr; } | 216 SkPaint* paint() { return fPaintPtr; } |
217 | 217 |
(...skipping 15 matching lines...) Expand all Loading... |
233 SkPaint fPaint; | 233 SkPaint fPaint; |
234 SkPaint* fPaintPtr; | 234 SkPaint* fPaintPtr; |
235 SkCanvas::DrawBitmapRectFlags fFlags; | 235 SkCanvas::DrawBitmapRectFlags fFlags; |
236 | 236 |
237 typedef SkDrawCommand INHERITED; | 237 typedef SkDrawCommand INHERITED; |
238 }; | 238 }; |
239 | 239 |
240 class SkBeginCommentGroupCommand : public SkDrawCommand { | 240 class SkBeginCommentGroupCommand : public SkDrawCommand { |
241 public: | 241 public: |
242 SkBeginCommentGroupCommand(const char* description); | 242 SkBeginCommentGroupCommand(const char* description); |
243 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE { | 243 void execute(SkCanvas* canvas) const SK_OVERRIDE { |
244 canvas->beginCommentGroup(fDescription.c_str()); | 244 canvas->beginCommentGroup(fDescription.c_str()); |
245 }; | 245 }; |
246 private: | 246 private: |
247 SkString fDescription; | 247 SkString fDescription; |
248 | 248 |
249 typedef SkDrawCommand INHERITED; | 249 typedef SkDrawCommand INHERITED; |
250 }; | 250 }; |
251 | 251 |
252 class SkCommentCommand : public SkDrawCommand { | 252 class SkCommentCommand : public SkDrawCommand { |
253 public: | 253 public: |
254 SkCommentCommand(const char* kywd, const char* value); | 254 SkCommentCommand(const char* kywd, const char* value); |
255 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE { | 255 void execute(SkCanvas* canvas) const SK_OVERRIDE { |
256 canvas->addComment(fKywd.c_str(), fValue.c_str()); | 256 canvas->addComment(fKywd.c_str(), fValue.c_str()); |
257 }; | 257 }; |
258 private: | 258 private: |
259 SkString fKywd; | 259 SkString fKywd; |
260 SkString fValue; | 260 SkString fValue; |
261 | 261 |
262 typedef SkDrawCommand INHERITED; | 262 typedef SkDrawCommand INHERITED; |
263 }; | 263 }; |
264 | 264 |
265 class SkEndCommentGroupCommand : public SkDrawCommand { | 265 class SkEndCommentGroupCommand : public SkDrawCommand { |
266 public: | 266 public: |
267 SkEndCommentGroupCommand(); | 267 SkEndCommentGroupCommand(); |
268 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE { | 268 void execute(SkCanvas* canvas) const SK_OVERRIDE { |
269 canvas->endCommentGroup(); | 269 canvas->endCommentGroup(); |
270 }; | 270 }; |
271 private: | 271 private: |
272 typedef SkDrawCommand INHERITED; | 272 typedef SkDrawCommand INHERITED; |
273 }; | 273 }; |
274 | 274 |
275 class SkDrawOvalCommand : public SkDrawCommand { | 275 class SkDrawOvalCommand : public SkDrawCommand { |
276 public: | 276 public: |
277 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); | 277 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |
278 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 278 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
279 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 279 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
280 private: | 280 private: |
281 SkRect fOval; | 281 SkRect fOval; |
282 SkPaint fPaint; | 282 SkPaint fPaint; |
283 | 283 |
284 typedef SkDrawCommand INHERITED; | 284 typedef SkDrawCommand INHERITED; |
285 }; | 285 }; |
286 | 286 |
287 class SkDrawPaintCommand : public SkDrawCommand { | 287 class SkDrawPaintCommand : public SkDrawCommand { |
288 public: | 288 public: |
289 SkDrawPaintCommand(const SkPaint& paint); | 289 SkDrawPaintCommand(const SkPaint& paint); |
290 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 290 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
291 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 291 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
292 private: | 292 private: |
293 SkPaint fPaint; | 293 SkPaint fPaint; |
294 | 294 |
295 typedef SkDrawCommand INHERITED; | 295 typedef SkDrawCommand INHERITED; |
296 }; | 296 }; |
297 | 297 |
298 class SkDrawPathCommand : public SkDrawCommand { | 298 class SkDrawPathCommand : public SkDrawCommand { |
299 public: | 299 public: |
300 SkDrawPathCommand(const SkPath& path, const SkPaint& paint); | 300 SkDrawPathCommand(const SkPath& path, const SkPaint& paint); |
301 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 301 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
302 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 302 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
303 | 303 |
304 private: | 304 private: |
305 SkPath fPath; | 305 SkPath fPath; |
306 SkPaint fPaint; | 306 SkPaint fPaint; |
307 | 307 |
308 typedef SkDrawCommand INHERITED; | 308 typedef SkDrawCommand INHERITED; |
309 }; | 309 }; |
310 | 310 |
311 class SkDrawPictureCommand : public SkDrawCommand { | 311 class SkDrawPictureCommand : public SkDrawCommand { |
312 public: | 312 public: |
313 SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const
SkPaint* paint); | 313 SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const
SkPaint* paint); |
314 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 314 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
315 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 315 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
316 | 316 |
317 private: | 317 private: |
318 SkAutoTUnref<const SkPicture> fPicture; | 318 SkAutoTUnref<const SkPicture> fPicture; |
319 SkMatrix fMatrix; | 319 SkMatrix fMatrix; |
320 SkMatrix* fMatrixPtr; | 320 SkMatrix* fMatrixPtr; |
321 SkPaint fPaint; | 321 SkPaint fPaint; |
322 SkPaint* fPaintPtr; | 322 SkPaint* fPaintPtr; |
323 | 323 |
324 typedef SkDrawCommand INHERITED; | 324 typedef SkDrawCommand INHERITED; |
325 }; | 325 }; |
326 | 326 |
327 class SkDrawPointsCommand : public SkDrawCommand { | 327 class SkDrawPointsCommand : public SkDrawCommand { |
328 public: | 328 public: |
329 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], | 329 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], |
330 const SkPaint& paint); | 330 const SkPaint& paint); |
331 virtual ~SkDrawPointsCommand() { delete [] fPts; } | 331 virtual ~SkDrawPointsCommand() { delete [] fPts; } |
332 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 332 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
333 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 333 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
334 private: | 334 private: |
335 SkCanvas::PointMode fMode; | 335 SkCanvas::PointMode fMode; |
336 size_t fCount; | 336 size_t fCount; |
337 SkPoint* fPts; | 337 SkPoint* fPts; |
338 SkPaint fPaint; | 338 SkPaint fPaint; |
339 | 339 |
340 typedef SkDrawCommand INHERITED; | 340 typedef SkDrawCommand INHERITED; |
341 }; | 341 }; |
342 | 342 |
343 class SkDrawTextCommand : public SkDrawCommand { | 343 class SkDrawTextCommand : public SkDrawCommand { |
344 public: | 344 public: |
345 SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar
y, | 345 SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar
y, |
346 const SkPaint& paint); | 346 const SkPaint& paint); |
347 virtual ~SkDrawTextCommand() { delete [] fText; } | 347 virtual ~SkDrawTextCommand() { delete [] fText; } |
348 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 348 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
349 private: | 349 private: |
350 char* fText; | 350 char* fText; |
351 size_t fByteLength; | 351 size_t fByteLength; |
352 SkScalar fX; | 352 SkScalar fX; |
353 SkScalar fY; | 353 SkScalar fY; |
354 SkPaint fPaint; | 354 SkPaint fPaint; |
355 | 355 |
356 typedef SkDrawCommand INHERITED; | 356 typedef SkDrawCommand INHERITED; |
357 }; | 357 }; |
358 | 358 |
359 class SkDrawPosTextCommand : public SkDrawCommand { | 359 class SkDrawPosTextCommand : public SkDrawCommand { |
360 public: | 360 public: |
361 SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[
], | 361 SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[
], |
362 const SkPaint& paint); | 362 const SkPaint& paint); |
363 virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; } | 363 virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; } |
364 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 364 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
365 private: | 365 private: |
366 char* fText; | 366 char* fText; |
367 size_t fByteLength; | 367 size_t fByteLength; |
368 SkPoint* fPos; | 368 SkPoint* fPos; |
369 SkPaint fPaint; | 369 SkPaint fPaint; |
370 | 370 |
371 typedef SkDrawCommand INHERITED; | 371 typedef SkDrawCommand INHERITED; |
372 }; | 372 }; |
373 | 373 |
374 class SkDrawTextOnPathCommand : public SkDrawCommand { | 374 class SkDrawTextOnPathCommand : public SkDrawCommand { |
375 public: | 375 public: |
376 SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& p
ath, | 376 SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& p
ath, |
377 const SkMatrix* matrix, const SkPaint& paint); | 377 const SkMatrix* matrix, const SkPaint& paint); |
378 virtual ~SkDrawTextOnPathCommand() { delete [] fText; } | 378 virtual ~SkDrawTextOnPathCommand() { delete [] fText; } |
379 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 379 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
380 private: | 380 private: |
381 char* fText; | 381 char* fText; |
382 size_t fByteLength; | 382 size_t fByteLength; |
383 SkPath fPath; | 383 SkPath fPath; |
384 SkMatrix fMatrix; | 384 SkMatrix fMatrix; |
385 SkPaint fPaint; | 385 SkPaint fPaint; |
386 | 386 |
387 typedef SkDrawCommand INHERITED; | 387 typedef SkDrawCommand INHERITED; |
388 }; | 388 }; |
389 | 389 |
390 class SkDrawPosTextHCommand : public SkDrawCommand { | 390 class SkDrawPosTextHCommand : public SkDrawCommand { |
391 public: | 391 public: |
392 SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xp
os[], | 392 SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xp
os[], |
393 SkScalar constY, const SkPaint& paint); | 393 SkScalar constY, const SkPaint& paint); |
394 virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } | 394 virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } |
395 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 395 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
396 private: | 396 private: |
397 SkScalar* fXpos; | 397 SkScalar* fXpos; |
398 char* fText; | 398 char* fText; |
399 size_t fByteLength; | 399 size_t fByteLength; |
400 SkScalar fConstY; | 400 SkScalar fConstY; |
401 SkPaint fPaint; | 401 SkPaint fPaint; |
402 | 402 |
403 typedef SkDrawCommand INHERITED; | 403 typedef SkDrawCommand INHERITED; |
404 }; | 404 }; |
405 | 405 |
406 class SkDrawTextBlobCommand : public SkDrawCommand { | 406 class SkDrawTextBlobCommand : public SkDrawCommand { |
407 public: | 407 public: |
408 SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const
SkPaint& paint); | 408 SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const
SkPaint& paint); |
409 | 409 |
410 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 410 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
411 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 411 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
412 | 412 |
413 private: | 413 private: |
414 SkAutoTUnref<const SkTextBlob> fBlob; | 414 SkAutoTUnref<const SkTextBlob> fBlob; |
415 SkScalar fXPos; | 415 SkScalar fXPos; |
416 SkScalar fYPos; | 416 SkScalar fYPos; |
417 SkPaint fPaint; | 417 SkPaint fPaint; |
418 | 418 |
419 typedef SkDrawCommand INHERITED; | 419 typedef SkDrawCommand INHERITED; |
420 }; | 420 }; |
421 | 421 |
422 class SkDrawRectCommand : public SkDrawCommand { | 422 class SkDrawRectCommand : public SkDrawCommand { |
423 public: | 423 public: |
424 SkDrawRectCommand(const SkRect& rect, const SkPaint& paint); | 424 SkDrawRectCommand(const SkRect& rect, const SkPaint& paint); |
425 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 425 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
426 | 426 |
427 const SkRect& rect() const { return fRect; } | 427 const SkRect& rect() const { return fRect; } |
428 const SkPaint& paint() const { return fPaint; } | 428 const SkPaint& paint() const { return fPaint; } |
429 private: | 429 private: |
430 SkRect fRect; | 430 SkRect fRect; |
431 SkPaint fPaint; | 431 SkPaint fPaint; |
432 | 432 |
433 typedef SkDrawCommand INHERITED; | 433 typedef SkDrawCommand INHERITED; |
434 }; | 434 }; |
435 | 435 |
436 class SkDrawRRectCommand : public SkDrawCommand { | 436 class SkDrawRRectCommand : public SkDrawCommand { |
437 public: | 437 public: |
438 SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint); | 438 SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint); |
439 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 439 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
440 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 440 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
441 private: | 441 private: |
442 SkRRect fRRect; | 442 SkRRect fRRect; |
443 SkPaint fPaint; | 443 SkPaint fPaint; |
444 | 444 |
445 typedef SkDrawCommand INHERITED; | 445 typedef SkDrawCommand INHERITED; |
446 }; | 446 }; |
447 | 447 |
448 class SkDrawDRRectCommand : public SkDrawCommand { | 448 class SkDrawDRRectCommand : public SkDrawCommand { |
449 public: | 449 public: |
450 SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, | 450 SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, |
451 const SkPaint& paint); | 451 const SkPaint& paint); |
452 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 452 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
453 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 453 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
454 private: | 454 private: |
455 SkRRect fOuter; | 455 SkRRect fOuter; |
456 SkRRect fInner; | 456 SkRRect fInner; |
457 SkPaint fPaint; | 457 SkPaint fPaint; |
458 | 458 |
459 typedef SkDrawCommand INHERITED; | 459 typedef SkDrawCommand INHERITED; |
460 }; | 460 }; |
461 | 461 |
462 class SkDrawSpriteCommand : public SkDrawCommand { | 462 class SkDrawSpriteCommand : public SkDrawCommand { |
463 public: | 463 public: |
464 SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint
* paint); | 464 SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint
* paint); |
465 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 465 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
466 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 466 bool render(SkCanvas* canvas) const SK_OVERRIDE; |
467 private: | 467 private: |
468 SkBitmap fBitmap; | 468 SkBitmap fBitmap; |
469 int fLeft; | 469 int fLeft; |
470 int fTop; | 470 int fTop; |
471 SkPaint fPaint; | 471 SkPaint fPaint; |
472 SkPaint* fPaintPtr; | 472 SkPaint* fPaintPtr; |
473 | 473 |
474 typedef SkDrawCommand INHERITED; | 474 typedef SkDrawCommand INHERITED; |
475 }; | 475 }; |
476 | 476 |
477 class SkDrawVerticesCommand : public SkDrawCommand { | 477 class SkDrawVerticesCommand : public SkDrawCommand { |
478 public: | 478 public: |
479 SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount, | 479 SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount, |
480 const SkPoint vertices[], const SkPoint texs[], | 480 const SkPoint vertices[], const SkPoint texs[], |
481 const SkColor colors[], SkXfermode* xfermode, | 481 const SkColor colors[], SkXfermode* xfermode, |
482 const uint16_t indices[], int indexCount, | 482 const uint16_t indices[], int indexCount, |
483 const SkPaint& paint); | 483 const SkPaint& paint); |
484 virtual ~SkDrawVerticesCommand(); | 484 virtual ~SkDrawVerticesCommand(); |
485 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 485 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
486 private: | 486 private: |
487 SkCanvas::VertexMode fVmode; | 487 SkCanvas::VertexMode fVmode; |
488 int fVertexCount; | 488 int fVertexCount; |
489 SkPoint* fVertices; | 489 SkPoint* fVertices; |
490 SkPoint* fTexs; | 490 SkPoint* fTexs; |
491 SkColor* fColors; | 491 SkColor* fColors; |
492 SkXfermode* fXfermode; | 492 SkXfermode* fXfermode; |
493 uint16_t* fIndices; | 493 uint16_t* fIndices; |
494 int fIndexCount; | 494 int fIndexCount; |
495 SkPaint fPaint; | 495 SkPaint fPaint; |
496 | 496 |
497 typedef SkDrawCommand INHERITED; | 497 typedef SkDrawCommand INHERITED; |
498 }; | 498 }; |
499 | 499 |
500 class SkRotateCommand : public SkDrawCommand { | 500 class SkRotateCommand : public SkDrawCommand { |
501 public: | 501 public: |
502 SkRotateCommand(SkScalar degrees); | 502 SkRotateCommand(SkScalar degrees); |
503 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 503 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
504 private: | 504 private: |
505 SkScalar fDegrees; | 505 SkScalar fDegrees; |
506 | 506 |
507 typedef SkDrawCommand INHERITED; | 507 typedef SkDrawCommand INHERITED; |
508 }; | 508 }; |
509 | 509 |
510 class SkSaveCommand : public SkDrawCommand { | 510 class SkSaveCommand : public SkDrawCommand { |
511 public: | 511 public: |
512 SkSaveCommand(); | 512 SkSaveCommand(); |
513 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 513 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
514 virtual void trackSaveState(int* state) SK_OVERRIDE; | 514 void trackSaveState(int* state) SK_OVERRIDE; |
515 virtual Action action() const SK_OVERRIDE { return kPushLayer_Action; } | 515 Action action() const SK_OVERRIDE { return kPushLayer_Action; } |
516 private: | 516 private: |
517 typedef SkDrawCommand INHERITED; | 517 typedef SkDrawCommand INHERITED; |
518 }; | 518 }; |
519 | 519 |
520 class SkSaveLayerCommand : public SkDrawCommand { | 520 class SkSaveLayerCommand : public SkDrawCommand { |
521 public: | 521 public: |
522 SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, | 522 SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, |
523 SkCanvas::SaveFlags flags); | 523 SkCanvas::SaveFlags flags); |
524 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 524 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
525 virtual void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; | 525 void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; |
526 virtual void trackSaveState(int* state) SK_OVERRIDE; | 526 void trackSaveState(int* state) SK_OVERRIDE; |
527 virtual Action action() const SK_OVERRIDE{ return kPushLayer_Action; } | 527 Action action() const SK_OVERRIDE{ return kPushLayer_Action; } |
528 virtual void setActive(bool active) SK_OVERRIDE { fActive = active; } | 528 void setActive(bool active) SK_OVERRIDE { fActive = active; } |
529 virtual bool active() const SK_OVERRIDE { return fActive; } | 529 bool active() const SK_OVERRIDE { return fActive; } |
530 | 530 |
531 const SkPaint* paint() const { return fPaintPtr; } | 531 const SkPaint* paint() const { return fPaintPtr; } |
532 | 532 |
533 private: | 533 private: |
534 SkRect fBounds; | 534 SkRect fBounds; |
535 SkPaint fPaint; | 535 SkPaint fPaint; |
536 SkPaint* fPaintPtr; | 536 SkPaint* fPaintPtr; |
537 SkCanvas::SaveFlags fFlags; | 537 SkCanvas::SaveFlags fFlags; |
538 | 538 |
539 bool fActive; | 539 bool fActive; |
540 | 540 |
541 typedef SkDrawCommand INHERITED; | 541 typedef SkDrawCommand INHERITED; |
542 }; | 542 }; |
543 | 543 |
544 class SkScaleCommand : public SkDrawCommand { | 544 class SkScaleCommand : public SkDrawCommand { |
545 public: | 545 public: |
546 SkScaleCommand(SkScalar sx, SkScalar sy); | 546 SkScaleCommand(SkScalar sx, SkScalar sy); |
547 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 547 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
548 | 548 |
549 SkScalar x() const { return fSx; } | 549 SkScalar x() const { return fSx; } |
550 SkScalar y() const { return fSy; } | 550 SkScalar y() const { return fSy; } |
551 | 551 |
552 private: | 552 private: |
553 SkScalar fSx; | 553 SkScalar fSx; |
554 SkScalar fSy; | 554 SkScalar fSy; |
555 | 555 |
556 typedef SkDrawCommand INHERITED; | 556 typedef SkDrawCommand INHERITED; |
557 }; | 557 }; |
558 | 558 |
559 class SkSetMatrixCommand : public SkDrawCommand { | 559 class SkSetMatrixCommand : public SkDrawCommand { |
560 public: | 560 public: |
561 SkSetMatrixCommand(const SkMatrix& matrix); | 561 SkSetMatrixCommand(const SkMatrix& matrix); |
562 virtual void setUserMatrix(const SkMatrix&) SK_OVERRIDE; | 562 void setUserMatrix(const SkMatrix&) SK_OVERRIDE; |
563 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 563 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
564 private: | 564 private: |
565 SkMatrix fUserMatrix; | 565 SkMatrix fUserMatrix; |
566 SkMatrix fMatrix; | 566 SkMatrix fMatrix; |
567 | 567 |
568 typedef SkDrawCommand INHERITED; | 568 typedef SkDrawCommand INHERITED; |
569 }; | 569 }; |
570 | 570 |
571 class SkSkewCommand : public SkDrawCommand { | 571 class SkSkewCommand : public SkDrawCommand { |
572 public: | 572 public: |
573 SkSkewCommand(SkScalar sx, SkScalar sy); | 573 SkSkewCommand(SkScalar sx, SkScalar sy); |
574 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 574 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
575 private: | 575 private: |
576 SkScalar fSx; | 576 SkScalar fSx; |
577 SkScalar fSy; | 577 SkScalar fSy; |
578 | 578 |
579 typedef SkDrawCommand INHERITED; | 579 typedef SkDrawCommand INHERITED; |
580 }; | 580 }; |
581 | 581 |
582 class SkTranslateCommand : public SkDrawCommand { | 582 class SkTranslateCommand : public SkDrawCommand { |
583 public: | 583 public: |
584 SkTranslateCommand(SkScalar dx, SkScalar dy); | 584 SkTranslateCommand(SkScalar dx, SkScalar dy); |
585 virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; | 585 void execute(SkCanvas* canvas) const SK_OVERRIDE; |
586 | 586 |
587 SkScalar x() const { return fDx; } | 587 SkScalar x() const { return fDx; } |
588 SkScalar y() const { return fDy; } | 588 SkScalar y() const { return fDy; } |
589 | 589 |
590 private: | 590 private: |
591 SkScalar fDx; | 591 SkScalar fDx; |
592 SkScalar fDy; | 592 SkScalar fDy; |
593 | 593 |
594 typedef SkDrawCommand INHERITED; | 594 typedef SkDrawCommand INHERITED; |
595 }; | 595 }; |
596 | 596 |
597 #endif | 597 #endif |
OLD | NEW |