| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 int height, | 62 int height, |
| 63 bool overdrawViz, | 63 bool overdrawViz, |
| 64 bool overrideFilterQuality, | 64 bool overrideFilterQuality, |
| 65 SkFilterQuality quality) | 65 SkFilterQuality quality) |
| 66 : INHERITED(width, height) | 66 : INHERITED(width, height) |
| 67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr) | 67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr) |
| 68 , fOverrideFilterQuality(overrideFilterQuality) | 68 , fOverrideFilterQuality(overrideFilterQuality) |
| 69 , fFilterQuality(quality) {} | 69 , fFilterQuality(quality) {} |
| 70 | 70 |
| 71 protected: | 71 protected: |
| 72 void onFilterPaint(SkPaint* paint, Type) const override { | 72 bool onFilter(const SkPaint* paint, Type, SkTLazy<SkPaint>* filteredPaint) c
onst override { |
| 73 if (nullptr != fOverdrawXfermode.get()) { | 73 if (paint) { |
| 74 paint->setAntiAlias(false); | 74 filteredPaint->set(*paint); |
| 75 paint->setXfermode(fOverdrawXfermode.get()); | 75 if (nullptr != fOverdrawXfermode.get()) { |
| 76 filteredPaint->get()->setAntiAlias(false); |
| 77 filteredPaint->get()->setXfermode(fOverdrawXfermode.get()); |
| 78 } |
| 79 |
| 80 if (fOverrideFilterQuality) { |
| 81 filteredPaint->get()->setFilterQuality(fFilterQuality); |
| 82 } |
| 76 } | 83 } |
| 77 | 84 return true; |
| 78 if (fOverrideFilterQuality) { | |
| 79 paint->setFilterQuality(fFilterQuality); | |
| 80 } | |
| 81 } | 85 } |
| 82 | 86 |
| 83 void onDrawPicture(const SkPicture* picture, | 87 void onDrawPicture(const SkPicture* picture, |
| 84 const SkMatrix* matrix, | 88 const SkMatrix* matrix, |
| 85 const SkPaint* paint) override { | 89 const SkPaint* paint) override { |
| 86 // We need to replay the picture onto this canvas in order to filter its
internal paints. | 90 // We need to replay the picture onto this canvas in order to filter its
internal paints. |
| 87 this->SkCanvas::onDrawPicture(picture, matrix, paint); | 91 this->SkCanvas::onDrawPicture(picture, matrix, paint); |
| 88 } | 92 } |
| 89 | 93 |
| 90 private: | 94 private: |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 662 } |
| 659 | 663 |
| 660 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 664 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
| 661 if (fCalledAddStackData) { | 665 if (fCalledAddStackData) { |
| 662 fClipStackData.appendf("<br>"); | 666 fClipStackData.appendf("<br>"); |
| 663 addPathData(devPath, "pathOut"); | 667 addPathData(devPath, "pathOut"); |
| 664 return true; | 668 return true; |
| 665 } | 669 } |
| 666 return false; | 670 return false; |
| 667 } | 671 } |
| OLD | NEW |