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