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

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

Issue 1245183002: Misc cleanup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address gcc complaint Created 5 years, 5 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
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 22 matching lines...) Expand all
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 SkMask::Format getFormat() const override; 42 SkMask::Format getFormat() const override;
43 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&, 43 bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
44 SkIPoint* margin) const override; 44 SkIPoint* margin) const override;
45 45
46 #if SK_SUPPORT_GPU 46 #if SK_SUPPORT_GPU
47 virtual bool canFilterMaskGPU(const SkRect& devBounds, 47 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 override; 50 SkRect* maskRect) const override;
51 virtual bool directFilterMaskGPU(GrContext* context, 51 bool directFilterMaskGPU(GrTextureProvider* texProvider,
52 GrRenderTarget* rt, 52 GrDrawContext* drawContext,
53 GrPaint* grp, 53 GrRenderTarget* rt,
54 const GrClip&, 54 GrPaint* grp,
55 const SkMatrix& viewMatrix, 55 const GrClip&,
56 const SkStrokeRec& strokeRec, 56 const SkMatrix& viewMatrix,
57 const SkPath& path) const override; 57 const SkStrokeRec& strokeRec,
58 virtual bool directFilterRRectMaskGPU(GrContext* context, 58 const SkPath& path) const override;
59 GrRenderTarget* rt, 59 bool directFilterRRectMaskGPU(GrTextureProvider* texProvider,
60 GrPaint* grp, 60 GrDrawContext* drawContext,
61 const GrClip&, 61 GrRenderTarget* rt,
62 const SkMatrix& viewMatrix, 62 GrPaint* grp,
63 const SkStrokeRec& strokeRec, 63 const GrClip&,
64 const SkRRect& rrect) const override; 64 const SkMatrix& viewMatrix,
65 65 const SkStrokeRec& strokeRec,
66 virtual bool filterMaskGPU(GrTexture* src, 66 const SkRRect& rrect) const override;
67 const SkMatrix& ctm, 67 bool filterMaskGPU(GrTexture* src,
68 const SkRect& maskRect, 68 const SkMatrix& ctm,
69 GrTexture** result, 69 const SkRect& maskRect,
70 bool canOverwriteSrc) const override; 70 GrTexture** result,
71 bool canOverwriteSrc) const override;
71 #endif 72 #endif
72 73
73 void computeFastBounds(const SkRect&, SkRect*) const override; 74 void computeFastBounds(const SkRect&, SkRect*) const override;
74 bool asABlur(BlurRec*) const override; 75 bool asABlur(BlurRec*) const override;
75 76
76 SK_TO_STRING_OVERRIDE() 77 SK_TO_STRING_OVERRIDE()
77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl)
78 79
79 protected: 80 protected:
80 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&, 81 FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix&,
81 const SkIRect& clipBounds, 82 const SkIRect& clipBounds,
82 NinePatch*) const override; 83 NinePatch*) const override;
83 84
84 virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&, 85 FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&,
85 const SkIRect& clipBounds, 86 const SkIRect& clipBounds,
86 NinePatch*) const override; 87 NinePatch*) const override;
87 88
88 bool filterRectMask(SkMask* dstM, const SkRect& r, const SkMatrix& matrix, 89 bool filterRectMask(SkMask* dstM, const SkRect& r, const SkMatrix& matrix,
89 SkIPoint* margin, SkMask::CreateMode createMode) const; 90 SkIPoint* margin, SkMask::CreateMode createMode) const;
90 bool filterRRectMask(SkMask* dstM, const SkRRect& r, const SkMatrix& matrix, 91 bool filterRRectMask(SkMask* dstM, const SkRRect& r, const SkMatrix& matrix,
91 SkIPoint* margin, SkMask::CreateMode createMode) const; 92 SkIPoint* margin, SkMask::CreateMode createMode) const;
92 93
93 private: 94 private:
94 // To avoid unseemly allocation requests (esp. for finite platforms like 95 // To avoid unseemly allocation requests (esp. for finite platforms like
95 // handset) we limit the radius so something manageable. (as opposed to 96 // handset) we limit the radius so something manageable. (as opposed to
96 // a request like 10,000) 97 // a request like 10,000)
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 824
824 GrFragmentProcessor* GrRectBlurEffect::TestCreate(GrProcessorTestData* d) { 825 GrFragmentProcessor* GrRectBlurEffect::TestCreate(GrProcessorTestData* d) {
825 float sigma = d->fRandom->nextRangeF(3,8); 826 float sigma = d->fRandom->nextRangeF(3,8);
826 float width = d->fRandom->nextRangeF(200,300); 827 float width = d->fRandom->nextRangeF(200,300);
827 float height = d->fRandom->nextRangeF(200,300); 828 float height = d->fRandom->nextRangeF(200,300);
828 return GrRectBlurEffect::Create(d->fContext->textureProvider(), SkRect::Make WH(width, height), 829 return GrRectBlurEffect::Create(d->fContext->textureProvider(), SkRect::Make WH(width, height),
829 sigma); 830 sigma);
830 } 831 }
831 832
832 833
833 bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context, 834 bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
835 GrDrawContext* drawContext,
834 GrRenderTarget* rt, 836 GrRenderTarget* rt,
835 GrPaint* grp, 837 GrPaint* grp,
836 const GrClip& clip, 838 const GrClip& clip,
837 const SkMatrix& viewMatrix, 839 const SkMatrix& viewMatrix,
838 const SkStrokeRec& strokeRec, 840 const SkStrokeRec& strokeRec,
839 const SkPath& path) const { 841 const SkPath& path) const {
842 SkASSERT(drawContext);
843
840 if (fBlurStyle != kNormal_SkBlurStyle) { 844 if (fBlurStyle != kNormal_SkBlurStyle) {
841 return false; 845 return false;
842 } 846 }
843 847
844 SkRect rect; 848 SkRect rect;
845 if (!path.isRect(&rect)) { 849 if (!path.isRect(&rect)) {
846 return false; 850 return false;
847 } 851 }
848 852
849 if (!strokeRec.isFillStyle()) { 853 if (!strokeRec.isFillStyle()) {
850 return false; 854 return false;
851 } 855 }
852 856
853 SkMatrix ctm = viewMatrix; 857 SkScalar xformedSigma = this->computeXformedSigma(viewMatrix);
854 SkScalar xformedSigma = this->computeXformedSigma(ctm);
855 858
856 int pad=SkScalarCeilToInt(6*xformedSigma)/2; 859 int pad = SkScalarCeilToInt(6*xformedSigma)/2;
857 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); 860 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad));
858 861
859 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create( 862 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create(
860 context->textureProvider(), rect, xformedSigma)); 863 texProvider, rec t, xformedSigma));
861 if (!fp) { 864 if (!fp) {
862 return false; 865 return false;
863 } 866 }
864 867
865 grp->addCoverageProcessor(fp); 868 grp->addCoverageProcessor(fp);
866 869
867 SkMatrix inverse; 870 SkMatrix inverse;
868 if (!viewMatrix.invert(&inverse)) { 871 if (!viewMatrix.invert(&inverse)) {
869 return false; 872 return false;
870 } 873 }
871 874
872 GrDrawContext* drawContext = context->drawContext(); 875 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), rec t, inverse);
873 if (drawContext) { 876 return true;
874 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), rect, inverse);
875 return true;
876 }
877
878 return false;
879 } 877 }
880 878
881 class GrRRectBlurEffect : public GrFragmentProcessor { 879 class GrRRectBlurEffect : public GrFragmentProcessor {
882 public: 880 public:
883 881
884 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk RRect&); 882 static GrFragmentProcessor* Create(GrTextureProvider*, float sigma, const Sk RRect&);
885 883
886 virtual ~GrRRectBlurEffect() {}; 884 virtual ~GrRRectBlurEffect() {};
887 const char* name() const override { return "GrRRectBlur"; } 885 const char* name() const override { return "GrRRectBlur"; }
888 886
889 const SkRRect& getRRect() const { return fRRect; } 887 const SkRRect& getRRect() const { return fRRect; }
890 float getSigma() const { return fSigma; } 888 float getSigma() const { return fSigma; }
891 889
892 virtual void getGLProcessorKey(const GrGLSLCaps& caps, 890 virtual void getGLProcessorKey(const GrGLSLCaps& caps,
893 GrProcessorKeyBuilder* b) const override; 891 GrProcessorKeyBuilder* b) const override;
894 892
895 GrGLFragmentProcessor* createGLInstance() const override; 893 GrGLFragmentProcessor* createGLInstance() const override;
896 894
897 private: 895 private:
898 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); 896 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture);
899 897
900 bool onIsEqual(const GrFragmentProcessor& other) const override; 898 bool onIsEqual(const GrFragmentProcessor& other) const override;
901 899
902 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 900 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
903 901
904 SkRRect fRRect; 902 SkRRect fRRect;
905 float fSigma; 903 float fSigma;
906 GrTextureAccess fNinePatchAccess; 904 GrTextureAccess fNinePatchAccess;
907 905
908 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 906 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
909 907
910 typedef GrFragmentProcessor INHERITED; 908 typedef GrFragmentProcessor INHERITED;
911 }; 909 };
912 910
913 911
914 GrFragmentProcessor* GrRRectBlurEffect::Create(GrContext* context, float sigma, 912 GrFragmentProcessor* GrRRectBlurEffect::Create(GrTextureProvider* texProvider, f loat sigma,
915 const SkRRect& rrect) { 913 const SkRRect& rrect) {
916 if (!rrect.isSimpleCircular()) { 914 if (!rrect.isSimpleCircular()) {
917 return NULL; 915 return NULL;
918 } 916 }
919 917
920 // Make sure we can successfully ninepatch this rrect -- the blur sigma has to be 918 // Make sure we can successfully ninepatch this rrect -- the blur sigma has to be
921 // sufficiently small relative to both the size of the corner radius and the 919 // sufficiently small relative to both the size of the corner radius and the
922 // width (and height) of the rrect. 920 // width (and height) of the rrect.
923 921
924 unsigned int blurRadius = 3*SkScalarCeilToInt(sigma-1/6.0f); 922 unsigned int blurRadius = 3*SkScalarCeilToInt(sigma-1/6.0f);
925 unsigned int cornerRadius = SkScalarCeilToInt(rrect.getSimpleRadii().x()); 923 unsigned int cornerRadius = SkScalarCeilToInt(rrect.getSimpleRadii().x());
926 if (cornerRadius + blurRadius > rrect.width()/2 || 924 if (cornerRadius + blurRadius > rrect.width()/2 ||
927 cornerRadius + blurRadius > rrect.height()/2) { 925 cornerRadius + blurRadius > rrect.height()/2) {
928 return NULL; 926 return NULL;
929 } 927 }
930 928
931 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); 929 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
932 GrUniqueKey key; 930 GrUniqueKey key;
933 GrUniqueKey::Builder builder(&key, kDomain, 2); 931 GrUniqueKey::Builder builder(&key, kDomain, 2);
934 builder[0] = blurRadius; 932 builder[0] = blurRadius;
935 builder[1] = cornerRadius; 933 builder[1] = cornerRadius;
936 builder.finish(); 934 builder.finish();
937 935
938 SkAutoTUnref<GrTexture> blurNinePatchTexture( 936 SkAutoTUnref<GrTexture> blurNinePatchTexture(texProvider->findAndRefTextureB yUniqueKey(key));
939 context->textureProvider()->findAndRefTextureByUniqueKey(key));
940 937
941 if (!blurNinePatchTexture) { 938 if (!blurNinePatchTexture) {
942 SkMask mask; 939 SkMask mask;
943 940
944 unsigned int smallRectSide = 2*(blurRadius + cornerRadius) + 1; 941 unsigned int smallRectSide = 2*(blurRadius + cornerRadius) + 1;
945 942
946 mask.fBounds = SkIRect::MakeWH(smallRectSide, smallRectSide); 943 mask.fBounds = SkIRect::MakeWH(smallRectSide, smallRectSide);
947 mask.fFormat = SkMask::kA8_Format; 944 mask.fFormat = SkMask::kA8_Format;
948 mask.fRowBytes = mask.fBounds.width(); 945 mask.fRowBytes = mask.fBounds.width();
949 mask.fImage = SkMask::AllocImage(mask.computeTotalImageSize()); 946 mask.fImage = SkMask::AllocImage(mask.computeTotalImageSize());
(...skipping 17 matching lines...) Expand all
967 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig h_SkBlurQuality, 964 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig h_SkBlurQuality,
968 NULL, true ); 965 NULL, true );
969 966
970 unsigned int texSide = smallRectSide + 2*blurRadius; 967 unsigned int texSide = smallRectSide + 2*blurRadius;
971 GrSurfaceDesc texDesc; 968 GrSurfaceDesc texDesc;
972 texDesc.fWidth = texSide; 969 texDesc.fWidth = texSide;
973 texDesc.fHeight = texSide; 970 texDesc.fHeight = texSide;
974 texDesc.fConfig = kAlpha_8_GrPixelConfig; 971 texDesc.fConfig = kAlpha_8_GrPixelConfig;
975 972
976 blurNinePatchTexture.reset( 973 blurNinePatchTexture.reset(
977 context->textureProvider()->createTexture(texDesc, true, blurredMask .fImage, 0)); 974 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0));
978 SkMask::FreeImage(blurredMask.fImage); 975 SkMask::FreeImage(blurredMask.fImage);
979 if (!blurNinePatchTexture) { 976 if (!blurNinePatchTexture) {
980 return NULL; 977 return NULL;
981 } 978 }
982 context->textureProvider()->assignUniqueKeyToTexture(key, blurNinePatchT exture); 979 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture);
983 } 980 }
984 return SkNEW_ARGS(GrRRectBlurEffect, (sigma, rrect, blurNinePatchTexture)); 981 return SkNEW_ARGS(GrRRectBlurEffect, (sigma, rrect, blurNinePatchTexture));
985 } 982 }
986 983
987 void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 984 void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
988 inout->mulByUnknownSingleComponent(); 985 inout->mulByUnknownSingleComponent();
989 } 986 }
990 987
991 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur e *ninePatchTexture) 988 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur e *ninePatchTexture)
992 : fRRect(rrect), 989 : fRRect(rrect),
(...skipping 13 matching lines...) Expand all
1006 1003
1007 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); 1004 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect);
1008 1005
1009 GrFragmentProcessor* GrRRectBlurEffect::TestCreate(GrProcessorTestData* d) { 1006 GrFragmentProcessor* GrRRectBlurEffect::TestCreate(GrProcessorTestData* d) {
1010 SkScalar w = d->fRandom->nextRangeScalar(100.f, 1000.f); 1007 SkScalar w = d->fRandom->nextRangeScalar(100.f, 1000.f);
1011 SkScalar h = d->fRandom->nextRangeScalar(100.f, 1000.f); 1008 SkScalar h = d->fRandom->nextRangeScalar(100.f, 1000.f);
1012 SkScalar r = d->fRandom->nextRangeF(1.f, 9.f); 1009 SkScalar r = d->fRandom->nextRangeF(1.f, 9.f);
1013 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); 1010 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
1014 SkRRect rrect; 1011 SkRRect rrect;
1015 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); 1012 rrect.setRectXY(SkRect::MakeWH(w, h), r, r);
1016 return GrRRectBlurEffect::Create(d->fContext, sigma, rrect); 1013 return GrRRectBlurEffect::Create(d->fContext->textureProvider(), sigma, rrec t);
1017 } 1014 }
1018 1015
1019 ////////////////////////////////////////////////////////////////////////////// 1016 //////////////////////////////////////////////////////////////////////////////
1020 1017
1021 class GrGLRRectBlurEffect : public GrGLFragmentProcessor { 1018 class GrGLRRectBlurEffect : public GrGLFragmentProcessor {
1022 public: 1019 public:
1023 GrGLRRectBlurEffect(const GrProcessor&) {} 1020 GrGLRRectBlurEffect(const GrProcessor&) {}
1024 1021
1025 virtual void emitCode(GrGLFPBuilder*, 1022 virtual void emitCode(GrGLFPBuilder*,
1026 const GrFragmentProcessor&, 1023 const GrFragmentProcessor&,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 } 1113 }
1117 1114
1118 void GrRRectBlurEffect::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey Builder* b) const { 1115 void GrRRectBlurEffect::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey Builder* b) const {
1119 GrGLRRectBlurEffect::GenKey(*this, caps, b); 1116 GrGLRRectBlurEffect::GenKey(*this, caps, b);
1120 } 1117 }
1121 1118
1122 GrGLFragmentProcessor* GrRRectBlurEffect::createGLInstance() const { 1119 GrGLFragmentProcessor* GrRRectBlurEffect::createGLInstance() const {
1123 return SkNEW_ARGS(GrGLRRectBlurEffect, (*this)); 1120 return SkNEW_ARGS(GrGLRRectBlurEffect, (*this));
1124 } 1121 }
1125 1122
1126 bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context, 1123 bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvid er,
1124 GrDrawContext* drawContext,
1127 GrRenderTarget* rt, 1125 GrRenderTarget* rt,
1128 GrPaint* grp, 1126 GrPaint* grp,
1129 const GrClip& clip, 1127 const GrClip& clip,
1130 const SkMatrix& viewMatrix, 1128 const SkMatrix& viewMatrix,
1131 const SkStrokeRec& strokeRec , 1129 const SkStrokeRec& strokeRec ,
1132 const SkRRect& rrect) const { 1130 const SkRRect& rrect) const {
1131 SkASSERT(drawContext);
1132
1133 if (fBlurStyle != kNormal_SkBlurStyle) { 1133 if (fBlurStyle != kNormal_SkBlurStyle) {
1134 return false; 1134 return false;
1135 } 1135 }
1136 1136
1137 if (!strokeRec.isFillStyle()) { 1137 if (!strokeRec.isFillStyle()) {
1138 return false; 1138 return false;
1139 } 1139 }
1140 1140
1141 SkRect proxy_rect = rrect.rect(); 1141 SkScalar xformedSigma = this->computeXformedSigma(viewMatrix);
1142 SkMatrix ctm = viewMatrix;
1143 SkScalar xformedSigma = this->computeXformedSigma(ctm);
1144 float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f); 1142 float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f);
1145 proxy_rect.outset(extra, extra);
1146 1143
1147 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(context, xfor medSigma, rrect)); 1144 SkRect proxyRect = rrect.rect();
1145 proxyRect.outset(extra, extra);
1146
1147 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(texProvider,
1148 xformedSigma, rrect));
1148 if (!fp) { 1149 if (!fp) {
1149 return false; 1150 return false;
1150 } 1151 }
1151 1152
1152 grp->addCoverageProcessor(fp); 1153 grp->addCoverageProcessor(fp);
1153 1154
1154 SkMatrix inverse; 1155 SkMatrix inverse;
1155 if (!viewMatrix.invert(&inverse)) { 1156 if (!viewMatrix.invert(&inverse)) {
1156 return false; 1157 return false;
1157 } 1158 }
1158 1159
1159 GrDrawContext* drawContext = context->drawContext(); 1160 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), pro xyRect, inverse);
1160 if (drawContext) { 1161 return true;
1161 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(),
1162 proxy_rect, inverse);
1163 return true;
1164 }
1165
1166 return false;
1167 } 1162 }
1168 1163
1169 bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds, 1164 bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds,
1170 const SkIRect& clipBounds, 1165 const SkIRect& clipBounds,
1171 const SkMatrix& ctm, 1166 const SkMatrix& ctm,
1172 SkRect* maskRect) const { 1167 SkRect* maskRect) const {
1173 SkScalar xformedSigma = this->computeXformedSigma(ctm); 1168 SkScalar xformedSigma = this->computeXformedSigma(ctm);
1174 if (xformedSigma <= 0) { 1169 if (xformedSigma <= 0) {
1175 return false; 1170 return false;
1176 } 1171 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 } else { 1281 } else {
1287 str->append("None"); 1282 str->append("None");
1288 } 1283 }
1289 str->append("))"); 1284 str->append("))");
1290 } 1285 }
1291 #endif 1286 #endif
1292 1287
1293 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1288 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1294 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1289 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1295 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1290 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698