7#include "flutter/display_list/display_list.h"
8#include "flutter/display_list/dl_builder.h"
9#include "flutter/display_list/dl_op_flags.h"
10#include "flutter/display_list/dl_sampling_options.h"
11#include "flutter/display_list/skia/dl_sk_canvas.h"
12#include "flutter/display_list/skia/dl_sk_conversions.h"
13#include "flutter/display_list/skia/dl_sk_dispatcher.h"
14#include "flutter/display_list/testing/dl_test_snippets.h"
15#include "flutter/display_list/testing/dl_test_surface_provider.h"
16#include "flutter/display_list/utils/dl_comparable.h"
17#include "flutter/fml/file.h"
18#include "flutter/fml/math.h"
19#include "flutter/testing/display_list_testing.h"
20#include "flutter/testing/testing.h"
21#ifdef IMPELLER_SUPPORTS_RENDERING
22#include "flutter/impeller/typographer/backends/skia/text_frame_skia.h"
182 for (
int y = 0;
y <
width;
y += cbdim) {
183 for (
int x = 0;
x <
height;
x += cbdim) {
184 DlPaint& cellp = ((
x +
y) & 1) == 0 ? p0 : p1;
197 return std::make_shared<DlImageColorSource>(
image,
214 : warning_(warning) {}
217 if (warnings_sent_.find(
name) == warnings_sent_.end()) {
218 warnings_sent_.insert(
name);
224 std::string warning_;
225 std::set<std::string> warnings_sent_;
252 copy.bounds_pad_.offset(bounds_pad_x, bounds_pad_y);
258 copy.scale_.fX *= scale_x;
259 copy.scale_.fY *= scale_y;
266 copy.absolute_pad_.offset(absolute_pad_x, absolute_pad_y);
273 copy.clip_pad_.offset(absolute_pad_x, absolute_pad_y);
286 copy.clip_.setEmpty();
294 return rect.makeOutset(outset_x, outset_y);
298 int worst_bounds_pad_x,
299 int worst_bounds_pad_y)
const {
301 allowed.
outset(bounds_pad_.
fX, bounds_pad_.
fY);
302 allowed =
Scale(allowed, scale_);
303 allowed.
outset(absolute_pad_.
fX, absolute_pad_.
fY);
313 int allowed_pad_x =
std::max(pad_left, pad_right);
314 int allowed_pad_y =
std::max(pad_top, pad_bottom);
315 if (worst_bounds_pad_x > allowed_pad_x ||
316 worst_bounds_pad_y > allowed_pad_y) {
318 << allowed_pad_x <<
", " << allowed_pad_y;
320 return (worst_bounds_pad_x > allowed_pad_x ||
321 worst_bounds_pad_y > allowed_pad_y);
327 return bounds_pad_ == other.bounds_pad_ && scale_ == other.scale_ &&
328 absolute_pad_ == other.absolute_pad_ && clip_ == other.clip_ &&
329 clip_pad_ == other.clip_pad_ &&
330 discrete_offset_ == other.discrete_offset_;
336 SkPoint absolute_pad_ = {0, 0};
337 SkRect clip_ = {-1E9, -1E9, 1E9, 1E9};
343template <
typename C,
typename P,
typename I>
375 virtual const uint32_t*
addr32(
int x,
int y)
const = 0;
382 bool take_snapshot =
false) {
387 surface->readPixels(pixmap_, 0, 0);
389 image_ =
surface->makeImageSnapshot();
397 const uint32_t*
addr32(
int x,
int y)
const override {
410 void* addr_ =
nullptr;
421 int width()
const override {
return screenshot_->width(); };
422 int height()
const override {
return screenshot_->height(); }
423 const uint32_t*
addr32(
int x,
int y)
const override {
424 return screenshot_->addr32(
x,
y);
427 screenshot_->write(
path);
472 : sk_setup_(sk_setup),
473 sk_render_(sk_render),
474 sk_restore_(sk_restore),
475 sk_image_(sk_image) {}
480 sk_setup_({canvas,
paint, sk_image_});
481 setup_paint_ =
paint;
485 sk_render_({canvas,
paint, sk_image_});
486 sk_restore_({canvas,
paint, sk_image_});
515 : dl_setup_(dl_setup),
516 dl_render_(dl_render),
517 dl_restore_(dl_restore),
518 dl_image_(dl_image) {}
528 dl_setup_({canvas,
paint, dl_image_});
529 setup_paint_ =
paint;
533 dl_render_({canvas,
paint, dl_image_});
534 dl_restore_({canvas,
paint, dl_image_});
549 return dl_image_->impeller_texture() !=
nullptr;
575 : display_list_(
std::move(display_list)) {}
626 test_impeller_image_ = makeTestImpellerImage(provider_);
628 test_impeller_image_);
637 auto canvas =
surface->getCanvas();
640 int restore_count = canvas->save();
641 canvas->scale(
info.scale,
info.scale);
643 canvas->restoreToCount(restore_count);
649 return std::make_unique<SkRenderResult>(
surface);
666 builder.DrawDisplayList(render_dl);
669 return std::make_unique<ImpellerRenderResult>(std::move(snap),
670 render_dl->bounds());
687 return ref_impeller_result_.get();
700 return surface_1x_->sk_surface();
703 return surface_2x_->sk_surface();
706 <<
") not supported.";
711 const DlSurfaceProvider* provider_;
713 std::shared_ptr<DlSurfaceInstance> surface_1x_;
714 std::shared_ptr<DlSurfaceInstance> surface_2x_;
719 std::unique_ptr<RenderResult> ref_sk_result_;
720 std::unique_ptr<RenderResult> ref_dl_result_;
721 std::unique_ptr<ImpellerRenderResult> ref_impeller_result_;
730 return surface->makeImageSnapshot();
733 const DlSurfaceProvider*
provider) {
742const sk_sp<SkImage> RenderEnvironment::kTestSkImage = makeTestSkImage();
786 bg_, has_diff_clip_, mutating_layer,
791 return CaseParameters(info_, sk_setup_, dl_setup_, sk_restore_, dl_restore_,
792 bg, has_diff_clip_, has_mutating_save_layer_,
793 fuzzy_compare_components_);
797 return CaseParameters(info_, sk_setup_, dl_setup_, sk_restore_, dl_restore_,
798 bg_,
true, has_mutating_save_layer_,
799 fuzzy_compare_components_);
802 std::string
info()
const {
return info_; }
814 const std::string info_;
820 const bool has_diff_clip_;
821 const bool has_mutating_save_layer_;
822 const bool fuzzy_compare_components_;
847 if (
paint.getColorSourcePtr() && !
paint.getColorSourcePtr()->asColor()) {
865 if (
env.ref_clip_bounds() !=
renderer.setup_clip_bounds() ||
924 getCap(ref_attr, geo_flags) !=
getCap(attr, geo_flags)) {
936 ref_miter < 1.4 || test_miter < 1.4) {
937 if (ref_miter != test_miter) {
974 paint.getStrokeMiter() *
paint.getStrokeWidth() * 0.5f;
1019 h_tolerance = v_tolerance =
adjust;
1023 return new_tolerance;
1044 is_draw_text_blob_ =
true;
1048 is_draw_display_list_ =
true;
1052 is_draw_line_ =
true;
1056 is_draw_arc_center_ =
true;
1060 is_draw_path_ =
true;
1064 ignores_dashes_ =
true;
1068 is_horizontal_line_ =
true;
1072 is_vertical_line_ =
true;
1082 bool is_draw_text_blob_ =
false;
1083 bool is_draw_display_list_ =
false;
1084 bool is_draw_line_ =
false;
1085 bool is_draw_arc_center_ =
false;
1086 bool is_draw_path_ =
false;
1087 bool ignores_dashes_ =
false;
1088 bool is_horizontal_line_ =
false;
1089 bool is_vertical_line_ =
false;
1102 if (provider ==
nullptr) {
1104 <<
" not supported (ignoring)";
1108 PixelFormat::kN32PremulPixelFormat);
1119 if (provider->supports_impeller()) {
1136 if (
env.supports_impeller()) {
1137 auto impeller_result =
env.ref_impeller_result();
1138 if (!
checkPixels(impeller_result, impeller_result->render_bounds(),
1139 "Impeller reference")) {
1140 std::string test_name =
1141 ::testing::UnitTest::GetInstance()->current_test_info()->name();
1142 save_to_png(impeller_result, test_name +
" (Impeller reference)",
1143 "base rendering was blank or out of bounds");
1147 warnings.
warn(
env.backend_name());
1154 if (
params.uses_paint()) {
1170 ctx.canvas->restore();
1179 ctx.canvas->DrawRect(
1182 ctx.canvas->Restore();
1186 ctx.canvas->restore();
1190 ctx.canvas->Restore();
1195 "With prior save/clip/restore",
1216 "saveLayer no paint, no bounds",
1218 ctx.
canvas->saveLayer(
nullptr,
nullptr);
1221 ctx.
canvas->SaveLayer(
nullptr,
nullptr);
1223 .with_restore(sk_safe_restore, dl_safe_restore,
false));
1226 "saveLayer no paint, with bounds",
1228 ctx.
canvas->saveLayer(layer_bounds,
nullptr);
1231 ctx.
canvas->SaveLayer(&layer_bounds,
nullptr);
1233 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1236 "saveLayer with alpha, no bounds",
1240 ctx.
canvas->saveLayer(
nullptr, &save_p);
1244 save_p.
setColor(alpha_layer_color);
1245 ctx.
canvas->SaveLayer(
nullptr, &save_p);
1247 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1250 "saveLayer with peephole alpha, no bounds",
1254 ctx.
canvas->saveLayer(
nullptr, &save_p);
1258 save_p.
setColor(alpha_layer_color);
1259 ctx.
canvas->SaveLayer(
nullptr, &save_p);
1261 .with_restore(sk_opt_restore, dl_opt_restore,
true,
true));
1264 "saveLayer with alpha and bounds",
1268 ctx.
canvas->saveLayer(layer_bounds, &save_p);
1272 save_p.
setColor(alpha_layer_color);
1273 ctx.
canvas->SaveLayer(&layer_bounds, &save_p);
1275 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1289 ctx.
canvas->drawPaint(setup_p);
1294 ctx.
canvas->DrawPaint(setup_p);
1297 ctx.
paint.setAlpha(ctx.
paint.getAlpha() / 2);
1300 ctx.
paint.setAlpha(ctx.
paint.getAlpha() / 2);
1312 "saveLayer with backdrop",
1314 sk_backdrop_setup(ctx);
1316 nullptr,
nullptr, sk_backdrop.get(), 0));
1317 sk_content_setup(ctx);
1320 dl_backdrop_setup(ctx);
1321 ctx.
canvas->SaveLayer(
nullptr,
nullptr, &dl_backdrop);
1322 dl_content_setup(ctx);
1324 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1327 "saveLayer with bounds and backdrop",
1329 sk_backdrop_setup(ctx);
1331 &layer_bounds,
nullptr, sk_backdrop.get(), 0));
1332 sk_content_setup(ctx);
1335 dl_backdrop_setup(ctx);
1336 ctx.
canvas->SaveLayer(&layer_bounds,
nullptr,
1338 dl_content_setup(ctx);
1340 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1343 "clipped saveLayer with backdrop",
1345 sk_backdrop_setup(ctx);
1346 ctx.
canvas->clipRect(layer_bounds);
1348 nullptr,
nullptr, sk_backdrop.get(), 0));
1349 sk_content_setup(ctx);
1352 dl_backdrop_setup(ctx);
1353 ctx.
canvas->ClipRect(layer_bounds);
1354 ctx.
canvas->SaveLayer(
nullptr,
nullptr, &dl_backdrop);
1355 dl_content_setup(ctx);
1357 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1362 constexpr float rotate_alpha_color_matrix[20] = {
1370 auto sk_alpha_rotate_filter =
1375 "saveLayer ColorFilter, no bounds",
1379 ctx.
canvas->saveLayer(
nullptr, &save_p);
1380 ctx.
paint.setStrokeWidth(5.0);
1385 ctx.
canvas->SaveLayer(
nullptr, &save_p);
1386 ctx.
paint.setStrokeWidth(5.0);
1388 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1393 "saveLayer ColorFilter and bounds",
1398 ctx.
paint.setStrokeWidth(5.0);
1404 ctx.
paint.setStrokeWidth(5.0);
1406 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1412 constexpr float color_matrix[20] = {
1426 "saveLayer ImageFilter, no bounds",
1430 ctx.
canvas->saveLayer(
nullptr, &save_p);
1431 ctx.
paint.setStrokeWidth(5.0);
1436 ctx.
canvas->SaveLayer(
nullptr, &save_p);
1437 ctx.
paint.setStrokeWidth(5.0);
1439 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1444 "saveLayer ImageFilter and bounds",
1449 ctx.
paint.setStrokeWidth(5.0);
1455 ctx.
paint.setStrokeWidth(5.0);
1457 .with_restore(sk_safe_restore, dl_safe_restore,
true));
1475 ctx.
canvas->translate(0.1, 0.1);
1476 ctx.
paint.setAntiAlias(is_aa);
1477 ctx.
paint.setStrokeWidth(5.0);
1480 ctx.
canvas->Translate(0.1, 0.1);
1481 ctx.
paint.setAntiAlias(is_aa);
1482 ctx.
paint.setStrokeWidth(5.0);
1491 testP, aa_env, aa_tolerance,
1493 "AntiAlias == True",
1497 testP, aa_env, aa_tolerance,
1499 "AntiAlias == False",
1505 testP,
env, tolerance,
1515 testP,
env, tolerance,
1537 ctx.
paint.setColor(blendable_color.
argb());
1541 ctx.
paint.setColor(blendable_color);
1549 ctx.
paint.setColor(blendable_color.
argb());
1553 ctx.
paint.setColor(blendable_color);
1565 ctx.
paint.setStrokeWidth(5.0);
1569 ctx.
paint.setStrokeWidth(5.0);
1576 auto sk_filter_decal_5 =
1580 RenderWith(testP, blur_env, blur_5_tolerance,
1582 "ImageFilter == Decal Blur 5",
1585 ctx.
paint.setImageFilter(sk_filter_decal_5);
1589 ctx.
paint.setImageFilter(&dl_filter_decal_5);
1593 auto sk_filter_clamp_5 =
1596 RenderWith(testP, blur_env, blur_5_tolerance,
1598 "ImageFilter == Clamp Blur 5",
1601 ctx.
paint.setImageFilter(sk_filter_clamp_5);
1605 ctx.
paint.setImageFilter(&dl_filter_clamp_5);
1617 ctx.
paint.setStrokeWidth(5.0);
1621 ctx.
paint.setStrokeWidth(5.0);
1631 "ImageFilter == Dilate 5",
1633 sk_dilate_setup(ctx);
1634 ctx.
paint.setImageFilter(sk_dilate_filter_5);
1637 dl_dilate_setup(ctx);
1638 ctx.
paint.setImageFilter(&dl_dilate_filter_5);
1649 ctx.
paint.setStrokeWidth(6.0);
1653 ctx.
paint.setStrokeWidth(6.0);
1665 "ImageFilter == Erode 1",
1667 sk_erode_setup(ctx);
1668 ctx.
paint.setImageFilter(sk_erode_filter_1);
1671 dl_erode_setup(ctx);
1672 ctx.
paint.setImageFilter(&dl_erode_filter_1);
1678 constexpr float rotate_color_matrix[20] = {
1684 constexpr float invert_color_matrix[20] = {
1688 1.0, 1.0, 1.0, 1.0, 0,
1697 "ColorFilter == RotateRGB",
1700 ctx.
paint.setColorFilter(sk_color_filter);
1704 ctx.
paint.setColorFilter(&dl_color_filter);
1712 "ColorFilter == Invert",
1715 ctx.
paint.setColorFilter(
1720 ctx.
paint.setInvertColors(
true);
1734 "MaskFilter == Blur 5",
1736 ctx.
paint.setStrokeWidth(5.0);
1737 ctx.
paint.setMaskFilter(sk_mask_filter);
1740 ctx.
paint.setStrokeWidth(5.0);
1741 ctx.
paint.setMaskFilter(&dl_mask_filter);
1774 "LinearGradient GYB",
1776 ctx.
paint.setShader(sk_gradient);
1780 ctx.
paint.setColorSource(dl_gradient);
1811 env.provider()->backend_type() != BackendType::kSoftwareBackend;
1814 "Stroke + defaults",
1817 ctx.
paint.setStrokeWidth(1.0);
1823 ctx.
paint.setStrokeWidth(1.0);
1830 "Fill + unnecessary StrokeWidth 10",
1833 ctx.
paint.setStrokeWidth(10.0);
1837 ctx.
paint.setStrokeWidth(10.0);
1844 ctx.
paint.setStrokeWidth(5.0);
1848 ctx.
paint.setStrokeWidth(5.0);
1855 RenderWith(testP, stroke_base_env, tolerance,
1860 ctx.
paint.setStrokeWidth(10.0);
1864 ctx.
paint.setStrokeWidth(10.0);
1866 RenderWith(testP, stroke_base_env, tolerance,
1871 ctx.
paint.setStrokeWidth(5.0);
1875 ctx.
paint.setStrokeWidth(5.0);
1878 RenderWith(testP, stroke_base_env, tolerance,
1880 "Stroke Width 5, Square Cap",
1883 ctx.
paint.setStrokeWidth(5.0);
1888 ctx.
paint.setStrokeWidth(5.0);
1891 RenderWith(testP, stroke_base_env, tolerance,
1893 "Stroke Width 5, Round Cap",
1896 ctx.
paint.setStrokeWidth(5.0);
1901 ctx.
paint.setStrokeWidth(5.0);
1905 RenderWith(testP, stroke_base_env, tolerance,
1907 "Stroke Width 5, Bevel Join",
1910 ctx.
paint.setStrokeWidth(5.0);
1915 ctx.
paint.setStrokeWidth(5.0);
1918 RenderWith(testP, stroke_base_env, tolerance,
1920 "Stroke Width 5, Round Join",
1923 ctx.
paint.setStrokeWidth(5.0);
1928 ctx.
paint.setStrokeWidth(5.0);
1932 RenderWith(testP, stroke_base_env, tolerance,
1934 "Stroke Width 5, Miter 10",
1937 ctx.
paint.setStrokeWidth(5.0);
1938 ctx.
paint.setStrokeMiter(10.0);
1943 ctx.
paint.setStrokeWidth(5.0);
1944 ctx.
paint.setStrokeMiter(10.0);
1948 RenderWith(testP, stroke_base_env, tolerance,
1950 "Stroke Width 5, Miter 0",
1953 ctx.
paint.setStrokeWidth(5.0);
1954 ctx.
paint.setStrokeMiter(0.0);
1959 ctx.
paint.setStrokeWidth(5.0);
1960 ctx.
paint.setStrokeMiter(0.0);
1973 testP,
env, tolerance,
1979 testP,
env, tolerance,
1985 testP,
env, skewed_tolerance,
1991 testP,
env, skewed_tolerance,
2006 tweak, 1.0 + tweak, 10,
2009 testP,
env, skewed_tolerance,
2011 "Transform 2D Affine",
2026 testP,
env, skewed_tolerance,
2028 "Transform Full Perspective",
2050 "Hard ClipRect inset by 15.4",
2059 "AntiAlias ClipRect inset by 15.4",
2068 "Hard ClipRect Diff, inset by 15.4",
2084 "Hard ClipRRect with radius of 15.4",
2094 "AntiAlias ClipRRect with radius of 15.4",
2103 "Hard ClipRRect Diff, with radius of 15.4",
2114 path_clip.addRect(r_clip);
2118 "Hard ClipPath inset by 15.4",
2128 "AntiAlias ClipPath inset by 15.4",
2137 testP,
env, diff_tolerance,
2139 "Hard ClipPath Diff, inset by 15.4",
2158 if (ret.is_valid()) {
2163 if (ret.is_valid()) {
2167 <<
") for impeller failure images" <<
", ret = " << ret.get()
2168 <<
", errno = " << errno;
2173 std::string base_dir =
"./impeller_failure_images";
2177 for (
int i = 0;
i < 10000;
i++) {
2179 while (sub_dir.length() < 4) {
2180 sub_dir =
"0" + sub_dir;
2182 std::string try_dir = base_dir +
"/" + sub_dir;
2193 FML_LOG(
ERROR) <<
"Too many output directories for Impeller failure images";
2197 const std::string& op_desc,
2198 const std::string& reason) {
2211 for (
const char& ch : op_desc) {
2212 filename += (ch ==
':' || ch ==
' ') ?
'_' : ch;
2214 filename = filename +
".png";
2224 std::string test_name =
2225 ::testing::UnitTest::GetInstance()->current_test_info()->name();
2226 const std::string
info =
2227 env.backend_name() +
": " + test_name +
" (" + caseP.
info() +
")";
2239 auto sk_result =
env.getResult(base_info, sk_job);
2245 auto dl_result =
env.getResult(base_info, dl_job);
2260 checkPixels(sk_result.get(), sk_bounds,
info +
" (Skia reference)", bg);
2264 info +
" (attribute should not have effect)");
2267 info +
" (attribute should affect rendering)");
2274 if (
env.supports_impeller() &&
2280 env.impeller_image());
2281 auto imp_result =
env.getImpellerResult(base_info, imp_job);
2282 std::string imp_info =
info +
" (Impeller)";
2283 bool success =
checkPixels(imp_result.get(), imp_result->render_bounds(),
2286 success = success &&
2288 env.ref_impeller_result(), imp_result.get(),
true,
2289 imp_info +
" (attribute should not have effect)");
2291 success = success &&
2293 env.ref_impeller_result(), imp_result.get(),
false,
2294 imp_info +
" (attribute should affect rendering)");
2302 "compare to reference without attributes");
2304 "and to Skia reference with attributes");
2306 "and to Skia reference without attributes");
2311 info +
" (DlCanvas output matches SkCanvas)");
2314 SkRect dl_bounds = display_list->bounds();
2315 if (!sk_bounds.
roundOut().contains(dl_bounds)) {
2318 << sk_bounds.
fLeft <<
", " << sk_bounds.
fTop <<
" => "
2321 << dl_bounds.
fLeft <<
", " << dl_bounds.
fTop <<
" => "
2323 if (!dl_bounds.
contains(sk_bounds)) {
2328 FML_LOG(
ERROR) <<
"###### DisplayList bounds larger than reference!";
2344 EXPECT_EQ(
static_cast<int>(display_list->op_count()),
2347 EXPECT_EQ(
static_cast<int>(display_list->op_count()),
2353 auto dl_builder_result =
env.getResult(base_info, dl_builder_job);
2356 dl_builder_result.get(), dl_result.get(),
2357 info +
" (DlCanvas DL output close to Builder Dl output)",
2358 &dl_bounds, &tolerance, bg,
true);
2361 dl_builder_result.get(), dl_result.get(),
true,
2362 info +
" (DlCanvas DL output matches Builder Dl output)");
2366 info +
" (DisplayList built directly -> surface)",
2367 &dl_bounds, &tolerance, bg,
2370 if (display_list->can_apply_group_opacity()) {
2372 info +
" with Group Opacity", bg);
2388 .
width = test_width_2,
2389 .height = test_height_2,
2393 auto ref_x2_result =
env.getResult(info_2x, sk_job_x2);
2394 ASSERT_EQ(ref_x2_result->width(), test_width_2) <<
info;
2395 ASSERT_EQ(ref_x2_result->height(), test_height_2) <<
info;
2398 auto test_x2_result =
env.getResult(info_2x, dl_job_x2);
2400 info +
" (Both rendered scaled 2x)",
nullptr,
nullptr,
2402 test_width_2, test_height_2,
false);
2407 for (
int i = 0;
i < 32;
i += 8) {
2408 int comp_a = (pixel_a >>
i) & 0xff;
2409 int comp_b = (pixel_b >>
i) & 0xff;
2410 if (
std::abs(comp_a - comp_b) > fudge) {
2418 if (
env.format() == PixelFormat::k565PixelFormat) {
2421 if (
env.provider()->backend_type() == BackendType::kOpenGlBackend) {
2431 const std::string&
info,
2440 auto group_opacity_result =
env.getResult(opacity_info, opacity_job);
2448 int pixels_touched = 0;
2449 int pixels_different = 0;
2461 const uint32_t* ref_row = ref_result->
addr32(0,
y);
2462 const uint32_t* test_row = group_opacity_result->addr32(0,
y);
2464 uint32_t ref_pixel = ref_row[
x];
2465 uint32_t test_pixel = test_row[
x];
2466 if (ref_pixel != bg.
argb() || test_pixel != bg.
argb()) {
2468 for (
int i = 0;
i < 32;
i += 8) {
2469 int ref_comp = (ref_pixel >>
i) & 0xff;
2470 int bg_comp = (bg.
argb() >>
i) & 0xff;
2471 SkScalar faded_comp = bg_comp + (ref_comp - bg_comp) * opacity;
2472 int test_comp = (test_pixel >>
i) & 0xff;
2473 if (
std::abs(faded_comp - test_comp) > fudge) {
2474 int diff =
std::abs(faded_comp - test_comp);
2475 if (max_diff < diff) {
2485 ASSERT_GT(pixels_touched, 20) <<
info;
2486 if (pixels_different > 1) {
2489 ASSERT_LE(pixels_different, 1) <<
info;
2494 const std::string&
info,
2496 uint32_t untouched = bg.premultipliedArgb();
2497 int pixels_touched = 0;
2503 const uint32_t* ref_row = ref_result->
addr32(0,
y);
2505 if (ref_row[
x] != untouched) {
2513 EXPECT_EQ(pixels_oob, 0) <<
info;
2514 EXPECT_GT(pixels_touched, 0) <<
info;
2515 return pixels_oob == 0 && pixels_touched > 0;
2522 const uint32_t* ref_row = ref_result->
addr32(0,
y);
2523 const uint32_t* test_row = test_result->
addr32(0,
y);
2525 if (ref_row[
x] != test_row[
x]) {
2526 if (ref_row[
x] == 0) {
2536 const std::string&
info) {
2538 info +
" reference rendering");
2544 const std::string&
info) {
2545 int w = test_result->
width();
2546 int h = test_result->
height();
2549 int pixels_different = 0;
2550 for (
int y = 0;
y <
h;
y++) {
2551 const uint32_t* ref_row = ref_result->
addr32(0,
y);
2552 const uint32_t* test_row = test_result->
addr32(0,
y);
2553 for (
int x = 0;
x <
w;
x++) {
2554 if (ref_row[
x] != test_row[
x]) {
2555 if (should_match && pixels_different < 5) {
2556 FML_LOG(
ERROR) << std::hex << ref_row[
x] <<
" != " << test_row[
x];
2563 EXPECT_EQ(pixels_different, 0) <<
info;
2564 return pixels_different == 0;
2566 EXPECT_NE(pixels_different, 0) <<
info;
2567 return pixels_different != 0;
2573 const std::string&
info,
2577 bool fuzzyCompares =
false,
2580 bool printMismatches =
false) {
2587 int pixels_different = 0;
2594 const uint32_t* ref_row = ref_result->
addr32(0,
y);
2595 const uint32_t* test_row = test_result->
addr32(0,
y);
2597 if (
bounds && test_row[
x] != untouched) {
2615 : test_row[
x] == ref_row[
x];
2617 if (printMismatches && pixels_different < 5) {
2619 <<
"] mismatch: " << std::hex << test_row[
x]
2620 <<
"(test) != (ref)" << ref_row[
x] << std::dec;
2626 if (pixels_oob > 0) {
2628 << min_x <<
", " << min_y <<
" => " << max_x <<
", "
2638 ASSERT_EQ(pixels_oob, 0) <<
info;
2639 ASSERT_EQ(pixels_different, 0) <<
info;
2656 int pix_width = pix_size.
width();
2657 int pix_height = pix_size.
height();
2658 int worst_pad_x =
std::max(pad_left, pad_right);
2659 int worst_pad_y =
std::max(pad_top, pad_bottom);
2660 if (tolerance->
overflows(pix_bounds, worst_pad_x, worst_pad_y)) {
2663 << pixLeft <<
", " << pixTop <<
" => "
2664 << pixRight <<
", " << pixBottom
2671 FML_LOG(
ERROR) <<
"Bounds overly conservative by up to "
2672 << worst_pad_x <<
", " << worst_pad_y
2673 <<
" (" << (worst_pad_x * 100.0 / pix_width)
2674 <<
"%, " << (worst_pad_y * 100.0 / pix_height) <<
"%)";
2675 int pix_area = pix_size.
area();
2677 FML_LOG(
ERROR) <<
"Total overflow area: " << (dl_area - pix_area)
2678 <<
" (+" << (dl_area * 100.0 / pix_area - 100.0)
2708template <
typename BaseT>
2715 if (
prefix.length() > str.length()) {
2718 for (
size_t i = 0;
i <
prefix.length();
i++) {
2727 bool do_software =
true;
2728 bool do_opengl =
false;
2729 bool do_metal =
false;
2730 std::vector<std::string>
args = ::testing::internal::GetArgvs();
2732 std::string arg = *p_arg;
2734 if (arg ==
"--save-impeller-failures") {
2740 arg =
"-" + arg.substr(4);
2743 arg =
"--en" + arg.substr(5);
2745 if (arg ==
"--enable-software") {
2746 do_software = enable;
2747 }
else if (arg ==
"--enable-opengl" || arg ==
"--enable-gl") {
2749 }
else if (arg ==
"--enable-metal") {
2751 }
else if (arg ==
"--enable-impeller") {
2767 std::string providers =
"";
2771 std::string libraries =
" Skia";
2774 libraries +=
" Impeller";
2776 FML_LOG(INFO) <<
"Running tests on [" << providers
2777 <<
" ], and [" << libraries <<
" ]";
2784 <<
" images saved in "
2787 FML_LOG(INFO) <<
" " << filename;
2840 ctx.
canvas->drawColor(0x7FFF00FF);
2868 ctx.
canvas->drawLine(p1, p2,
p);
2869 ctx.
canvas->drawLine(p3, p4,
p);
2870 ctx.
canvas->drawLine(p5, p6,
p);
2871 ctx.
canvas->drawLine(p7, p8,
p);
2895 ctx.
canvas->drawLine(p1, p2,
p);
2917 ctx.
canvas->drawLine(p1, p2,
p);
2957 SkScalar intervals[2] = {25.0f, 5.0f};
2959 ctx.
canvas->drawLine(p1, p2,
p);
2960 ctx.
canvas->drawLine(p3, p4,
p);
2961 ctx.
canvas->drawLine(p5, p6,
p);
2962 ctx.
canvas->drawLine(p7, p8,
p);
2966 25.0f, 5.0f, ctx.
paint);
2968 25.0f, 5.0f, ctx.
paint);
2970 25.0f, 5.0f, ctx.
paint);
2972 25.0f, 5.0f, ctx.
paint);
3092 kDrawArcNoCenterFlags));
3114 kDrawArcWithCenterFlags)
3115 .set_draw_arc_center());
3140 {x0, y0}, {x1, y0}, {x2, y0}, {x3, y0}, {x4, y0}, {x5, y0}, {x6, y0},
3141 {x0, y1}, {x1, y1}, {x2, y1}, {x3, y1}, {x4, y1}, {x5, y1}, {x6, y1},
3142 {x0, y2}, {x1, y2}, {x2, y2}, {x3, y2}, {x4, y2}, {x5, y2}, {x6, y2},
3143 {x0, y3}, {x1, y3}, {x2, y3}, {x3, y3}, {x4, y3}, {x5, y3}, {x6, y3},
3144 {x0, y4}, {x1, y4}, {x2, y4}, {x3, y4}, {x4, y4}, {x5, y4}, {x6, y4},
3145 {x0, y5}, {x1, y5}, {x2, y5}, {x3, y5}, {x4, y5}, {x5, y5}, {x6, y5},
3146 {x0, y6}, {x1, y6}, {x2, y6}, {x3, y6}, {x4, y6}, {x5, y6}, {x6, y6},
3166 kDrawPointsAsPointsFlags)
3191 {x0, y0}, {x3, y3}, {x3, y0}, {x0, y3},
3202 ASSERT_TRUE((
count & 1) == 0);
3218 kDrawPointsAsLinesFlags));
3234 const int count1 =
sizeof(points1) /
sizeof(points1[0]);
3251 kDrawPointsAsPolygonFlags));
3274 const DlColor dl_colors[6] = {
3278 const SkColor sk_colors[6] = {
3282 const std::shared_ptr<DlVertices> dl_vertices =
3284 const auto sk_vertices =
3286 pts,
nullptr, sk_colors);
3298 kDrawVerticesFlags));
3329 const std::shared_ptr<DlVertices> dl_vertices =
3332 SkVertices::VertexMode::kTriangles_VertexMode, 6, pts, tex,
nullptr);
3339 v_paint.setShader(MakeColorSource(ctx.image));
3347 v_paint.setColorSource(MakeColorSource(ctx.image));
3352 kDrawVerticesFlags));
3369 kDrawImageWithPaintFlags));
3399 kDrawImageWithPaintFlags));
3408 ctx.
canvas->drawImageRect(
3413 ctx.
canvas->DrawImageRect(
3417 kDrawImageRectWithPaintFlags));
3426 ctx.
canvas->drawImageRect(
3431 ctx.
canvas->DrawImageRect(
3435 kDrawImageRectFlags));
3444 ctx.
canvas->drawImageRect(
3449 ctx.
canvas->DrawImageRect(
3453 kDrawImageRectWithPaintFlags));
3469 kDrawImageNineWithPaintFlags));
3485 kDrawImageNineFlags));
3501 kDrawImageNineWithPaintFlags));
3538 ctx.
canvas->drawAtlas(ctx.
image.get(), xform, tex, sk_colors, 4,
3543 ctx.
canvas->DrawAtlas(ctx.
image, xform, tex, dl_colors, 4,
3547 kDrawAtlasWithPaintFlags));
3584 ctx.
canvas->drawAtlas(ctx.
image.get(), xform, tex, sk_colors, 4,
3589 ctx.
canvas->DrawAtlas(ctx.
image, xform, tex, dl_colors, 4,
3630 ctx.
canvas->drawAtlas(ctx.
image.get(), xform, tex, sk_colors, 2,
3632 nullptr, &ctx.
paint);
3635 ctx.
canvas->DrawAtlas(ctx.
image, xform, tex, dl_colors, 2,
3637 nullptr, &ctx.
paint);
3639 kDrawAtlasWithPaintFlags));
3669 ctx.
canvas->DrawDisplayList(display_list);
3671 kDrawDisplayListFlags)
3672 .set_draw_display_list());
3679#if defined(OS_FUCHSIA)
3680 GTEST_SKIP() <<
"Rendering comparisons require a valid default font manager";
3684#ifdef IMPELLER_SUPPORTS_RENDERING
3703#ifdef IMPELLER_SUPPORTS_RENDERING
3712 .set_draw_text_blob(),
3833 kSaveLayerWithPaintFlags);
3834 CaseParameters case_params(
"Filtered SaveLayer with clipped content");
3842 test_params.imp_renderer());
3849 float commutable_color_matrix[]{
3857 float non_commutable_color_matrix[]{
3868 std::vector<SkScalar> opacities = {
3873 std::vector<std::shared_ptr<DlColorFilter>> color_filters = {
3876 std::make_shared<DlMatrixColorFilter>(commutable_color_matrix),
3877 std::make_shared<DlMatrixColorFilter>(non_commutable_color_matrix),
3881 std::vector<std::shared_ptr<DlImageFilter>> image_filters = {
3883 std::make_shared<DlDilateImageFilter>(5.0f, 5.0f),
3884 std::make_shared<DlErodeImageFilter>(5.0f, 5.0f),
3885 std::make_shared<DlMatrixImageFilter>(contract_matrix,
3904 auto test_attributes_env =
3906 const DlPaint& paint_both,
bool same,
bool rev_same,
3907 const std::string& desc1,
const std::string& desc2,
3912 render_content(nested_builder);
3913 auto nested_results =
env->getResult(nested_builder.
Build());
3918 render_content(reverse_builder);
3919 auto reverse_results =
env->getResult(reverse_builder.
Build());
3923 render_content(combined_builder);
3924 auto combined_results =
env->getResult(combined_builder.
Build());
3933 const bool always =
false;
3938 if (always || same) {
3940 nested_results.get(), combined_results.get(),
3941 "nested " + desc1 +
" then " + desc2,
nullptr,
3943 true, combined_results->width(),
3944 combined_results->height(),
true);
3946 if (always || rev_same) {
3948 reverse_results.get(), combined_results.get(),
3949 "nested " + desc2 +
" then " + desc1,
nullptr,
3951 true, combined_results->width(),
3952 combined_results->height(),
true);
3956 auto test_attributes = [test_attributes_env](
DlPaint& paint1,
DlPaint& paint2,
3958 bool same,
bool rev_same,
3959 const std::string& desc1,
3960 const std::string& desc2) {
3963 auto env = std::make_unique<RenderEnvironment>(
3964 provider.get(), PixelFormat::kN32PremulPixelFormat);
3965 test_attributes_env(paint1, paint2, paint_both,
3966 same, rev_same, desc1, desc2,
env.get());
3972 for (
size_t cfi = 0; cfi < color_filters.size(); cfi++) {
3974 std::string cf_desc =
"color filter #" +
std::to_string(cfi + 1);
3977 for (
size_t oi = 0; oi < opacities.size(); oi++) {
3982 DlPaint combined_paint = nested_paint1;
3985 bool op_then_cf_works = opacity <= 0.0 || opacity >= 1.0 ||
3988 test_attributes(nested_paint1, nested_paint2, combined_paint,
true,
3989 op_then_cf_works, cf_desc, op_desc);
3997 for (
size_t oi = 0; oi < opacities.size(); oi++) {
4002 for (
size_t ifi = 0; ifi < image_filters.size(); ifi++) {
4003 auto image_filter = image_filters[ifi];
4004 std::string if_desc =
"image filter #" +
std::to_string(ifi + 1);
4007 DlPaint combined_paint = nested_paint1;
4010 bool if_then_op_works = opacity <= 0.0 || opacity >= 1.0;
4011 test_attributes(nested_paint1, nested_paint2, combined_paint,
true,
4012 if_then_op_works, op_desc, if_desc);
4018 for (
size_t cfi = 0; cfi < color_filters.size(); cfi++) {
4020 std::string cf_desc =
"color filter #" +
std::to_string(cfi + 1);
4023 for (
size_t ifi = 0; ifi < image_filters.size(); ifi++) {
4024 auto image_filter = image_filters[ifi];
4025 std::string if_desc =
"image filter #" +
std::to_string(ifi + 1);
4028 DlPaint combined_paint = nested_paint1;
4031 test_attributes(nested_paint1, nested_paint2, combined_paint,
true,
false,
4049 float original_value =
matrix[element];
4063 auto display_list1 = builder1.
Build();
4072 auto display_list2 = builder2.
Build();
4076 auto env = std::make_unique<RenderEnvironment>(
4077 provider.get(), PixelFormat::kN32PremulPixelFormat);
4078 auto results1 =
env->getResult(display_list1);
4079 auto results2 =
env->getResult(display_list2);
4082 desc +
" filter affects rendering");
4083 int modified_transparent_pixels =
4087 modified_transparent_pixels != 0)
4095 for (
int i = 0;
i < 20;
i++) {
4134 auto display_list1 = builder1.
Build();
4143 auto display_list2 = builder2.
Build();
4147 auto env = std::make_unique<RenderEnvironment>(
4148 provider.get(), PixelFormat::kN32PremulPixelFormat);
4149 auto results1 =
env->getResult(display_list1);
4150 auto results2 =
env->getResult(display_list2);
4151 if (!filter || filter->can_commute_with_opacity()) {
4153 results2.get(), results1.get(),
desc,
nullptr,
nullptr,
4157 results1.get(), results2.get(),
false,
desc);
4165 for (
int i = 0;
i < 20;
i++) {
4177#define FOR_EACH_BLEND_MODE_ENUM(FUNC) \
4212#define MODE_CASE(m) \
4213 case DlBlendMode::m: \
4222 std::stringstream desc_str;
4224 desc_str <<
"blend[" << mode_string <<
", " <<
color <<
"]";
4225 std::string
desc = desc_str.str();
4239 auto display_list1 = builder1.
Build();
4248 auto display_list2 = builder2.
Build();
4252 auto env = std::make_unique<RenderEnvironment>(
4253 provider.get(), PixelFormat::kN32PremulPixelFormat);
4254 auto results1 =
env->getResult(display_list1);
4255 auto results2 =
env->getResult(display_list2);
4256 int modified_transparent_pixels =
4260 modified_transparent_pixels != 0)
4273#define TEST_MODE(V) test_mode(DlBlendMode::V);
4280 std::stringstream desc_str;
4282 desc_str <<
"blend[" << mode_string <<
", " <<
color <<
"]";
4283 std::string
desc = desc_str.str();
4303 auto display_list1 = builder1.
Build();
4312 auto display_list2 = builder2.
Build();
4316 auto env = std::make_unique<RenderEnvironment>(
4317 provider.get(), PixelFormat::kN32PremulPixelFormat);
4318 auto results1 =
env->getResult(display_list1);
4319 auto results2 =
env->getResult(display_list2);
4322 results2.get(), results1.get(),
desc,
nullptr,
nullptr,
4326 results1.get(), results2.get(),
false,
desc);
4339#define TEST_MODE(V) test_mode(DlBlendMode::V);
4365 const int step = 0x55;
4366 static_assert(
step * 3 == 255);
4368 for (
int r =
step; r < 256; r +=
step) {
4369 for (
int g =
step; g < 256; g +=
step) {
4377 static constexpr float color_filter_matrix_nomtb[] = {
4378 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4379 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4380 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4381 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4383 static constexpr float color_filter_matrix_mtb[] = {
4384 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4385 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4386 0.0001, 0.0001, 0.0001, 0.9997, 0.0,
4387 0.0001, 0.0001, 0.0001, 0.9997, 0.1,
4397 for (DlColor color : test_dst_colors) {
4399 paint.setColor(ToSk(color));
4400 paint.setBlendMode(SkBlendMode::kSrc);
4401 canvas->drawRect(SkRect::MakeXYWH(x, 0, 1, 1), paint);
4410 int data_count =
test_data->image()->width();
4412 data_count, data_count,
true, [
this, data_count](
SkCanvas* canvas) {
4413 ASSERT_EQ(
test_data->width(), data_count);
4415 for (
int y = 0;
y < data_count;
y++) {
4420 data_count, data_count,
true, [
this, data_count](
SkCanvas* canvas) {
4421 ASSERT_EQ(
test_data->width(), data_count);
4425 for (
int y = 0;
y < data_count;
y++) {
4430 for (
int y = 0;
y < data_count;
y++) {
4431 for (
int x = 0;
x < data_count;
x++) {
4440 static constexpr int kWasNotNop = 0x1;
4441 static constexpr int kWasMTB = 0x2;
4466 return std::make_unique<SkRenderResult>(
surface, snapshot);
4472 const std::string&
desc) {
4474 bool is_error =
false;
4477 is_error = !dl->modifies_transparent_black();
4479 if (result_color != dst_color) {
4481 is_error = (dl->op_count() == 0u);
4484 FML_LOG(
ERROR) << std::hex << dst_color <<
" filters to " << result_color
4491 const std::unique_ptr<RenderResult>& result_data,
4493 const std::string&
desc) {
4494 EXPECT_EQ(dst_data->width(), result_data->width());
4495 EXPECT_EQ(dst_data->height(), result_data->height());
4497 for (
int y = 0;
y < dst_data->height();
y++) {
4498 const uint32_t* dst_pixels = dst_data->addr32(0,
y);
4499 const uint32_t* result_pixels = result_data->addr32(0,
y);
4500 for (
int x = 0;
x < dst_data->width();
x++) {
4510 const std::string&
desc) {
4511 if (!dl->modifies_transparent_black()) {
4513 }
else if ((
all_flags & kWasMTB) == 0) {
4514 FML_LOG(INFO) <<
"combination does not affect transparency: " <<
desc;
4516 if (dl->op_count() == 0u) {
4518 }
else if ((
all_flags & kWasNotNop) == 0) {
4519 FML_LOG(INFO) <<
"combination could be classified as a nop: " <<
desc;
4524 std::stringstream desc_stream;
4525 desc_stream <<
" using SkColorFilter::filterColor() with: ";
4527 desc_stream <<
"/" <<
color;
4528 std::string
desc = desc_stream.str();
4533 if (dl->modifies_transparent_black()) {
4534 ASSERT_TRUE(dl->op_count() != 0u);
4541 if (sk_color_filter) {
4542 for (
DlColor dst_color : test_dst_colors) {
4543 SkColor4f dst_color_f = SkColor4f::FromColor(
ToSk(dst_color));
4545 sk_color_filter->filterColor4f(dst_color_f, srgb.get(), srgb.get())
4550 EXPECT_FALSE(sk_color_filter->isAlphaUnchanged());
4557 std::stringstream desc_stream;
4558 desc_stream <<
" rendering with: ";
4560 desc_stream <<
"/" <<
color;
4561 std::string
desc = desc_stream.str();
4569 bool dl_is_elided = dl->op_count() == 0u;
4570 bool dl_affects_transparent_pixels = dl->modifies_transparent_black();
4571 ASSERT_TRUE(!dl_is_elided || !dl_affects_transparent_pixels);
4579 auto result_surface = provider->MakeOffscreenSurface(
4582 SkCanvas* result_canvas = result_surface->sk_surface()->getCanvas();
4587 result_surface->sk_surface()->recordingContext())) {
4588 direct_context->flushAndSubmit();
4589 direct_context->flushAndSubmit(result_surface->sk_surface().get(),
4592 const std::unique_ptr<RenderResult> result_pixels =
4593 std::make_unique<SkRenderResult>(result_surface->sk_surface());
4595 int all_flags = check_image_result(test_data, result_pixels, dl,
desc);
4605 std::stringstream desc_stream;
4606 desc_stream <<
" rendering with: ";
4608 desc_stream <<
"/" <<
color;
4611 ?
"modifies transparency"
4612 :
"preserves transparency"
4614 desc_stream <<
", CF: " << cf_mtb;
4615 std::string if_mtb = image_filter
4617 ?
"modifies transparency"
4618 :
"preserves transparency"
4620 desc_stream <<
", IF: " << if_mtb;
4621 std::string
desc = desc_stream.str();
4632 int w = test_image_src_data->width();
4633 int h = test_image_src_data->height();
4642 auto result_surface = provider->MakeOffscreenSurface(
4644 SkCanvas* result_canvas = result_surface->sk_surface()->getCanvas();
4646 result_canvas->
drawImage(test_image_dst_data->image(), 0, 0);
4647 result_canvas->
drawImage(test_image_src_data->image(), 0, 0,
4650 result_surface->sk_surface()->recordingContext())) {
4651 direct_context->flushAndSubmit();
4652 direct_context->flushAndSubmit(result_surface->sk_surface().get(),
4655 std::unique_ptr<RenderResult> result_pixels =
4656 std::make_unique<SkRenderResult>(result_surface->sk_surface());
4659 check_image_result(test_image_dst_data, result_pixels, dl,
desc);
4668 test_mode_color_via_filter(
mode,
color);
4672#define TEST_MODE(V) test_mode_filter(DlBlendMode::V);
4681 test_mode_color_via_rendering(
mode,
color);
4685#define TEST_MODE(V) test_mode_render(DlBlendMode::V);
4695 test_attributes_image(
mode,
color,
nullptr,
nullptr);
4696 test_attributes_image(
mode,
color, color_filter_nomtb.get(),
nullptr);
4697 test_attributes_image(
mode,
color, color_filter_mtb.get(),
nullptr);
4698 test_attributes_image(
mode,
color,
nullptr, &image_filter_nomtb);
4699 test_attributes_image(
mode,
color,
nullptr, &image_filter_mtb);
4703#define TEST_MODE(V) test_mode_render(DlBlendMode::V);
4708#undef FOR_EACH_BLEND_MODE_ENUM
static int step(int x, SkScalar min, SkScalar max)
static void test_bounds(skiatest::Reporter *reporter, SkClipStack::Element::DeviceSpaceType primType)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
static void test_scale(skiatest::Reporter *reporter, const Geo &geo)
static const int points[]
static bool is_identity(const SkMatrix &m)
static float next(float f)
static void test_matrix(skiatest::Reporter *reporter)
@ kSrcOver
r = s + (1-sa)*d
@ kNormal_SkBlurStyle
fuzzy inside and outside
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorBLUE
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
@ kUTF8
uses bytes to represent UTF-8 or ASCII
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define SK_ScalarInfinity
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
static void test_image(const sk_sp< SkSpecialImage > &img, skiatest::Reporter *reporter, GrRecordingContext *rContext, bool isGPUBacked)
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
@ kFast_SrcRectConstraint
sample outside bounds; faster
void clear(SkColor color)
void rotate(SkScalar degrees)
SkMatrix getTotalMatrix() const
SkIRect getDeviceClipBounds() const
@ kLines_PointMode
draw each pair of points as a line segment
@ kPolygon_PointMode
draw the array of points as a open polygon
@ kPoints_PointMode
draw each point separately
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static SkM44 Rotate(SkV3 axis, SkScalar radians)
SkM44 & preConcat(const SkM44 &m)
SkM44 & preTranslate(SkScalar x, SkScalar y, SkScalar z=0)
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
void setColor(SkColor color)
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setShader(sk_sp< SkShader > shader)
@ kMiter_Join
extends to miter limit
@ kBevel_Join
connects outside edges
void setBlendMode(SkBlendMode mode)
SkShader * getShader() const
void setColorFilter(sk_sp< SkColorFilter > colorFilter)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
virtual SkRect cullRect() const =0
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
virtual int approximateOpCount(bool nested=false) const =0
const uint32_t * addr32() const
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
constexpr bool applies_color() const
constexpr bool is_stroked(DlDrawStyle style=DlDrawStyle::kStroke) const
constexpr bool applies_color_filter() const
constexpr bool ignores_paint() const
constexpr bool applies_image_filter() const
constexpr bool applies_shader() const
const DisplayListSpecialGeometryFlags GeometryFlags(bool is_stroked) const
constexpr bool applies_anti_alias() const
constexpr bool applies_mask_filter() const
constexpr bool applies_blend() const
The primitive honors the DlBlendMode.
constexpr bool is_flood() const
void DrawRect(const SkRect &rect, const DlPaint &paint) override
void Translate(SkScalar tx, SkScalar ty) override
void Rotate(SkScalar degrees) override
void SaveLayer(const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr) override
sk_sp< DisplayList > Build()
constexpr bool may_have_joins() const
The geometry may have segments connect non-continuously.
constexpr bool may_have_end_caps() const
The geometry may have segments that end without closing the path.
constexpr bool may_have_acute_joins() const
constexpr bool butt_cap_becomes_square() const
Mainly for drawPoints(PointMode) where Butt caps are rendered as squares.
static std::shared_ptr< DlColorFilter > Make(DlColor color, DlBlendMode mode)
bool can_commute_with_opacity() const override
bool modifies_transparent_black() const override
static std::shared_ptr< DlImageFilter > Make(SkScalar sigma_x, SkScalar sigma_y, DlTileMode tile_mode)
Developer-facing API for rendering anything within the engine.
virtual void DrawRect(const SkRect &rect, const DlPaint &paint)=0
@ kLines
draw each separate pair of points as a line segment
@ kPolygon
draw each pair of overlapping points as a line segment
@ kPoints
draw each point separately
virtual SkRect GetDestinationClipBounds() const =0
virtual SkISize GetBaseLayerSize() const =0
virtual SkMatrix GetTransform() const =0
static std::shared_ptr< DlLinearGradientColorSource > MakeLinear(const SkPoint start_point, const SkPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
virtual bool modifies_transparent_black() const =0
static sk_sp< DlImage > Make(const SkImage *image)
static const std::shared_ptr< DlLinearToSrgbGammaColorFilter > kInstance
static std::shared_ptr< DlColorFilter > Make(const float matrix[20])
bool modifies_transparent_black() const override
DlStrokeCap getStrokeCap() const
DlPaint & setColor(DlColor color)
DlBlendMode getBlendMode() const
DlPaint & setColorFilter(const std::shared_ptr< const DlColorFilter > &filter)
float getStrokeMiter() const
std::shared_ptr< const DlColorSource > getColorSource() const
DlStrokeJoin getStrokeJoin() const
DlPaint & setAlpha(uint8_t alpha)
DlPaint & setBlendMode(DlBlendMode mode)
DlDrawStyle getDrawStyle() const
std::shared_ptr< const DlMaskFilter > getMaskFilter() const
std::shared_ptr< const DlColorFilter > getColorFilter() const
DlPaint & setImageFilter(const std::shared_ptr< const DlImageFilter > &filter)
float getStrokeWidth() const
DlPaint & setOpacity(SkScalar opacity)
std::shared_ptr< const DlImageFilter > getImageFilter() const
DlPaint & setDrawStyle(DlDrawStyle style)
DlPaint & setColorSource(std::shared_ptr< const DlColorSource > source)
bool isInvertColors() const
Backend implementation of |DlCanvas| for |SkCanvas|.
void DrawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1) override
static void DrawShadow(SkCanvas *canvas, const SkPath &path, DlColor color, float elevation, bool transparentOccluder, SkScalar dpr)
static const std::shared_ptr< DlSrgbToLinearGammaColorFilter > kInstance
static std::shared_ptr< DlVertices > Make(DlVertexMode mode, int vertex_count, const SkPoint vertices[], const SkPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr)
Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
static SkRect Scale(const SkRect &rect, const SkPoint &scales)
BoundsTolerance()=default
BoundsTolerance(const BoundsTolerance &)=default
BoundsTolerance addBoundsPadding(SkScalar bounds_pad_x, SkScalar bounds_pad_y) const
bool operator==(BoundsTolerance const &other) const
BoundsTolerance addPostClipPadding(SkScalar absolute_pad_x, SkScalar absolute_pad_y) const
SkScalar discrete_offset() const
bool overflows(SkIRect pix_bounds, int worst_bounds_pad_x, int worst_bounds_pad_y) const
BoundsTolerance addDiscreteOffset(SkScalar discrete_offset) const
BoundsTolerance clip(SkRect clip) const
BoundsTolerance mulScale(SkScalar scale_x, SkScalar scale_y) const
BoundsTolerance addAbsolutePadding(SkScalar absolute_pad_x, SkScalar absolute_pad_y) const
static std::vector< BackendType > TestBackends
static void showBoundsOverflow(const std::string &info, SkIRect &bounds, const BoundsTolerance *tolerance, int pixLeft, int pixTop, int pixRight, int pixBottom)
static void RenderWithAttributes(const TestParameters &testP, const RenderEnvironment &env, const BoundsTolerance &tolerance)
static int countModifiedTransparentPixels(const RenderResult *ref_result, const RenderResult *test_result)
static void RenderWithStrokes(const TestParameters &testP, const RenderEnvironment &env, const BoundsTolerance &tolerance_in)
static void SetupImpellerFailureImageDirectory()
static bool checkPixels(const RenderResult *ref_result, const SkRect ref_bounds, const std::string &info, const DlColor bg=DlColor::kTransparent())
static void RenderWithSaveRestore(const TestParameters &testP, const RenderEnvironment &env, const BoundsTolerance &tolerance)
static bool SaveImpellerFailureImages
static DirectoryStatus CheckDir(const std::string &dir)
static std::unique_ptr< DlSurfaceProvider > GetProvider(BackendType type)
static sk_sp< SkTextBlob > MakeTextBlob(const std::string &string, SkScalar font_height)
static void RenderWithClips(const TestParameters &testP, const RenderEnvironment &env, const BoundsTolerance &diff_tolerance)
static void RenderWith(const TestParameters &testP, const RenderEnvironment &env, const BoundsTolerance &tolerance_in, const CaseParameters &caseP)
static bool quickCompareToReference(const RenderResult *ref_result, const RenderResult *test_result, bool should_match, const std::string &info)
static void checkGroupOpacity(const RenderEnvironment &env, const sk_sp< DisplayList > &display_list, const RenderResult *ref_result, const std::string &info, DlColor bg)
static void save_to_png(const RenderResult *result, const std::string &op_desc, const std::string &reason)
static void compareToReference(const RenderResult *test_result, const RenderResult *ref_result, const std::string &info, const SkRect *bounds, const BoundsTolerance *tolerance, const DlColor bg, bool fuzzyCompares=false, int width=kTestWidth, int height=kTestHeight, bool printMismatches=false)
static bool ImpellerSupported
static void RenderAll(const TestParameters ¶ms, const BoundsTolerance &tolerance=DefaultTolerance)
static bool AddProvider(BackendType type)
static std::vector< std::string > ImpellerFailureImages
static void ClearProviders()
static bool fuzzyCompare(uint32_t pixel_a, uint32_t pixel_b, int fudge)
static void quickCompareToReference(const RenderEnvironment &env, const std::string &info)
static void RenderWithTransforms(const TestParameters &testP, const RenderEnvironment &env, const BoundsTolerance &tolerance)
static BoundsTolerance DefaultTolerance
static std::string ImpellerFailureImageDirectory
static int groupOpacityFudgeFactor(const RenderEnvironment &env)
CaseParameters with_diff_clip()
bool fuzzy_compare_components() const
bool has_mutating_save_layer() const
bool has_diff_clip() const
CaseParameters(std::string info)
SkRenderer sk_restore() const
CaseParameters with_restore(SkRenderer &sk_restore, DlRenderer &dl_restore, bool mutating_layer, bool fuzzy_compare_components=false)
CaseParameters(std::string info, SkSetup &sk_setup, DlSetup &dl_setup, SkRenderer &sk_restore, DlRenderer &dl_restore, DlColor bg, bool has_diff_clip, bool has_mutating_save_layer, bool fuzzy_compare_components)
CaseParameters with_bg(DlColor bg)
CaseParameters(std::string info, SkSetup &sk_setup, DlSetup &dl_setup)
DlRenderer dl_restore() const
std::shared_ptr< DlColorFilter > color_filter_mtb
void test_attributes_image(DlBlendMode mode, DlColor color, DlColorFilter *color_filter, DlImageFilter *image_filter)
void report_results(int all_flags, const sk_sp< DisplayList > &dl, const std::string &desc)
std::unique_ptr< RenderResult > test_data
std::shared_ptr< DlColorFilter > color_filter_nomtb
int check_image_result(const std::unique_ptr< RenderResult > &dst_data, const std::unique_ptr< RenderResult > &result_data, const sk_sp< DisplayList > &dl, const std::string &desc)
std::unique_ptr< RenderResult > test_image_dst_data
std::vector< DlColor > test_dst_colors
void test_mode_color_via_rendering(DlBlendMode mode, DlColor color)
std::unique_ptr< RenderResult > test_image_src_data
int check_color_result(DlColor dst_color, DlColor result_color, const sk_sp< DisplayList > &dl, const std::string &desc)
std::vector< DlColor > test_src_colors
void test_mode_color_via_filter(DlBlendMode mode, DlColor color)
std::unique_ptr< RenderResult > get_output(int w, int h, bool snapshot, const std::function< void(SkCanvas *)> &renderer)
DisplayListRenderingTestBase()=default
static void SetUpTestSuite()
static bool StartsWith(std::string str, std::string prefix)
static void TearDownTestSuite()
virtual bool supports(PixelFormat format) const =0
virtual sk_sp< DlImage > MakeImpellerImage(const sk_sp< DisplayList > &list, int width, int height) const
virtual bool supports_impeller() const
static std::string BackendName(BackendType type)
static std::unique_ptr< DlSurfaceProvider > Create(BackendType backend_type)
virtual sk_sp< DlPixelData > ImpellerSnapshot(const sk_sp< DisplayList > &list, int width, int height) const
virtual std::shared_ptr< DlSurfaceInstance > MakeOffscreenSurface(size_t width, size_t height, PixelFormat format=kN32PremulPixelFormat) const =0
virtual const std::string backend_name() const =0
const SkRect & render_bounds() const
ImpellerRenderResult(sk_sp< DlPixelData > screenshot, SkRect render_bounds)
void write(const std::string &path) const override
int width() const override
~ImpellerRenderResult() override=default
int height() const override
const uint32_t * addr32(int x, int y) const override
sk_sp< SkImage > image() const override
void warn(const std::string &name)
OncePerBackendWarning(const std::string &warning)
std::unique_ptr< RenderResult > getResult(const RenderJobInfo &info, JobRenderer &renderer) const
const SkMatrix & ref_matrix() const
void init_ref(SkSetup &sk_setup, SkRenderer &sk_renderer, DlSetup &dl_setup, DlRenderer &dl_renderer, DlRenderer &imp_renderer, DlColor bg=DlColor::kTransparent())
std::unique_ptr< ImpellerRenderResult > getImpellerResult(const RenderJobInfo &info, DlJobRenderer &renderer) const
const DlPaint & ref_dl_paint() const
PixelFormat format() const
static RenderEnvironment MakeN32(const DlSurfaceProvider *provider)
const DlSurfaceProvider * provider() const
const sk_sp< SkImage > sk_image() const
const SkIRect & ref_clip_bounds() const
const sk_sp< DlImage > dl_image() const
RenderEnvironment(const DlSurfaceProvider *provider, PixelFormat format)
static RenderEnvironment Make565(const DlSurfaceProvider *provider)
bool supports_impeller() const
std::unique_ptr< RenderResult > getResult(sk_sp< DisplayList > dl) const
const std::string backend_name() const
const sk_sp< DlImage > impeller_image() const
const RenderResult * ref_dl_result() const
const ImpellerRenderResult * ref_impeller_result() const
static bool EnableImpeller
const RenderResult * ref_sk_result() const
virtual int width() const =0
virtual const uint32_t * addr32(int x, int y) const =0
virtual int height() const =0
virtual ~RenderResult()=default
virtual sk_sp< SkImage > image() const =0
virtual void write(const std::string &path) const =0
static constexpr SkSamplingOptions kCubic
static constexpr SkSamplingOptions kMipmapLinear
static constexpr SkSamplingOptions kLinear
static constexpr SkSamplingOptions kNearestNeighbor
const uint32_t * addr32(int x, int y) const override
~SkRenderResult() override
SkRenderResult(const sk_sp< SkSurface > &surface, bool take_snapshot=false)
sk_sp< SkImage > image() const override
int width() const override
int height() const override
void write(const std::string &path) const
const BoundsTolerance lineAdjust(const BoundsTolerance &tolerance, const DlPaint &paint, const SkMatrix &matrix) const
TestParameters & set_draw_display_list()
TestParameters(const SkRenderer &sk_renderer, const DlRenderer &dl_renderer, const DisplayListAttributeFlags &flags)
const DlRenderer & imp_renderer() const
TestParameters & set_draw_text_blob()
TestParameters & set_vertical_line()
bool ignores_dashes() const
bool is_draw_display_list() const
bool is_draw_arc_center() const
TestParameters(const SkRenderer &sk_renderer, const DlRenderer &dl_renderer, const DlRenderer &imp_renderer, const DisplayListAttributeFlags &flags)
TestParameters & set_draw_path()
bool uses_gradient() const
const BoundsTolerance adjust(const BoundsTolerance &tolerance, const DlPaint &paint, const SkMatrix &matrix) const
TestParameters & set_ignores_dashes()
bool is_draw_path() const
bool is_horizontal_line() const
TestParameters & set_draw_line()
bool is_draw_line() const
TestParameters & set_draw_arc_center()
TestParameters & set_horizontal_line()
bool is_draw_text_blob() const
bool is_vertical_line() const
const DlRenderer & dl_renderer() const
bool impeller_compatible(const DlPaint &paint) const
bool should_match(const RenderEnvironment &env, const CaseParameters &caseP, const DlPaint &attr, const MatrixClipJobRenderer &renderer) const
DlStrokeCap getCap(const DlPaint &attr, DisplayListSpecialGeometryFlags geo_flags) const
const SkRenderer & sk_renderer() const
#define FOR_EACH_BLEND_MODE_ENUM(FUNC)
const EmbeddedViewParams * params
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define FML_LOG(severity)
#define FML_CHECK(condition)
#define FML_DCHECK(condition)
Dart_NativeFunction function
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< const SkImage > image
sk_sp< const SkPicture > picture
sk_sp< SkBlender > blender SkRect rect
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
void * malloc(size_t size)
constexpr SkScalar kXOffsetR3
const std::function< void(const SkRenderContext &)> SkRenderer
constexpr int kTestHeight
constexpr SkScalar kYOffsetD3
TEST_F(DisplayListTest, Defaults)
const std::function< void(const DlSetupContext &)> DlSetup
static void DrawCheckerboard(DlCanvas *canvas)
constexpr SkPoint kVerticalMiterDiamondPoints[]
constexpr int kRenderCenterY
constexpr int kRenderCenterX
constexpr int kRenderRight
static std::string BlendModeToString(DlBlendMode mode)
constexpr SkScalar kXOffsetR1
static const DlSetup kEmptyDlSetup
constexpr SkScalar kYOffsetD1
SkFont CreateTestFontOfSize(SkScalar scalar)
static const SkRenderer kEmptySkRenderer
constexpr SkScalar kMiterExtremeDiamondOffsetX
sk_sp< DisplayList > makeTestDisplayList()
constexpr SkScalar kYOffsetU2
const int kHorizontalMiterDiamondPointCount
constexpr SkScalar kXOffsetL3
constexpr SkScalar kMiter4DiamondOffsetY
static std::shared_ptr< DlImageColorSource > MakeColorSource(const sk_sp< DlImage > &image)
constexpr int kRenderBottom
constexpr int kRenderHalfHeight
constexpr SkScalar kYOffsetD2
constexpr int kRenderHalfWidth
DlSurfaceProvider::PixelFormat PixelFormat
constexpr SkRect kTestBounds2
constexpr SkScalar kXOffsetR2
constexpr int kRenderHeight
const std::function< void(const SkSetupContext &)> SkSetup
DlCanvas::PointMode PointMode
constexpr SkScalar kXOffsetL1
constexpr SkScalar kMiter10DiamondOffsetY
constexpr int kRenderWidth
constexpr SkScalar kMiter10DiamondOffsetX
const SkPoint kHorizontalMiterDiamondPoints[]
constexpr SkScalar kYOffset0
constexpr SkRect kRenderBounds
constexpr SkScalar kYOffsetU1
constexpr SkScalar kYOffsetU3
const int kVerticalMiterDiamondPointCount
constexpr int kRenderLeft
static const DlRenderer kEmptyDlRenderer
static const SkSetup kEmptySkSetup
constexpr SkScalar kXOffset0
constexpr SkScalar kMiter4DiamondOffsetX
constexpr SkScalar kRenderCornerRadius
constexpr SkScalar kXOffsetL2
constexpr SkScalar kRenderRadius
const std::function< void(const DlRenderContext &)> DlRenderer
constexpr SkPoint kTestCenter
constexpr SkScalar kMiterExtremeDiamondOffsetY
SkPaint ToSk(const DlPaint &paint)
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
bool NotEquals(const T *a, const T *b)
const DlPoint & ToDlPoint(const SkPoint &point)
@ kButt
no stroke extension
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
DEF_SWITCHES_START aot vmservice shared library name
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
@ kStroke
strokes boundary of shapes
@ kFill
fills interior of shapes
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 which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
@ kNormal
fuzzy inside and outside
it will be possible to load the file into Perfetto s trace viewer 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
it will be possible to load the file into Perfetto s trace viewer 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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
TEST_F(EngineAnimatorTest, AnimatorAcceptsMultipleRenders)
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
@ kSrcOver
r = s + (1-sa)*d
@ kSrcATop
r = s*da + d*(1-sa)
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
font
Font Metadata and Metrics.
std::shared_ptr< TextFrame > MakeTextFrameFromTextBlobSkia(const sk_sp< SkTextBlob > &blob)
static void draw_rect(SkCanvas *canvas, const SkRect &r, const SkPaint &p)
SkSamplingOptions(SkFilterMode::kLinear))
SINT bool isfinite(const Vec< N, T > &v)
SIN Vec< N, float > abs(const Vec< N, float > &x)
static SkString to_string(int n)
int32_t fBottom
larger y-axis bounds
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
constexpr SkISize size() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
SkIRect makeInset(int32_t dx, int32_t dy) const
int32_t fLeft
smaller x-axis bounds
bool contains(int32_t x, int32_t y) const
int32_t fRight
larger x-axis bounds
constexpr int32_t width() const
constexpr int32_t height() const
constexpr int64_t area() const
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkPoint Make(float x, float y)
static SkRect Make(const SkISize &size)
SkScalar fBottom
larger y-axis bounds
constexpr SkRect makeOffset(float dx, float dy) const
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
static SkRect MakeIWH(int w, int h)
void outset(float dx, float dy)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkRect makeInset(float dx, float dy) const
SkScalar fRight
larger x-axis bounds
bool contains(SkScalar x, SkScalar y) const
void roundOut(SkIRect *dst) const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
SkScalar fTop
smaller y-axis bounds
static constexpr DlColor kMagenta()
static constexpr DlColor kWhite()
static constexpr DlColor kBlue()
static constexpr DlColor kBlack()
static constexpr DlColor kYellow()
static constexpr DlColor kLightGrey()
constexpr DlColor withAlpha(uint8_t alpha) const
constexpr uint32_t premultipliedArgb() const
static constexpr DlColor kTransparent()
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
constexpr bool isTransparent() const
static constexpr DlColor kDarkGrey()
static constexpr DlColor kCyan()
constexpr uint32_t argb() const
void Render(SkCanvas *canvas, const RenderJobInfo &info)
DisplayListJobRenderer(sk_sp< DisplayList > display_list)
void Render(DlCanvas *canvas, const RenderJobInfo &info)
sk_sp< DisplayList > MakeDisplayList(const RenderJobInfo &info)
bool targets_impeller() const override
const DlPaint & setup_paint() const
void Render(SkCanvas *sk_canvas, const RenderJobInfo &info) override
DlJobRenderer(const DlSetup &dl_setup, const DlRenderer &dl_render, const DlRenderer &dl_restore, const sk_sp< DlImage > &dl_image)
virtual void Render(SkCanvas *canvas, const RenderJobInfo &info)=0
virtual bool targets_impeller() const
SkIRect setup_clip_bounds_
const SkIRect & setup_clip_bounds() const
const SkMatrix & setup_matrix() const
SkJobRenderer(const SkSetup &sk_setup, const SkRenderer &sk_render, const SkRenderer &sk_restore, const sk_sp< SkImage > &sk_image)
void Render(SkCanvas *canvas, const RenderJobInfo &info) override
const SkPaint & setup_paint() const
sk_sp< SkPicture > MakePicture(const RenderJobInfo &info)
void Render(SkCanvas *canvas, const RenderJobInfo &info)
SkPictureJobRenderer(sk_sp< SkPicture > picture)
#define EXPECT_TRUE(handle)