skia2/gm/skbug_9319.cpp
Brian Salomon 2c59659821 Make GrRectBlurEffect be analytical rather than use a texture LUT.
The math isn't that complex and the existing code has intergralization of
the profile size that makes getting the texture coords correct tricky
(and currently wrong).


Bug: skia:9319
Change-Id: Ic928737ce4c40d28ee0696c3628e914f35ffe371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233985
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-08-14 13:35:37 +00:00

41 lines
1.1 KiB
C++

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