chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 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 | |
Florin Malita | ab244f0 | 2017-05-03 19:16:58 +0000 | [diff] [blame] | 11 | #include "SkBitmap.h" |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 12 | #include "SkCanvas.h" |
Mike Reed | 086a427 | 2017-07-18 10:53:11 -0400 | [diff] [blame] | 13 | #include "SkFlattenable.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 14 | #include "SkTLazy.h" |
| 15 | #include "SkPath.h" |
Mike Reed | 267be7f | 2017-02-13 09:32:54 -0500 | [diff] [blame] | 16 | #include "SkRegion.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 17 | #include "SkRRect.h" |
reed | 45561a0 | 2016-07-07 12:47:17 -0700 | [diff] [blame] | 18 | #include "SkRSXform.h" |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 19 | #include "SkString.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 20 | #include "SkTDArray.h" |
Mike Reed | fed9cfd | 2017-03-17 12:09:04 -0400 | [diff] [blame] | 21 | #include "SkVertices.h" |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 22 | #include "SkJSONCPP.h" |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 23 | #include "UrlDataManager.h" |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 24 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 25 | class SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 26 | public: |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 27 | enum OpType { |
fmalita | 160ebb2 | 2015-04-01 20:58:37 -0700 | [diff] [blame] | 28 | kBeginDrawPicture_OpType, |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 29 | kClear_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 30 | kClipPath_OpType, |
| 31 | kClipRegion_OpType, |
| 32 | kClipRect_OpType, |
| 33 | kClipRRect_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 34 | kConcat_OpType, |
reed | 97660cc | 2016-06-28 18:54:19 -0700 | [diff] [blame] | 35 | kDrawAnnotation_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 36 | kDrawBitmap_OpType, |
| 37 | kDrawBitmapNine_OpType, |
| 38 | kDrawBitmapRect_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 39 | kDrawDRRect_OpType, |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 40 | kDrawImage_OpType, |
Stan Iliev | ac42aeb | 2017-01-12 16:20:50 -0500 | [diff] [blame] | 41 | kDrawImageLattice_OpType, |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 42 | kDrawImageNine_OpType, |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 43 | kDrawImageRect_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 44 | kDrawOval_OpType, |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 45 | kDrawArc_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 46 | kDrawPaint_OpType, |
| 47 | kDrawPatch_OpType, |
| 48 | kDrawPath_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 49 | kDrawPoints_OpType, |
| 50 | kDrawPosText_OpType, |
| 51 | kDrawPosTextH_OpType, |
| 52 | kDrawRect_OpType, |
| 53 | kDrawRRect_OpType, |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 54 | kDrawRegion_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 55 | kDrawText_OpType, |
| 56 | kDrawTextBlob_OpType, |
| 57 | kDrawTextOnPath_OpType, |
reed | 45561a0 | 2016-07-07 12:47:17 -0700 | [diff] [blame] | 58 | kDrawTextRSXform_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 59 | kDrawVertices_OpType, |
fmalita | 160ebb2 | 2015-04-01 20:58:37 -0700 | [diff] [blame] | 60 | kEndDrawPicture_OpType, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 61 | kRestore_OpType, |
| 62 | kSave_OpType, |
| 63 | kSaveLayer_OpType, |
| 64 | kSetMatrix_OpType, |
robertphillips | 72942b8 | 2015-02-12 06:37:12 -0800 | [diff] [blame] | 65 | |
Jim Van Verth | 343fe49 | 2017-05-02 16:49:24 -0400 | [diff] [blame] | 66 | kLast_OpType = kSetMatrix_OpType |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | static const int kOpTypeCount = kLast_OpType + 1; |
| 70 | |
halcanary | a73d76a | 2016-10-17 13:19:02 -0700 | [diff] [blame] | 71 | static void WritePNG(const uint8_t* rgba, unsigned width, unsigned height, |
msarett | a5cf4f4 | 2016-06-30 10:06:51 -0700 | [diff] [blame] | 72 | SkWStream& out, bool isOpaque); |
ethannicholas | f67531f | 2016-03-21 10:19:39 -0700 | [diff] [blame] | 73 | |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 74 | SkDrawCommand(OpType opType); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 75 | |
Brian Osman | 255735e | 2018-04-06 14:51:42 -0400 | [diff] [blame^] | 76 | virtual ~SkDrawCommand() {} |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 77 | |
chudy@google.com | 0b5bbb0 | 2012-07-31 19:55:32 +0000 | [diff] [blame] | 78 | bool isVisible() const { |
| 79 | return fVisible; |
| 80 | } |
| 81 | |
| 82 | void setVisible(bool toggle) { |
| 83 | fVisible = toggle; |
| 84 | } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 85 | |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 86 | virtual void execute(SkCanvas*) const = 0; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 87 | |
robertphillips@google.com | 6ede1fe | 2013-06-06 23:59:28 +0000 | [diff] [blame] | 88 | virtual bool render(SkCanvas* canvas) const { return false; } |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 89 | |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 90 | virtual Json::Value toJSON(UrlDataManager& urlDataManager) const; |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 91 | |
| 92 | /* Converts a JSON representation of a command into a newly-allocated SkDrawCommand object. It |
| 93 | * is the caller's responsibility to delete this object. This method may return null if an error |
| 94 | * occurs. |
| 95 | */ |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 96 | static SkDrawCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 97 | |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 98 | static const char* GetCommandString(OpType type); |
robertphillips@google.com | 8a1cdae | 2012-11-19 20:44:29 +0000 | [diff] [blame] | 99 | |
joshualitt | bd72413 | 2016-03-03 11:39:38 -0800 | [diff] [blame] | 100 | // Helper methods for converting things to JSON |
brianosman | fad9856 | 2016-05-04 11:06:28 -0700 | [diff] [blame] | 101 | static Json::Value MakeJsonColor(const SkColor color); |
brianosman | 97bbf82 | 2016-09-25 13:15:58 -0700 | [diff] [blame] | 102 | static Json::Value MakeJsonColor4f(const SkColor4f& color); |
brianosman | fad9856 | 2016-05-04 11:06:28 -0700 | [diff] [blame] | 103 | static Json::Value MakeJsonPoint(const SkPoint& point); |
| 104 | static Json::Value MakeJsonPoint(SkScalar x, SkScalar y); |
| 105 | static Json::Value MakeJsonRect(const SkRect& rect); |
joshualitt | bd72413 | 2016-03-03 11:39:38 -0800 | [diff] [blame] | 106 | static Json::Value MakeJsonIRect(const SkIRect&); |
| 107 | static Json::Value MakeJsonMatrix(const SkMatrix&); |
vjiaoblack | e5de130 | 2016-07-13 14:05:28 -0700 | [diff] [blame] | 108 | static Json::Value MakeJsonScalar(SkScalar); |
brianosman | fad9856 | 2016-05-04 11:06:28 -0700 | [diff] [blame] | 109 | static Json::Value MakeJsonPath(const SkPath& path); |
| 110 | static Json::Value MakeJsonRegion(const SkRegion& region); |
| 111 | static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDataManager); |
Stan Iliev | ac42aeb | 2017-01-12 16:20:50 -0500 | [diff] [blame] | 112 | static Json::Value MakeJsonLattice(const SkCanvas::Lattice& lattice); |
brianosman | fad9856 | 2016-05-04 11:06:28 -0700 | [diff] [blame] | 113 | |
| 114 | static void flatten(const SkFlattenable* flattenable, Json::Value* target, |
| 115 | UrlDataManager& urlDataManager); |
| 116 | static bool flatten(const SkImage& image, Json::Value* target, |
| 117 | UrlDataManager& urlDataManager); |
| 118 | static bool flatten(const SkBitmap& bitmap, Json::Value* target, |
| 119 | UrlDataManager& urlDataManager); |
joshualitt | bd72413 | 2016-03-03 11:39:38 -0800 | [diff] [blame] | 120 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 121 | private: |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 122 | OpType fOpType; |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 123 | bool fVisible; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 124 | }; |
| 125 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 126 | class SkRestoreCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 127 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 128 | SkRestoreCommand(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 129 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 130 | static SkRestoreCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 131 | |
| 132 | private: |
| 133 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 134 | }; |
| 135 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 136 | class SkClearCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 137 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 138 | SkClearCommand(SkColor color); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 139 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 140 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 141 | static SkClearCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 142 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 143 | private: |
| 144 | SkColor fColor; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 145 | |
| 146 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 147 | }; |
| 148 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 149 | class SkClipPathCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 150 | public: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 151 | SkClipPathCommand(const SkPath& path, SkClipOp op, bool doAA); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 152 | void execute(SkCanvas* canvas) const override; |
| 153 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 154 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 155 | static SkClipPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 156 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 157 | private: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 158 | SkPath fPath; |
| 159 | SkClipOp fOp; |
| 160 | bool fDoAA; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 161 | |
| 162 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 163 | }; |
| 164 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 165 | class SkClipRegionCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 166 | public: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 167 | SkClipRegionCommand(const SkRegion& region, SkClipOp op); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 168 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 169 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 170 | static SkClipRegionCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 171 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 172 | private: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 173 | SkRegion fRegion; |
| 174 | SkClipOp fOp; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 175 | |
| 176 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 177 | }; |
| 178 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 179 | class SkClipRectCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 180 | public: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 181 | SkClipRectCommand(const SkRect& rect, SkClipOp op, bool doAA); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 182 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 183 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 184 | static SkClipRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 185 | |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 186 | const SkRect& rect() const { return fRect; } |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 187 | SkClipOp op() const { return fOp; } |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 188 | bool doAA() const { return fDoAA; } |
| 189 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 190 | private: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 191 | SkRect fRect; |
| 192 | SkClipOp fOp; |
| 193 | bool fDoAA; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 194 | |
| 195 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 196 | }; |
| 197 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 198 | class SkClipRRectCommand : public SkDrawCommand { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 199 | public: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 200 | SkClipRRectCommand(const SkRRect& rrect, SkClipOp op, bool doAA); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 201 | void execute(SkCanvas* canvas) const override; |
| 202 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 203 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 204 | static SkClipRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 205 | |
| 206 | const SkRRect& rrect() const { return fRRect; } |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 207 | SkClipOp op() const { return fOp; } |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 208 | bool doAA() const { return fDoAA; } |
| 209 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 210 | private: |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 211 | SkRRect fRRect; |
| 212 | SkClipOp fOp; |
| 213 | bool fDoAA; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 214 | |
| 215 | typedef SkDrawCommand INHERITED; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 216 | }; |
| 217 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 218 | class SkConcatCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 219 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 220 | SkConcatCommand(const SkMatrix& matrix); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 221 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 222 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 223 | static SkConcatCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 224 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 225 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 226 | SkMatrix fMatrix; |
| 227 | |
| 228 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 229 | }; |
| 230 | |
reed | 97660cc | 2016-06-28 18:54:19 -0700 | [diff] [blame] | 231 | class SkDrawAnnotationCommand : public SkDrawCommand { |
| 232 | public: |
| 233 | SkDrawAnnotationCommand(const SkRect&, const char key[], sk_sp<SkData> value); |
| 234 | void execute(SkCanvas* canvas) const override; |
| 235 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 236 | static SkDrawAnnotationCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
| 237 | |
| 238 | private: |
| 239 | SkRect fRect; |
| 240 | SkString fKey; |
| 241 | sk_sp<SkData> fValue; |
| 242 | |
| 243 | typedef SkDrawCommand INHERITED; |
| 244 | }; |
| 245 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 246 | class SkDrawBitmapCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 247 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 248 | SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 249 | const SkPaint* paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 250 | void execute(SkCanvas* canvas) const override; |
| 251 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 252 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 253 | static SkDrawBitmapCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 254 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 255 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 256 | SkBitmap fBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 257 | SkScalar fLeft; |
| 258 | SkScalar fTop; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 259 | SkPaint fPaint; |
| 260 | SkPaint* fPaintPtr; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 261 | |
| 262 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 263 | }; |
| 264 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 265 | class SkDrawBitmapNineCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 266 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 267 | SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center, |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 268 | const SkRect& dst, const SkPaint* paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 269 | void execute(SkCanvas* canvas) const override; |
| 270 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 271 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 272 | static SkDrawBitmapNineCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 273 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 274 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 275 | SkBitmap fBitmap; |
| 276 | SkIRect fCenter; |
| 277 | SkRect fDst; |
| 278 | SkPaint fPaint; |
| 279 | SkPaint* fPaintPtr; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 280 | |
| 281 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 282 | }; |
| 283 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 284 | class SkDrawBitmapRectCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 285 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 286 | SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 287 | const SkRect& dst, const SkPaint* paint, |
reed | a5517e2 | 2015-07-14 10:54:12 -0700 | [diff] [blame] | 288 | SkCanvas::SrcRectConstraint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 289 | void execute(SkCanvas* canvas) const override; |
| 290 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 291 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 292 | static SkDrawBitmapRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 293 | |
robertphillips@google.com | c3410b8 | 2013-03-28 12:25:25 +0000 | [diff] [blame] | 294 | const SkBitmap& bitmap() const { return fBitmap; } |
| 295 | |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 296 | // The non-const 'paint' method allows modification of this object's |
| 297 | // SkPaint. For this reason the ctor and setPaint method make a local copy. |
| 298 | // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
| 299 | // (since only an SkPaint* is passed into the ctor). |
| 300 | const SkPaint* paint() const { return fPaintPtr; } |
| 301 | SkPaint* paint() { return fPaintPtr; } |
| 302 | |
| 303 | void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
| 304 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 305 | const SkRect* srcRect() const { return fSrc.isEmpty() ? nullptr : &fSrc; } |
robertphillips@google.com | c3410b8 | 2013-03-28 12:25:25 +0000 | [diff] [blame] | 306 | void setSrcRect(const SkRect& src) { fSrc = src; } |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 307 | |
| 308 | const SkRect& dstRect() const { return fDst; } |
robertphillips@google.com | c3410b8 | 2013-03-28 12:25:25 +0000 | [diff] [blame] | 309 | void setDstRect(const SkRect& dst) { fDst = dst; } |
| 310 | |
reed | a5517e2 | 2015-07-14 10:54:12 -0700 | [diff] [blame] | 311 | SkCanvas::SrcRectConstraint constraint() const { return fConstraint; } |
| 312 | void setConstraint(SkCanvas::SrcRectConstraint constraint) { fConstraint = constraint; } |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 313 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 314 | private: |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 315 | SkBitmap fBitmap; |
| 316 | SkRect fSrc; |
| 317 | SkRect fDst; |
| 318 | SkPaint fPaint; |
| 319 | SkPaint* fPaintPtr; |
reed | a5517e2 | 2015-07-14 10:54:12 -0700 | [diff] [blame] | 320 | SkCanvas::SrcRectConstraint fConstraint; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 321 | |
| 322 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 323 | }; |
| 324 | |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 325 | class SkDrawImageCommand : public SkDrawCommand { |
| 326 | public: |
| 327 | SkDrawImageCommand(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* paint); |
| 328 | void execute(SkCanvas* canvas) const override; |
| 329 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 330 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 331 | static SkDrawImageCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 332 | |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 333 | private: |
Hal Canary | 1b612a8 | 2016-11-03 16:26:13 -0400 | [diff] [blame] | 334 | sk_sp<const SkImage> fImage; |
| 335 | SkScalar fLeft; |
| 336 | SkScalar fTop; |
| 337 | SkTLazy<SkPaint> fPaint; |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 338 | |
| 339 | typedef SkDrawCommand INHERITED; |
| 340 | }; |
| 341 | |
Stan Iliev | ac42aeb | 2017-01-12 16:20:50 -0500 | [diff] [blame] | 342 | class SkDrawImageLatticeCommand : public SkDrawCommand { |
| 343 | public: |
| 344 | SkDrawImageLatticeCommand(const SkImage* image, const SkCanvas::Lattice& lattice, |
| 345 | const SkRect& dst, const SkPaint* paint); |
| 346 | void execute(SkCanvas* canvas) const override; |
| 347 | bool render(SkCanvas* canvas) const override; |
| 348 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 349 | static SkDrawImageLatticeCommand* fromJSON(Json::Value& command, |
| 350 | UrlDataManager& urlDataManager); |
Stan Iliev | ac42aeb | 2017-01-12 16:20:50 -0500 | [diff] [blame] | 351 | |
| 352 | private: |
| 353 | sk_sp<const SkImage> fImage; |
| 354 | SkCanvas::Lattice fLattice; |
| 355 | SkRect fDst; |
| 356 | SkTLazy<SkPaint> fPaint; |
| 357 | |
| 358 | typedef SkDrawCommand INHERITED; |
| 359 | }; |
| 360 | |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 361 | class SkDrawImageNineCommand : public SkDrawCommand { |
| 362 | public: |
| 363 | SkDrawImageNineCommand(const SkImage* image, const SkIRect& center, |
| 364 | const SkRect& dst, const SkPaint* paint); |
| 365 | void execute(SkCanvas* canvas) const override; |
| 366 | bool render(SkCanvas* canvas) const override; |
| 367 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 368 | static SkDrawImageNineCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
| 369 | |
| 370 | private: |
| 371 | sk_sp<const SkImage> fImage; |
| 372 | SkIRect fCenter; |
| 373 | SkRect fDst; |
| 374 | SkPaint fPaint; |
| 375 | SkPaint* fPaintPtr; |
| 376 | |
| 377 | typedef SkDrawCommand INHERITED; |
| 378 | }; |
| 379 | |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 380 | class SkDrawImageRectCommand : public SkDrawCommand { |
| 381 | public: |
| 382 | SkDrawImageRectCommand(const SkImage* image, const SkRect* src, const SkRect& dst, |
| 383 | const SkPaint* paint, SkCanvas::SrcRectConstraint constraint); |
| 384 | void execute(SkCanvas* canvas) const override; |
| 385 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 386 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 387 | static SkDrawImageRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 388 | |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 389 | private: |
Hal Canary | 1b612a8 | 2016-11-03 16:26:13 -0400 | [diff] [blame] | 390 | sk_sp<const SkImage> fImage; |
fmalita | 651c920 | 2015-07-22 10:23:01 -0700 | [diff] [blame] | 391 | SkTLazy<SkRect> fSrc; |
| 392 | SkRect fDst; |
| 393 | SkTLazy<SkPaint> fPaint; |
| 394 | SkCanvas::SrcRectConstraint fConstraint; |
| 395 | |
| 396 | typedef SkDrawCommand INHERITED; |
| 397 | }; |
| 398 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 399 | class SkDrawOvalCommand : public SkDrawCommand { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 400 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 401 | SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 402 | void execute(SkCanvas* canvas) const override; |
| 403 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 404 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 405 | static SkDrawOvalCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 406 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 407 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 408 | SkRect fOval; |
| 409 | SkPaint fPaint; |
| 410 | |
| 411 | typedef SkDrawCommand INHERITED; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 412 | }; |
| 413 | |
bsalomon | ac3aa24 | 2016-08-19 11:25:19 -0700 | [diff] [blame] | 414 | class SkDrawArcCommand : public SkDrawCommand { |
| 415 | public: |
| 416 | SkDrawArcCommand(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, |
| 417 | const SkPaint& paint); |
| 418 | void execute(SkCanvas* canvas) const override; |
| 419 | bool render(SkCanvas* canvas) const override; |
| 420 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 421 | static SkDrawArcCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
| 422 | |
| 423 | private: |
| 424 | SkRect fOval; |
| 425 | SkScalar fStartAngle; |
| 426 | SkScalar fSweepAngle; |
| 427 | bool fUseCenter; |
| 428 | SkPaint fPaint; |
| 429 | |
| 430 | typedef SkDrawCommand INHERITED; |
| 431 | }; |
| 432 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 433 | class SkDrawPaintCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 434 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 435 | SkDrawPaintCommand(const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 436 | void execute(SkCanvas* canvas) const override; |
| 437 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 438 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 439 | static SkDrawPaintCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 440 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 441 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 442 | SkPaint fPaint; |
| 443 | |
| 444 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 445 | }; |
| 446 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 447 | class SkDrawPathCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 448 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 449 | SkDrawPathCommand(const SkPath& path, const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 450 | void execute(SkCanvas* canvas) const override; |
| 451 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 452 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 453 | static SkDrawPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 454 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 455 | private: |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 456 | SkPath fPath; |
| 457 | SkPaint fPaint; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 458 | |
| 459 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 460 | }; |
| 461 | |
fmalita | 160ebb2 | 2015-04-01 20:58:37 -0700 | [diff] [blame] | 462 | class SkBeginDrawPictureCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 463 | public: |
fmalita | 160ebb2 | 2015-04-01 20:58:37 -0700 | [diff] [blame] | 464 | SkBeginDrawPictureCommand(const SkPicture* picture, |
| 465 | const SkMatrix* matrix, |
| 466 | const SkPaint* paint); |
| 467 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 468 | void execute(SkCanvas* canvas) const override; |
| 469 | bool render(SkCanvas* canvas) const override; |
commit-bot@chromium.org | e898e9c | 2013-11-21 17:08:12 +0000 | [diff] [blame] | 470 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 471 | private: |
Hal Canary | 1b612a8 | 2016-11-03 16:26:13 -0400 | [diff] [blame] | 472 | sk_sp<const SkPicture> fPicture; |
| 473 | SkTLazy<SkMatrix> fMatrix; |
| 474 | SkTLazy<SkPaint> fPaint; |
fmalita | 160ebb2 | 2015-04-01 20:58:37 -0700 | [diff] [blame] | 475 | |
| 476 | typedef SkDrawCommand INHERITED; |
| 477 | }; |
| 478 | |
| 479 | class SkEndDrawPictureCommand : public SkDrawCommand { |
| 480 | public: |
| 481 | SkEndDrawPictureCommand(bool restore); |
| 482 | |
| 483 | void execute(SkCanvas* canvas) const override; |
| 484 | |
| 485 | private: |
| 486 | bool fRestore; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 487 | |
| 488 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 489 | }; |
| 490 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 491 | class SkDrawPointsCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 492 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 493 | SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 494 | const SkPaint& paint); |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 495 | ~SkDrawPointsCommand() override { delete [] fPts; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 496 | void execute(SkCanvas* canvas) const override; |
| 497 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 498 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 499 | static SkDrawPointsCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 500 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 501 | private: |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 502 | SkCanvas::PointMode fMode; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 503 | size_t fCount; |
| 504 | SkPoint* fPts; |
| 505 | SkPaint fPaint; |
| 506 | |
| 507 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 508 | }; |
| 509 | |
Brian Osman | c25e269 | 2018-03-12 10:57:28 -0400 | [diff] [blame] | 510 | class SkDrawRegionCommand : public SkDrawCommand { |
| 511 | public: |
| 512 | SkDrawRegionCommand(const SkRegion& region, const SkPaint& paint); |
| 513 | void execute(SkCanvas* canvas) const override; |
| 514 | bool render(SkCanvas* canvas) const override; |
| 515 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 516 | static SkDrawRegionCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
| 517 | |
| 518 | private: |
| 519 | SkRegion fRegion; |
| 520 | SkPaint fPaint; |
| 521 | |
| 522 | typedef SkDrawCommand INHERITED; |
| 523 | }; |
| 524 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 525 | class SkDrawTextCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 526 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 527 | SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 528 | const SkPaint& paint); |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 529 | ~SkDrawTextCommand() override { delete [] fText; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 530 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 531 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 532 | static SkDrawTextCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 533 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 534 | private: |
robertphillips@google.com | 77279cb | 2013-03-25 12:01:45 +0000 | [diff] [blame] | 535 | char* fText; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 536 | size_t fByteLength; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 537 | SkScalar fX; |
| 538 | SkScalar fY; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 539 | SkPaint fPaint; |
| 540 | |
| 541 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 542 | }; |
| 543 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 544 | class SkDrawPosTextCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 545 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 546 | SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[], |
| 547 | const SkPaint& paint); |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 548 | ~SkDrawPosTextCommand() override { delete [] fPos; delete [] fText; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 549 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 550 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 551 | static SkDrawPosTextCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 552 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 553 | private: |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 554 | char* fText; |
| 555 | size_t fByteLength; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 556 | SkPoint* fPos; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 557 | SkPaint fPaint; |
| 558 | |
| 559 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 560 | }; |
| 561 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 562 | class SkDrawTextOnPathCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 563 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 564 | SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& path, |
| 565 | const SkMatrix* matrix, const SkPaint& paint); |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 566 | ~SkDrawTextOnPathCommand() override { delete [] fText; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 567 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 568 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 569 | static SkDrawTextOnPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 570 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 571 | private: |
robertphillips@google.com | 77279cb | 2013-03-25 12:01:45 +0000 | [diff] [blame] | 572 | char* fText; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 573 | size_t fByteLength; |
| 574 | SkPath fPath; |
| 575 | SkMatrix fMatrix; |
| 576 | SkPaint fPaint; |
| 577 | |
| 578 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 579 | }; |
| 580 | |
reed | 45561a0 | 2016-07-07 12:47:17 -0700 | [diff] [blame] | 581 | class SkDrawTextRSXformCommand : public SkDrawCommand { |
| 582 | public: |
| 583 | SkDrawTextRSXformCommand(const void* text, size_t byteLength, const SkRSXform[], |
| 584 | const SkRect*, const SkPaint& paint); |
| 585 | ~SkDrawTextRSXformCommand() override { delete[] fText; delete[] fXform; } |
| 586 | void execute(SkCanvas* canvas) const override; |
| 587 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 588 | static SkDrawTextRSXformCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
| 589 | |
| 590 | private: |
| 591 | char* fText; |
| 592 | size_t fByteLength; |
| 593 | SkRSXform* fXform; |
| 594 | SkRect* fCull; |
| 595 | SkRect fCullStorage; |
| 596 | SkPaint fPaint; |
| 597 | |
| 598 | typedef SkDrawCommand INHERITED; |
| 599 | }; |
| 600 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 601 | class SkDrawPosTextHCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 602 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 603 | SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xpos[], |
| 604 | SkScalar constY, const SkPaint& paint); |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 605 | ~SkDrawPosTextHCommand() override { delete [] fXpos; delete [] fText; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 606 | void execute(SkCanvas* canvas) const override; |
bungeman | 51190df | 2016-03-09 07:42:54 -0800 | [diff] [blame] | 607 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 608 | static SkDrawPosTextHCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 609 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 610 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 611 | SkScalar* fXpos; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 612 | char* fText; |
| 613 | size_t fByteLength; |
| 614 | SkScalar fConstY; |
| 615 | SkPaint fPaint; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 616 | |
| 617 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 618 | }; |
| 619 | |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 620 | class SkDrawTextBlobCommand : public SkDrawCommand { |
| 621 | public: |
fmalita | 37283c2 | 2016-09-13 10:00:23 -0700 | [diff] [blame] | 622 | SkDrawTextBlobCommand(sk_sp<SkTextBlob> blob, SkScalar x, SkScalar y, const SkPaint& paint); |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 623 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 624 | void execute(SkCanvas* canvas) const override; |
| 625 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 626 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 627 | static SkDrawTextBlobCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 628 | |
| 629 | private: |
fmalita | 37283c2 | 2016-09-13 10:00:23 -0700 | [diff] [blame] | 630 | sk_sp<SkTextBlob> fBlob; |
| 631 | SkScalar fXPos; |
| 632 | SkScalar fYPos; |
| 633 | SkPaint fPaint; |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 634 | |
| 635 | typedef SkDrawCommand INHERITED; |
| 636 | }; |
| 637 | |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 638 | class SkDrawPatchCommand : public SkDrawCommand { |
| 639 | public: |
| 640 | SkDrawPatchCommand(const SkPoint cubics[12], const SkColor colors[4], |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 641 | const SkPoint texCoords[4], SkBlendMode bmode, |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 642 | const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 643 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 644 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 645 | static SkDrawPatchCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 646 | |
| 647 | private: |
| 648 | SkPoint fCubics[12]; |
ethannicholas | 1446a9a | 2016-02-10 14:05:02 -0800 | [diff] [blame] | 649 | SkColor* fColorsPtr; |
| 650 | SkColor fColors[4]; |
| 651 | SkPoint* fTexCoordsPtr; |
| 652 | SkPoint fTexCoords[4]; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 653 | SkBlendMode fBlendMode; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 654 | SkPaint fPaint; |
| 655 | |
| 656 | typedef SkDrawCommand INHERITED; |
| 657 | }; |
| 658 | |
| 659 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 660 | class SkDrawRectCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 661 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 662 | SkDrawRectCommand(const SkRect& rect, const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 663 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 664 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 665 | static SkDrawRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 666 | |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 667 | const SkRect& rect() const { return fRect; } |
| 668 | const SkPaint& paint() const { return fPaint; } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 669 | private: |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 670 | SkRect fRect; |
| 671 | SkPaint fPaint; |
| 672 | |
| 673 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 674 | }; |
| 675 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 676 | class SkDrawRRectCommand : public SkDrawCommand { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 677 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 678 | SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 679 | void execute(SkCanvas* canvas) const override; |
| 680 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 681 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 682 | static SkDrawRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 683 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 684 | private: |
| 685 | SkRRect fRRect; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 686 | SkPaint fPaint; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 687 | |
| 688 | typedef SkDrawCommand INHERITED; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 689 | }; |
| 690 | |
commit-bot@chromium.org | 3d30520 | 2014-02-24 17:28:55 +0000 | [diff] [blame] | 691 | class SkDrawDRRectCommand : public SkDrawCommand { |
| 692 | public: |
| 693 | SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, |
| 694 | const SkPaint& paint); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 695 | void execute(SkCanvas* canvas) const override; |
| 696 | bool render(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 697 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 698 | static SkDrawDRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 699 | |
commit-bot@chromium.org | 3d30520 | 2014-02-24 17:28:55 +0000 | [diff] [blame] | 700 | private: |
| 701 | SkRRect fOuter; |
| 702 | SkRRect fInner; |
| 703 | SkPaint fPaint; |
| 704 | |
| 705 | typedef SkDrawCommand INHERITED; |
| 706 | }; |
| 707 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 708 | class SkDrawVerticesCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 709 | public: |
Mike Reed | fed9cfd | 2017-03-17 12:09:04 -0400 | [diff] [blame] | 710 | SkDrawVerticesCommand(sk_sp<SkVertices>, SkBlendMode, const SkPaint&); |
| 711 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 712 | void execute(SkCanvas* canvas) const override; |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 713 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 714 | private: |
Mike Reed | fed9cfd | 2017-03-17 12:09:04 -0400 | [diff] [blame] | 715 | sk_sp<SkVertices> fVertices; |
| 716 | SkBlendMode fBlendMode; |
| 717 | SkPaint fPaint; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 718 | |
| 719 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 720 | }; |
| 721 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 722 | class SkSaveCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 723 | public: |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 724 | SkSaveCommand(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 725 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 726 | static SkSaveCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 727 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 728 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 729 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 730 | }; |
| 731 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 732 | class SkSaveLayerCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 733 | public: |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 734 | SkSaveLayerCommand(const SkCanvas::SaveLayerRec&); |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 735 | ~SkSaveLayerCommand() override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 736 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 737 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 738 | static SkSaveLayerCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 739 | |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 740 | const SkPaint* paint() const { return fPaintPtr; } |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 741 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 742 | private: |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 743 | SkRect fBounds; |
| 744 | SkPaint fPaint; |
| 745 | SkPaint* fPaintPtr; |
| 746 | const SkImageFilter* fBackdrop; |
| 747 | uint32_t fSaveLayerFlags; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 748 | |
| 749 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 750 | }; |
| 751 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 752 | class SkSetMatrixCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 753 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 754 | SkSetMatrixCommand(const SkMatrix& matrix); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 755 | void execute(SkCanvas* canvas) const override; |
ethannicholas | f62a8b7 | 2016-02-11 10:35:21 -0800 | [diff] [blame] | 756 | Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 757 | static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager); |
ethannicholas | 50a8dd0 | 2016-02-10 05:40:46 -0800 | [diff] [blame] | 758 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 759 | private: |
robertphillips@google.com | b94b1e7 | 2013-02-19 21:00:26 +0000 | [diff] [blame] | 760 | SkMatrix fMatrix; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 761 | |
| 762 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 763 | }; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 764 | #endif |
vjiaoblack | e6f5d56 | 2016-08-25 06:30:23 -0700 | [diff] [blame] | 765 | |