7#include "flutter/display_list/dl_builder.h"
8#include "flutter/testing/testing.h"
9#include "gtest/gtest.h"
25 const std::vector<std::unique_ptr<DlImage>>&
images) {
26 canvas->
Scale(0.2, 0.2);
35 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
48 std::vector<sk_sp<DlImage>>
images;
49 images.emplace_back(CreateDlImageForFixture(
"kalimba.jpg"));
52 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
58 Point content_scale = GetContentScale();
60 const std::vector<sk_sp<DlImage>>&
images) {
61 canvas->
Scale(content_scale.
x, content_scale.
y);
100 std::vector<sk_sp<DlImage>>
images;
103 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
107void DrawBlurGrid(
DlCanvas* canvas) {
113 std::vector<Scalar> blur_radii = {10, 30, 50};
114 for (
size_t i = 0;
i < blur_radii.size(); ++
i) {
115 Scalar blur_radius = blur_radii[
i];
116 auto blur_filter = std::make_shared<flutter::DlBlurMaskFilter>(
118 paint.setMaskFilter(blur_filter);
132 Point content_scale = GetContentScale();
134 const std::vector<sk_sp<DlImage>>&
images) {
135 canvas->
Scale(content_scale.
x, content_scale.
y);
137 DrawBlurGrid(canvas);
141 std::vector<sk_sp<DlImage>>
images;
144 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
148 Point content_scale = GetContentScale();
150 const std::vector<sk_sp<DlImage>>&
images) {
151 canvas->
Scale(content_scale.
x, content_scale.
y);
153 canvas->
Scale(0.33, 0.33);
154 DrawBlurGrid(canvas);
158 std::vector<sk_sp<DlImage>>
images;
161 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
165 Point content_scale = GetContentScale();
167 const std::vector<sk_sp<DlImage>>&
images) {
168 canvas->
Scale(content_scale.
x, content_scale.
y);
171 canvas->
Scale(0.33, 0.33);
175 DrawBlurGrid(canvas);
179 std::vector<sk_sp<DlImage>>
images;
182 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
186 Point content_scale = GetContentScale();
188 const std::vector<sk_sp<DlImage>>&
images) {
189 canvas->
Scale(content_scale.
x, content_scale.
y);
209 for (
int degrees = 0; degrees < 360; degrees += 30) {
212 dash_on, dash_off, thick_paint);
214 dash_on, dash_off, middle_paint);
216 dash_on, dash_off, thin_paint);
228 clip_path.
moveTo(275.0f, 225.0f);
229 clip_path.
lineTo(325.0f, 275.0f);
230 clip_path.
lineTo(275.0f, 325.0f);
231 clip_path.
lineTo(225.0f, 275.0f);
239 std::vector<sk_sp<DlImage>>
images;
242 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
static SkRRect MakeOval(const SkRect &oval)
void setNinePatch(const SkRect &rect, SkScalar leftRad, SkScalar topRad, SkScalar rightRad, SkScalar bottomRad)
Developer-facing API for rendering anything within the engine.
virtual void DrawPaint(const DlPaint &paint)=0
virtual void Rotate(SkScalar degrees)=0
virtual void DrawRect(const SkRect &rect, const DlPaint &paint)=0
virtual void Scale(SkScalar sx, SkScalar sy)=0
virtual void DrawCircle(const SkPoint ¢er, SkScalar radius, const DlPaint &paint)=0
virtual void SaveLayer(const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr)=0
virtual void DrawRRect(const SkRRect &rrect, const DlPaint &paint)=0
virtual void DrawColor(DlColor color, DlBlendMode mode=DlBlendMode::kSrcOver)=0
virtual void DrawDashedLine(const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length, const DlPaint &paint)=0
virtual void Translate(SkScalar tx, SkScalar ty)=0
virtual void DrawImage(const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr)=0
virtual void ClipPath(const SkPath &path, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
virtual void ClipRRect(const SkRRect &rrect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false)=0
DlPaint & setColor(DlColor color)
DlPaint & setAntiAlias(bool isAntiAlias)
DlPaint & setStrokeCap(DlStrokeCap cap)
DlPaint & setStrokeWidth(float width)
DlPaint & setDrawStyle(DlDrawStyle style)
#define FML_CHECK(condition)
std::array< MockImage, 3 > images
sk_sp< const SkImageFilter > backdrop
TEST_P(DlGoldenTest, TextBlurMaskFilterRespectCTM)
INSTANTIATE_PLAYGROUND_SUITE(DlGoldenTest)
@ kButt
no stroke extension
@ kStroke
strokes boundary of shapes
@ kNormal
fuzzy inside and outside
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr DlColor kMagenta()
static constexpr DlColor kWhite()
static constexpr DlColor kBlue()
static constexpr DlColor kYellow()
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
static constexpr DlColor kCyan()
constexpr TPoint Rotate(const Radians &angle) const