• 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 "include/core/SkBitmap.h"
12 #include "include/core/SkCanvas.h"
13 #include "include/core/SkFlattenable.h"
14 #include "include/core/SkPath.h"
15 #include "include/core/SkRRect.h"
16 #include "include/core/SkRSXform.h"
17 #include "include/core/SkRegion.h"
18 #include "include/core/SkString.h"
19 #include "include/core/SkVertices.h"
20 #include "include/private/SkTDArray.h"
21 #include "src/core/SkDrawShadowInfo.h"
22 #include "src/core/SkTLazy.h"
23 #include "src/utils/SkJSONWriter.h"
24 #include "tools/UrlDataManager.h"
25 
26 class DebugLayerManager;
27 
28 class DrawCommand {
29 public:
30     enum OpType {
31         kBeginDrawPicture_OpType,
32         kClear_OpType,
33         kClipPath_OpType,
34         kClipRegion_OpType,
35         kClipRect_OpType,
36         kClipRRect_OpType,
37         kClipShader_OpType,
38         kResetClip_OpType,
39         kConcat_OpType,
40         kConcat44_OpType,
41         kDrawAnnotation_OpType,
42         kDrawBitmap_OpType,
43         kDrawBitmapRect_OpType,
44         kDrawDRRect_OpType,
45         kDrawImage_OpType,
46         kDrawImageLattice_OpType,
47         kDrawImageRect_OpType,
48         kDrawImageRectLayer_OpType, // unique to DebugCanvas
49         kDrawOval_OpType,
50         kDrawArc_OpType,
51         kDrawPaint_OpType,
52         kDrawPatch_OpType,
53         kDrawPath_OpType,
54         kDrawPoints_OpType,
55         kDrawRect_OpType,
56         kDrawRRect_OpType,
57         kDrawRegion_OpType,
58         kDrawShadow_OpType,
59         kDrawTextBlob_OpType,
60         kDrawVertices_OpType,
61         kDrawAtlas_OpType,
62         kDrawDrawable_OpType,
63         kDrawEdgeAAQuad_OpType,
64         kDrawEdgeAAImageSet_OpType,
65         kEndDrawPicture_OpType,
66         kRestore_OpType,
67         kSave_OpType,
68         kSaveLayer_OpType,
69         kSetMatrix_OpType,
70         kSetM44_OpType,
71 
72         kLast_OpType = kSetM44_OpType
73     };
74 
75     static const int kOpTypeCount = kLast_OpType + 1;
76 
77     static void WritePNG(SkBitmap bitmap, SkWStream& out);
78 
79     DrawCommand(OpType opType);
80 
~DrawCommand()81     virtual ~DrawCommand() {}
82 
isVisible()83     bool isVisible() const { return fVisible; }
84 
setVisible(bool toggle)85     void setVisible(bool toggle) { fVisible = toggle; }
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 MakeJsonMatrix44(SkJSONWriter&, const SkM44&);
105     static void MakeJsonPath(SkJSONWriter&, const SkPath& path);
106     static void MakeJsonRegion(SkJSONWriter&, const SkRegion& region);
107     static void MakeJsonPaint(SkJSONWriter&, const SkPaint& paint, UrlDataManager& urlDataManager);
108     static void MakeJsonLattice(SkJSONWriter&, const SkCanvas::Lattice& lattice);
109 
110     static void flatten(const SkFlattenable* flattenable,
111                         SkJSONWriter&        writer,
112                         UrlDataManager&      urlDataManager);
113     static bool flatten(const SkImage& image, SkJSONWriter& writer, UrlDataManager& urlDataManager);
114     static bool flatten(const SkBitmap& bitmap,
115                         SkJSONWriter&   writer,
116                         UrlDataManager& urlDataManager);
getOpType()117     OpType getOpType() const { return fOpType; }
118 
119 private:
120     OpType fOpType;
121     bool   fVisible;
122 };
123 
124 class RestoreCommand : public DrawCommand {
125 public:
126     RestoreCommand();
127     void execute(SkCanvas* canvas) const override;
128 
129 private:
130     using INHERITED = DrawCommand;
131 };
132 
133 class ClearCommand : public DrawCommand {
134 public:
135     ClearCommand(SkColor color);
136     void execute(SkCanvas* canvas) const override;
137     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
138 
139 private:
140     SkColor fColor;
141 
142     using INHERITED = DrawCommand;
143 };
144 
145 class ClipPathCommand : public DrawCommand {
146 public:
147     ClipPathCommand(const SkPath& path, SkClipOp op, bool doAA);
148     void execute(SkCanvas* canvas) const override;
149     bool render(SkCanvas* canvas) const override;
150     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
151 
152 private:
153     SkPath   fPath;
154     SkClipOp fOp;
155     bool     fDoAA;
156 
157     using INHERITED = DrawCommand;
158 };
159 
160 class ClipRegionCommand : public DrawCommand {
161 public:
162     ClipRegionCommand(const SkRegion& region, SkClipOp op);
163     void execute(SkCanvas* canvas) const override;
164     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
165 
166 private:
167     SkRegion fRegion;
168     SkClipOp fOp;
169 
170     using INHERITED = DrawCommand;
171 };
172 
173 class ClipRectCommand : public DrawCommand {
174 public:
175     ClipRectCommand(const SkRect& rect, SkClipOp op, bool doAA);
176     void execute(SkCanvas* canvas) const override;
177     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
178 
179 private:
180     SkRect   fRect;
181     SkClipOp fOp;
182     bool     fDoAA;
183 
184     using INHERITED = DrawCommand;
185 };
186 
187 class ClipRRectCommand : public DrawCommand {
188 public:
189     ClipRRectCommand(const SkRRect& rrect, SkClipOp op, bool doAA);
190     void execute(SkCanvas* canvas) const override;
191     bool render(SkCanvas* canvas) const override;
192     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
193 
194 private:
195     SkRRect  fRRect;
196     SkClipOp fOp;
197     bool     fDoAA;
198 
199     using INHERITED = DrawCommand;
200 };
201 
202 class ClipShaderCommand : public DrawCommand {
203 public:
204     ClipShaderCommand(sk_sp<SkShader>, SkClipOp);
205     void execute(SkCanvas* canvas) const override;
206     bool render(SkCanvas* canvas) const override;
207     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
208 
209 private:
210     sk_sp<SkShader> fShader;
211     SkClipOp fOp;
212 
213     using INHERITED = DrawCommand;
214 };
215 
216 class ResetClipCommand : public DrawCommand {
217 public:
218     ResetClipCommand();
219     void execute(SkCanvas* canvas) const override;
220 
221 private:
222     using INHERITED = DrawCommand;
223 };
224 
225 class ConcatCommand : public DrawCommand {
226 public:
227     ConcatCommand(const SkMatrix& matrix);
228     void execute(SkCanvas* canvas) const override;
229     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
230 
231 private:
232     SkMatrix fMatrix;
233 
234     using INHERITED = DrawCommand;
235 };
236 
237 class Concat44Command : public DrawCommand {
238 public:
239     Concat44Command(const SkM44& matrix);
240     void execute(SkCanvas* canvas) const override;
241     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
242 
243 private:
244     SkM44 fMatrix;
245 
246     using INHERITED = DrawCommand;
247 };
248 
249 class DrawAnnotationCommand : public DrawCommand {
250 public:
251     DrawAnnotationCommand(const SkRect&, const char key[], sk_sp<SkData> value);
252     void execute(SkCanvas* canvas) const override;
253     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
254 
255 private:
256     SkRect        fRect;
257     SkString      fKey;
258     sk_sp<SkData> fValue;
259 
260     using INHERITED = DrawCommand;
261 };
262 
263 class DrawImageCommand : public DrawCommand {
264 public:
265     DrawImageCommand(const SkImage* image, SkScalar left, SkScalar top,
266                      const SkSamplingOptions&, const SkPaint* paint);
267     void execute(SkCanvas* canvas) const override;
268     bool render(SkCanvas* canvas) const override;
269     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
270     uint64_t imageId(UrlDataManager& udb) const;
271 
272 private:
273     sk_sp<const SkImage> fImage;
274     SkScalar             fLeft;
275     SkScalar             fTop;
276     SkSamplingOptions    fSampling;
277     SkTLazy<SkPaint>     fPaint;
278 
279     using INHERITED = DrawCommand;
280 };
281 
282 class DrawImageLatticeCommand : public DrawCommand {
283 public:
284     DrawImageLatticeCommand(const SkImage*           image,
285                             const SkCanvas::Lattice& lattice,
286                             const SkRect&            dst,
287                             SkFilterMode,
288                             const SkPaint*           paint);
289     void execute(SkCanvas* canvas) const override;
290     bool render(SkCanvas* canvas) const override;
291     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
292     uint64_t imageId(UrlDataManager& udb) const;
293 
294 private:
295     sk_sp<const SkImage> fImage;
296     SkCanvas::Lattice    fLattice;
297     SkRect               fDst;
298     SkFilterMode         fFilter;
299     SkTLazy<SkPaint>     fPaint;
300 
301     using INHERITED = DrawCommand;
302 };
303 
304 class DrawImageRectCommand : public DrawCommand {
305 public:
306     DrawImageRectCommand(const SkImage*              image,
307                          const SkRect&               src,
308                          const SkRect&               dst,
309                          const SkSamplingOptions&    sampling,
310                          const SkPaint*              paint,
311                          SkCanvas::SrcRectConstraint constraint);
312     void execute(SkCanvas* canvas) const override;
313     bool render(SkCanvas* canvas) const override;
314     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
315     uint64_t imageId(UrlDataManager& udm) const;
316 
317 private:
318     sk_sp<const SkImage>        fImage;
319     SkRect                      fSrc;
320     SkRect                      fDst;
321     SkSamplingOptions           fSampling;
322     SkTLazy<SkPaint>            fPaint;
323     SkCanvas::SrcRectConstraint fConstraint;
324 
325     using INHERITED = DrawCommand;
326 };
327 
328 // Command for resolving the deferred SkImage representing an android layer
329 // Functions like DrawImageRect except it uses the saved UrlDataManager to resolve the image
330 // at the time execute() is called.
331 class DrawImageRectLayerCommand : public DrawCommand {
332 public:
333     DrawImageRectLayerCommand(DebugLayerManager*          layerManager,
334                               const int                   nodeId,
335                               const int                   frame,
336                               const SkRect&               src,
337                               const SkRect&               dst,
338                               const SkSamplingOptions&    sampling,
339                               const SkPaint*              paint,
340                               SkCanvas::SrcRectConstraint constraint);
341     void execute(SkCanvas* canvas) const override;
342     bool render(SkCanvas* canvas) const override;
343     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
344 
345 private:
346     DebugLayerManager*          fLayerManager;
347     int                         fNodeId;
348     int                         fFrame;
349     SkRect                      fSrc;
350     SkRect                      fDst;
351     SkSamplingOptions           fSampling;
352     SkTLazy<SkPaint>            fPaint;
353     SkCanvas::SrcRectConstraint fConstraint;
354 
355     using INHERITED = DrawCommand;
356 };
357 
358 class DrawOvalCommand : public DrawCommand {
359 public:
360     DrawOvalCommand(const SkRect& oval, const SkPaint& paint);
361     void execute(SkCanvas* canvas) const override;
362     bool render(SkCanvas* canvas) const override;
363     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
364 
365 private:
366     SkRect  fOval;
367     SkPaint fPaint;
368 
369     using INHERITED = DrawCommand;
370 };
371 
372 class DrawArcCommand : public DrawCommand {
373 public:
374     DrawArcCommand(const SkRect&  oval,
375                    SkScalar       startAngle,
376                    SkScalar       sweepAngle,
377                    bool           useCenter,
378                    const SkPaint& paint);
379     void execute(SkCanvas* canvas) const override;
380     bool render(SkCanvas* canvas) const override;
381     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
382 
383 private:
384     SkRect   fOval;
385     SkScalar fStartAngle;
386     SkScalar fSweepAngle;
387     bool     fUseCenter;
388     SkPaint  fPaint;
389 
390     using INHERITED = DrawCommand;
391 };
392 
393 class DrawPaintCommand : public DrawCommand {
394 public:
395     DrawPaintCommand(const SkPaint& paint);
396     void execute(SkCanvas* canvas) const override;
397     bool render(SkCanvas* canvas) const override;
398     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
399 
400 private:
401     SkPaint fPaint;
402 
403     using INHERITED = DrawCommand;
404 };
405 
406 class DrawBehindCommand : public DrawCommand {
407 public:
408     DrawBehindCommand(const SkPaint& paint);
409     void execute(SkCanvas* canvas) const override;
410     bool render(SkCanvas* canvas) const override;
411     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
412 
413 private:
414     SkPaint fPaint;
415 
416     using INHERITED = DrawCommand;
417 };
418 
419 class DrawPathCommand : public DrawCommand {
420 public:
421     DrawPathCommand(const SkPath& path, const SkPaint& paint);
422     void execute(SkCanvas* canvas) const override;
423     bool render(SkCanvas* canvas) const override;
424     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
425 
426 private:
427     SkPath  fPath;
428     SkPaint fPaint;
429 
430     using INHERITED = DrawCommand;
431 };
432 
433 class BeginDrawPictureCommand : public DrawCommand {
434 public:
435     BeginDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint);
436 
437     void execute(SkCanvas* canvas) const override;
438     bool render(SkCanvas* canvas) const override;
439 
440 private:
441     sk_sp<const SkPicture> fPicture;
442     SkTLazy<SkMatrix>      fMatrix;
443     SkTLazy<SkPaint>       fPaint;
444 
445     using INHERITED = DrawCommand;
446 };
447 
448 class EndDrawPictureCommand : public DrawCommand {
449 public:
450     EndDrawPictureCommand(bool restore);
451 
452     void execute(SkCanvas* canvas) const override;
453 
454 private:
455     bool fRestore;
456 
457     using INHERITED = DrawCommand;
458 };
459 
460 class DrawPointsCommand : public DrawCommand {
461 public:
462     DrawPointsCommand(SkCanvas::PointMode mode,
463                       size_t              count,
464                       const SkPoint       pts[],
465                       const SkPaint&      paint);
466     void execute(SkCanvas* canvas) const override;
467     bool render(SkCanvas* canvas) const override;
468     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
469 
470 private:
471     SkCanvas::PointMode fMode;
472     SkTDArray<SkPoint>  fPts;
473     SkPaint             fPaint;
474 
475     using INHERITED = DrawCommand;
476 };
477 
478 class DrawRegionCommand : public DrawCommand {
479 public:
480     DrawRegionCommand(const SkRegion& region, const SkPaint& paint);
481     void execute(SkCanvas* canvas) const override;
482     bool render(SkCanvas* canvas) const override;
483     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
484 
485 private:
486     SkRegion fRegion;
487     SkPaint  fPaint;
488 
489     using INHERITED = DrawCommand;
490 };
491 
492 class DrawTextBlobCommand : public DrawCommand {
493 public:
494     DrawTextBlobCommand(sk_sp<SkTextBlob> blob, SkScalar x, SkScalar y, const SkPaint& paint);
495 
496     void execute(SkCanvas* canvas) const override;
497     bool render(SkCanvas* canvas) const override;
498     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
499 
500 private:
501     sk_sp<SkTextBlob> fBlob;
502     SkScalar          fXPos;
503     SkScalar          fYPos;
504     SkPaint           fPaint;
505 
506     using INHERITED = DrawCommand;
507 };
508 
509 class DrawPatchCommand : public DrawCommand {
510 public:
511     DrawPatchCommand(const SkPoint  cubics[12],
512                      const SkColor  colors[4],
513                      const SkPoint  texCoords[4],
514                      SkBlendMode    bmode,
515                      const SkPaint& paint);
516     void execute(SkCanvas* canvas) const override;
517     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
518 
519 private:
520     SkPoint     fCubics[12];
521     SkColor*    fColorsPtr;
522     SkColor     fColors[4];
523     SkPoint*    fTexCoordsPtr;
524     SkPoint     fTexCoords[4];
525     SkBlendMode fBlendMode;
526     SkPaint     fPaint;
527 
528     using INHERITED = DrawCommand;
529 };
530 
531 class DrawRectCommand : public DrawCommand {
532 public:
533     DrawRectCommand(const SkRect& rect, const SkPaint& paint);
534     void execute(SkCanvas* canvas) const override;
535     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
536 
537 private:
538     SkRect  fRect;
539     SkPaint fPaint;
540 
541     using INHERITED = DrawCommand;
542 };
543 
544 class DrawRRectCommand : public DrawCommand {
545 public:
546     DrawRRectCommand(const SkRRect& rrect, const SkPaint& paint);
547     void execute(SkCanvas* canvas) const override;
548     bool render(SkCanvas* canvas) const override;
549     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
550 
551 private:
552     SkRRect fRRect;
553     SkPaint fPaint;
554 
555     using INHERITED = DrawCommand;
556 };
557 
558 class DrawDRRectCommand : public DrawCommand {
559 public:
560     DrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint);
561     void execute(SkCanvas* canvas) const override;
562     bool render(SkCanvas* canvas) const override;
563     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
564 
565 private:
566     SkRRect fOuter;
567     SkRRect fInner;
568     SkPaint fPaint;
569 
570     using INHERITED = DrawCommand;
571 };
572 
573 class DrawVerticesCommand : public DrawCommand {
574 public:
575     DrawVerticesCommand(sk_sp<SkVertices>, SkBlendMode, const SkPaint&);
576 
577     void execute(SkCanvas* canvas) const override;
578 
579 private:
580     sk_sp<SkVertices> fVertices;
581     SkBlendMode       fBlendMode;
582     SkPaint           fPaint;
583 
584     using INHERITED = DrawCommand;
585 };
586 
587 class DrawAtlasCommand : public DrawCommand {
588 public:
589     DrawAtlasCommand(const SkImage*,
590                      const SkRSXform[],
591                      const SkRect[],
592                      const SkColor[],
593                      int,
594                      SkBlendMode,
595                      const SkSamplingOptions&,
596                      const SkRect*,
597                      const SkPaint*);
598 
599     void execute(SkCanvas* canvas) const override;
600 
601 private:
602     sk_sp<const SkImage> fImage;
603     SkTDArray<SkRSXform> fXform;
604     SkTDArray<SkRect>    fTex;
605     SkTDArray<SkColor>   fColors;
606     SkBlendMode          fBlendMode;
607     SkSamplingOptions    fSampling;
608     SkTLazy<SkRect>      fCull;
609     SkTLazy<SkPaint>     fPaint;
610 
611     using INHERITED = DrawCommand;
612 };
613 
614 class SaveCommand : public DrawCommand {
615 public:
616     SaveCommand();
617     void execute(SkCanvas* canvas) const override;
618 
619 private:
620     using INHERITED = DrawCommand;
621 };
622 
623 class SaveLayerCommand : public DrawCommand {
624 public:
625     SaveLayerCommand(const SkCanvas::SaveLayerRec&);
626     void execute(SkCanvas* canvas) const override;
627     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
628 
629 private:
630     SkTLazy<SkRect>            fBounds;
631     SkTLazy<SkPaint>           fPaint;
632     sk_sp<const SkImageFilter> fBackdrop;
633     uint32_t                   fSaveLayerFlags;
634     SkScalar                   fBackdropScale;
635 
636     using INHERITED = DrawCommand;
637 };
638 
639 class SetMatrixCommand : public DrawCommand {
640 public:
641     SetMatrixCommand(const SkMatrix& matrix);
642     void execute(SkCanvas* canvas) const override;
643     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
644 
645 private:
646     SkMatrix fMatrix;
647 
648     using INHERITED = DrawCommand;
649 };
650 
651 class SetM44Command : public DrawCommand {
652 public:
653     SetM44Command(const SkM44& matrix);
654     void execute(SkCanvas* canvas) const override;
655     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
656 
657 private:
658     SkM44 fMatrix;
659 
660     using INHERITED = DrawCommand;
661 };
662 
663 class DrawShadowCommand : public DrawCommand {
664 public:
665     DrawShadowCommand(const SkPath& path, const SkDrawShadowRec& rec);
666     void execute(SkCanvas* canvas) const override;
667     bool render(SkCanvas* canvas) const override;
668     void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
669 
670 private:
671     SkPath          fPath;
672     SkDrawShadowRec fShadowRec;
673 
674     using INHERITED = DrawCommand;
675 };
676 
677 class DrawDrawableCommand : public DrawCommand {
678 public:
679     DrawDrawableCommand(SkDrawable*, const SkMatrix*);
680     void execute(SkCanvas* canvas) const override;
681 
682 private:
683     sk_sp<SkDrawable> fDrawable;
684     SkTLazy<SkMatrix> fMatrix;
685 
686     using INHERITED = DrawCommand;
687 };
688 
689 class DrawEdgeAAQuadCommand : public DrawCommand {
690 public:
691     DrawEdgeAAQuadCommand(const SkRect&         rect,
692                           const SkPoint         clip[4],
693                           SkCanvas::QuadAAFlags aa,
694                           const SkColor4f&      color,
695                           SkBlendMode           mode);
696     void execute(SkCanvas* canvas) const override;
697 
698 private:
699     SkRect                fRect;
700     SkPoint               fClip[4];
701     int                   fHasClip;
702     SkCanvas::QuadAAFlags fAA;
703     SkColor4f             fColor;
704     SkBlendMode           fMode;
705 
706     using INHERITED = DrawCommand;
707 };
708 
709 class DrawEdgeAAImageSetCommand : public DrawCommand {
710 public:
711     DrawEdgeAAImageSetCommand(const SkCanvas::ImageSetEntry[],
712                               int count,
713                               const SkPoint[],
714                               const SkMatrix[],
715                               const SkSamplingOptions&,
716                               const SkPaint*,
717                               SkCanvas::SrcRectConstraint);
718     void execute(SkCanvas* canvas) const override;
719 
720 private:
721     SkAutoTArray<SkCanvas::ImageSetEntry> fSet;
722     int                                   fCount;
723     SkAutoTArray<SkPoint>                 fDstClips;
724     SkAutoTArray<SkMatrix>                fPreViewMatrices;
725     SkSamplingOptions                     fSampling;
726     SkTLazy<SkPaint>                      fPaint;
727     SkCanvas::SrcRectConstraint           fConstraint;
728 
729     using INHERITED = DrawCommand;
730 };
731 #endif
732