2 * Copyright 2019 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkMaskFilter.h"
11 #include "include/core/SkPaint.h"
12 #include "include/core/SkRRect.h"
13 #include "include/core/SkRect.h"
15 // Illustrates a bug where the outer portion of the GPU rect blur was too dark with a small sigma.
16 DEF_SIMPLE_GM(skbug_9319, canvas, 256, 512) {
19 p.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 0.5f));
21 const auto r = SkRect::MakeXYWH(10, 10, 100, 100);
24 SkAutoCanvasRestore acr(canvas, true);
25 // Clip out interior so that the outer portion stands out.
26 canvas->clipRect(r, SkClipOp::kDifference);
27 canvas->drawRect(r, p);
30 canvas->translate(0, 120);
33 // RRect for comparison.
34 const auto rr = SkRRect::MakeRectXY(r, .1f, .1f);
36 SkAutoCanvasRestore acr(canvas, true);
37 canvas->clipRRect(rr, SkClipOp::kDifference);
38 canvas->drawRRect(rr, p);