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 "SkPathOps.h" |
15 #include "SkPicture.h" | 16 #include "SkPicture.h" |
16 #include "SkTArray.h" | 17 #include "SkTArray.h" |
17 #include "SkString.h" | 18 #include "SkString.h" |
18 | 19 |
19 class SkTexOverrideFilter; | 20 class SkTexOverrideFilter; |
20 | 21 |
21 class SK_API SkDebugCanvas : public SkCanvas { | 22 class SK_API SkDebugCanvas : public SkCanvas { |
22 public: | 23 public: |
23 SkDebugCanvas(int width, int height); | 24 SkDebugCanvas(int width, int height); |
24 virtual ~SkDebugCanvas(); | 25 virtual ~SkDebugCanvas(); |
25 | 26 |
26 void toggleFilter(bool toggle) { fFilter = toggle; } | 27 void toggleFilter(bool toggle) { fFilter = toggle; } |
27 | 28 |
28 void setMegaVizMode(bool megaVizMode) { fMegaVizMode = megaVizMode; } | 29 void setMegaVizMode(bool megaVizMode) { fMegaVizMode = megaVizMode; } |
29 bool getMegaVizMode() const { return fMegaVizMode; } | 30 bool getMegaVizMode() const { return fMegaVizMode; } |
30 | 31 |
31 /** | 32 /** |
32 * Enable or disable overdraw visualization | 33 * Enable or disable overdraw visualization |
33 */ | 34 */ |
34 void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; } | 35 void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; } |
35 bool getOverdrawViz() const { return fOverdrawViz; } | 36 bool getOverdrawViz() const { return fOverdrawViz; } |
36 | 37 |
37 void setOutstandingSaveCount(int saveCount) { fOutstandingSaveCount = saveCo
unt; } | 38 void setOutstandingSaveCount(int saveCount) { fOutstandingSaveCount = saveCo
unt; } |
38 int getOutstandingSaveCount() const { return fOutstandingSaveCount; } | 39 int getOutstandingSaveCount() const { return fOutstandingSaveCount; } |
39 | 40 |
| 41 bool getAllowSimplifyClip() const { return fAllowSimplifyClip; } |
| 42 |
40 void setPicture(SkPicture* picture) { fPicture = picture; } | 43 void setPicture(SkPicture* picture) { fPicture = picture; } |
41 | 44 |
42 /** | 45 /** |
43 * Enable or disable texure filtering override | 46 * Enable or disable texure filtering override |
44 */ | 47 */ |
45 void overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel le
vel); | 48 void overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel le
vel); |
46 | 49 |
47 /** | 50 /** |
48 Executes all draw calls to the canvas. | 51 Executes all draw calls to the canvas. |
49 @param canvas The canvas being drawn to | 52 @param canvas The canvas being drawn to |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 147 |
145 void setBounds(int width, int height) { | 148 void setBounds(int width, int height) { |
146 fWidth = width; | 149 fWidth = width; |
147 fHeight = height; | 150 fHeight = height; |
148 } | 151 } |
149 | 152 |
150 void setUserMatrix(SkMatrix matrix) { | 153 void setUserMatrix(SkMatrix matrix) { |
151 fUserMatrix = matrix; | 154 fUserMatrix = matrix; |
152 } | 155 } |
153 | 156 |
| 157 SkString clipStackData() const { return fClipStackData; } |
| 158 |
154 //////////////////////////////////////////////////////////////////////////////// | 159 //////////////////////////////////////////////////////////////////////////////// |
155 // Inherited from SkCanvas | 160 // Inherited from SkCanvas |
156 //////////////////////////////////////////////////////////////////////////////// | 161 //////////////////////////////////////////////////////////////////////////////// |
157 | 162 |
158 virtual void clear(SkColor) SK_OVERRIDE; | 163 virtual void clear(SkColor) SK_OVERRIDE; |
159 | 164 |
160 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, | 165 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
161 const SkPaint*) SK_OVERRIDE; | 166 const SkPaint*) SK_OVERRIDE; |
162 | 167 |
163 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, | 168 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 SkPicture* fPicture; | 264 SkPicture* fPicture; |
260 int fWidth; | 265 int fWidth; |
261 int fHeight; | 266 int fHeight; |
262 bool fFilter; | 267 bool fFilter; |
263 bool fMegaVizMode; | 268 bool fMegaVizMode; |
264 int fIndex; | 269 int fIndex; |
265 SkMatrix fUserMatrix; | 270 SkMatrix fUserMatrix; |
266 SkMatrix fMatrix; | 271 SkMatrix fMatrix; |
267 SkIRect fClip; | 272 SkIRect fClip; |
268 | 273 |
| 274 SkString fClipStackData; |
| 275 bool fCalledAddStackData; |
| 276 SkPath fSaveDevPath; |
| 277 |
269 bool fOverdrawViz; | 278 bool fOverdrawViz; |
270 SkDrawFilter* fOverdrawFilter; | 279 SkDrawFilter* fOverdrawFilter; |
271 | 280 |
272 bool fOverrideTexFiltering; | 281 bool fOverrideTexFiltering; |
273 SkTexOverrideFilter* fTexOverrideFilter; | 282 SkTexOverrideFilter* fTexOverrideFilter; |
274 | 283 |
275 /** | 284 /** |
276 Number of unmatched save() calls at any point during a draw. | 285 Number of unmatched save() calls at any point during a draw. |
277 If there are any saveLayer() calls outstanding, we need to resolve | 286 If there are any saveLayer() calls outstanding, we need to resolve |
278 all of them, which in practice means resolving all save() calls, | 287 all of them, which in practice means resolving all save() calls, |
(...skipping 25 matching lines...) Expand all Loading... |
304 */ | 313 */ |
305 void applyUserTransform(SkCanvas* canvas); | 314 void applyUserTransform(SkCanvas* canvas); |
306 | 315 |
307 size_t getOpID() const { | 316 size_t getOpID() const { |
308 if (NULL != fPicture) { | 317 if (NULL != fPicture) { |
309 return fPicture->EXPERIMENTAL_curOpID(); | 318 return fPicture->EXPERIMENTAL_curOpID(); |
310 } | 319 } |
311 return 0; | 320 return 0; |
312 } | 321 } |
313 | 322 |
| 323 void resetClipStackData() { fClipStackData.reset(); fCalledAddStackData = fa
lse; } |
| 324 |
| 325 void addClipStackData(const SkPath& devPath, const SkPath& operand, SkRegion
::Op elementOp); |
| 326 void addPathData(const SkPath& path, const char* pathName); |
| 327 bool lastClipStackData(const SkPath& devPath); |
| 328 void outputConicPoints(const SkPoint* pts, SkScalar weight); |
| 329 void outputPoints(const SkPoint* pts, int count); |
| 330 void outputPointsCommon(const SkPoint* pts, int count); |
| 331 void outputScalar(SkScalar num); |
| 332 |
314 typedef SkCanvas INHERITED; | 333 typedef SkCanvas INHERITED; |
315 }; | 334 }; |
316 | 335 |
317 #endif | 336 #endif |
OLD | NEW |