Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter::testing::DisplayListNopTest Class Reference
Inheritance diagram for flutter::testing::DisplayListNopTest:
flutter::testing::DisplayListRendering flutter::DisplayListOpFlags flutter::DisplayListFlags

Classes

struct  TestData
 

Protected Member Functions

 DisplayListNopTest ()
 
const TestData make_test_data (DlSurfaceProvider *provider)
 
const TestData GetTestData (DlSurfaceProvider *provider)
 
std::shared_ptr< DlSurfaceInstanceget_output (DlSurfaceProvider *provider, int w, int h, bool snapshot, const std::function< void(DlCanvas *)> &renderer)
 
int check_color_result (DlColor dst_color, DlColor result_color, int x, int y, const sk_sp< DisplayList > &dl, const std::string &desc)
 
int check_image_result (const RenderResult &dst_data, const RenderResult &result_data, const sk_sp< DisplayList > &dl, const std::string &desc)
 
void report_results (int all_flags, const sk_sp< DisplayList > &dl, const std::string &desc)
 
void test_mode_color_via_filter (DlBlendMode mode, DlColor color)
 
void test_mode_color_via_rendering (DlBlendMode mode, DlColor color)
 
void test_attributes_image (DlBlendMode mode, DlColor color, const DlColorFilter *color_filter, DlImageFilter *image_filter)
 

Protected Attributes

std::vector< DlColortest_src_colors
 
std::vector< DlColortest_dst_colors
 
std::shared_ptr< const DlColorFiltercolor_filter_nomtb
 
std::shared_ptr< const DlColorFiltercolor_filter_mtb
 
std::map< DlSurfaceProvider::BackendType, TestDatatest_datas
 

Static Protected Attributes

static constexpr int kWasNotNop = 0x1
 
static constexpr int kWasMTB = 0x2
 
- Static Protected Attributes inherited from flutter::DisplayListOpFlags
static constexpr DisplayListAttributeFlags kSaveLayerFlags
 
static constexpr DisplayListAttributeFlags kSaveLayerWithPaintFlags
 
static constexpr DisplayListAttributeFlags kDrawColorFlags
 
static constexpr DisplayListAttributeFlags kDrawPaintFlags
 
static constexpr DisplayListAttributeFlags kDrawHVLineFlags
 
static constexpr DisplayListAttributeFlags kDrawLineFlags
 
static constexpr DisplayListAttributeFlags kDrawRectFlags
 
static constexpr DisplayListAttributeFlags kDrawOvalFlags
 
static constexpr DisplayListAttributeFlags kDrawCircleFlags
 
static constexpr DisplayListAttributeFlags kDrawRRectFlags
 
static constexpr DisplayListAttributeFlags kDrawDRRectFlags
 
static constexpr DisplayListAttributeFlags kDrawRSuperellipseFlags
 
static constexpr DisplayListAttributeFlags kDrawPathFlags
 
static constexpr DisplayListAttributeFlags kDrawArcNoCenterFlags
 
static constexpr DisplayListAttributeFlags kDrawArcWithCenterFlags
 
static constexpr DisplayListAttributeFlags kDrawPointsAsPointsFlags
 
static constexpr DisplayListAttributeFlags kDrawPointsAsLinesFlags
 
static constexpr DisplayListAttributeFlags kDrawPointsAsPolygonFlags
 
static constexpr DisplayListAttributeFlags kDrawVerticesFlags
 
static constexpr DisplayListAttributeFlags kDrawImageFlags
 
static constexpr DisplayListAttributeFlags kDrawImageWithPaintFlags
 
static constexpr DisplayListAttributeFlags kDrawImageRectFlags
 
static constexpr DisplayListAttributeFlags kDrawImageRectWithPaintFlags
 
static constexpr DisplayListAttributeFlags kDrawImageNineFlags
 
static constexpr DisplayListAttributeFlags kDrawImageNineWithPaintFlags
 
static constexpr DisplayListAttributeFlags kDrawAtlasFlags
 
static constexpr DisplayListAttributeFlags kDrawAtlasWithPaintFlags
 
static constexpr DisplayListAttributeFlags kDrawDisplayListFlags
 
static constexpr DisplayListAttributeFlags kDrawTextFlags
 
static constexpr DisplayListAttributeFlags kDrawShadowFlags
 
