Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 21 matching lines...) Expand all
32 32
33 SkScalar SkBlurMaskFilter::ConvertRadiusToSigma(SkScalar radius) { 33 SkScalar SkBlurMaskFilter::ConvertRadiusToSigma(SkScalar radius) {
34 return SkBlurMask::ConvertRadiusToSigma(radius); 34 return SkBlurMask::ConvertRadiusToSigma(radius);
35 } 35 }
36 36
37 class SkBlurMaskFilterImpl : public SkMaskFilter { 37 class SkBlurMaskFilterImpl : public SkMaskFilter {
38 public: 38 public:
39 SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle, uint32_t flags); 39 SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle, uint32_t flags);
40 40
41 // overrides from SkMaskFilter 41 // overrides from SkMaskFilter
42 virtual SkMask::Format getFormat() const SK_OVERRIDE; 42 SkMask::Format getFormat() const SK_OVERRIDE;
43 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&, 43 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
44 SkIPoint* margin) const SK_OVERRIDE; 44 SkIPoint* margin) const SK_OVERRIDE;
45 45
46 #if SK_SUPPORT_GPU 46 #if SK_SUPPORT_GPU
47 virtual bool canFilterMaskGPU(const SkRect& devBounds, 47 virtual bool canFilterMaskGPU(const SkRect& devBounds,
48 const SkIRect& clipBounds, 48 const SkIRect& clipBounds,
49 const SkMatrix& ctm, 49 const SkMatrix& ctm,
50 SkRect* maskRect) const SK_OVERRIDE; 50 SkRect* maskRect) const SK_OVERRIDE;
51 virtual bool directFilterMaskGPU(GrContext* context, 51 virtual bool directFilterMaskGPU(GrContext* context,
52 GrPaint* grp, 52 GrPaint* grp,
53 const SkMatrix& viewMatrix, 53 const SkMatrix& viewMatrix,
54 const SkStrokeRec& strokeRec, 54 const SkStrokeRec& strokeRec,
55 const SkPath& path) const SK_OVERRIDE; 55 const SkPath& path) const SK_OVERRIDE;
56 virtual bool directFilterRRectMaskGPU(GrContext* context, 56 virtual bool directFilterRRectMaskGPU(GrContext* context,
57 GrPaint* grp, 57 GrPaint* grp,
58 const SkMatrix& viewMatrix, 58 const SkMatrix& viewMatrix,
59 const SkStrokeRec& strokeRec, 59 const SkStrokeRec& strokeRec,
60 const SkRRect& rrect) const SK_OVERRID E; 60 const SkRRect& rrect) const SK_OVERRID E;
61 61
62 virtual bool filterMaskGPU(GrTexture* src, 62 virtual bool filterMaskGPU(GrTexture* src,
63 const SkMatrix& ctm, 63 const SkMatrix& ctm,
64 const SkRect& maskRect, 64 const SkRect& maskRect,
65 GrTexture** result, 65 GrTexture** result,
66 bool canOverwriteSrc) const SK_OVERRIDE; 66 bool canOverwriteSrc) const SK_OVERRIDE;
67 #endif 67 #endif
68 68
69 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; 69 void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
70 virtual bool asABlur(BlurRec*) const SK_OVERRIDE; 70 bool asABlur(BlurRec*) const SK_OVERRIDE;
71 71
72 SK_TO_STRING_OVERRIDE() 72 SK_TO_STRING_OVERRIDE()
73 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) 73 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl)
74 74
75 protected: 75 protected:
76 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&, 76 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&,
77 const SkIRect& clipBounds, 77 const SkIRect& clipBounds,
78 NinePatch*) const SK_OVERRIDE; 78 NinePatch*) const SK_OVERRIDE;
79 79
80 virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&, 80 virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&,
(...skipping 14 matching lines...) Expand all
95 SkScalar fSigma; 95 SkScalar fSigma;
96 SkBlurStyle fBlurStyle; 96 SkBlurStyle fBlurStyle;
97 uint32_t fBlurFlags; 97 uint32_t fBlurFlags;
98 98
99 SkBlurQuality getQuality() const { 99 SkBlurQuality getQuality() const {
100 return (fBlurFlags & SkBlurMaskFilter::kHighQuality_BlurFlag) ? 100 return (fBlurFlags & SkBlurMaskFilter::kHighQuality_BlurFlag) ?
101 kHigh_SkBlurQuality : kLow_SkBlurQuality; 101 kHigh_SkBlurQuality : kLow_SkBlurQuality;
102 } 102 }
103 103
104 SkBlurMaskFilterImpl(SkReadBuffer&); 104 SkBlurMaskFilterImpl(SkReadBuffer&);
105 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 105 void flatten(SkWriteBuffer&) const SK_OVERRIDE;
106 106
107 SkScalar computeXformedSigma(const SkMatrix& ctm) const { 107 SkScalar computeXformedSigma(const SkMatrix& ctm) const {
108 bool ignoreTransform = SkToBool(fBlurFlags & SkBlurMaskFilter::kIgnoreTr ansform_BlurFlag); 108 bool ignoreTransform = SkToBool(fBlurFlags & SkBlurMaskFilter::kIgnoreTr ansform_BlurFlag);
109 109
110 SkScalar xformedSigma = ignoreTransform ? fSigma : ctm.mapRadius(fSigma) ; 110 SkScalar xformedSigma = ignoreTransform ? fSigma : ctm.mapRadius(fSigma) ;
111 return SkMinScalar(xformedSigma, kMAX_BLUR_SIGMA); 111 return SkMinScalar(xformedSigma, kMAX_BLUR_SIGMA);
112 } 112 }
113 113
114 friend class SkBlurMaskFilter; 114 friend class SkBlurMaskFilter;
115 115
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 600 }
601 601
602 #if SK_SUPPORT_GPU 602 #if SK_SUPPORT_GPU
603 603
604 class GrGLRectBlurEffect; 604 class GrGLRectBlurEffect;
605 605
606 class GrRectBlurEffect : public GrFragmentProcessor { 606 class GrRectBlurEffect : public GrFragmentProcessor {
607 public: 607 public:
608 virtual ~GrRectBlurEffect(); 608 virtual ~GrRectBlurEffect();
609 609
610 virtual const char* name() const SK_OVERRIDE { return "RectBlur"; } 610 const char* name() const SK_OVERRIDE { return "RectBlur"; }
611 611
612 virtual void getGLProcessorKey(const GrGLCaps& caps, 612 virtual void getGLProcessorKey(const GrGLCaps& caps,
613 GrProcessorKeyBuilder* b) const SK_OVERRIDE; 613 GrProcessorKeyBuilder* b) const SK_OVERRIDE;
614 614
615 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; 615 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
616 616
617 /** 617 /**
618 * Create a simple filter effect with custom bicubic coefficients. 618 * Create a simple filter effect with custom bicubic coefficients.
619 */ 619 */
620 static GrFragmentProcessor* Create(GrContext *context, const SkRect& rect, f loat sigma) { 620 static GrFragmentProcessor* Create(GrContext *context, const SkRect& rect, f loat sigma) {
621 GrTexture *blurProfileTexture = NULL; 621 GrTexture *blurProfileTexture = NULL;
622 int doubleProfileSize = SkScalarCeilToInt(12*sigma); 622 int doubleProfileSize = SkScalarCeilToInt(12*sigma);
623 623
624 if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.heigh t()) { 624 if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.heigh t()) {
625 // if the blur sigma is too large so the gaussian overlaps the whole 625 // if the blur sigma is too large so the gaussian overlaps the whole
626 // rect in either direction, fall back to CPU path for now. 626 // rect in either direction, fall back to CPU path for now.
627 627
628 return NULL; 628 return NULL;
629 } 629 }
630 630
631 bool createdBlurProfileTexture = CreateBlurProfileTexture(context, sigma , &blurProfileTexture); 631 bool createdBlurProfileTexture = CreateBlurProfileTexture(context, sigma , &blurProfileTexture);
632 SkAutoTUnref<GrTexture> hunref(blurProfileTexture); 632 SkAutoTUnref<GrTexture> hunref(blurProfileTexture);
633 if (!createdBlurProfileTexture) { 633 if (!createdBlurProfileTexture) {
634 return NULL; 634 return NULL;
635 } 635 }
636 return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture)); 636 return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture));
637 } 637 }
638 638
639 const SkRect& getRect() const { return fRect; } 639 const SkRect& getRect() const { return fRect; }
640 float getSigma() const { return fSigma; } 640 float getSigma() const { return fSigma; }
641 641
642 private: 642 private:
643 GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blur_profile); 643 GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blur_profile);
644 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 644 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
645 645
646 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE; 646 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
647 647
648 static bool CreateBlurProfileTexture(GrContext *context, float sigma, 648 static bool CreateBlurProfileTexture(GrContext *context, float sigma,
649 GrTexture **blurProfileTexture); 649 GrTexture **blurProfileTexture);
650 650
651 SkRect fRect; 651 SkRect fRect;
652 float fSigma; 652 float fSigma;
653 GrTextureAccess fBlurProfileAccess; 653 GrTextureAccess fBlurProfileAccess;
654 654
655 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 655 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
656 656
657 typedef GrFragmentProcessor INHERITED; 657 typedef GrFragmentProcessor INHERITED;
658 }; 658 };
659 659
660 class GrGLRectBlurEffect : public GrGLFragmentProcessor { 660 class GrGLRectBlurEffect : public GrGLFragmentProcessor {
661 public: 661 public:
662 GrGLRectBlurEffect(const GrProcessor&) {} 662 GrGLRectBlurEffect(const GrProcessor&) {}
663 virtual void emitCode(GrGLFPBuilder*, 663 virtual void emitCode(GrGLFPBuilder*,
664 const GrFragmentProcessor&, 664 const GrFragmentProcessor&,
665 const char* outputColor, 665 const char* outputColor,
666 const char* inputColor, 666 const char* inputColor,
667 const TransformedCoordsArray&, 667 const TransformedCoordsArray&,
668 const TextureSamplerArray&) SK_OVERRIDE; 668 const TextureSamplerArray&) SK_OVERRIDE;
669 669
670 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE; 670 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
671 671
672 private: 672 private:
673 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 673 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
674 674
675 UniformHandle fProxyRectUniform; 675 UniformHandle fProxyRectUniform;
676 UniformHandle fProfileSizeUniform; 676 UniformHandle fProfileSizeUniform;
677 677
678 typedef GrGLFragmentProcessor INHERITED; 678 typedef GrGLFragmentProcessor INHERITED;
679 }; 679 };
680 680
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), rect, inverse); 869 context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), rect, inverse);
870 return true; 870 return true;
871 } 871 }
872 872
873 class GrRRectBlurEffect : public GrFragmentProcessor { 873 class GrRRectBlurEffect : public GrFragmentProcessor {
874 public: 874 public:
875 875
876 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk RRect&); 876 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk RRect&);
877 877
878 virtual ~GrRRectBlurEffect() {}; 878 virtual ~GrRRectBlurEffect() {};
879 virtual const char* name() const SK_OVERRIDE { return "GrRRectBlur"; } 879 const char* name() const SK_OVERRIDE { return "GrRRectBlur"; }
880 880
881 const SkRRect& getRRect() const { return fRRect; } 881 const SkRRect& getRRect() const { return fRRect; }
882 float getSigma() const { return fSigma; } 882 float getSigma() const { return fSigma; }
883 883
884 virtual void getGLProcessorKey(const GrGLCaps& caps, 884 virtual void getGLProcessorKey(const GrGLCaps& caps,
885 GrProcessorKeyBuilder* b) const SK_OVERRIDE; 885 GrProcessorKeyBuilder* b) const SK_OVERRIDE;
886 886
887 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; 887 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
888 888
889 private: 889 private:
890 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); 890 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture);
891 891
892 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; 892 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
893 893
894 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE; 894 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
895 895
896 SkRRect fRRect; 896 SkRRect fRRect;
897 float fSigma; 897 float fSigma;
898 GrTextureAccess fNinePatchAccess; 898 GrTextureAccess fNinePatchAccess;
899 899
900 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 900 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
901 901
902 typedef GrFragmentProcessor INHERITED; 902 typedef GrFragmentProcessor INHERITED;
903 }; 903 };
904 904
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 public: 1017 public:
1018 GrGLRRectBlurEffect(const GrProcessor&) {} 1018 GrGLRRectBlurEffect(const GrProcessor&) {}
1019 1019
1020 virtual void emitCode(GrGLFPBuilder*, 1020 virtual void emitCode(GrGLFPBuilder*,
1021 const GrFragmentProcessor&, 1021 const GrFragmentProcessor&,
1022 const char* outputColor, 1022 const char* outputColor,
1023 const char* inputColor, 1023 const char* inputColor,
1024 const TransformedCoordsArray&, 1024 const TransformedCoordsArray&,
1025 const TextureSamplerArray&) SK_OVERRIDE; 1025 const TextureSamplerArray&) SK_OVERRIDE;
1026 1026
1027 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE; 1027 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
1028 1028
1029 private: 1029 private:
1030 GrGLProgramDataManager::UniformHandle fProxyRectUniform; 1030 GrGLProgramDataManager::UniformHandle fProxyRectUniform;
1031 GrGLProgramDataManager::UniformHandle fCornerRadiusUniform; 1031 GrGLProgramDataManager::UniformHandle fCornerRadiusUniform;
1032 GrGLProgramDataManager::UniformHandle fBlurRadiusUniform; 1032 GrGLProgramDataManager::UniformHandle fBlurRadiusUniform;
1033 typedef GrGLFragmentProcessor INHERITED; 1033 typedef GrGLFragmentProcessor INHERITED;
1034 }; 1034 };
1035 1035
1036 void GrGLRRectBlurEffect::emitCode(GrGLFPBuilder* builder, 1036 void GrGLRRectBlurEffect::emitCode(GrGLFPBuilder* builder,
1037 const GrFragmentProcessor&, 1037 const GrFragmentProcessor&,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 } else { 1267 } else {
1268 str->append("None"); 1268 str->append("None");
1269 } 1269 }
1270 str->append("))"); 1270 str->append("))");
1271 } 1271 }
1272 #endif 1272 #endif
1273 1273
1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1275 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1275 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1276 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1276 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698