hide SkBlurMaskFilter and SkBlurQuality
SK_SUPPORT_LEGACY_BLURMASKFILTER Bug: skia: Change-Id: Ic3e27e08e6e3cd2ffc1cd13b044e197bebc96236 Reviewed-on: https://skia-review.googlesource.com/113940 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
c29c76aae5
commit
1be1f8d097
@ -6,8 +6,8 @@
|
||||
*/
|
||||
#include "Benchmark.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkShader.h"
|
||||
@ -31,17 +31,14 @@ static const char* gStyleName[] = {
|
||||
class BlurBench : public Benchmark {
|
||||
SkScalar fRadius;
|
||||
SkBlurStyle fStyle;
|
||||
uint32_t fFlags;
|
||||
SkString fName;
|
||||
|
||||
public:
|
||||
BlurBench(SkScalar rad, SkBlurStyle bs, uint32_t flags = 0) {
|
||||
BlurBench(SkScalar rad, SkBlurStyle bs) {
|
||||
fRadius = rad;
|
||||
fStyle = bs;
|
||||
fFlags = flags;
|
||||
const char* name = rad > 0 ? gStyleName[bs] : "none";
|
||||
const char* quality = flags & SkBlurMaskFilter::kHighQuality_BlurFlag ? "high_quality"
|
||||
: "low_quality";
|
||||
const char* quality = "high_quality";
|
||||
if (SkScalarFraction(rad) != 0) {
|
||||
fName.printf("blur_%.2f_%s_%s", SkScalarToFloat(rad), name, quality);
|
||||
} else {
|
||||
@ -67,9 +64,8 @@ protected:
|
||||
r.offset(fRadius, fRadius);
|
||||
|
||||
if (fRadius > 0) {
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(fStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(fRadius),
|
||||
fFlags));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(fStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(fRadius)));
|
||||
}
|
||||
canvas->drawOval(r, paint);
|
||||
}
|
||||
@ -104,15 +100,4 @@ DEF_BENCH(return new BlurBench(REAL, kSolid_SkBlurStyle);)
|
||||
DEF_BENCH(return new BlurBench(REAL, kOuter_SkBlurStyle);)
|
||||
DEF_BENCH(return new BlurBench(REAL, kInner_SkBlurStyle);)
|
||||
|
||||
DEF_BENCH(return new BlurBench(MINI, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
|
||||
|
||||
DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
|
||||
|
||||
DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
|
||||
|
||||
DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
|
||||
|
||||
DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
|
||||
DEF_BENCH(return new BlurBench(CUTOVER, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
|
||||
|
||||
DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);)
|
||||
|
@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "Benchmark.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkRRect.h"
|
||||
#include "SkRect.h"
|
||||
@ -48,7 +48,7 @@ public:
|
||||
SkPaint firstBlur;
|
||||
firstBlur.setAntiAlias(true);
|
||||
firstBlur.setColor(0x09000000);
|
||||
firstBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
firstBlur.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
2.5f,
|
||||
occRect));
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
SkPaint secondBlur;
|
||||
secondBlur.setAntiAlias(true);
|
||||
secondBlur.setColor(0x30000000);
|
||||
secondBlur.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
secondBlur.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
6.0f,
|
||||
occRect));
|
||||
|
||||
|
@ -145,7 +145,7 @@ protected:
|
||||
void makeBlurryRect(const SkRect&) override {
|
||||
SkMask mask;
|
||||
if (!SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()),
|
||||
kNormal_SkBlurStyle, kHigh_SkBlurQuality)) {
|
||||
kNormal_SkBlurStyle)) {
|
||||
return;
|
||||
}
|
||||
SkMask::FreeImage(mask.fImage);
|
||||
|
@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "Benchmark.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRect.h"
|
||||
@ -31,7 +31,7 @@ public:
|
||||
|
||||
void onDraw(int loops, SkCanvas* canvas) override {
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, fRadius));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, fRadius));
|
||||
|
||||
SkPath path;
|
||||
path.addRect(fOuter, SkPath::kCW_Direction);
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "Benchmark.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkPoint.h"
|
||||
@ -48,9 +48,8 @@ public:
|
||||
info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0));
|
||||
info.fPostTranslate = false;
|
||||
SkPaint* paint = looperBuilder.addLayerOnTop(info);
|
||||
paint->setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(0.5),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
paint->setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(0.5)));
|
||||
paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorLTGRAY,
|
||||
SkBlendMode::kSrcIn));
|
||||
paint->setColor(SK_ColorGRAY);
|
||||
|
@ -6,9 +6,9 @@
|
||||
*/
|
||||
|
||||
#include "Benchmark.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRandom.h"
|
||||
@ -86,8 +86,7 @@ private:
|
||||
|
||||
SkPaint* paint = looperBuilder.addLayer(info);
|
||||
|
||||
paint->setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, sigma,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
paint->setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
|
||||
|
||||
//-----------------------------------------------
|
||||
info.fPaintBits = 0;
|
||||
|
@ -509,8 +509,9 @@ static sk_sp<SkMaskFilter> make_fuzz_maskfilter(Fuzz* fuzz) {
|
||||
fuzz->next(&occluder);
|
||||
}
|
||||
uint32_t flags;
|
||||
fuzz->nextRange(&flags, 0, 3);
|
||||
return SkBlurMaskFilter::Make(blurStyle, sigma, occluder, flags);
|
||||
fuzz->nextRange(&flags, 0, 1);
|
||||
bool respectCTM = flags != 0;
|
||||
return SkMaskFilter::MakeBlur(blurStyle, sigma, occluder, respectCTM);
|
||||
}
|
||||
case 2: {
|
||||
SkRRect first, second;
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "gm.h"
|
||||
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkShader.h"
|
||||
|
||||
static SkBitmap make_alpha_image(int w, int h) {
|
||||
@ -39,7 +39,7 @@ DEF_SIMPLE_GM(alpha_image, canvas, 256, 256) {
|
||||
SkPaint paint;
|
||||
|
||||
paint.setColorFilter(make_color_filter());
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 10.0f, 0));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 10.0f));
|
||||
canvas->drawImage(image.get(), 16, 16, &paint);
|
||||
|
||||
paint.setColorFilter(nullptr);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
|
||||
namespace skiagm {
|
||||
@ -71,7 +71,7 @@ protected:
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j <= kLastEnum_SkBlurStyle; ++j) {
|
||||
blurPaint.setMaskFilter(SkBlurMaskFilter::Make((SkBlurStyle)j, kSigma));
|
||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur((SkBlurStyle)j, kSigma));
|
||||
|
||||
for (int k = 0; k < (int)SK_ARRAY_COUNT(origins); ++k) {
|
||||
canvas->save();
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkTDArray.h"
|
||||
#include "SkUtils.h"
|
||||
#include "sk_tool_utils.h"
|
||||
@ -281,7 +281,7 @@ protected:
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterQuality(filter);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(3)));
|
||||
paint.setShader(fShader);
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
@ -299,7 +299,7 @@ protected:
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterQuality(filter);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle,
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(7)));
|
||||
paint.setShader(fShader);
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkString.h"
|
||||
|
||||
@ -31,10 +31,9 @@ protected:
|
||||
const float blurRadii[kNumBlurs] = { 1,5,10,20 };
|
||||
|
||||
for (int i = 0; i < kNumBlurs; ++i) {
|
||||
fBlurFilters[i] = SkBlurMaskFilter::Make(
|
||||
fBlurFilters[i] = SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i])),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag);
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i])));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,8 @@ protected:
|
||||
};
|
||||
|
||||
auto blurMaker = [] (SkScalar radius) ->sk_sp<SkMaskFilter> {
|
||||
return SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(radius),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag);
|
||||
return SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(radius));
|
||||
};
|
||||
|
||||
SkPaint paint;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "sk_tool_utils.h"
|
||||
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
|
||||
// This GM tests out the SkBlurMaskFilter's kIgnoreTransform flag. That flag causes the blur mask
|
||||
@ -42,10 +42,10 @@ protected:
|
||||
|
||||
void onOnceBeforeDraw() override {
|
||||
for (int i = 0; i < kNumBlurs; ++i) {
|
||||
fBlurFilters[i] = SkBlurMaskFilter::Make(
|
||||
fBlurFilters[i] = SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag | kBlurFlags[i].fFlags);
|
||||
kBlurFlags[i].fRespectCTM);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ private:
|
||||
static constexpr int kNumBlurs = 2;
|
||||
|
||||
static const struct BlurFlags {
|
||||
uint32_t fFlags;
|
||||
bool fRespectCTM;
|
||||
const char* fName;
|
||||
} kBlurFlags[kNumBlurs];
|
||||
|
||||
@ -130,8 +130,8 @@ private:
|
||||
};
|
||||
|
||||
const BlurIgnoreXformGM::BlurFlags BlurIgnoreXformGM::kBlurFlags[] = {
|
||||
{0, "none"},
|
||||
{SkBlurMaskFilter::kIgnoreTransform_BlurFlag, "IgnoreTransform"}
|
||||
{true, "none"},
|
||||
{false, "IgnoreTransform"}
|
||||
};
|
||||
|
||||
const BlurIgnoreXformGM::MatrixScale BlurIgnoreXformGM::kMatrixScales[] = {
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
|
||||
@ -38,9 +38,7 @@ DEF_SIMPLE_GM(blurimagevmask, canvas, 700, 1200) {
|
||||
|
||||
r.offset(250, 0);
|
||||
|
||||
paint.setMaskFilter(
|
||||
SkBlurMaskFilter::Make(kNormal_SkBlurStyle, sigma,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
|
||||
canvas->drawRect(r, paint);
|
||||
paint.setMaskFilter(nullptr);
|
||||
|
||||
@ -61,7 +59,7 @@ DEF_SIMPLE_GM(blur_image, canvas, 500, 500) {
|
||||
auto image = GetResourceAsImage("images/mandrill_128.png");
|
||||
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 4));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 4));
|
||||
|
||||
// both of these should draw with the blur, but (formerally) we had a bug where the unscaled
|
||||
// version (taking the spriteblitter code path) ignore the maskfilter.
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
|
||||
// This GM tests out the quick reject bounds of the blur mask filter. It draws
|
||||
// four blurred rects around a central clip. The blurred rect geometry outset
|
||||
@ -56,7 +56,7 @@ protected:
|
||||
|
||||
SkPaint blurPaint;
|
||||
blurPaint.setFilterQuality(kLow_SkFilterQuality);
|
||||
blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(kBlurRadius)));
|
||||
|
||||
canvas->clear(SK_ColorBLACK);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
|
||||
#define STROKE_WIDTH SkIntToScalar(10)
|
||||
@ -95,9 +95,8 @@ public:
|
||||
protected:
|
||||
void onOnceBeforeDraw() override {
|
||||
for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) {
|
||||
fMaskFilters[i] = SkBlurMaskFilter::Make((SkBlurStyle)i,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(STROKE_WIDTH/2)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag);
|
||||
fMaskFilters[i] = SkMaskFilter::MakeBlur((SkBlurStyle)i,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(STROKE_WIDTH/2)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkClipOpPriv.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkRRect.h"
|
||||
|
||||
@ -65,10 +65,9 @@ protected:
|
||||
|
||||
SkPaint paint;
|
||||
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
1.366025f,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
1.366025f));
|
||||
paint.setColorFilter(SkColorFilter::MakeModeFilter(
|
||||
SK_ColorRED,
|
||||
SkBlendMode::kSrcIn));
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkPoint.h"
|
||||
@ -55,10 +55,9 @@ public:
|
||||
info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0));
|
||||
info.fPostTranslate = false;
|
||||
SkPaint* paint = looperBuilder.addLayerOnTop(info);
|
||||
paint->setMaskFilter(SkBlurMaskFilter::Make(
|
||||
paint->setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf)));
|
||||
paint->setColorFilter(SkColorFilter::MakeModeFilter(
|
||||
sk_tool_utils::color_to_565(SK_ColorLTGRAY),
|
||||
SkBlendMode::kSrcIn));
|
||||
@ -143,9 +142,8 @@ protected:
|
||||
for (int k = 0; k <= 1; k++) {
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i])),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]))));
|
||||
|
||||
bool useRadial = SkToBool(k);
|
||||
if (useRadial) {
|
||||
|
69
gm/blurs.cpp
69
gm/blurs.cpp
@ -9,8 +9,8 @@
|
||||
#include "sk_tool_utils.h"
|
||||
#include "Resources.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
|
||||
DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, sk_tool_utils::color_to_565(0xFFDDDDDD)) {
|
||||
@ -32,43 +32,34 @@ DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, sk_tool_utils::color_to_565(0xFFDDDDDD
|
||||
paint.setTextSize(SkIntToScalar(25));
|
||||
canvas->translate(SkIntToScalar(-40), SkIntToScalar(0));
|
||||
|
||||
SkBlurMaskFilter::BlurFlags flags = SkBlurMaskFilter::kNone_BlurFlag;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
canvas->save();
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
|
||||
if (gRecs[i].fStyle != NONE) {
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(gRecs[i].fStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20)),
|
||||
flags));
|
||||
} else {
|
||||
paint.setMaskFilter(nullptr);
|
||||
}
|
||||
canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100),
|
||||
SkIntToScalar(200 + gRecs[i].fCy*100),
|
||||
SkIntToScalar(50),
|
||||
paint);
|
||||
}
|
||||
// draw text
|
||||
{
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)),
|
||||
flags));
|
||||
SkScalar x = SkIntToScalar(70);
|
||||
SkScalar y = SkIntToScalar(400);
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
canvas->drawString("Hamburgefons Style",
|
||||
x, y + SkIntToScalar(50), paint);
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
|
||||
if (gRecs[i].fStyle != NONE) {
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(gRecs[i].fStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20))));
|
||||
} else {
|
||||
paint.setMaskFilter(nullptr);
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
x -= SkIntToScalar(2);
|
||||
y -= SkIntToScalar(2);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
}
|
||||
canvas->restore();
|
||||
flags = SkBlurMaskFilter::kHighQuality_BlurFlag;
|
||||
canvas->translate(SkIntToScalar(350), SkIntToScalar(0));
|
||||
canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100),
|
||||
SkIntToScalar(200 + gRecs[i].fCy*100),
|
||||
SkIntToScalar(50),
|
||||
paint);
|
||||
}
|
||||
// draw text
|
||||
{
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4))));
|
||||
SkScalar x = SkIntToScalar(70);
|
||||
SkScalar y = SkIntToScalar(400);
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
canvas->drawString("Hamburgefons Style",
|
||||
x, y + SkIntToScalar(50), paint);
|
||||
paint.setMaskFilter(nullptr);
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
x -= SkIntToScalar(2);
|
||||
y -= SkIntToScalar(2);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +74,7 @@ DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, sk_tool_utils::color_to_565(0xFFDDDDDD
|
||||
DEF_SIMPLE_GM(blur2rects, canvas, 700, 500) {
|
||||
SkPaint paint;
|
||||
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 2.3f));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 2.3f));
|
||||
|
||||
SkRect outer = SkRect::MakeXYWH(10.125f, 10.125f, 100.125f, 100);
|
||||
SkRect inner = SkRect::MakeXYWH(20.25f, 20.125f, 80, 80);
|
||||
@ -101,7 +92,7 @@ DEF_SIMPLE_GM(blur2rects, canvas, 700, 500) {
|
||||
|
||||
DEF_SIMPLE_GM(blur2rectsnonninepatch, canvas, 700, 500) {
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 4.3f));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 4.3f));
|
||||
|
||||
SkRect outer = SkRect::MakeXYWH(10, 110, 100, 100);
|
||||
SkRect inner = SkRect::MakeXYWH(50, 150, 10, 10);
|
||||
@ -122,7 +113,7 @@ DEF_SIMPLE_GM(blur2rectsnonninepatch, canvas, 700, 500) {
|
||||
|
||||
DEF_SIMPLE_GM(BlurDrawImage, canvas, 256, 256) {
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 10, 0));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 10));
|
||||
canvas->clear(0xFF88FF88);
|
||||
if (auto image = GetResourceAsImage("images/mandrill_512_q075.jpg")) {
|
||||
canvas->scale(0.25, 0.25);
|
||||
|
@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColor.h"
|
||||
#include "SkMaskFilter.h"
|
||||
|
||||
// GM to check the behavior from chrome bug:745290
|
||||
DEF_SIMPLE_GM(blurSmallRadii, canvas, 100, 100) {
|
||||
@ -17,7 +17,7 @@ DEF_SIMPLE_GM(blurSmallRadii, canvas, 100, 100) {
|
||||
for (auto sigma : sigmas) {
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
paint.setAntiAlias(true);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, sigma));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
|
||||
canvas->drawString("Guest", 20, 10, paint);
|
||||
|
||||
paint.setMaskFilter(nullptr);
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include "gm.h"
|
||||
#include "SkBlurDrawLooper.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkMatrix.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkTArray.h"
|
||||
@ -52,10 +52,9 @@ protected:
|
||||
// AA with mask filter
|
||||
SkPaint p;
|
||||
p.setAntiAlias(true);
|
||||
p.setMaskFilter(SkBlurMaskFilter::Make(
|
||||
p.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5))));
|
||||
fPaints.push_back(p);
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkTextBlob.h"
|
||||
|
||||
#define WIDTH 800
|
||||
@ -53,7 +53,7 @@ protected:
|
||||
const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(50));
|
||||
|
||||
SkPaint blurPaint(paint);
|
||||
blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kSigma));
|
||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kSigma));
|
||||
|
||||
SkTextBlobBuilder builder;
|
||||
|
||||
|
@ -224,10 +224,9 @@ protected:
|
||||
paint.setFilterQuality(kLow_SkFilterQuality);
|
||||
|
||||
srcRect.setXYWH(1, 1, 3, 3);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5))));
|
||||
|
||||
sk_sp<SkImage> image(SkImage::MakeFromBitmap(bm));
|
||||
fProc(canvas, image.get(), bm, srcRect, dstRect, &paint);
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
@ -45,9 +45,8 @@ protected:
|
||||
}
|
||||
|
||||
void onOnceBeforeDraw() override {
|
||||
fBlur = SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(10.0f),
|
||||
kLow_SkBlurQuality);
|
||||
fBlur = SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(10.0f));
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGraphics.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRandom.h"
|
||||
|
||||
#define WIDTH 200
|
||||
@ -78,7 +78,7 @@ private:
|
||||
paint->setStyle(gParams[i].fStyle);
|
||||
paint->setStrokeWidth(gParams[i].fWidth);
|
||||
if (gParams[i].fBlur > 0) {
|
||||
paint->setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
paint->setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(gParams[i].fBlur)));
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDashPathEffect.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRegion.h"
|
||||
|
||||
class DrawRegionModesGM : public skiagm::GM {
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
canvas->translate(-125.0f, 125.0f);
|
||||
paint.setImageFilter(nullptr);
|
||||
SkRect occluder = SkRect::MakeEmpty();
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 5.0f, occluder, 0));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 5.0f, occluder));
|
||||
canvas->drawRegion(fRegion, paint);
|
||||
|
||||
canvas->translate(-125.0f, -125.0f);
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "sk_tool_utils.h"
|
||||
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkTextBlob.h"
|
||||
|
||||
// This test ensures that glyphs whose point size is less than the SkGlyphCache's maxmium, but
|
||||
@ -27,7 +27,7 @@ DEF_SIMPLE_GM(largeglyphblur, canvas, 1920, 600) {
|
||||
const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(40));
|
||||
|
||||
SkPaint blurPaint(paint);
|
||||
blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kSigma));
|
||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kSigma));
|
||||
|
||||
SkTextBlobBuilder builder;
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
|
||||
// This GM tests 3 different ways of drawing four shadows around a square:
|
||||
// just using 4 blurred rects
|
||||
@ -113,8 +113,7 @@ private:
|
||||
static sk_sp<SkMaskFilter> MakeBlur() {
|
||||
const SkScalar kBlurSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(25));
|
||||
|
||||
return SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kBlurSigma,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag);
|
||||
return SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kBlurSigma);
|
||||
}
|
||||
|
||||
// This draws 4 blurred shadows around a single square (centered at x, y).
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRRect.h"
|
||||
|
||||
static SkRect offset_center_to(const SkIRect& src, SkScalar x, SkScalar y) {
|
||||
@ -46,7 +46,7 @@ static void draw_rrect(SkCanvas* canvas, const SkRRect& rr, const SkRRect& occRR
|
||||
|
||||
// draw the blur
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kBlurSigma, occRect));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kBlurSigma, occRect));
|
||||
canvas->drawRRect(rr, paint);
|
||||
|
||||
// draw the stroked geometry of the full occluder
|
||||
|
@ -65,10 +65,9 @@ protected:
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorWHITE);
|
||||
p.setAntiAlias(true);
|
||||
p.setMaskFilter(SkBlurMaskFilter::Make(
|
||||
p.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5))));
|
||||
fPaints.push_back(p);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkAnimTimer.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRRectsGaussianEdgeMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkPathOps.h"
|
||||
@ -400,7 +400,7 @@ protected:
|
||||
|
||||
SkPaint blurPaint;
|
||||
blurPaint.setAntiAlias(true);
|
||||
blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, sigma));
|
||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
|
||||
canvas->drawPath(clippedPath, blurPaint);
|
||||
} else {
|
||||
SkASSERT(kRRectsGaussianEdge_Mode == fMode);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkShader.h"
|
||||
|
||||
@ -82,7 +82,7 @@ protected:
|
||||
}
|
||||
|
||||
const SkScalar sigma = 1;
|
||||
fMaskFilter = SkBlurMaskFilter::Make(kNormal_SkBlurStyle, sigma);
|
||||
fMaskFilter = SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlendModePriv.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkShaderMaskFilter.h"
|
||||
|
||||
static void draw_masked_image(SkCanvas* canvas, const SkImage* image, SkScalar x, SkScalar y,
|
||||
@ -58,7 +58,7 @@ DEF_SIMPLE_GM(shadermaskfilter_image, canvas, 560, 370) {
|
||||
|
||||
auto image = GetResourceAsImage("images/mandrill_128.png");
|
||||
auto mask = GetResourceAsImage("images/color_wheel.png");
|
||||
auto blurmf = SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 5);
|
||||
auto blurmf = SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 5);
|
||||
auto gradmf = SkShaderMaskFilter::Make(make_shader(SkRect::MakeIWH(mask->width(),
|
||||
mask->height())));
|
||||
|
||||
@ -166,7 +166,7 @@ DEF_SIMPLE_GM(combinemaskfilter, canvas, 560, 510) {
|
||||
|
||||
#include "SkSurface.h"
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
static sk_sp<SkImage> make_circle_image(SkCanvas* canvas, SkScalar radius, int margin) {
|
||||
const int n = SkScalarCeilToInt(radius) * 2 + margin * 2;
|
||||
auto surf = sk_tool_utils::makeSurface(canvas, SkImageInfo::MakeN32Premul(n, n));
|
||||
@ -190,7 +190,7 @@ DEF_SIMPLE_GM(savelayer_maskfilter, canvas, 450, 675) {
|
||||
|
||||
sk_sp<SkMaskFilter> mfs[] = {
|
||||
SkShaderMaskFilter::Make(maskImage->makeShader()),
|
||||
SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 3.5f),
|
||||
SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 3.5f),
|
||||
nullptr,
|
||||
};
|
||||
mfs[2] = SkMaskFilter::MakeCompose(mfs[1], mfs[0]);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
|
||||
/**
|
||||
@ -62,8 +62,7 @@ DEF_SIMPLE_GM_BG(skbug1719, canvas, 300, 100,
|
||||
paint.setAntiAlias(true);
|
||||
paint.setColor(0xFF000000);
|
||||
paint.setMaskFilter(
|
||||
SkBlurMaskFilter::Make(kNormal_SkBlurStyle, 0.78867501f,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 0.78867501f));
|
||||
paint.setColorFilter(SkColorFilter::MakeModeFilter(0xBFFFFFFF, SkBlendMode::kSrcIn));
|
||||
|
||||
canvas->clipPath(clipPath, true);
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "gm.h"
|
||||
#include "sk_tool_utils.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkDashPathEffect.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkPoint3.h"
|
||||
@ -163,8 +163,7 @@ protected:
|
||||
// blur
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorWHITE);
|
||||
p.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3.0f,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
p.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3.0f));
|
||||
fPaints.push_back(p);
|
||||
}
|
||||
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
#include "Sk2DPathEffect.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColorMatrixFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkGraphics.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkTextBlob.h"
|
||||
|
||||
@ -62,7 +62,7 @@ struct LooperSettings {
|
||||
};
|
||||
|
||||
static void mask_filter(SkPaint* paint) {
|
||||
paint->setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
paint->setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(3.f)));
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
#include "Resources.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkStream.h"
|
||||
#include "SkSurface.h"
|
||||
@ -136,7 +136,7 @@ protected:
|
||||
// setup blur paint
|
||||
SkPaint blurPaint(paint);
|
||||
blurPaint.setColor(sk_tool_utils::color_to_565(SK_ColorBLACK));
|
||||
blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kSigma));
|
||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kSigma));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
canvas->save();
|
||||
|
@ -7,4 +7,5 @@ flutter_defines = [
|
||||
"SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION",
|
||||
"SK_DISABLE_RENDER_TARGET_SORTING",
|
||||
"SK_SUPPORT_LEGACY_RECTMAKELARGEST",
|
||||
"SK_SUPPORT_LEGACY_BLURMASKFILTER",
|
||||
]
|
||||
|
@ -52,6 +52,7 @@ def CleanupCFlags(cflags):
|
||||
"-DSKIA_DLL",
|
||||
"-DSKIA_IMPLEMENTATION=1",
|
||||
"-DATRACE_TAG=ATRACE_TAG_VIEW",
|
||||
"-DSK_SUPPORT_LEGACY_BLURMASKFILTER",
|
||||
"-DSK_PRINT_CODEC_MESSAGES",
|
||||
])
|
||||
|
||||
|
@ -19,12 +19,13 @@ enum SkBlurStyle {
|
||||
kLastEnum_SkBlurStyle = kInner_SkBlurStyle
|
||||
};
|
||||
|
||||
// DEPRECATED
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
enum SkBlurQuality {
|
||||
kLow_SkBlurQuality, //!< e.g. box filter
|
||||
kHigh_SkBlurQuality, //!< e.g. 3-pass similar to gaussian
|
||||
|
||||
kLastEnum_SkBlurQuality
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -84,7 +84,9 @@ public:
|
||||
SkVector fOffset;
|
||||
SkColor fColor;
|
||||
SkBlurStyle fStyle;
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
SkBlurQuality fQuality;
|
||||
#endif
|
||||
};
|
||||
/**
|
||||
* If this looper can be interpreted as having two layers, such that
|
||||
|
@ -18,6 +18,7 @@ class SkRRect;
|
||||
|
||||
class SK_API SkBlurMaskFilter {
|
||||
public:
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
enum BlurFlags {
|
||||
kNone_BlurFlag = 0x00,
|
||||
/** The blur layer's radius is not affected by transforms */
|
||||
@ -44,6 +45,7 @@ public:
|
||||
uint32_t flags = kNone_BlurFlag) {
|
||||
return Make(style, sigma, SkRect::MakeEmpty(), flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
|
||||
/** Create an emboss maskfilter
|
||||
@ -58,8 +60,10 @@ public:
|
||||
SkScalar ambient, SkScalar specular);
|
||||
#endif
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
private:
|
||||
SkBlurMaskFilter(); // can't be instantiated
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -585,6 +585,7 @@ def base_defines(os_conditions):
|
||||
# Required for building dm.
|
||||
"GR_TEST_UTILS",
|
||||
# Staging flags for API changes
|
||||
"SK_SUPPORT_LEGACY_BLURMASKFILTER",
|
||||
# Should remove after we update golden images
|
||||
"SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
|
||||
# Experiment to diagnose image diffs in Google3
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "SampleCode.h"
|
||||
#include "SkAnimTimer.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkRandom.h"
|
||||
|
||||
SkScalar get_anim_sin(double secs, SkScalar amplitude, SkScalar periodInSec, SkScalar phaseInSec) {
|
||||
@ -47,9 +47,8 @@ protected:
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
|
||||
SkPaint paint;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(gStyles[i],
|
||||
fBlurSigma,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(gStyles[i],
|
||||
fBlurSigma));
|
||||
paint.setColor(random.nextU() | 0xff000000);
|
||||
canvas->drawCircle(200 * SK_Scalar1 + 400 * (i % 2) * SK_Scalar1,
|
||||
200 * SK_Scalar1 + i / 2 * 400 * SK_Scalar1,
|
||||
|
@ -6,8 +6,8 @@
|
||||
*/
|
||||
#include "SampleCode.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkView.h"
|
||||
|
||||
class BigBlurView : public SampleView {
|
||||
@ -29,10 +29,9 @@ protected:
|
||||
SkPaint paint;
|
||||
canvas->save();
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128))));
|
||||
canvas->translate(200, 200);
|
||||
canvas->drawCircle(100, 100, 200, paint);
|
||||
canvas->restore();
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include "SampleCode.h"
|
||||
#include "SkBitmap.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkUtils.h"
|
||||
#include "SkView.h"
|
||||
|
||||
@ -54,40 +54,31 @@ protected:
|
||||
paint.setTextSize(25);
|
||||
canvas->translate(-40, 0);
|
||||
|
||||
SkBlurMaskFilter::BlurFlags flags = SkBlurMaskFilter::kNone_BlurFlag;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
canvas->save();
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
|
||||
if (gRecs[i].fStyle != NONE) {
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(gRecs[i].fStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20)),
|
||||
flags));
|
||||
} else {
|
||||
paint.setMaskFilter(nullptr);
|
||||
}
|
||||
canvas->drawCircle(200 + gRecs[i].fCx*100.f,
|
||||
200 + gRecs[i].fCy*100.f, 50, paint);
|
||||
}
|
||||
// draw text
|
||||
{
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(4),
|
||||
flags));
|
||||
SkScalar x = SkIntToScalar(70);
|
||||
SkScalar y = SkIntToScalar(400);
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
canvas->drawString("Hamburgefons Style", x, y + SkIntToScalar(50), paint);
|
||||
paint.setColor(SK_ColorBLUE);
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
|
||||
if (gRecs[i].fStyle != NONE) {
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(gRecs[i].fStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20))));
|
||||
} else {
|
||||
paint.setMaskFilter(nullptr);
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
x -= SkIntToScalar(2);
|
||||
y -= SkIntToScalar(2);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
}
|
||||
canvas->restore();
|
||||
flags = SkBlurMaskFilter::kHighQuality_BlurFlag;
|
||||
canvas->translate(350, 0);
|
||||
canvas->drawCircle(200 + gRecs[i].fCx*100.f,
|
||||
200 + gRecs[i].fCy*100.f, 50, paint);
|
||||
}
|
||||
// draw text
|
||||
{
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(4)));
|
||||
SkScalar x = SkIntToScalar(70);
|
||||
SkScalar y = SkIntToScalar(400);
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
canvas->drawString("Hamburgefons Style", x, y + SkIntToScalar(50), paint);
|
||||
paint.setMaskFilter(nullptr);
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
x -= SkIntToScalar(2);
|
||||
y -= SkIntToScalar(2);
|
||||
canvas->drawString("Hamburgefons Style", x, y, paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
#include "SampleCode.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorMatrixFilter.h"
|
||||
#include "SkDiscretePathEffect.h"
|
||||
@ -23,7 +22,7 @@ static void paint_proc0(SkPaint*) {
|
||||
}
|
||||
|
||||
static void paint_proc1(SkPaint* paint) {
|
||||
paint->setMaskFilter(SkBlurMaskFilter::Make(
|
||||
paint->setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(2)));
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "Sk2DPathEffect.h"
|
||||
#include "SkAlphaThresholdFilter.h"
|
||||
#include "SkBlurImageFilter.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkColorFilterImageFilter.h"
|
||||
@ -186,8 +185,8 @@ static SkBlurStyle make_blur_style() {
|
||||
return static_cast<SkBlurStyle>(R(kLastEnum_SkBlurStyle+1));
|
||||
}
|
||||
|
||||
static SkBlurMaskFilter::BlurFlags make_blur_mask_filter_flag() {
|
||||
return static_cast<SkBlurMaskFilter::BlurFlags>(R(SkBlurMaskFilter::kAll_BlurFlag+1));
|
||||
static bool make_blur_mask_filter_respectctm() {
|
||||
return static_cast<bool>(R(2));
|
||||
}
|
||||
|
||||
static SkFilterQuality make_filter_quality() {
|
||||
@ -458,8 +457,8 @@ static sk_sp<SkMaskFilter> make_mask_filter() {
|
||||
sk_sp<SkMaskFilter> maskFilter;
|
||||
switch (R(3)) {
|
||||
case 0:
|
||||
maskFilter = SkBlurMaskFilter::Make(make_blur_style(), make_scalar(),
|
||||
make_blur_mask_filter_flag());
|
||||
maskFilter = SkMaskFilter::MakeBlur(make_blur_style(), make_scalar(),
|
||||
make_blur_mask_filter_respectctm());
|
||||
case 1: {
|
||||
SkEmbossMaskFilter::Light light;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
|
@ -4,10 +4,11 @@
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SampleCode.h"
|
||||
#include "SkView.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkMatrix.h"
|
||||
@ -188,7 +189,7 @@ static void do_fuzz(SkCanvas* canvas) {
|
||||
|
||||
case 7:
|
||||
if (quick == true) break;
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, make_number()));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, make_number()));
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
@ -6,8 +6,8 @@
|
||||
*/
|
||||
#include "SampleCode.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkParsePath.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRandom.h"
|
||||
@ -168,7 +168,7 @@ protected:
|
||||
SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4));
|
||||
for (int y = 0; y < 10; y++) {
|
||||
if (x) {
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(gStyle[x - 1], sigma));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(gStyle[x - 1], sigma));
|
||||
}
|
||||
canvas->drawString("Title Bar", x*SkIntToScalar(100), y*SkIntToScalar(30), paint);
|
||||
sigma *= 0.75f;
|
||||
|
@ -4,12 +4,13 @@
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SampleCode.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkGraphics.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRandom.h"
|
||||
#include "SkRegion.h"
|
||||
@ -50,7 +51,7 @@ protected:
|
||||
|
||||
paint.setARGB(fByte, 0xFF, 0xFF, 0xFF);
|
||||
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(3)));
|
||||
|
||||
SkRandom rand;
|
||||
|
@ -76,11 +76,8 @@ protected:
|
||||
// renders correctly
|
||||
srcRect.setXYWH(1, 1, 3, 3);
|
||||
dstRect.setXYWH(5, 405, 305, 305);
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(
|
||||
kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag |
|
||||
SkBlurMaskFilter::kIgnoreTransform_BlurFlag));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(
|
||||
kNormal_SkBlurStyle, SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)), false));
|
||||
canvas->drawImageRect(image, srcRect, dstRect, &paint);
|
||||
|
||||
// Blur and a rotation + nullptr src rect
|
||||
@ -88,9 +85,8 @@ protected:
|
||||
// but it will test a code path in SkGpuDevice::drawBitmap
|
||||
// that handles blurs with rects transformed to non-
|
||||
// orthogonal rects. It also tests the nullptr src rect handling
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(5),
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(5)));
|
||||
|
||||
dstRect.setXYWH(-150, -150, 300, 300);
|
||||
canvas->translate(550, 550);
|
||||
|
@ -39,9 +39,8 @@ class XfermodesBlurView : public SampleView {
|
||||
|
||||
void draw_mode(SkCanvas* canvas, SkBlendMode mode, int alpha, SkScalar x, SkScalar y) {
|
||||
SkPaint p;
|
||||
p.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(5),
|
||||
SkBlurMaskFilter::kNone_BlurFlag));
|
||||
p.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(5)));
|
||||
|
||||
SkScalar ww = SkIntToScalar(W);
|
||||
SkScalar hh = SkIntToScalar(H);
|
||||
|
@ -106,8 +106,6 @@ private:
|
||||
SkRect fOccluder;
|
||||
bool fRespectCTM;
|
||||
|
||||
SkBlurQuality getQuality() const { return kHigh_SkBlurQuality; }
|
||||
|
||||
SkBlurMaskFilterImpl(SkReadBuffer&);
|
||||
void flatten(SkWriteBuffer&) const override;
|
||||
|
||||
@ -291,7 +289,9 @@ bool SkBlurMaskFilterImpl::asABlur(BlurRec* rec) const {
|
||||
if (rec) {
|
||||
rec->fSigma = fSigma;
|
||||
rec->fStyle = fBlurStyle;
|
||||
rec->fQuality = this->getQuality();
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
rec->fQuality = kHigh_SkBlurQuality;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -300,7 +300,7 @@ bool SkBlurMaskFilterImpl::filterMask(SkMask* dst, const SkMask& src,
|
||||
const SkMatrix& matrix,
|
||||
SkIPoint* margin) const {
|
||||
SkScalar sigma = this->computeXformedSigma(matrix);
|
||||
return SkBlurMask::BoxBlur(dst, src, sigma, fBlurStyle, this->getQuality(), margin);
|
||||
return SkBlurMask::BoxBlur(dst, src, sigma, fBlurStyle, margin);
|
||||
}
|
||||
|
||||
bool SkBlurMaskFilterImpl::filterRectMask(SkMask* dst, const SkRect& r,
|
||||
@ -406,29 +406,29 @@ static SkCachedData* copy_mask_to_cacheddata(SkMask* mask) {
|
||||
}
|
||||
|
||||
static SkCachedData* find_cached_rrect(SkMask* mask, SkScalar sigma, SkBlurStyle style,
|
||||
SkBlurQuality quality, const SkRRect& rrect) {
|
||||
return SkMaskCache::FindAndRef(sigma, style, quality, rrect, mask);
|
||||
const SkRRect& rrect) {
|
||||
return SkMaskCache::FindAndRef(sigma, style, rrect, mask);
|
||||
}
|
||||
|
||||
static SkCachedData* add_cached_rrect(SkMask* mask, SkScalar sigma, SkBlurStyle style,
|
||||
SkBlurQuality quality, const SkRRect& rrect) {
|
||||
const SkRRect& rrect) {
|
||||
SkCachedData* cache = copy_mask_to_cacheddata(mask);
|
||||
if (cache) {
|
||||
SkMaskCache::Add(sigma, style, quality, rrect, *mask, cache);
|
||||
SkMaskCache::Add(sigma, style, rrect, *mask, cache);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
static SkCachedData* find_cached_rects(SkMask* mask, SkScalar sigma, SkBlurStyle style,
|
||||
SkBlurQuality quality, const SkRect rects[], int count) {
|
||||
return SkMaskCache::FindAndRef(sigma, style, quality, rects, count, mask);
|
||||
const SkRect rects[], int count) {
|
||||
return SkMaskCache::FindAndRef(sigma, style, rects, count, mask);
|
||||
}
|
||||
|
||||
static SkCachedData* add_cached_rects(SkMask* mask, SkScalar sigma, SkBlurStyle style,
|
||||
SkBlurQuality quality, const SkRect rects[], int count) {
|
||||
const SkRect rects[], int count) {
|
||||
SkCachedData* cache = copy_mask_to_cacheddata(mask);
|
||||
if (cache) {
|
||||
SkMaskCache::Add(sigma, style, quality, rects, count, *mask, cache);
|
||||
SkMaskCache::Add(sigma, style, rects, count, *mask, cache);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
@ -541,8 +541,7 @@ SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
|
||||
smallRR.setRectRadii(smallR, radii);
|
||||
|
||||
const SkScalar sigma = this->computeXformedSigma(matrix);
|
||||
SkCachedData* cache = find_cached_rrect(&patch->fMask, sigma, fBlurStyle,
|
||||
this->getQuality(), smallRR);
|
||||
SkCachedData* cache = find_cached_rrect(&patch->fMask, sigma, fBlurStyle, smallRR);
|
||||
if (!cache) {
|
||||
bool analyticBlurWorked = false;
|
||||
if (c_analyticBlurRRect) {
|
||||
@ -562,7 +561,7 @@ SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
|
||||
return kFalse_FilterReturn;
|
||||
}
|
||||
}
|
||||
cache = add_cached_rrect(&patch->fMask, sigma, fBlurStyle, this->getQuality(), smallRR);
|
||||
cache = add_cached_rrect(&patch->fMask, sigma, fBlurStyle, smallRR);
|
||||
}
|
||||
|
||||
patch->fMask.fBounds.offsetTo(0, 0);
|
||||
@ -675,8 +674,7 @@ SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count,
|
||||
}
|
||||
|
||||
const SkScalar sigma = this->computeXformedSigma(matrix);
|
||||
SkCachedData* cache = find_cached_rects(&patch->fMask, sigma, fBlurStyle,
|
||||
this->getQuality(), smallR, count);
|
||||
SkCachedData* cache = find_cached_rects(&patch->fMask, sigma, fBlurStyle, smallR, count);
|
||||
if (!cache) {
|
||||
if (count > 1 || !c_analyticBlurNinepatch) {
|
||||
if (!draw_rects_into_mask(smallR, count, &srcM)) {
|
||||
@ -694,7 +692,7 @@ SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count,
|
||||
return kFalse_FilterReturn;
|
||||
}
|
||||
}
|
||||
cache = add_cached_rects(&patch->fMask, sigma, fBlurStyle, this->getQuality(), smallR, count);
|
||||
cache = add_cached_rects(&patch->fMask, sigma, fBlurStyle, smallR, count);
|
||||
}
|
||||
patch->fMask.fBounds.offsetTo(0, 0);
|
||||
patch->fOuterRect = dstM.fBounds;
|
||||
|
@ -95,9 +95,8 @@ void SkMask_FreeImage(uint8_t* image) {
|
||||
SkMask::FreeImage(image);
|
||||
}
|
||||
|
||||
bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src,
|
||||
SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
SkIPoint* margin, bool force_quality) {
|
||||
bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, SkScalar sigma, SkBlurStyle style,
|
||||
SkIPoint* margin) {
|
||||
|
||||
if (src.fFormat != SkMask::kA8_Format) {
|
||||
return false;
|
||||
|
@ -36,9 +36,8 @@ public:
|
||||
// null.
|
||||
|
||||
static bool SK_WARN_UNUSED_RESULT BoxBlur(SkMask* dst, const SkMask& src,
|
||||
SkScalar sigma, SkBlurStyle style, SkBlurQuality,
|
||||
SkIPoint* margin = nullptr,
|
||||
bool forceQuality = false);
|
||||
SkScalar sigma, SkBlurStyle style,
|
||||
SkIPoint* margin = nullptr);
|
||||
|
||||
// the "ground truth" blur does a gaussian convolution; it's slow
|
||||
// but useful for comparison purposes.
|
||||
|
@ -20,19 +20,17 @@ static unsigned gRRectBlurKeyNamespaceLabel;
|
||||
|
||||
struct RRectBlurKey : public SkResourceCache::Key {
|
||||
public:
|
||||
RRectBlurKey(SkScalar sigma, const SkRRect& rrect, SkBlurStyle style, SkBlurQuality quality)
|
||||
RRectBlurKey(SkScalar sigma, const SkRRect& rrect, SkBlurStyle style)
|
||||
: fSigma(sigma)
|
||||
, fStyle(style)
|
||||
, fQuality(quality)
|
||||
, fRRect(rrect)
|
||||
{
|
||||
this->init(&gRRectBlurKeyNamespaceLabel, 0,
|
||||
sizeof(fSigma) + sizeof(fStyle) + sizeof(fQuality) + sizeof(fRRect));
|
||||
sizeof(fSigma) + sizeof(fStyle) + sizeof(fRRect));
|
||||
}
|
||||
|
||||
SkScalar fSigma;
|
||||
int32_t fStyle;
|
||||
int32_t fQuality;
|
||||
SkRRect fRRect;
|
||||
};
|
||||
|
||||
@ -74,10 +72,10 @@ struct RRectBlurRec : public SkResourceCache::Rec {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRRect& rrect, SkMask* mask, SkResourceCache* localCache) {
|
||||
MaskValue result;
|
||||
RRectBlurKey key(sigma, rrect, style, quality);
|
||||
RRectBlurKey key(sigma, rrect, style);
|
||||
if (!CHECK_LOCAL(localCache, find, Find, key, RRectBlurRec::Visitor, &result)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -87,10 +85,10 @@ SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQ
|
||||
return result.fData;
|
||||
}
|
||||
|
||||
void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRRect& rrect, const SkMask& mask, SkCachedData* data,
|
||||
SkResourceCache* localCache) {
|
||||
RRectBlurKey key(sigma, rrect, style, quality);
|
||||
RRectBlurKey key(sigma, rrect, style);
|
||||
return CHECK_LOCAL(localCache, add, Add, new RRectBlurRec(key, mask, data));
|
||||
}
|
||||
|
||||
@ -101,11 +99,9 @@ static unsigned gRectsBlurKeyNamespaceLabel;
|
||||
|
||||
struct RectsBlurKey : public SkResourceCache::Key {
|
||||
public:
|
||||
RectsBlurKey(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
const SkRect rects[], int count)
|
||||
RectsBlurKey(SkScalar sigma, SkBlurStyle style, const SkRect rects[], int count)
|
||||
: fSigma(sigma)
|
||||
, fStyle(style)
|
||||
, fQuality(quality)
|
||||
{
|
||||
SkASSERT(1 == count || 2 == count);
|
||||
SkIRect ir;
|
||||
@ -121,12 +117,11 @@ public:
|
||||
fSizes[3] = SkSize{rects[0].x() - ir.x(), rects[0].y() - ir.y()};
|
||||
|
||||
this->init(&gRectsBlurKeyNamespaceLabel, 0,
|
||||
sizeof(fSigma) + sizeof(fStyle) + sizeof(fQuality) + sizeof(fSizes));
|
||||
sizeof(fSigma) + sizeof(fStyle) + sizeof(fSizes));
|
||||
}
|
||||
|
||||
SkScalar fSigma;
|
||||
int32_t fStyle;
|
||||
int32_t fQuality;
|
||||
SkSize fSizes[4];
|
||||
};
|
||||
|
||||
@ -168,11 +163,11 @@ struct RectsBlurRec : public SkResourceCache::Rec {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRect rects[], int count, SkMask* mask,
|
||||
SkResourceCache* localCache) {
|
||||
MaskValue result;
|
||||
RectsBlurKey key(sigma, style, quality, rects, count);
|
||||
RectsBlurKey key(sigma, style, rects, count);
|
||||
if (!CHECK_LOCAL(localCache, find, Find, key, RectsBlurRec::Visitor, &result)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -182,9 +177,9 @@ SkCachedData* SkMaskCache::FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQ
|
||||
return result.fData;
|
||||
}
|
||||
|
||||
void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRect rects[], int count, const SkMask& mask, SkCachedData* data,
|
||||
SkResourceCache* localCache) {
|
||||
RectsBlurKey key(sigma, style, quality, rects, count);
|
||||
RectsBlurKey key(sigma, style, rects, count);
|
||||
return CHECK_LOCAL(localCache, add, Add, new RectsBlurRec(key, mask, data));
|
||||
}
|
||||
|
@ -23,20 +23,20 @@ public:
|
||||
*
|
||||
* On failure, return nullptr.
|
||||
*/
|
||||
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRRect& rrect, SkMask* mask,
|
||||
SkResourceCache* localCache = nullptr);
|
||||
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRect rects[], int count, SkMask* mask,
|
||||
SkResourceCache* localCache = nullptr);
|
||||
|
||||
/**
|
||||
* Add a mask and its pixel-data to the cache.
|
||||
*/
|
||||
static void Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
static void Add(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRRect& rrect, const SkMask& mask, SkCachedData* data,
|
||||
SkResourceCache* localCache = nullptr);
|
||||
static void Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
|
||||
static void Add(SkScalar sigma, SkBlurStyle style,
|
||||
const SkRect rects[], int count, const SkMask& mask, SkCachedData* data,
|
||||
SkResourceCache* localCache = nullptr);
|
||||
};
|
||||
|
@ -155,7 +155,9 @@ public:
|
||||
struct BlurRec {
|
||||
SkScalar fSigma;
|
||||
SkBlurStyle fStyle;
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
SkBlurQuality fQuality;
|
||||
#endif
|
||||
};
|
||||
/**
|
||||
* If this filter can be represented by a BlurRec, return true and (if not null) fill in the
|
||||
|
@ -7,8 +7,11 @@
|
||||
|
||||
#include "SkBlurMaskFilter.h"
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
sk_sp<SkMaskFilter> SkBlurMaskFilter::Make(SkBlurStyle style, SkScalar sigma,
|
||||
const SkRect& occluder, uint32_t flags) {
|
||||
bool respectCTM = !(flags & kIgnoreTransform_BlurFlag);
|
||||
return SkMaskFilter::MakeBlur(style, sigma, occluder, respectCTM);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -74,7 +74,7 @@ bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src,
|
||||
const SkMatrix& matrix, SkIPoint* margin) const {
|
||||
SkScalar sigma = matrix.mapRadius(fBlurSigma);
|
||||
|
||||
if (!SkBlurMask::BoxBlur(dst, src, sigma, kInner_SkBlurStyle, kLow_SkBlurQuality)) {
|
||||
if (!SkBlurMask::BoxBlur(dst, src, sigma, kInner_SkBlurStyle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,9 @@ bool SkLayerDrawLooper::asABlurShadow(BlurShadowRec* bsRec) const {
|
||||
bsRec->fOffset = fRecs->fInfo.fOffset;
|
||||
bsRec->fColor = fRecs->fPaint.getColor();
|
||||
bsRec->fStyle = maskBlur.fStyle;
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
bsRec->fQuality = maskBlur.fQuality;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -184,9 +184,7 @@ bool GrAtlasTextBlob::mustRegenerate(const GrTextUtils::Paint& paint,
|
||||
|
||||
// We only cache one masked version
|
||||
if (fKey.fHasBlur &&
|
||||
(fBlurRec.fSigma != blurRec.fSigma ||
|
||||
fBlurRec.fStyle != blurRec.fStyle ||
|
||||
fBlurRec.fQuality != blurRec.fQuality)) {
|
||||
(fBlurRec.fSigma != blurRec.fSigma || fBlurRec.fStyle != blurRec.fStyle)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -409,7 +407,6 @@ void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo
|
||||
|
||||
SkASSERT_RELEASE(l.fBlurRec.fSigma == r.fBlurRec.fSigma);
|
||||
SkASSERT_RELEASE(l.fBlurRec.fStyle == r.fBlurRec.fStyle);
|
||||
SkASSERT_RELEASE(l.fBlurRec.fQuality == r.fBlurRec.fQuality);
|
||||
|
||||
SkASSERT_RELEASE(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth);
|
||||
SkASSERT_RELEASE(l.fStrokeInfo.fMiterLimit == r.fStrokeInfo.fMiterLimit);
|
||||
|
@ -383,7 +383,9 @@ static void test_blurDrawLooper(skiatest::Reporter* reporter, SkScalar sigma, Sk
|
||||
REPORTER_ASSERT(reporter, rec.fOffset.y() == dy);
|
||||
REPORTER_ASSERT(reporter, rec.fColor == color);
|
||||
REPORTER_ASSERT(reporter, rec.fStyle == style);
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
REPORTER_ASSERT(reporter, rec.fQuality == kHigh_SkBlurQuality);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -399,7 +401,9 @@ static void test_looper(skiatest::Reporter* reporter, sk_sp<SkDrawLooper> lp, Sk
|
||||
if (success) {
|
||||
REPORTER_ASSERT(reporter, rec.fSigma == sigma);
|
||||
REPORTER_ASSERT(reporter, rec.fStyle == style);
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
REPORTER_ASSERT(reporter, rec.fQuality == kHigh_SkBlurQuality);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,7 +478,9 @@ DEF_TEST(BlurAsABlur, reporter) {
|
||||
REPORTER_ASSERT(reporter, success);
|
||||
REPORTER_ASSERT(reporter, rec.fSigma == sigma);
|
||||
REPORTER_ASSERT(reporter, rec.fStyle == style);
|
||||
#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER
|
||||
REPORTER_ASSERT(reporter, rec.fQuality == kHigh_SkBlurQuality);
|
||||
#endif
|
||||
} else {
|
||||
REPORTER_ASSERT(reporter, !success);
|
||||
}
|
||||
|
@ -36,10 +36,9 @@ DEF_TEST(RRectMaskCache, reporter) {
|
||||
SkRRect rrect;
|
||||
rrect.setRectXY(rect, 30, 30);
|
||||
SkBlurStyle style = kNormal_SkBlurStyle;
|
||||
SkBlurQuality quality = kLow_SkBlurQuality;
|
||||
SkMask mask;
|
||||
|
||||
SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, quality, rrect, &mask, &cache);
|
||||
SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, rrect, &mask, &cache);
|
||||
REPORTER_ASSERT(reporter, nullptr == data);
|
||||
|
||||
size_t size = 256;
|
||||
@ -48,14 +47,14 @@ DEF_TEST(RRectMaskCache, reporter) {
|
||||
mask.fBounds.setXYWH(0, 0, 100, 100);
|
||||
mask.fRowBytes = 100;
|
||||
mask.fFormat = SkMask::kBW_Format;
|
||||
SkMaskCache::Add(sigma, style, quality, rrect, mask, data, &cache);
|
||||
SkMaskCache::Add(sigma, style, rrect, mask, data, &cache);
|
||||
check_data(reporter, data, 2, kInCache, kLocked);
|
||||
|
||||
data->unref();
|
||||
check_data(reporter, data, 1, kInCache, kUnlocked);
|
||||
|
||||
sk_bzero(&mask, sizeof(mask));
|
||||
data = SkMaskCache::FindAndRef(sigma, style, quality, rrect, &mask, &cache);
|
||||
data = SkMaskCache::FindAndRef(sigma, style, rrect, &mask, &cache);
|
||||
REPORTER_ASSERT(reporter, data);
|
||||
REPORTER_ASSERT(reporter, data->size() == size);
|
||||
REPORTER_ASSERT(reporter, mask.fBounds.top() == 0 && mask.fBounds.bottom() == 100);
|
||||
@ -74,10 +73,9 @@ DEF_TEST(RectsMaskCache, reporter) {
|
||||
SkRect rect = SkRect::MakeWH(100, 100);
|
||||
SkRect rects[2] = {rect};
|
||||
SkBlurStyle style = kNormal_SkBlurStyle;
|
||||
SkBlurQuality quality = kLow_SkBlurQuality;
|
||||
SkMask mask;
|
||||
|
||||
SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, quality, rects, 1, &mask, &cache);
|
||||
SkCachedData* data = SkMaskCache::FindAndRef(sigma, style, rects, 1, &mask, &cache);
|
||||
REPORTER_ASSERT(reporter, nullptr == data);
|
||||
|
||||
size_t size = 256;
|
||||
@ -86,14 +84,14 @@ DEF_TEST(RectsMaskCache, reporter) {
|
||||
mask.fBounds.setXYWH(0, 0, 100, 100);
|
||||
mask.fRowBytes = 100;
|
||||
mask.fFormat = SkMask::kBW_Format;
|
||||
SkMaskCache::Add(sigma, style, quality, rects, 1, mask, data, &cache);
|
||||
SkMaskCache::Add(sigma, style, rects, 1, mask, data, &cache);
|
||||
check_data(reporter, data, 2, kInCache, kLocked);
|
||||
|
||||
data->unref();
|
||||
check_data(reporter, data, 1, kInCache, kUnlocked);
|
||||
|
||||
sk_bzero(&mask, sizeof(mask));
|
||||
data = SkMaskCache::FindAndRef(sigma, style, quality, rects, 1, &mask, &cache);
|
||||
data = SkMaskCache::FindAndRef(sigma, style, rects, 1, &mask, &cache);
|
||||
REPORTER_ASSERT(reporter, data);
|
||||
REPORTER_ASSERT(reporter, data->size() == size);
|
||||
REPORTER_ASSERT(reporter, mask.fBounds.top() == 0 && mask.fBounds.bottom() == 100);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "SkAutoMalloc.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkLayerDrawLooper.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaintPriv.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkRandom.h"
|
||||
@ -147,7 +147,7 @@ DEF_TEST(Paint_copy, reporter) {
|
||||
// set a few pointers
|
||||
SkLayerDrawLooper::Builder looperBuilder;
|
||||
paint.setLooper(looperBuilder.detach());
|
||||
paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
|
||||
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(1)));
|
||||
|
||||
// copy the paint using the copy constructor and check they are the same
|
||||
|
@ -6,17 +6,16 @@
|
||||
*/
|
||||
|
||||
#include "Resources.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkImageSource.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkSurface.h"
|
||||
#include "Test.h"
|
||||
|
||||
DEF_TEST(skbug_6389, r) {
|
||||
auto s = SkSurface::MakeRasterN32Premul(100, 100);
|
||||
SkPaint p;
|
||||
p.setMaskFilter(SkBlurMaskFilter::Make(SkBlurStyle::kNormal_SkBlurStyle, 5,
|
||||
SkBlurMaskFilter::kHighQuality_BlurFlag));
|
||||
p.setMaskFilter(SkMaskFilter::MakeBlur(SkBlurStyle::kNormal_SkBlurStyle, 5));
|
||||
p.setImageFilter(SkImageSource::Make(GetResourceAsImage("images/mandrill_512.png"), {0, 0, 0, 0},
|
||||
{0, 0, 0, 0}, (SkFilterQuality)0));
|
||||
s->getCanvas()->drawPaint(p);
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "png.h"
|
||||
|
||||
#include "SkAutoMalloc.h"
|
||||
#include "SkBlurMaskFilter.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkDashPathEffect.h"
|
||||
#include "SkImageFilter.h"
|
||||
@ -1124,18 +1123,6 @@ static void apply_paint_maskfilter(const SkPaint& paint, Json::Value* target,
|
||||
default:
|
||||
SkASSERT(false);
|
||||
}
|
||||
switch (blurRec.fQuality) {
|
||||
case SkBlurQuality::kLow_SkBlurQuality:
|
||||
blur[SKDEBUGCANVAS_ATTRIBUTE_QUALITY] = Json::Value(
|
||||
SKDEBUGCANVAS_BLURQUALITY_LOW);
|
||||
break;
|
||||
case SkBlurQuality::kHigh_SkBlurQuality:
|
||||
blur[SKDEBUGCANVAS_ATTRIBUTE_QUALITY] = Json::Value(
|
||||
SKDEBUGCANVAS_BLURQUALITY_HIGH);
|
||||
break;
|
||||
default:
|
||||
SkASSERT(false);
|
||||
}
|
||||
(*target)[SKDEBUGCANVAS_ATTRIBUTE_BLUR] = blur;
|
||||
} else {
|
||||
Json::Value jsonMaskFilter;
|
||||
@ -1590,19 +1577,7 @@ static void extract_json_paint_blur(Json::Value& jsonPaint, SkPaint* target) {
|
||||
SkASSERT(false);
|
||||
style = SkBlurStyle::kNormal_SkBlurStyle;
|
||||
}
|
||||
SkBlurMaskFilter::BlurFlags flags;
|
||||
const char* jsonQuality = blur[SKDEBUGCANVAS_ATTRIBUTE_QUALITY].asCString();
|
||||
if (!strcmp(jsonQuality, SKDEBUGCANVAS_BLURQUALITY_LOW)) {
|
||||
flags = SkBlurMaskFilter::BlurFlags::kNone_BlurFlag;
|
||||
}
|
||||
else if (!strcmp(jsonQuality, SKDEBUGCANVAS_BLURQUALITY_HIGH)) {
|
||||
flags = SkBlurMaskFilter::BlurFlags::kHighQuality_BlurFlag;
|
||||
}
|
||||
else {
|
||||
SkASSERT(false);
|
||||
flags = SkBlurMaskFilter::BlurFlags::kNone_BlurFlag;
|
||||
}
|
||||
target->setMaskFilter(SkBlurMaskFilter::Make(style, sigma, flags));
|
||||
target->setMaskFilter(SkMaskFilter::MakeBlur(style, sigma));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user