Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
gm
crbug_1313579.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2022 Google LLC
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
gm/gm.h
"
9
#include "
include/core/SkCanvas.h
"
10
#include "
include/core/SkMatrix.h
"
11
#include "
include/core/SkRect.h
"
12
#include "
include/effects/SkImageFilters.h
"
13
14
// SkiaRenderer can wind up specifying near-integer scale-and-translate matrices on SkCanvas before
15
// applying a backdrop blur image filter via saveLayer() with an integer clip, crop rect, and
16
// SaveLayerRec bounds. Round-out is used to determine the bounds of the input image needed in IFs.
17
// This could cause an extra row/column of pixels to be included in the blur. When that row/column
18
// is significantly different in color than the intended blur content and the radius is large then
19
// clamp mode blur creates a very noticeable color bleed artifact.
20
DEF_SIMPLE_GM
(crbug_1313579, canvas, 110, 110) {
21
static
constexpr
auto
kBGRect =
SkIRect
{0, 0, 100, 100};
22
23
sk_sp<SkImageFilter>
backdrop_filter =
24
SkImageFilters::Blur
(50.f, 50.f,
SkTileMode::kClamp
,
nullptr
, kBGRect);
25
26
SkMatrix
m;
27
28
canvas->clear(
SK_ColorGREEN
);
29
30
m.setAll(0.999999f, 0, 4.99999f,
31
0, 0.999999f, 4.99999f,
32
0, 0, 1);
33
canvas->concat(m);
34
canvas->clipIRect(kBGRect);
35
canvas->clear(
SK_ColorWHITE
);
36
canvas->saveLayer(
SkCanvas::SaveLayerRec
(
nullptr
,
nullptr
, backdrop_filter.
get
(), 0));
37
canvas->restore();
38
}
SkCanvas.h
SK_ColorGREEN
constexpr SkColor SK_ColorGREEN
Definition
SkColor.h:131
SK_ColorWHITE
constexpr SkColor SK_ColorWHITE
Definition
SkColor.h:122
SkImageFilters.h
SkMatrix.h
SkRect.h
SkTileMode::kClamp
@ kClamp
SkImageFilters::Blur
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
Definition
SkBlurImageFilter.cpp:107
SkMatrix
Definition
SkMatrix.h:54
sk_sp
Definition
SkRefCnt.h:220
sk_sp::get
T * get() const
Definition
SkRefCnt.h:303
gm.h
DEF_SIMPLE_GM
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition
gm.h:50
SkCanvas::SaveLayerRec
Definition
SkCanvas.h:684
SkIRect
Definition
SkRect.h:32
Generated on Fri Apr 26 2024 06:16:01 for Flutter Engine by
1.9.8