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 "PictureRenderer.h" | 8 #include "PictureRenderer.h" |
9 #include "picture_utils.h" | 9 #include "picture_utils.h" |
10 #include "SamplePipeControllers.h" | 10 #include "SamplePipeControllers.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 fCanvas.reset(this->setupCanvas()); | 57 fCanvas.reset(this->setupCanvas()); |
58 } | 58 } |
59 | 59 |
60 class FlagsDrawFilter : public SkDrawFilter { | 60 class FlagsDrawFilter : public SkDrawFilter { |
61 public: | 61 public: |
62 FlagsDrawFilter(PictureRenderer::DrawFilterFlags* flags) : | 62 FlagsDrawFilter(PictureRenderer::DrawFilterFlags* flags) : |
63 fFlags(flags) {} | 63 fFlags(flags) {} |
64 | 64 |
65 virtual bool filter(SkPaint* paint, Type t) { | 65 virtual bool filter(SkPaint* paint, Type t) { |
66 paint->setFlags(paint->getFlags() & ~fFlags[t] & SkPaint::kAllFlags); | 66 paint->setFlags(paint->getFlags() & ~fFlags[t] & SkPaint::kAllFlags); |
67 if (PictureRenderer::kBlur_DrawFilterFlag & fFlags[t]) { | 67 if (PictureRenderer::kMaskFilter_DrawFilterFlag & fFlags[t]) { |
68 SkMaskFilter* maskFilter = paint->getMaskFilter(); | 68 SkMaskFilter* maskFilter = paint->getMaskFilter(); |
69 SkMaskFilter::BlurInfo blurInfo; | 69 if (NULL != maskFilter) { |
70 if (maskFilter && maskFilter->asABlur(&blurInfo)) { | |
71 paint->setMaskFilter(NULL); | 70 paint->setMaskFilter(NULL); |
72 } | 71 } |
73 } | 72 } |
74 if (PictureRenderer::kHinting_DrawFilterFlag & fFlags[t]) { | 73 if (PictureRenderer::kHinting_DrawFilterFlag & fFlags[t]) { |
75 paint->setHinting(SkPaint::kNo_Hinting); | 74 paint->setHinting(SkPaint::kNo_Hinting); |
76 } else if (PictureRenderer::kSlightHinting_DrawFilterFlag & fFlags[t]) { | 75 } else if (PictureRenderer::kSlightHinting_DrawFilterFlag & fFlags[t]) { |
77 paint->setHinting(SkPaint::kSlight_Hinting); | 76 paint->setHinting(SkPaint::kSlight_Hinting); |
78 } | 77 } |
79 return true; | 78 return true; |
80 } | 79 } |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 virtual SkString getConfigNameInternal() SK_OVERRIDE { | 851 virtual SkString getConfigNameInternal() SK_OVERRIDE { |
853 return SkString("picture_clone"); | 852 return SkString("picture_clone"); |
854 } | 853 } |
855 }; | 854 }; |
856 | 855 |
857 PictureRenderer* CreatePictureCloneRenderer() { | 856 PictureRenderer* CreatePictureCloneRenderer() { |
858 return SkNEW(PictureCloneRenderer); | 857 return SkNEW(PictureCloneRenderer); |
859 } | 858 } |
860 | 859 |
861 } // namespace sk_tools | 860 } // namespace sk_tools |
OLD | NEW |