7#include "flutter/display_list/dl_builder.h"
8#include "flutter/display_list/effects/dl_mask_filter.h"
9#include "flutter/testing/testing.h"
10#include "gtest/gtest.h"
20struct TextRenderOptions {
28 const std::string&
text,
29 const std::string_view& font_fixture,
31 const TextRenderOptions&
options = {}) {
32 auto c_font_fixture = std::string(font_fixture);
53 canvas->DrawTextFrame(
frame, position.
x(), position.
y(), text_paint);
62 const std::vector<std::unique_ptr<DlImage>>&
images) {
64 canvas->
Scale(content_scale.
x, content_scale.
y);
83 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
89 const std::vector<std::unique_ptr<DlImage>>&
images) {
91 canvas->
Scale(content_scale.
x, content_scale.
y);
103 "Roboto-Regular.ttf",
110 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
sk_sp< SkTypeface > makeFromData(sk_sp< SkData >, int ttcIndex=0) const
static sk_sp< SkTextBlob > MakeFromString(const char *string, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
static std::shared_ptr< DlMaskFilter > Make(DlBlurStyle style, SkScalar sigma, bool respect_ctm=true)
Developer-facing API for rendering anything within the engine.
virtual void Scale(SkScalar sx, SkScalar sy)=0
virtual void DrawColor(DlColor color, DlBlendMode mode=DlBlendMode::kSrcOver)=0
DlPaint & setColor(DlColor color)
DlPaint & setMaskFilter(const std::shared_ptr< DlMaskFilter > &filter)
Describes a typeface along with any modifications to its intrinsic properties.
std::shared_ptr< DlMaskFilter > mask_filter
std::array< MockImage, 3 > images
sk_sp< SkData > OpenFixtureAsSkData(const std::string &fixture_name)
Opens a fixture of the given file name and returns a Skia SkData holding its contents.
TEST_P(DlGoldenTest, TextBlurMaskFilterRespectCTM)
@ kNormal
fuzzy inside and outside
bool RenderTextInCanvasSkia(const std::shared_ptr< Context > &context, Canvas &canvas, const std::string &text, const std::string_view &font_fixture, TextRenderOptions options={})
std::shared_ptr< TextFrame > MakeTextFrameFromTextBlobSkia(const sk_sp< SkTextBlob > &blob)
flutter::DlCanvas DlCanvas
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
static constexpr SkPoint Make(float x, float y)
constexpr float y() const
constexpr float x() const
static constexpr DlColor kYellow()
static constexpr DlColor kRed()