static constexpr DisplayListAttributeFlags kDrawParagraphFlags
 

Additional Inherited Members

- Public Member Functions inherited from flutter::testing::DisplayListRendering
 DisplayListRendering ()=default
 
- Static Public Member Functions inherited from flutter::testing::DisplayListRendering
static void SetUpTestSuite ()
 
static void TearDownTestSuite ()
 
static const std::vector< BackendType > & GetTestBackends ()
 
static std::unique_ptr< DlSurfaceProviderGetProvider (BackendType type)
 
static void RenderAll (const TestParameters &params, const BoundsTolerance &tolerance=CanvasCompareTester::DefaultTolerance)
 

Detailed Description

Definition at line 3735 of file dl_rendering_unittests.cc.

Constructor & Destructor Documentation

◆ DisplayListNopTest()

flutter::testing::DisplayListNopTest::DisplayListNopTest ( )
inlineprotected

Definition at line 3739 of file dl_rendering_unittests.cc.

3740 test_src_colors = {
3741 DlColor::kBlack().withAlpha(0), // transparent black
3742 DlColor::kBlack().withAlpha(0x7f), // half transparent black
3743 DlColor::kWhite().withAlpha(0x7f), // half transparent white
3744 DlColor::kBlack(), // opaque black
3745 DlColor::kWhite(), // opaque white
3746 DlColor::kRed(), // opaque red
3747 DlColor::kGreen(), // opaque green
3748 DlColor::kBlue(), // opaque blue
3749 DlColor::kDarkGrey(), // dark grey
3750 DlColor::kLightGrey(), // light grey
3751 };
3752
3753 // We test against a color cube of 3x3x3x3 colors [55,aa,ff]
3754 // plus transparency as the first color/pixel
3756 const int step = 0x55;
3757 static_assert(step * 3 == 255);
3758 for (int a = step; a < 256; a += step) {
3759 for (int r = step; r < 256; r += step) {
3760 for (int g = step; g < 256; g += step) {
3761 for (int b = step; b < 256; b += step) {
3762 test_dst_colors.push_back(DlColor(a << 24 | r << 16 | g << 8 | b));
3763 }
3764 }
3765 }
3766 }
3767
3768 static constexpr float color_filter_matrix_nomtb[] = {
3769 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3770 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3771 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3772 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3773 };
3774 static constexpr float color_filter_matrix_mtb[] = {
3775 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3776 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3777 0.0001, 0.0001, 0.0001, 0.9997, 0.0, //
3778 0.0001, 0.0001, 0.0001, 0.9997, 0.1, //
3779 };
3780 color_filter_nomtb = DlColorFilter::MakeMatrix(color_filter_matrix_nomtb);
3781 color_filter_mtb = DlColorFilter::MakeMatrix(color_filter_matrix_mtb);
3782 EXPECT_FALSE(color_filter_nomtb->modifies_transparent_black());
3783 EXPECT_TRUE(color_filter_mtb->modifies_transparent_black());
3784 }
static std::shared_ptr< const DlColorFilter > MakeMatrix(const float matrix[20])
std::shared_ptr< const DlColorFilter > color_filter_nomtb
std::shared_ptr< const DlColorFilter > color_filter_mtb
flutter::DlColor DlColor
static constexpr DlColor kWhite()
Definition dl_color.h:70
static constexpr DlColor kBlue()
Definition dl_color.h:73
static constexpr DlColor kBlack()
Definition dl_color.h:69
static constexpr DlColor kLightGrey()
Definition dl_color.h:79
static constexpr DlColor kTransparent()
Definition dl_color.h:68
static constexpr DlColor kRed()
Definition dl_color.h:71
static constexpr DlColor kGreen()
Definition dl_color.h:72
static constexpr DlColor kDarkGrey()
Definition dl_color.h:77
DlColor withAlpha(uint8_t alpha) const
Definition dl_color.h:120

References color_filter_mtb, color_filter_nomtb, flutter::DlColor::kBlack(), flutter::DlColor::kBlue(), flutter::DlColor::kDarkGrey(), flutter::DlColor::kGreen(), flutter::DlColor::kLightGrey(), flutter::DlColor::kRed(), flutter::DlColor::kTransparent(), flutter::DlColor::kWhite(), flutter::DlColorFilter::MakeMatrix(), test_dst_colors, test_src_colors, and flutter::DlColor::withAlpha().

