Add default ctor to SkMask
The minimal fix here seems to be handling BoxBlur's return value in SkBlurMaskFilter.cpp::GrRRectBlurEffect::Create. We seem to do enough special handling of the fImage field though that always initialializing it may not be a bad idea.
BUG=570232
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1539553002
Review URL: https://codereview.chromium.org/1539553002
diff --git a/bench/BlurRectBench.cpp b/bench/BlurRectBench.cpp
index b8a7211..53cf2da 100644
--- a/bench/BlurRectBench.cpp
+++ b/bench/BlurRectBench.cpp
@@ -63,7 +63,7 @@
preBenchSetup(r);
for (int i = 0; i < loops; i++) {
- makeBlurryRect(r);
+ this->makeBlurryRect(r);
}
}
@@ -90,8 +90,10 @@
protected:
void makeBlurryRect(const SkRect& r) override {
SkMask mask;
- SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
- &mask, r, kNormal_SkBlurStyle);
+ if (!SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
+ &mask, r, kNormal_SkBlurStyle)) {
+ return;
+ }
SkMask::FreeImage(mask.fImage);
}
private:
@@ -101,9 +103,7 @@
class BlurRectSeparableBench: public BlurRectBench {
public:
- BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) {
- fSrcMask.fImage = nullptr;
- }
+ BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) { }
~BlurRectSeparableBench() {
SkMask::FreeImage(fSrcMask.fImage);
@@ -144,9 +144,10 @@
void makeBlurryRect(const SkRect&) override {
SkMask mask;
- mask.fImage = nullptr;
- SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()),
- kNormal_SkBlurStyle, kHigh_SkBlurQuality);
+ if (!SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()),
+ kNormal_SkBlurStyle, kHigh_SkBlurQuality)) {
+ return;
+ }
SkMask::FreeImage(mask.fImage);
}
private:
@@ -171,9 +172,10 @@
void makeBlurryRect(const SkRect&) override {
SkMask mask;
- mask.fImage = nullptr;
- SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
- &mask, fSrcMask, kNormal_SkBlurStyle);
+ if (!SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
+ &mask, fSrcMask, kNormal_SkBlurStyle)) {
+ return;
+ }
SkMask::FreeImage(mask.fImage);
}
private: