OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkClipStack.h" | 8 #include "SkClipStack.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkDebugCanvas.h" | 10 #include "SkDebugCanvas.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 Factory getFactory() const override { return NULL; } | 53 Factory getFactory() const override { return NULL; } |
54 #ifndef SK_IGNORE_TO_STRING | 54 #ifndef SK_IGNORE_TO_STRING |
55 void toString(SkString* str) const override { str->set("OverdrawXfermode");
} | 55 void toString(SkString* str) const override { str->set("OverdrawXfermode");
} |
56 #endif | 56 #endif |
57 }; | 57 }; |
58 | 58 |
59 class DebugPaintFilterCanvas : public SkPaintFilterCanvas { | 59 class DebugPaintFilterCanvas : public SkPaintFilterCanvas { |
60 public: | 60 public: |
61 DebugPaintFilterCanvas(int width, int height, bool overdrawViz, bool overrid
eFilterQuality, | 61 DebugPaintFilterCanvas(int width, |
| 62 int height, |
| 63 bool overdrawViz, |
| 64 bool overrideFilterQuality, |
62 SkFilterQuality quality) | 65 SkFilterQuality quality) |
63 : INHERITED(width, height) | 66 : INHERITED(width, height) |
64 , fOverdrawXfermode(overdrawViz ? SkNEW(OverdrawXfermode) : NULL) | 67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : NULL) |
65 , fOverrideFilterQuality(overrideFilterQuality) | 68 , fOverrideFilterQuality(overrideFilterQuality) |
66 , fFilterQuality(quality) { } | 69 , fFilterQuality(quality) {} |
67 | 70 |
68 protected: | 71 protected: |
69 void onFilterPaint(SkPaint* paint, Type) const override { | 72 void onFilterPaint(SkPaint* paint, Type) const override { |
70 if (NULL != fOverdrawXfermode.get()) { | 73 if (NULL != fOverdrawXfermode.get()) { |
71 paint->setAntiAlias(false); | 74 paint->setAntiAlias(false); |
72 paint->setXfermode(fOverdrawXfermode.get()); | 75 paint->setXfermode(fOverdrawXfermode.get()); |
73 } | 76 } |
74 | 77 |
75 if (fOverrideFilterQuality) { | 78 if (fOverrideFilterQuality) { |
76 paint->setFilterQuality(fFilterQuality); | 79 paint->setFilterQuality(fFilterQuality); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 return fCommandVector; | 357 return fCommandVector; |
355 } | 358 } |
356 | 359 |
357 void SkDebugCanvas::updatePaintFilterCanvas() { | 360 void SkDebugCanvas::updatePaintFilterCanvas() { |
358 if (!fOverdrawViz && !fOverrideFilterQuality) { | 361 if (!fOverdrawViz && !fOverrideFilterQuality) { |
359 fPaintFilterCanvas.reset(NULL); | 362 fPaintFilterCanvas.reset(NULL); |
360 return; | 363 return; |
361 } | 364 } |
362 | 365 |
363 const SkImageInfo info = this->imageInfo(); | 366 const SkImageInfo info = this->imageInfo(); |
364 fPaintFilterCanvas.reset(SkNEW_ARGS(DebugPaintFilterCanvas, (info.width(), | 367 fPaintFilterCanvas.reset(new DebugPaintFilterCanvas(info.width(), info.heigh
t(), fOverdrawViz, |
365 info.height(), | 368 fOverrideFilterQuality,
fFilterQuality)); |
366 fOverdrawViz, | |
367 fOverrideFilter
Quality, | |
368 fFilterQuality)
)); | |
369 } | 369 } |
370 | 370 |
371 void SkDebugCanvas::setOverdrawViz(bool overdrawViz) { | 371 void SkDebugCanvas::setOverdrawViz(bool overdrawViz) { |
372 if (fOverdrawViz == overdrawViz) { | 372 if (fOverdrawViz == overdrawViz) { |
373 return; | 373 return; |
374 } | 374 } |
375 | 375 |
376 fOverdrawViz = overdrawViz; | 376 fOverdrawViz = overdrawViz; |
377 this->updatePaintFilterCanvas(); | 377 this->updatePaintFilterCanvas(); |
378 } | 378 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 663 } |
664 | 664 |
665 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 665 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
666 if (fCalledAddStackData) { | 666 if (fCalledAddStackData) { |
667 fClipStackData.appendf("<br>"); | 667 fClipStackData.appendf("<br>"); |
668 addPathData(devPath, "pathOut"); | 668 addPathData(devPath, "pathOut"); |
669 return true; | 669 return true; |
670 } | 670 } |
671 return false; | 671 return false; |
672 } | 672 } |
OLD | NEW |