Member Function Documentation

◆ check_color_result()

int flutter::testing::DisplayListNopTest::check_color_result ( DlColor  dst_color,
DlColor  result_color,
int  x,
int  y,
const sk_sp< DisplayList > &  dl,
const std::string &  desc 
)
inlineprotected

Definition at line 3910 of file dl_rendering_unittests.cc.

3915 {
3916 int ret = 0;
3917 bool is_error = false;
3918 if (dst_color.isTransparent() && !result_color.isTransparent()) {
3919 ret |= kWasMTB;
3920 is_error = !dl->modifies_transparent_black();
3921 }
3922 if (result_color != dst_color) {
3923 ret |= kWasNotNop;
3924 is_error = (dl->op_count() == 0u);
3925 }
3926 if (is_error) {
3927 FML_LOG(ERROR) << std::hex << dst_color //
3928 << std::dec << " at " << x << ", " << y //
3929 << " filters to " << std::hex << result_color //
3930 << desc;
3931 }
3932 return ret;
3933 }
int32_t x
#define FML_LOG(severity)
Definition logging.h:101
double y

References FML_LOG, flutter::DlColor::isTransparent(), x, and y.

◆ check_image_result()

int flutter::testing::DisplayListNopTest::check_image_result ( const RenderResult dst_data,
const RenderResult result_data,
const sk_sp< DisplayList > &  dl,
const std::string &  desc 
)
inlineprotected

Definition at line 3935 of file dl_rendering_unittests.cc.

3938 {
3939 EXPECT_EQ(dst_data.pixel_data->width(), result_data.pixel_data->width());
3940 EXPECT_EQ(dst_data.pixel_data->height(), result_data.pixel_data->height());
3941 int all_flags = 0;
3942 for (uint32_t y = 0; y < dst_data.pixel_data->height(); y++) {
3943 const uint32_t* dst_pixels = dst_data.pixel_data->addr32(0, y);
3944 const uint32_t* result_pixels = result_data.pixel_data->addr32(0, y);
3945 for (uint32_t x = 0; x < dst_data.pixel_data->width(); x++) {
3946 all_flags |= check_color_result(
3947 DlColor(dst_pixels[x]), DlColor(result_pixels[x]), x, y, dl, desc);
3948 }
3949 }
3950 return all_flags;
3951 }
int check_color_result(DlColor dst_color, DlColor result_color, int x, int y, const sk_sp< DisplayList > &dl, const std::string &desc)

References flutter::testing::RenderResult::pixel_data, x, and y.

◆ get_output()

std::shared_ptr< DlSurfaceInstance > flutter::testing::DisplayListNopTest::get_output ( DlSurfaceProvider provider,
int  w,
int  h,
bool  snapshot,
const std::function< void(DlCanvas *)> &  renderer 
)
inlineprotected

Definition at line 3895 of file dl_rendering_unittests.cc.

3900 {
3901 std::shared_ptr<DlSurfaceInstance> surface =
3902 provider->MakeOffscreenSurface(w, h, DlSurfaceProvider::kN32Premul);
3903 DisplayListBuilder builder;
3904 renderer(&builder);
3905 surface->RenderDisplayList(builder.Build());
3906 surface->FlushSubmitCpuSync();
3907 return surface;
3908 }
VkSurfaceKHR surface
Definition main.cc:65
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder h
Definition switch_defs.h:54

References flutter::DisplayListBuilder::Build(), flutter::h, flutter::testing::DlSurfaceProvider::kN32Premul, flutter::testing::DlSurfaceProvider::MakeOffscreenSurface(), and surface.

Referenced by make_test_data().

◆ GetTestData()

const TestData flutter::testing::DisplayListNopTest::GetTestData ( DlSurfaceProvider provider)
inlineprotected

Definition at line 3885 of file dl_rendering_unittests.cc.

3885 {
3886 auto entry = test_datas.find(provider->GetBackendType());
3887 if (entry == test_datas.end()) {
3888 TestData test_data = make_test_data(provider);
3889 test_datas[provider->GetBackendType()] = test_data;
3890 return test_data;
3891 }
3892 return entry->second;
3893 }
const TestData make_test_data(DlSurfaceProvider *provider)
std::map< DlSurfaceProvider::BackendType, TestData > test_datas

