• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SKDRAWCOMMAND_H_
9 #define SKDRAWCOMMAND_H_
10 
11 #include "SkBitmap.h"
12 #include "SkCanvas.h"
13 #include "SkDrawShadowInfo.h"
14 #include "SkFlattenable.h"
15 #include "SkJSONWriter.h"
16 #include "SkTLazy.h"
17 #include "SkPath.h"
18 #include "SkRegion.h"
19 #include "SkRRect.h"
20 #include "SkRSXform.h"
21 #include "SkString.h"
22 #include "SkTDArray.h"
23 #include "SkVertices.h"
24 #include "UrlDataManager.h"
25 
26 class SkDrawCommand {
27 public:
28     enum OpType {
29         kBeginDrawPicture_OpType,
30         kClear_OpType,
31         kClipPath_OpType,
32         kClipRegion_OpType,
33         kClipRect_OpType,
34         kClipRRect_OpType,
35         kConcat_OpType,
36         kDrawAnnotation_OpType,
37         kDrawBitmap_OpType,
38         kDrawBitmapLattice_OpType,
39         kDrawBitmapNine_OpType,
40         kDrawBitmapRect_OpType,
41         kDrawDRRect_OpType,
42         kDrawImage_OpType,
43         kDrawImageLattice_OpType,
44         kDrawImageNine_OpType,
45         kDrawImageRect_OpType,
46         kDrawImageSet_OpType,
47         kDrawOval_OpType,
48         kDrawArc_OpType,
49         kDrawPaint_OpType,
50         kDrawPatch_OpType,
51         kDrawPath_OpType,
52         kDrawPoints_OpType,
53         kDrawRect_OpType,
54         kDrawEdgeAARect_OpType,
55         kDrawRRect_OpType,
56         kDrawRegion_OpType,
57         kDrawShadow_OpType,
58         kDrawTextBlob_OpType,
59         kDrawVertices_OpType,
60         kDrawAtlas_OpType,
61         kDrawDrawable_OpType,
62         kEndDrawPicture_OpType,
63         kRestore_OpType,
64         kSave_OpType,
65         kSaveLayer_OpType,
66         kSetMatrix_OpType,
67 
68         kLast_OpType = kSetMatrix_OpType
69     };
70 
71     static const int kOpTypeCount = kLast_OpType + 1;
72 
73     static void WritePNG(SkBitmap bitmap, SkWStream& out);
74 
75     SkDrawCommand(OpType opType);
76 
~SkDrawCommand()77     virtual ~SkDrawCommand() {}
78 
isVisible()79     bool isVisible() const {
80         return fVisible;
81     }
82 
setVisible(bool toggle)83     void setVisible(bool toggle) {
84         fVisible = toggle;
85     }
86 
87     virtual void execute(SkCanvas*) const = 0;
88 
render(SkCanvas * canvas)89     virtual bool render(SkCanvas* canvas) const { return false; }
90 
91     virtual void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const;
92 
93     static const char* GetCommandString(OpType type);
94 
95     // Helper methods for converting things to JSON
96     static void MakeJsonColor(SkJSONWriter&, const SkColor color);
97     static void MakeJsonColor4f(SkJSONWriter&, const SkColor4f& color);
98     static void MakeJsonPoint(SkJSONWriter&, const SkPoint& point);
99     static void MakeJsonPoint(SkJSONWriter&, SkScalar x, SkScalar y);
100     static void MakeJsonPoint3(SkJSONWriter&, const SkPoint3& point);
101     static void MakeJsonRect(SkJSONWriter&, const SkRect& rect);
102     static void MakeJsonIRect(SkJSONWriter&, const SkIRect&);
103     static void MakeJsonMatrix(SkJSONWriter&, const SkMatrix&);
104     static void MakeJsonPath(SkJSONWriter&, const SkPath& path);
105     static void MakeJsonRegion(SkJSONWriter&, const SkRegion& region);
106     static void MakeJsonPaint(SkJSONWriter&, const SkPaint& paint, UrlDataManager& urlDataManager);
107     static void MakeJsonLattice(SkJSONWriter&, const SkCanvas::Lattice& lattice);
108 
109     static void flatten(const SkFlattenable* flattenable, SkJSONWriter& writer,
110                         UrlDataManager& urlDataManager);
111     static bool flatten(const SkImage& image, SkJSONWriter& writer,
112                         UrlDataManager& urlDataManager);
113     static bool flatten(const SkBitmap& bitmap, SkJSONWriter& writer,
114                         UrlDataManager& urlDataManager);
115 
116 private:
117     OpType fOpType;
118     bool   fVisible;
119 };
120 
121 class SkRestoreCommand : public SkDrawCommand {
122 public:
123     SkRestoreCommand();
124     void execute(SkCanvas* canvas) const override;
125 
126 private:
127     typedef SkDrawCommand INHERITED;
128 };
129 
130 class SkClearCommand : public SkDrawCommand {
131 public:
132     SkClearCommand(SkColor color);
133     void execute(SkCanvas* canvas) const override;
134     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
135 
136 private:
137     SkColor fColor;
138 
139     typedef SkDrawCommand INHERITED;
140 };
141 
142 class SkClipPathCommand : public SkDrawCommand {
143 public:
144     SkClipPathCommand(const SkPath& path, SkClipOp op, bool doAA);
145     void execute(SkCanvas* canvas) const override;
146     bool render(SkCanvas* canvas) const override;
147     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
148 
149 private:
150     SkPath   fPath;
151     SkClipOp fOp;
152     bool     fDoAA;
153 
154     typedef SkDrawCommand INHERITED;
155 };
156 
157 class SkClipRegionCommand : public SkDrawCommand {
158 public:
159     SkClipRegionCommand(const SkRegion& region, SkClipOp op);
160     void execute(SkCanvas* canvas) const override;
161     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
162 
163 private:
164     SkRegion fRegion;
165     SkClipOp fOp;
166 
167     typedef SkDrawCommand INHERITED;
168 };
169 
170 class SkClipRectCommand : public SkDrawCommand {
171 public:
172     SkClipRectCommand(const SkRect& rect, SkClipOp op, bool doAA);
173     void execute(SkCanvas* canvas) const override;
174     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
175 
176 private:
177     SkRect   fRect;
178     SkClipOp fOp;
179     bool     fDoAA;
180 
181     typedef SkDrawCommand INHERITED;
182 };
183 
184 class SkClipRRectCommand : public SkDrawCommand {
185 public:
186     SkClipRRectCommand(const SkRRect& rrect, SkClipOp op, bool doAA);
187     void execute(SkCanvas* canvas) const override;
188     bool render(SkCanvas* canvas) const override;
189     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
190 
191 private:
192     SkRRect  fRRect;
193     SkClipOp fOp;
194     bool     fDoAA;
195 
196     typedef SkDrawCommand INHERITED;
197 };
198 
199 class SkConcatCommand : public SkDrawCommand {
200 public:
201     SkConcatCommand(const SkMatrix& matrix);
202     void execute(SkCanvas* canvas) const override;
203     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
204 
205 private:
206     SkMatrix fMatrix;
207 
208     typedef SkDrawCommand INHERITED;
209 };
210 
211 class SkDrawAnnotationCommand : public SkDrawCommand {
212 public:
213     SkDrawAnnotationCommand(const SkRect&, const char key[], sk_sp<SkData> value);
214     void execute(SkCanvas* canvas) const override;
215     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
216 
217 private:
218     SkRect          fRect;
219     SkString        fKey;
220     sk_sp<SkData>   fValue;
221 
222     typedef SkDrawCommand INHERITED;
223 };
224 
225 class SkDrawBitmapCommand : public SkDrawCommand {
226 public:
227     SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
228                         const SkPaint* paint);
229     void execute(SkCanvas* canvas) const override;
230     bool render(SkCanvas* canvas) const override;
231     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
232 
233 private:
234     SkBitmap         fBitmap;
235     SkScalar         fLeft;
236     SkScalar         fTop;
237     SkTLazy<SkPaint> fPaint;
238 
239     typedef SkDrawCommand INHERITED;
240 };
241 
242 class SkDrawBitmapLatticeCommand : public SkDrawCommand {
243 public:
244     SkDrawBitmapLatticeCommand(const SkBitmap& bitmap, const SkCanvas::Lattice& lattice,
245                                const SkRect& dst, const SkPaint* paint);
246     void execute(SkCanvas* canvas) const override;
247     bool render(SkCanvas* canvas) const override;
248     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
249 
250 private:
251     SkBitmap          fBitmap;
252     SkCanvas::Lattice fLattice;
253     SkRect            fDst;
254     SkTLazy<SkPaint>  fPaint;
255 
256     typedef SkDrawCommand INHERITED;
257 };
258 
259 class SkDrawBitmapNineCommand : public SkDrawCommand {
260 public:
261     SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center,
262                             const SkRect& dst, const SkPaint* paint);
263     void execute(SkCanvas* canvas) const override;
264     bool render(SkCanvas* canvas) const override;
265     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
266 
267 private:
268     SkBitmap         fBitmap;
269     SkIRect          fCenter;
270     SkRect           fDst;
271     SkTLazy<SkPaint> fPaint;
272 
273     typedef SkDrawCommand INHERITED;
274 };
275 
276 class SkDrawBitmapRectCommand : public SkDrawCommand {
277 public:
278     SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src,
279                             const SkRect& dst, const SkPaint* paint,
280                             SkCanvas::SrcRectConstraint);
281     void execute(SkCanvas* canvas) const override;
282     bool render(SkCanvas* canvas) const override;
283     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
284 
285 private:
286     SkBitmap                      fBitmap;
287     SkTLazy<SkRect>               fSrc;
288     SkRect                        fDst;
289     SkTLazy<SkPaint>              fPaint;
290     SkCanvas::SrcRectConstraint   fConstraint;
291 
292     typedef SkDrawCommand INHERITED;
293 };
294 
295 class SkDrawImageCommand : public SkDrawCommand {
296 public:
297     SkDrawImageCommand(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* paint);
298     void execute(SkCanvas* canvas) const override;
299     bool render(SkCanvas* canvas) const override;
300     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
301 
302 private:
303     sk_sp<const SkImage> fImage;
304     SkScalar             fLeft;
305     SkScalar             fTop;
306     SkTLazy<SkPaint>     fPaint;
307 
308     typedef SkDrawCommand INHERITED;
309 };
310 
311 class SkDrawImageLatticeCommand : public SkDrawCommand {
312 public:
313     SkDrawImageLatticeCommand(const SkImage* image, const SkCanvas::Lattice& lattice,
314                               const SkRect& dst, const SkPaint* paint);
315     void execute(SkCanvas* canvas) const override;
316     bool render(SkCanvas* canvas) const override;
317     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
318 
319 private:
320     sk_sp<const SkImage>        fImage;
321     SkCanvas::Lattice           fLattice;
322     SkRect                      fDst;
323     SkTLazy<SkPaint>            fPaint;
324 
325     typedef SkDrawCommand INHERITED;
326 };
327 
328 class SkDrawImageNineCommand : public SkDrawCommand {
329 public:
330     SkDrawImageNineCommand(const SkImage* image, const SkIRect& center,
331                            const SkRect& dst, const SkPaint* paint);
332     void execute(SkCanvas* canvas) const override;
333     bool render(SkCanvas* canvas) const override;
334     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
335 
336 private:
337     sk_sp<const SkImage> fImage;
338     SkIRect              fCenter;
339     SkRect               fDst;
340     SkTLazy<SkPaint>     fPaint;
341 
342     typedef SkDrawCommand INHERITED;
343 };
344 
345 class SkDrawImageRectCommand : public SkDrawCommand {
346 public:
347     SkDrawImageRectCommand(const SkImage* image, const SkRect* src, const SkRect& dst,
348                            const SkPaint* paint, SkCanvas::SrcRectConstraint constraint);
349     void execute(SkCanvas* canvas) const override;
350     bool render(SkCanvas* canvas) const override;
351     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
352 
353 private:
354     sk_sp<const SkImage>        fImage;
355     SkTLazy<SkRect>             fSrc;
356     SkRect                      fDst;
357     SkTLazy<SkPaint>            fPaint;
358     SkCanvas::SrcRectConstraint fConstraint;
359 
360     typedef SkDrawCommand INHERITED;
361 };
362 
363 class SkDrawImageSetCommand : public SkDrawCommand {
364 public:
365     SkDrawImageSetCommand(const SkCanvas::ImageSetEntry[], int count, SkFilterQuality, SkBlendMode);
366     void execute(SkCanvas* canvas) const override;
367 
368 private:
369     SkAutoTArray<SkCanvas::ImageSetEntry> fSet;
370     int fCount;
371     SkFilterQuality fFilterQuality;
372     SkBlendMode fMode;
373 
374     typedef SkDrawCommand INHERITED;
375 };
376 
377 class SkDrawOvalCommand : public SkDrawCommand {
378 public:
379     SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint);
380     void execute(SkCanvas* canvas) const override;
381     bool render(SkCanvas* canvas) const override;
382     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
383 
384 private:
385     SkRect  fOval;
386     SkPaint fPaint;
387 
388     typedef SkDrawCommand INHERITED;
389 };
390 
391 class SkDrawArcCommand : public SkDrawCommand {
392 public:
393     SkDrawArcCommand(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter,
394                      const SkPaint& paint);
395     void execute(SkCanvas* canvas) const override;
396     bool render(SkCanvas* canvas) const override;
397     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
398 
399 private:
400     SkRect   fOval;
401     SkScalar fStartAngle;
402     SkScalar fSweepAngle;
403     bool     fUseCenter;
404     SkPaint  fPaint;
405 
406     typedef SkDrawCommand INHERITED;
407 };
408 
409 class SkDrawPaintCommand : public SkDrawCommand {
410 public:
411     SkDrawPaintCommand(const SkPaint& paint);
412     void execute(SkCanvas* canvas) const override;
413     bool render(SkCanvas* canvas) const override;
414     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
415 
416 private:
417     SkPaint fPaint;
418 
419     typedef SkDrawCommand INHERITED;
420 };
421 
422 class SkDrawPathCommand : public SkDrawCommand {
423 public:
424     SkDrawPathCommand(const SkPath& path, const SkPaint& paint);
425     void execute(SkCanvas* canvas) const override;
426     bool render(SkCanvas* canvas) const override;
427     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
428 
429 private:
430     SkPath   fPath;
431     SkPaint  fPaint;
432 
433     typedef SkDrawCommand INHERITED;
434 };
435 
436 class SkBeginDrawPictureCommand : public SkDrawCommand {
437 public:
438     SkBeginDrawPictureCommand(const SkPicture* picture,
439                               const SkMatrix* matrix,
440                               const SkPaint* paint);
441 
442     void execute(SkCanvas* canvas) const override;
443     bool render(SkCanvas* canvas) const override;
444 
445 private:
446     sk_sp<const SkPicture> fPicture;
447     SkTLazy<SkMatrix>      fMatrix;
448     SkTLazy<SkPaint>       fPaint;
449 
450     typedef SkDrawCommand INHERITED;
451 };
452 
453 class SkEndDrawPictureCommand : public SkDrawCommand {
454 public:
455     SkEndDrawPictureCommand(bool restore);
456 
457     void execute(SkCanvas* canvas) const override;
458 
459 private:
460     bool fRestore;
461 
462     typedef SkDrawCommand INHERITED;
463 };
464 
465 class SkDrawPointsCommand : public SkDrawCommand {
466 public:
467     SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pts[],
468                         const SkPaint& paint);
469     void execute(SkCanvas* canvas) const override;
470     bool render(SkCanvas* canvas) const override;
471     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
472 
473 private:
474     SkCanvas::PointMode fMode;
475     SkTDArray<SkPoint>  fPts;
476     SkPaint             fPaint;
477 
478     typedef SkDrawCommand INHERITED;
479 };
480 
481 class SkDrawRegionCommand : public SkDrawCommand {
482 public:
483     SkDrawRegionCommand(const SkRegion& region, const SkPaint& paint);
484     void execute(SkCanvas* canvas) const override;
485     bool render(SkCanvas* canvas) const override;
486     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
487 
488 private:
489     SkRegion fRegion;
490     SkPaint  fPaint;
491 
492     typedef SkDrawCommand INHERITED;
493 };
494 
495 class SkDrawTextBlobCommand : public SkDrawCommand {
496 public:
497     SkDrawTextBlobCommand(sk_sp<SkTextBlob> blob, SkScalar x, SkScalar y, const SkPaint& paint);
498 
499     void execute(SkCanvas* canvas) const override;
500     bool render(SkCanvas* canvas) const override;
501     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
502 
503 private:
504     sk_sp<SkTextBlob> fBlob;
505     SkScalar          fXPos;
506     SkScalar          fYPos;
507     SkPaint           fPaint;
508 
509     typedef SkDrawCommand INHERITED;
510 };
511 
512 class SkDrawPatchCommand : public SkDrawCommand {
513 public:
514     SkDrawPatchCommand(const SkPoint cubics[12], const SkColor colors[4],
515                        const SkPoint texCoords[4], SkBlendMode bmode,
516                        const SkPaint& paint);
517     void execute(SkCanvas* canvas) const override;
518     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
519 
520 private:
521     SkPoint fCubics[12];
522     SkColor* fColorsPtr;
523     SkColor  fColors[4];
524     SkPoint* fTexCoordsPtr;
525     SkPoint  fTexCoords[4];
526     SkBlendMode fBlendMode;
527     SkPaint fPaint;
528 
529     typedef SkDrawCommand INHERITED;
530 };
531 
532 
533 class SkDrawRectCommand : public SkDrawCommand {
534 public:
535     SkDrawRectCommand(const SkRect& rect, const SkPaint& paint);
536     void execute(SkCanvas* canvas) const override;
537     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
538 
539 private:
540     SkRect  fRect;
541     SkPaint fPaint;
542 
543     typedef SkDrawCommand INHERITED;
544 };
545 
546 class SkDrawEdgeAARectCommand : public SkDrawCommand {
547 public:
548     SkDrawEdgeAARectCommand(const SkRect& rect, SkCanvas::QuadAAFlags aa, SkColor color,
549                             SkBlendMode mode);
550     void execute(SkCanvas* canvas) const override;
551 
552 private:
553     SkRect  fRect;
554     SkCanvas::QuadAAFlags fAA;
555     SkColor fColor;
556     SkBlendMode fMode;
557 
558     typedef SkDrawCommand INHERITED;
559 };
560 
561 class SkDrawRRectCommand : public SkDrawCommand {
562 public:
563     SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint);
564     void execute(SkCanvas* canvas) const override;
565     bool render(SkCanvas* canvas) const override;
566     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
567 
568 private:
569     SkRRect fRRect;
570     SkPaint fPaint;
571 
572     typedef SkDrawCommand INHERITED;
573 };
574 
575 class SkDrawDRRectCommand : public SkDrawCommand {
576 public:
577     SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner,
578                         const SkPaint& paint);
579     void execute(SkCanvas* canvas) const override;
580     bool render(SkCanvas* canvas) const override;
581     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
582 
583 private:
584     SkRRect fOuter;
585     SkRRect fInner;
586     SkPaint fPaint;
587 
588     typedef SkDrawCommand INHERITED;
589 };
590 
591 class SkDrawVerticesCommand : public SkDrawCommand {
592 public:
593     SkDrawVerticesCommand(sk_sp<SkVertices>, SkBlendMode, const SkPaint&);
594 
595     void execute(SkCanvas* canvas) const override;
596 
597 private:
598     sk_sp<SkVertices>   fVertices;
599     SkBlendMode         fBlendMode;
600     SkPaint             fPaint;
601 
602     typedef SkDrawCommand INHERITED;
603 };
604 
605 class SkDrawAtlasCommand : public SkDrawCommand {
606 public:
607     SkDrawAtlasCommand(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
608                        SkBlendMode, const SkRect*, const SkPaint*);
609 
610     void execute(SkCanvas* canvas) const override;
611 
612 private:
613     sk_sp<const SkImage> fImage;
614     SkTDArray<SkRSXform> fXform;
615     SkTDArray<SkRect>    fTex;
616     SkTDArray<SkColor>   fColors;
617     SkBlendMode          fBlendMode;
618     SkTLazy<SkRect>      fCull;
619     SkTLazy<SkPaint>     fPaint;
620 
621     typedef SkDrawCommand INHERITED;
622 };
623 
624 class SkSaveCommand : public SkDrawCommand {
625 public:
626     SkSaveCommand();
627     void execute(SkCanvas* canvas) const override;
628 
629 private:
630     typedef SkDrawCommand INHERITED;
631 };
632 
633 class SkSaveLayerCommand : public SkDrawCommand {
634 public:
635     SkSaveLayerCommand(const SkCanvas::SaveLayerRec&);
636     void execute(SkCanvas* canvas) const override;
637     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
638 
639 private:
640     SkTLazy<SkRect>            fBounds;
641     SkTLazy<SkPaint>           fPaint;
642     sk_sp<const SkImageFilter> fBackdrop;
643     uint32_t                   fSaveLayerFlags;
644 
645     typedef SkDrawCommand INHERITED;
646 };
647 
648 class SkSetMatrixCommand : public SkDrawCommand {
649 public:
650     SkSetMatrixCommand(const SkMatrix& matrix);
651     void execute(SkCanvas* canvas) const override;
652     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
653 
654 private:
655     SkMatrix fMatrix;
656 
657     typedef SkDrawCommand INHERITED;
658 };
659 
660 class SkDrawShadowCommand : public SkDrawCommand {
661 public:
662     SkDrawShadowCommand(const SkPath& path, const SkDrawShadowRec& rec);
663     void execute(SkCanvas* canvas) const override;
664     bool render(SkCanvas* canvas) const override;
665     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
666 
667 private:
668     SkPath           fPath;
669     SkDrawShadowRec  fShadowRec;
670 
671     typedef SkDrawCommand INHERITED;
672 };
673 
674 class SkDrawDrawableCommand : public SkDrawCommand {
675 public:
676     SkDrawDrawableCommand(SkDrawable*, const SkMatrix*);
677     void execute(SkCanvas* canvas) const override;
678 
679 private:
680     sk_sp<SkDrawable> fDrawable;
681     SkTLazy<SkMatrix> fMatrix;
682 
683     typedef SkDrawCommand INHERITED;
684 };
685 #endif
686