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