| 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; |
| 20 |
| 19 class SK_API SkDebugCanvas : public SkCanvas { | 21 class SK_API SkDebugCanvas : public SkCanvas { |
| 20 public: | 22 public: |
| 21 SkDebugCanvas(int width, int height); | 23 SkDebugCanvas(int width, int height); |
| 22 virtual ~SkDebugCanvas(); | 24 virtual ~SkDebugCanvas(); |
| 23 | 25 |
| 24 void toggleFilter(bool toggle); | 26 void toggleFilter(bool toggle); |
| 25 | 27 |
| 26 /** | 28 /** |
| 27 * Enable or disable overdraw visualization | 29 * Enable or disable overdraw visualization |
| 28 */ | 30 */ |
| 29 void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; } | 31 void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; } |
| 30 | 32 |
| 31 /** | 33 /** |
| 34 * Enable or disable texure filtering override |
| 35 */ |
| 36 void overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel le
vel); |
| 37 |
| 38 /** |
| 32 Executes all draw calls to the canvas. | 39 Executes all draw calls to the canvas. |
| 33 @param canvas The canvas being drawn to | 40 @param canvas The canvas being drawn to |
| 34 */ | 41 */ |
| 35 void draw(SkCanvas* canvas); | 42 void draw(SkCanvas* canvas); |
| 36 | 43 |
| 37 /** | 44 /** |
| 38 Executes the draw calls in the specified range. | 45 Executes the draw calls in the specified range. |
| 39 @param canvas The canvas being drawn to | 46 @param canvas The canvas being drawn to |
| 40 @param i The beginning of the range | 47 @param i The beginning of the range |
| 41 @param j The end of the range | 48 @param j The end of the range |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 private: | 245 private: |
| 239 SkTDArray<SkDrawCommand*> fCommandVector; | 246 SkTDArray<SkDrawCommand*> fCommandVector; |
| 240 int fHeight; | 247 int fHeight; |
| 241 int fWidth; | 248 int fWidth; |
| 242 SkBitmap fBm; | 249 SkBitmap fBm; |
| 243 bool fFilter; | 250 bool fFilter; |
| 244 int fIndex; | 251 int fIndex; |
| 245 SkMatrix fUserMatrix; | 252 SkMatrix fUserMatrix; |
| 246 SkMatrix fMatrix; | 253 SkMatrix fMatrix; |
| 247 SkIRect fClip; | 254 SkIRect fClip; |
| 255 |
| 248 bool fOverdrawViz; | 256 bool fOverdrawViz; |
| 249 SkDrawFilter* fOverdrawFilter; | 257 SkDrawFilter* fOverdrawFilter; |
| 250 | 258 |
| 259 bool fOverrideTexFiltering; |
| 260 SkTexOverrideFilter* fTexOverrideFilter; |
| 261 |
| 251 /** | 262 /** |
| 252 Number of unmatched save() calls at any point during a draw. | 263 Number of unmatched save() calls at any point during a draw. |
| 253 If there are any saveLayer() calls outstanding, we need to resolve | 264 If there are any saveLayer() calls outstanding, we need to resolve |
| 254 all of them, which in practice means resolving all save() calls, | 265 all of them, which in practice means resolving all save() calls, |
| 255 to avoid corruption of our canvas. | 266 to avoid corruption of our canvas. |
| 256 */ | 267 */ |
| 257 int fOutstandingSaveCount; | 268 int fOutstandingSaveCount; |
| 258 | 269 |
| 259 /** | 270 /** |
| 260 Adds the command to the classes vector of commands. | 271 Adds the command to the classes vector of commands. |
| 261 @param command The draw command for execution | 272 @param command The draw command for execution |
| 262 */ | 273 */ |
| 263 void addDrawCommand(SkDrawCommand* command); | 274 void addDrawCommand(SkDrawCommand* command); |
| 264 | 275 |
| 265 /** | 276 /** |
| 266 Applies any panning and zooming the user has specified before | 277 Applies any panning and zooming the user has specified before |
| 267 drawing anything else into the canvas. | 278 drawing anything else into the canvas. |
| 268 */ | 279 */ |
| 269 void applyUserTransform(SkCanvas* canvas); | 280 void applyUserTransform(SkCanvas* canvas); |
| 270 | 281 |
| 271 typedef SkCanvas INHERITED; | 282 typedef SkCanvas INHERITED; |
| 272 }; | 283 }; |
| 273 | 284 |
| 274 #endif | 285 #endif |
| OLD | NEW |