| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SKDEBUGCANVAS_H_ | 10 #ifndef SKDEBUGCANVAS_H_ |
| 11 #define SKDEBUGCANVAS_H_ | 11 #define SKDEBUGCANVAS_H_ |
| 12 | 12 |
| 13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
| 14 #include "SkDrawCommand.h" | 14 #include "SkDrawCommand.h" |
| 15 #include "SkPicture.h" | 15 #include "SkPicture.h" |
| 16 #include "SkTArray.h" | 16 #include "SkTArray.h" |
| 17 #include "SkString.h" | 17 #include "SkString.h" |
| 18 | 18 |
| 19 class SkTexOverrideFilter; | 19 class SkTexOverrideFilter; |
| 20 | 20 |
| 21 class SK_API SkDebugCanvas : public SkCanvas { | 21 class SK_API SkDebugCanvas : public SkCanvas { |
| 22 public: | 22 public: |
| 23 SkDebugCanvas(int width, int height); | 23 SkDebugCanvas(int width, int height); |
| 24 virtual ~SkDebugCanvas(); | 24 virtual ~SkDebugCanvas(); |
| 25 | 25 |
| 26 void toggleFilter(bool toggle) { fFilter = toggle; } | 26 void toggleFilter(bool toggle) { fFilter = toggle; } |
| 27 | 27 |
| 28 void setMegaVizMode(bool megaVizMode) { fMegaVizMode = megaVizMode; } | 28 void setMegaVizMode(bool megaVizMode) { fMegaVizMode = megaVizMode; } |
| 29 bool getMegaVizMode() const { return fMegaVizMode; } |
| 29 | 30 |
| 30 /** | 31 /** |
| 31 * Enable or disable overdraw visualization | 32 * Enable or disable overdraw visualization |
| 32 */ | 33 */ |
| 33 void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; } | 34 void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; } |
| 35 bool getOverdrawViz() const { return fOverdrawViz; } |
| 36 |
| 37 void setOutstandingSaveCount(int saveCount) { fOutstandingSaveCount = saveCo
unt; } |
| 38 int getOutstandingSaveCount() const { return fOutstandingSaveCount; } |
| 39 |
| 40 void setPicture(SkPicture* picture) { fPicture = picture; } |
| 34 | 41 |
| 35 /** | 42 /** |
| 36 * Enable or disable texure filtering override | 43 * Enable or disable texure filtering override |
| 37 */ | 44 */ |
| 38 void overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel le
vel); | 45 void overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel le
vel); |
| 39 | 46 |
| 40 /** | 47 /** |
| 41 Executes all draw calls to the canvas. | 48 Executes all draw calls to the canvas. |
| 42 @param canvas The canvas being drawn to | 49 @param canvas The canvas being drawn to |
| 43 */ | 50 */ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 point - it is going away! | 118 point - it is going away! |
| 112 */ | 119 */ |
| 113 SkTDArray<SkDrawCommand*>& getDrawCommands(); | 120 SkTDArray<SkDrawCommand*>& getDrawCommands(); |
| 114 | 121 |
| 115 /** | 122 /** |
| 116 * Returns the string vector of draw commands | 123 * Returns the string vector of draw commands |
| 117 */ | 124 */ |
| 118 SkTArray<SkString>* getDrawCommandsAsStrings() const; | 125 SkTArray<SkString>* getDrawCommandsAsStrings() const; |
| 119 | 126 |
| 120 /** | 127 /** |
| 128 * Returns an array containing an offset (in the SkPicture) for each command |
| 129 */ |
| 130 SkTDArray<size_t>* getDrawCommandOffsets() const; |
| 131 |
| 132 /** |
| 121 Returns length of draw command vector. | 133 Returns length of draw command vector. |
| 122 */ | 134 */ |
| 123 int getSize() const { | 135 int getSize() const { |
| 124 return fCommandVector.count(); | 136 return fCommandVector.count(); |
| 125 } | 137 } |
| 126 | 138 |
| 127 /** | 139 /** |
| 128 Toggles the visibility / execution of the draw command at index i with | 140 Toggles the visibility / execution of the draw command at index i with |
| 129 the value of toggle. | 141 the value of toggle. |
| 130 */ | 142 */ |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 255 |
| 244 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 256 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
| 245 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 257 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; |
| 246 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 258 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
| 247 virtual void onClipRegion(const SkRegion& region, SkRegion::Op) SK_OVERRIDE; | 259 virtual void onClipRegion(const SkRegion& region, SkRegion::Op) SK_OVERRIDE; |
| 248 | 260 |
| 249 void markActiveCommands(int index); | 261 void markActiveCommands(int index); |
| 250 | 262 |
| 251 private: | 263 private: |
| 252 SkTDArray<SkDrawCommand*> fCommandVector; | 264 SkTDArray<SkDrawCommand*> fCommandVector; |
| 265 SkPicture* fPicture; |
| 253 int fWidth; | 266 int fWidth; |
| 254 int fHeight; | 267 int fHeight; |
| 255 bool fFilter; | 268 bool fFilter; |
| 256 bool fMegaVizMode; | 269 bool fMegaVizMode; |
| 257 int fIndex; | 270 int fIndex; |
| 258 SkMatrix fUserMatrix; | 271 SkMatrix fUserMatrix; |
| 259 SkMatrix fMatrix; | 272 SkMatrix fMatrix; |
| 260 SkIRect fClip; | 273 SkIRect fClip; |
| 261 | 274 |
| 262 bool fOverdrawViz; | 275 bool fOverdrawViz; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 290 @param command The draw command for execution | 303 @param command The draw command for execution |
| 291 */ | 304 */ |
| 292 void addDrawCommand(SkDrawCommand* command); | 305 void addDrawCommand(SkDrawCommand* command); |
| 293 | 306 |
| 294 /** | 307 /** |
| 295 Applies any panning and zooming the user has specified before | 308 Applies any panning and zooming the user has specified before |
| 296 drawing anything else into the canvas. | 309 drawing anything else into the canvas. |
| 297 */ | 310 */ |
| 298 void applyUserTransform(SkCanvas* canvas); | 311 void applyUserTransform(SkCanvas* canvas); |
| 299 | 312 |
| 313 size_t getOpID() const { |
| 314 if (NULL != fPicture) { |
| 315 return fPicture->EXPERIMENTAL_curOpID(); |
| 316 } |
| 317 return 0; |
| 318 } |
| 319 |
| 300 typedef SkCanvas INHERITED; | 320 typedef SkCanvas INHERITED; |
| 301 }; | 321 }; |
| 302 | 322 |
| 303 #endif | 323 #endif |
| OLD | NEW |