References flutter::testing::DlSurfaceProvider::GetBackendType().

◆ make_test_data()

const TestData flutter::testing::DisplayListNopTest::make_test_data ( DlSurfaceProvider provider)
inlineprotected

Definition at line 3803 of file dl_rendering_unittests.cc.

3803 {
3804 std::shared_ptr<DlSurfaceInstance> test_surface = get_output(
3805 provider, test_dst_colors.size(), 1, true, [this](DlCanvas* canvas) {
3806 int x = 0;
3807 DlPaint paint;
3808 paint.setBlendMode(DlBlendMode::kSrc);
3809 for (DlColor color : test_dst_colors) {
3810 paint.setColor(color);
3811 canvas->DrawRect(DlRect::MakeXYWH(x, 0, 1, 1), paint);
3812 x++;
3813 }
3814 });
3815 sk_sp<DlImage> test_image = test_surface->SnapshotToImage();
3816 std::shared_ptr<DlPixelData> test_pixels =
3817 test_surface->SnapshotToPixelData();
3818
3819 // For image-on-image tests, the src and dest images will have repeated
3820 // rows/columns that have every color, but laid out at right angles to
3821 // each other so we see an interaction with every test color against
3822 // every other test color.
3823 int data_count = test_image->width();
3824 std::shared_ptr<DlSurfaceInstance> dst_surface =
3825 get_output(provider, data_count, data_count, true,
3826 [&test_image, data_count](DlCanvas* canvas) {
3827 ASSERT_EQ(test_image->width(), data_count);
3828 ASSERT_EQ(test_image->height(), 1);
3829 for (int y = 0; y < data_count; y++) {
3830 canvas->DrawImage(test_image, DlPoint(0, y),
3832 }
3833 });
3834 std::shared_ptr<DlPixelData> dst_pixels =
3835 dst_surface->SnapshotToPixelData();
3836
3837 std::shared_ptr<DlSurfaceInstance> src_surface =
3838 get_output(provider, data_count, data_count, true,
3839 [&test_image, data_count](DlCanvas* canvas) {
3840 ASSERT_EQ(test_image->width(), data_count);
3841 ASSERT_EQ(test_image->height(), 1);
3842 canvas->Translate(data_count, 0);
3843 canvas->Rotate(90);
3844 for (int y = 0; y < data_count; y++) {
3845 canvas->DrawImage(test_image, DlPoint(0, y),
3847 }
3848 });
3849 std::shared_ptr<DlPixelData> src_pixels =
3850 src_surface->SnapshotToPixelData();
3851
3852 // Double check that the pixel data is laid out in orthogonal stripes
3853 for (int y = 0; y < data_count; y++) {
3854 for (int x = 0; x < data_count; x++) {
3855 EXPECT_EQ(*dst_pixels->addr32(x, y), *test_pixels->addr32(x, 0));
3856 EXPECT_EQ(*src_pixels->addr32(x, y), *test_pixels->addr32(y, 0));
3857 }
3858 }
3859
3860 return {
3861 .test_image_1d = test_surface->SnapshotToImage(),
3862 .test_pixels = RenderResult::Make(test_pixels),
3863
3864 .dst_image_2d = dst_surface->SnapshotToImage(),
3865 .dst_pixels = RenderResult::Make(dst_pixels),
3866
3867 .src_image_2d = src_surface->SnapshotToImage(),
3868 .src_pixels = RenderResult::Make(src_pixels),
3869 };
3870 }
std::shared_ptr< DlSurfaceInstance > get_output(DlSurfaceProvider *provider, int w, int h, bool snapshot, const std::function< void(DlCanvas *)> &renderer)
impeller::Point DlPoint
static RenderResult Make(const std::shared_ptr< DlSurfaceInstance > &surface)

References get_output(), and test_dst_colors.

◆ report_results()

void flutter::testing::DisplayListNopTest::report_results ( int  all_flags,
const sk_sp< DisplayList > &  dl,
const std::string &  desc 
)
inlineprotected

Definition at line 3953 of file dl_rendering_unittests.cc.

3955 {
3956 if (!dl->modifies_transparent_black()) {
3957 EXPECT_TRUE((all_flags & kWasMTB) == 0);
3958 } else if ((all_flags & kWasMTB) == 0) {
3959 FML_LOG(INFO) << "combination does not affect transparency: " << desc;
3960 }
3961 if (dl->op_count() == 0u) {
3962 EXPECT_TRUE((all_flags & kWasNotNop) == 0);
3963 } else if ((all_flags & kWasNotNop) == 0) {
3964 FML_LOG(INFO) << "combination could be classified as a nop: " << desc;
3965 }
3966 };

References FML_LOG.

◆ test_attributes_image()

void flutter::testing::DisplayListNopTest::test_attributes_image ( DlBlendMode  mode,
DlColor  color,
const DlColorFilter color_filter,
DlImageFilter image_filter 
)
inlineprotected

Definition at line 4049 of file dl_rendering_unittests.cc.

4052 {
4053 // if (true) { return; }
4054 std::stringstream desc_stream;
4055 desc_stream << " rendering with: ";
4056 desc_stream << BlendModeToString(mode);
4057 desc_stream << "/" << color;
4058 std::string cf_mtb = color_filter
4059 ? color_filter->modifies_transparent_black()
4060 ? "modifies transparency"
4061 : "preserves transparency"
4062 : "no filter";
4063 desc_stream << ", CF: " << cf_mtb;
4064 std::string if_mtb = image_filter
4065 ? image_filter->modifies_transparent_black()
4066 ? "modifies transparency"
4067 : "preserves transparency"
4068 : "no filter";
4069 desc_stream << ", IF: " << if_mtb;
4070 std::string desc = desc_stream.str();
4071
4072 for (BackendType back_end : GetTestBackends()) {
4073 std::unique_ptr<DlSurfaceProvider> provider = GetProvider(back_end);
4074 const TestData test_data = GetTestData(provider.get());
4075 std::string provider_desc = " " + provider->GetBackendName() + desc;
4076
4077 DisplayListBuilder builder_for_properties(DlRect::MakeWH(100.0f, 100.0f));
4078 DlPaint paint = DlPaint(color) //
4079 .setBlendMode(mode) //
4080 .setColorFilter(color_filter) //
4081 .setImageFilter(image_filter);
4082 builder_for_properties.DrawImage(test_data.src_image_2d, DlPoint(0, 0),
4084 &paint);
4085 sk_sp<DisplayList> properties_display_list =
4086 builder_for_properties.Build();
4087
4088 int w = test_data.src_image_2d->width();
4089 int h = test_data.src_image_2d->height();
4090 std::shared_ptr<DlSurfaceInstance> result_surface =
4091 provider->MakeOffscreenSurface(w, h, DlSurfaceProvider::kN32Premul);
4092 DisplayListBuilder builder_for_rendering;
4093 builder_for_rendering.Clear(DlColor::kTransparent());
4094 builder_for_rendering.DrawImage(test_data.dst_image_2d, DlPoint(0, 0),
4096 builder_for_rendering.DrawImage(test_data.src_image_2d, DlPoint(0, 0),
4098 &paint);
4099 result_surface->RenderDisplayList(builder_for_rendering.Build());
4100 result_surface->FlushSubmitCpuSync();
4101 RenderResult result_pixels = RenderResult::Make(result_surface);
4102
4103 int all_flags =
4104 check_image_result(test_data.dst_pixels, result_pixels,
4105 properties_display_list, provider_desc);
4106 report_results(all_flags, properties_display_list, provider_desc);
4107 }
4108 };
DlPaint & setBlendMode(DlBlendMode mode)
Definition dl_paint.h:85
DlPaint & setImageFilter(std::nullptr_t filter)
Definition dl_paint.h:167
DlPaint & setColorFilter(std::nullptr_t filter)
Definition dl_paint.h:149
void report_results(int all_flags, const sk_sp< DisplayList > &dl, const std::string &desc)
int check_image_result(const RenderResult &dst_data, const RenderResult &result_data, const sk_sp< DisplayList > &dl, const std::string &desc)
const TestData GetTestData(DlSurfaceProvider *provider)
static std::unique_ptr< DlSurfaceProvider > GetProvider(BackendType type)
static const std::vector< BackendType > & GetTestBackends()
DlSurfaceProvider::BackendType BackendType
const char * BlendModeToString(BlendMode blend_mode)
Definition color.cc:45
flutter::DlPaint DlPaint
static constexpr TRect MakeWH(Type width, Type height)
Definition rect.h:140

References impeller::BlendModeToString(), flutter::DisplayListBuilder::Build(), flutter::DlCanvas::Clear(), flutter::DisplayListBuilder::DrawImage(), flutter::testing::DisplayListNopTest::TestData::dst_image_2d, flutter::testing::DisplayListNopTest::TestData::dst_pixels, flutter::h, flutter::testing::DlSurfaceProvider::kN32Premul, flutter::kNearestNeighbor, flutter::DlColor::kTransparent(), flutter::testing::RenderResult::Make(), impeller::TRect< Scalar >::MakeWH(), flutter::mode, flutter::DlColorFilter::modifies_transparent_black(), flutter::DlImageFilter::modifies_transparent_black(), flutter::DlPaint::setBlendMode(), flutter::DlPaint::setColorFilter(), flutter::DlPaint::setImageFilter(), and flutter::testing::DisplayListNopTest::TestData::src_image_2d.

◆ test_mode_color_via_filter()

void flutter::testing::DisplayListNopTest::test_mode_color_via_filter ( DlBlendMode  mode,
DlColor  color 
)
inlineprotected

Definition at line 3968 of file dl_rendering_unittests.cc.

3968 {
3969 std::stringstream desc_stream;
3970 desc_stream << " using SkColorFilter::filterColor() with: ";
3971 desc_stream << BlendModeToString(mode);
3972 desc_stream << "/" << color;
3973 std::string desc = desc_stream.str();
3974 DisplayListBuilder builder(DlRect::MakeWH(100.0f, 100.0f));
3975 DlPaint paint = DlPaint(color).setBlendMode(mode);
3976 builder.DrawRect(DlRect::MakeLTRB(0.0f, 0.0f, 10.0f, 10.0f), paint);
3977 sk_sp<DisplayList> dl = builder.Build();
3978 if (dl->modifies_transparent_black()) {
3979 ASSERT_TRUE(dl->op_count() != 0u);
3980 }
3981
3982 SkBlendMode sk_mode = static_cast<SkBlendMode>(mode);
3983 sk_sp<SkColorFilter> sk_color_filter =
3984 SkColorFilters::Blend(ToSkColor4f(color), nullptr, sk_mode);
3985 sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
3986 int all_flags = 0;
3987 if (sk_color_filter) {
3988 for (DlColor dst_color : test_dst_colors) {
3989 SkColor4f dst_color_f = ToSkColor4f(dst_color);
3990 DlColor result = DlColor(
3991 sk_color_filter->filterColor4f(dst_color_f, srgb.get(), srgb.get())
3992 .toSkColor());
3993 all_flags |=
3994 check_color_result(dst_color, result, /*x=*/0, /*y=*/0, dl, desc);
3995 }
3996 if ((all_flags & kWasMTB) != 0) {
3997 EXPECT_FALSE(sk_color_filter->isAlphaUnchanged());
3998 }
3999 }
4000 report_results(all_flags, dl, desc);
4001 };
SkColor4f ToSkColor4f(DlColor color)
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129

References impeller::BlendModeToString(), flutter::DisplayListBuilder::Build(), flutter::DisplayListBuilder::DrawRect(), impeller::TRect< Scalar >::MakeLTRB(), impeller::TRect< Scalar >::MakeWH(), flutter::mode, flutter::DlPaint::setBlendMode(), and flutter::ToSkColor4f().

◆ test_mode_color_via_rendering()

void flutter::testing::DisplayListNopTest::test_mode_color_via_rendering ( DlBlendMode  mode,
DlColor  color 
)
inlineprotected

Definition at line 4003 of file dl_rendering_unittests.cc.

4003 {
4004 std::stringstream desc_stream;
4005 desc_stream << " rendering with: ";
4006 desc_stream << BlendModeToString(mode);
4007 desc_stream << "/" << color;
4008 std::string desc = desc_stream.str();
4009 DisplayListBuilder builder_for_properties;
4010 DlPaint dl_paint = DlPaint(color).setBlendMode(mode);
4011 builder_for_properties.DrawRect(DlRect::MakeWH(100, 100), dl_paint);
4012 sk_sp<DisplayList> properties_display_list = builder_for_properties.Build();
4013 bool dl_is_elided = properties_display_list->op_count() == 0u;
4014 bool dl_affects_transparent_pixels =
4015 properties_display_list->modifies_transparent_black();
4016 ASSERT_TRUE(!dl_is_elided || !dl_affects_transparent_pixels);
4017
4018 DlPaint paint;
4019 paint.setBlendMode(mode);
4020 paint.setColor(color);
4021 for (BackendType back_end : GetTestBackends()) {
4022 std::unique_ptr<DlSurfaceProvider> provider = GetProvider(back_end);
4023 const TestData test_data = GetTestData(provider.get());
4024 std::string provider_desc = " " + provider->GetBackendName() + desc;
4025
4026 sk_sp<DlImage> test_image = test_data.test_image_1d;
4027 DlRect test_bounds =
4028 DlRect::MakeWH(test_image->width(), test_image->height());
4029 std::shared_ptr<DlSurfaceInstance> result_surface =
4030 provider->MakeOffscreenSurface(test_image->width(),
4031 test_image->height(),
4033 DisplayListBuilder builder_for_rendering;
4034 builder_for_rendering.Clear(DlColor::kTransparent());
4035 builder_for_rendering.DrawImage(test_image, DlPoint(0, 0),
4037 builder_for_rendering.DrawRect(test_bounds, paint);
4038 result_surface->RenderDisplayList(builder_for_rendering.Build());
4039 result_surface->FlushSubmitCpuSync();
4040 RenderResult result_pixels = RenderResult::Make(result_surface);
4041
4042 int all_flags =
4043 check_image_result(test_data.test_pixels, result_pixels,
4044 properties_display_list, provider_desc);
4045 report_results(all_flags, properties_display_list, provider_desc);
4046 }
4047 };
DlPaint & setColor(DlColor color)
Definition dl_paint.h:70
impeller::Rect DlRect

References impeller::BlendModeToString(), flutter::DisplayListBuilder::Build(), flutter::DlCanvas::Clear(), flutter::DisplayListBuilder::DrawImage(), flutter::DisplayListBuilder::DrawRect(), flutter::testing::DlSurfaceProvider::kN32Premul, flutter::kNearestNeighbor, flutter::DlColor::kTransparent(), flutter::testing::RenderResult::Make(), impeller::TRect< Scalar >::MakeWH(), flutter::mode, flutter::DlPaint::setBlendMode(), flutter::DlPaint::setColor(), flutter::testing::DisplayListNopTest::TestData::test_image_1d, and flutter::testing::DisplayListNopTest::TestData::test_pixels.

Member Data Documentation

◆ color_filter_mtb

std::shared_ptr<const DlColorFilter> flutter::testing::DisplayListNopTest::color_filter_mtb
protected

Definition at line 3881 of file dl_rendering_unittests.cc.

Referenced by DisplayListNopTest().

◆ color_filter_nomtb

std::shared_ptr<const DlColorFilter> flutter::testing::DisplayListNopTest::color_filter_nomtb
protected

Definition at line 3880 of file dl_rendering_unittests.cc.

Referenced by DisplayListNopTest().

◆ kWasMTB

constexpr int flutter::testing::DisplayListNopTest::kWasMTB = 0x2
staticconstexprprotected

Definition at line 3875 of file dl_rendering_unittests.cc.

◆ kWasNotNop

constexpr int flutter::testing::DisplayListNopTest::kWasNotNop = 0x1
staticconstexprprotected

Definition at line 3874 of file dl_rendering_unittests.cc.

◆ test_datas

std::map<DlSurfaceProvider::BackendType, TestData> flutter::testing::DisplayListNopTest::test_datas
protected

Definition at line 3883 of file dl_rendering_unittests.cc.

◆ test_dst_colors

std::vector<DlColor> flutter::testing::DisplayListNopTest::test_dst_colors
protected

Definition at line 3878 of file dl_rendering_unittests.cc.

Referenced by DisplayListNopTest(), and make_test_data().

◆ test_src_colors

std::vector<DlColor> flutter::testing::DisplayListNopTest::test_src_colors
protected

Definition at line 3877 of file dl_rendering_unittests.cc.

Referenced by DisplayListNopTest().


The documentation for this class was generated from the following file: