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 | |
| 9 | #ifndef SKDEBUGCANVAS_H_ |
| 10 | #define SKDEBUGCANVAS_H_ |
| 11 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 12 | #include "SkCanvas.h" |
| 13 | #include "SkDrawCommand.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 14 | #include "SkPath.h" |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 15 | #include "SkPathOps.h" |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 16 | #include "SkPicture.h" |
reed | fb8c1fc | 2015-08-04 18:44:56 -0700 | [diff] [blame] | 17 | #include "SkString.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 18 | #include "SkTArray.h" |
Brian Salomon | 199fb87 | 2017-02-06 09:41:10 -0500 | [diff] [blame] | 19 | #include "SkVertices.h" |
ethannicholas | 402cd91 | 2016-02-10 12:57:30 -0800 | [diff] [blame] | 20 | #include "UrlDataManager.h" |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 21 | |
joshualitt | ae47aee | 2016-03-10 13:29:36 -0800 | [diff] [blame] | 22 | class GrAuditTrail; |
fmalita | 65cdb57 | 2015-03-26 07:24:48 -0700 | [diff] [blame] | 23 | class SkNWayCanvas; |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 24 | |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 25 | class SkDebugCanvas : public SkCanvas { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 26 | public: |
chudy@google.com | 80a4a60 | 2012-07-30 18:54:07 +0000 | [diff] [blame] | 27 | SkDebugCanvas(int width, int height); |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 28 | |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 29 | virtual ~SkDebugCanvas(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 30 | |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 31 | void toggleFilter(bool toggle) { fFilter = toggle; } |
| 32 | |
| 33 | void setMegaVizMode(bool megaVizMode) { fMegaVizMode = megaVizMode; } |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 34 | |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 35 | bool getMegaVizMode() const { return fMegaVizMode; } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 36 | |
| 37 | /** |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 38 | * Enable or disable overdraw visualization |
| 39 | */ |
fmalita | 65cdb57 | 2015-03-26 07:24:48 -0700 | [diff] [blame] | 40 | void setOverdrawViz(bool overdrawViz); |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 41 | |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 42 | bool getOverdrawViz() const { return fOverdrawViz; } |
| 43 | |
ethannicholas | 0a0520a | 2016-02-12 12:06:53 -0800 | [diff] [blame] | 44 | /** |
| 45 | * Set the color of the clip visualization. An alpha of zero renders the clip invisible. |
| 46 | */ |
| 47 | void setClipVizColor(SkColor clipVizColor) { this->fClipVizColor = clipVizColor; } |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 48 | |
ethannicholas | 0a0520a | 2016-02-12 12:06:53 -0800 | [diff] [blame] | 49 | SkColor getClipVizColor() const { return fClipVizColor; } |
| 50 | |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 51 | void setDrawGpuOpBounds(bool drawGpuOpBounds) { fDrawGpuOpBounds = drawGpuOpBounds; } |
joshualitt | 10d8fc2 | 2016-02-29 11:15:06 -0800 | [diff] [blame] | 52 | |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 53 | bool getDrawGpuOpBounds() const { return fDrawGpuOpBounds; } |
joshualitt | 5d5207a | 2016-02-29 12:46:04 -0800 | [diff] [blame] | 54 | |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 55 | bool getAllowSimplifyClip() const { return fAllowSimplifyClip; } |
| 56 | |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 57 | void setPicture(SkPicture *picture) { fPicture = picture; } |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 58 | |
| 59 | /** |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 60 | * Enable or disable texure filtering override |
| 61 | */ |
reed | 93a1215 | 2015-03-16 10:08:34 -0700 | [diff] [blame] | 62 | void overrideTexFiltering(bool overrideTexFiltering, SkFilterQuality); |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 63 | |
| 64 | /** |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 65 | Executes all draw calls to the canvas. |
| 66 | @param canvas The canvas being drawn to |
| 67 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 68 | void draw(SkCanvas *canvas); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 69 | |
| 70 | /** |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 71 | Executes the draw calls up to the specified index. |
| 72 | @param canvas The canvas being drawn to |
| 73 | @param index The index of the final command being executed |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 74 | @param m an optional Mth gpu op to highlight, or -1 |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 75 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 76 | void drawTo(SkCanvas *canvas, int index, int m = -1); |
chudy@google.com | 0b5bbb0 | 2012-07-31 19:55:32 +0000 | [diff] [blame] | 77 | |
| 78 | /** |
chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 79 | Returns the most recently calculated transformation matrix |
| 80 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 81 | const SkMatrix &getCurrentMatrix() { |
chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 82 | return fMatrix; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | Returns the most recently calculated clip |
| 87 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 88 | const SkIRect &getCurrentClip() { |
chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 89 | return fClip; |
| 90 | } |
| 91 | |
| 92 | /** |
chudy@google.com | 0b5bbb0 | 2012-07-31 19:55:32 +0000 | [diff] [blame] | 93 | Returns the index of the last draw command to write to the pixel at (x,y) |
| 94 | */ |
chudy@google.com | 830b879 | 2012-08-01 15:57:52 +0000 | [diff] [blame] | 95 | int getCommandAtPoint(int x, int y, int index); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 96 | |
| 97 | /** |
robertphillips@google.com | 50c84da | 2013-04-01 18:18:49 +0000 | [diff] [blame] | 98 | Removes the command at the specified index |
| 99 | @param index The index of the command to delete |
| 100 | */ |
| 101 | void deleteDrawCommandAt(int index); |
| 102 | |
| 103 | /** |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 104 | Returns the draw command at the given index. |
| 105 | @param index The index of the command |
| 106 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 107 | SkDrawCommand *getDrawCommandAt(int index); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 108 | |
| 109 | /** |
robertphillips@google.com | 50c84da | 2013-04-01 18:18:49 +0000 | [diff] [blame] | 110 | Sets the draw command for a given index. |
| 111 | @param index The index to overwrite |
| 112 | @param command The new command |
| 113 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 114 | void setDrawCommandAt(int index, SkDrawCommand *command); |
robertphillips@google.com | 50c84da | 2013-04-01 18:18:49 +0000 | [diff] [blame] | 115 | |
| 116 | /** |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 117 | Returns information about the command at the given index. |
| 118 | @param index The index of the command |
| 119 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 120 | const SkTDArray<SkString *> *getCommandInfo(int index) const; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 121 | |
| 122 | /** |
chudy@google.com | 7e4cfbf | 2012-07-17 15:40:51 +0000 | [diff] [blame] | 123 | Returns the visibility of the command at the given index. |
| 124 | @param index The index of the command |
| 125 | */ |
| 126 | bool getDrawCommandVisibilityAt(int index); |
| 127 | |
| 128 | /** |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 129 | Returns the vector of draw commands |
| 130 | */ |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 131 | SK_ATTR_DEPRECATED("please use getDrawCommandAt and getSize instead") |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 132 | const SkTDArray<SkDrawCommand *> &getDrawCommands() const; |
skia.committer@gmail.com | 2e71f16 | 2013-03-12 07:12:32 +0000 | [diff] [blame] | 133 | |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 134 | /** |
| 135 | Returns the vector of draw commands. Do not use this entry |
| 136 | point - it is going away! |
| 137 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 138 | SkTDArray<SkDrawCommand *> &getDrawCommands(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 139 | |
| 140 | /** |
chudy@google.com | f141432 | 2012-07-03 20:28:14 +0000 | [diff] [blame] | 141 | Returns length of draw command vector. |
| 142 | */ |
commit-bot@chromium.org | 0d4fe14 | 2013-07-15 22:47:14 +0000 | [diff] [blame] | 143 | int getSize() const { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 144 | return fCommandVector.count(); |
chudy@google.com | f141432 | 2012-07-03 20:28:14 +0000 | [diff] [blame] | 145 | } |
| 146 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 147 | /** |
| 148 | Toggles the visibility / execution of the draw command at index i with |
| 149 | the value of toggle. |
| 150 | */ |
| 151 | void toggleCommand(int index, bool toggle); |
| 152 | |
bungeman@google.com | e8cc6e8 | 2013-01-17 16:30:56 +0000 | [diff] [blame] | 153 | void setUserMatrix(SkMatrix matrix) { |
| 154 | fUserMatrix = matrix; |
chudy@google.com | 830b879 | 2012-08-01 15:57:52 +0000 | [diff] [blame] | 155 | } |
| 156 | |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 157 | SkString clipStackData() const { return fClipStackData; } |
| 158 | |
ethannicholas | 402cd91 | 2016-02-10 12:57:30 -0800 | [diff] [blame] | 159 | /** |
ethannicholas | 0a0520a | 2016-02-12 12:06:53 -0800 | [diff] [blame] | 160 | Returns a JSON object representing up to the Nth draw, where N is less than |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 161 | SkDebugCanvas::getSize(). The encoder may use the UrlDataManager to store binary data such |
ethannicholas | 0a0520a | 2016-02-12 12:06:53 -0800 | [diff] [blame] | 162 | as images, referring to them via URLs embedded in the JSON. |
ethannicholas | 402cd91 | 2016-02-10 12:57:30 -0800 | [diff] [blame] | 163 | */ |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 164 | Json::Value toJSON(UrlDataManager &urlDataManager, int n, SkCanvas *); |
ethannicholas | 402cd91 | 2016-02-10 12:57:30 -0800 | [diff] [blame] | 165 | |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 166 | Json::Value toJSONOpList(int n, SkCanvas*); |
joshualitt | ae47aee | 2016-03-10 13:29:36 -0800 | [diff] [blame] | 167 | |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 168 | //////////////////////////////////////////////////////////////////////////////// |
| 169 | // Inherited from SkCanvas |
| 170 | //////////////////////////////////////////////////////////////////////////////// |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 171 | |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 172 | static const int kVizImageHeight = 256; |
| 173 | static const int kVizImageWidth = 256; |
| 174 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 175 | bool isClipEmpty() const override { return false; } |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 176 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 177 | bool isClipRect() const override { return true; } |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 178 | |
Mike Reed | 42e8c53 | 2017-01-23 14:09:13 -0500 | [diff] [blame] | 179 | SkRect onGetLocalClipBounds() const override { |
| 180 | return SkRect::MakeIWH(this->imageInfo().width(), this->imageInfo().height()); |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 181 | } |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 182 | |
Mike Reed | 42e8c53 | 2017-01-23 14:09:13 -0500 | [diff] [blame] | 183 | SkIRect onGetDeviceClipBounds() const override { |
| 184 | return SkIRect::MakeWH(this->imageInfo().width(), this->imageInfo().height()); |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 185 | } |
| 186 | |
commit-bot@chromium.org | ab58273 | 2014-02-21 12:20:45 +0000 | [diff] [blame] | 187 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 188 | void willSave() override; |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 189 | |
| 190 | SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec &) override; |
| 191 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 192 | void willRestore() override; |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 193 | |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 194 | void didConcat(const SkMatrix &) override; |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 195 | |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 196 | void didSetMatrix(const SkMatrix &) override; |
| 197 | |
| 198 | #ifdef SK_EXPERIMENTAL_SHADOWING |
Mike Klein | 0f61faa | 2016-10-11 16:26:57 -0400 | [diff] [blame] | 199 | void didTranslateZ(SkScalar) override; |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 200 | #else |
| 201 | void didTranslateZ(SkScalar); |
| 202 | #endif |
vjiaoblack | e5de130 | 2016-07-13 14:05:28 -0700 | [diff] [blame] | 203 | |
reed | 97660cc | 2016-06-28 18:54:19 -0700 | [diff] [blame] | 204 | void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 205 | void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 206 | void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 207 | const SkPaint&) override; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 208 | void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 209 | const SkPaint&) override; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 210 | void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 211 | SkScalar constY, const SkPaint&) override; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 212 | void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 213 | const SkMatrix* matrix, const SkPaint&) override; |
reed | 45561a0 | 2016-07-07 12:47:17 -0700 | [diff] [blame] | 214 | void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform[], const SkRect*, |
| 215 | const SkPaint&) override; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 216 | void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 217 | const SkPaint& paint) override; |
commit-bot@chromium.org | ab58273 | 2014-02-21 12:20:45 +0000 | [diff] [blame] | 218 | |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 219 | void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
Mike Reed | faba371 | 2016-11-03 14:45:31 -0400 | [diff] [blame] | 220 | const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 221 | void onDrawPaint(const SkPaint&) override; |
robertphillips | 9bafc30 | 2015-02-13 11:13:00 -0800 | [diff] [blame] | 222 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 223 | void onDrawRect(const SkRect&, const SkPaint&) override; |
| 224 | void onDrawOval(const SkRect&, const SkPaint&) override; |
bsalomon | ac3aa24 | 2016-08-19 11:25:19 -0700 | [diff] [blame] | 225 | void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 226 | void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 227 | void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; |
Mike Reed | fed9cfd | 2017-03-17 12:09:04 -0400 | [diff] [blame] | 228 | void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 229 | void onDrawPath(const SkPath&, const SkPaint&) override; |
| 230 | void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 231 | void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 232 | SrcRectConstraint) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 233 | void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; |
Stan Iliev | ac42aeb | 2017-01-12 16:20:50 -0500 | [diff] [blame] | 234 | void onDrawImageLattice(const SkImage* image, const Lattice& lattice, |
| 235 | const SkRect& dst, const SkPaint* paint) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 236 | void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 237 | const SkPaint*, SrcRectConstraint) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 238 | void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 239 | const SkPaint*) override; |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 240 | void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; |
| 241 | void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; |
| 242 | void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; |
| 243 | void onClipRegion(const SkRegion& region, SkClipOp) override; |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 244 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 245 | void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 246 | |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 247 | #ifdef SK_EXPERIMENTAL_SHADOWING |
| 248 | void onDrawShadowedPicture(const SkPicture*, |
| 249 | const SkMatrix*, |
vjiaoblack | e6f5d56 | 2016-08-25 06:30:23 -0700 | [diff] [blame] | 250 | const SkPaint*, |
| 251 | const SkShadowParams& params) override; |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 252 | #else |
| 253 | void onDrawShadowedPicture(const SkPicture*, |
| 254 | const SkMatrix*, |
vjiaoblack | e6f5d56 | 2016-08-25 06:30:23 -0700 | [diff] [blame] | 255 | const SkPaint*, |
| 256 | const SkShadowParams& params); |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame] | 257 | #endif |
| 258 | |
commit-bot@chromium.org | 1643b2c | 2014-03-03 23:25:41 +0000 | [diff] [blame] | 259 | void markActiveCommands(int index); |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 260 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 261 | private: |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 262 | SkTDArray<SkDrawCommand*> fCommandVector; |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 263 | SkPicture* fPicture; |
chudy@google.com | 7e4cfbf | 2012-07-17 15:40:51 +0000 | [diff] [blame] | 264 | bool fFilter; |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 265 | bool fMegaVizMode; |
bungeman@google.com | e8cc6e8 | 2013-01-17 16:30:56 +0000 | [diff] [blame] | 266 | SkMatrix fUserMatrix; |
chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 267 | SkMatrix fMatrix; |
| 268 | SkIRect fClip; |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 269 | |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 270 | SkString fClipStackData; |
| 271 | bool fCalledAddStackData; |
| 272 | SkPath fSaveDevPath; |
| 273 | |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 274 | bool fOverdrawViz; |
fmalita | 65cdb57 | 2015-03-26 07:24:48 -0700 | [diff] [blame] | 275 | bool fOverrideFilterQuality; |
| 276 | SkFilterQuality fFilterQuality; |
ethannicholas | 0a0520a | 2016-02-12 12:06:53 -0800 | [diff] [blame] | 277 | SkColor fClipVizColor; |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 278 | bool fDrawGpuOpBounds; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 279 | |
| 280 | /** |
commit-bot@chromium.org | 1643b2c | 2014-03-03 23:25:41 +0000 | [diff] [blame] | 281 | The active saveLayer commands at a given point in the renderering. |
| 282 | Only used when "mega" visualization is enabled. |
| 283 | */ |
| 284 | SkTDArray<SkDrawCommand*> fActiveLayers; |
| 285 | |
skia.committer@gmail.com | ade9a34 | 2014-03-04 03:02:32 +0000 | [diff] [blame] | 286 | /** |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 287 | Adds the command to the classes vector of commands. |
| 288 | @param command The draw command for execution |
| 289 | */ |
| 290 | void addDrawCommand(SkDrawCommand* command); |
chudy@google.com | 830b879 | 2012-08-01 15:57:52 +0000 | [diff] [blame] | 291 | |
| 292 | /** |
| 293 | Applies any panning and zooming the user has specified before |
| 294 | drawing anything else into the canvas. |
| 295 | */ |
| 296 | void applyUserTransform(SkCanvas* canvas); |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 297 | |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 298 | void resetClipStackData() { fClipStackData.reset(); fCalledAddStackData = false; } |
| 299 | |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 300 | void addClipStackData(const SkPath& devPath, const SkPath& operand, SkClipOp elementOp); |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 301 | void addPathData(const SkPath& path, const char* pathName); |
| 302 | bool lastClipStackData(const SkPath& devPath); |
| 303 | void outputConicPoints(const SkPoint* pts, SkScalar weight); |
| 304 | void outputPoints(const SkPoint* pts, int count); |
| 305 | void outputPointsCommon(const SkPoint* pts, int count); |
| 306 | void outputScalar(SkScalar num); |
skia.committer@gmail.com | 3b9e8be | 2014-05-20 03:05:34 +0000 | [diff] [blame] | 307 | |
joshualitt | ae47aee | 2016-03-10 13:29:36 -0800 | [diff] [blame] | 308 | GrAuditTrail* getAuditTrail(SkCanvas*); |
| 309 | |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 310 | void drawAndCollectOps(int n, SkCanvas*); |
joshualitt | ae47aee | 2016-03-10 13:29:36 -0800 | [diff] [blame] | 311 | void cleanupAuditTrail(SkCanvas*); |
fmalita | 65cdb57 | 2015-03-26 07:24:48 -0700 | [diff] [blame] | 312 | |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 313 | typedef SkCanvas INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | #endif |