[DisplayList] Create DlFoo type variants to start moving away from Skia types in API (flutter/engine#55812)
This is the beginning of the bulk of de-skia-fication work in the engine. All of the standard types in the DlCanvas API now have overloads that specify the corresponding Dl type, mainly for Dl*Rect and DlPoint types. This enables further work to switch from SkFoo types to DlFoo types in the various engine modules culminating in the elimination of the old methods that use the Sk types. All of the former methods that used the basic Sk types are now implemented as inlinable translation overloads and the underlying implementations of DlCanvas now implement only the newer style interfaces so that they don't need to be further modified as we eliminate the old Skia types from the interface. There are still a couple of Skia types remaining in the DlCanvas API without any DL type variants which will be handled in a future phase: - SkRRect - SkRSXform - SkTextBlob (will be hidden behind a common interface along with TextFrame) - SkImageInfo (only used in a few calling sites)
This commit is contained in:
parent
a8a7d1db42
commit
3f0d57e071
@ -273,7 +273,7 @@ TEST_F(DisplayListTest, GeneralReceiverInitialValues) {
|
|||||||
|
|
||||||
TEST_F(DisplayListTest, Iteration) {
|
TEST_F(DisplayListTest, Iteration) {
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
auto dl = builder.Build();
|
auto dl = builder.Build();
|
||||||
for (DlIndex i : *dl) {
|
for (DlIndex i : *dl) {
|
||||||
EXPECT_EQ(dl->GetOpType(i), DisplayListOpType::kDrawRect) //
|
EXPECT_EQ(dl->GetOpType(i), DisplayListOpType::kDrawRect) //
|
||||||
@ -421,7 +421,7 @@ TEST_F(DisplayListTest, SaveRestoreRestoresClip) {
|
|||||||
DisplayListBuilder builder(cull_rect);
|
DisplayListBuilder builder(cull_rect);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0.0f, 0.0f, 10.0f, 10.0f});
|
builder.ClipRect(SkRect{0.0f, 0.0f, 10.0f, 10.0f});
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
check_defaults(builder, cull_rect);
|
check_defaults(builder, cull_rect);
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ TEST_F(DisplayListTest, BuildRestoresClip) {
|
|||||||
SkRect cull_rect = SkRect::MakeLTRB(-10.0f, -10.0f, 500.0f, 500.0f);
|
SkRect cull_rect = SkRect::MakeLTRB(-10.0f, -10.0f, 500.0f, 500.0f);
|
||||||
DisplayListBuilder builder(cull_rect);
|
DisplayListBuilder builder(cull_rect);
|
||||||
|
|
||||||
builder.ClipRect({0.0f, 0.0f, 10.0f, 10.0f});
|
builder.ClipRect(SkRect{0.0f, 0.0f, 10.0f, 10.0f});
|
||||||
builder.Build();
|
builder.Build();
|
||||||
check_defaults(builder, cull_rect);
|
check_defaults(builder, cull_rect);
|
||||||
|
|
||||||
@ -1228,24 +1228,26 @@ TEST_F(DisplayListTest, SingleOpsMightSupportGroupOpacityBlendMode) {
|
|||||||
RUN_TESTS2(canvas.DrawColor(DlColor(SK_ColorRED), DlBlendMode::kSrcOver);
|
RUN_TESTS2(canvas.DrawColor(DlColor(SK_ColorRED), DlBlendMode::kSrcOver);
|
||||||
, true);
|
, true);
|
||||||
RUN_TESTS2(canvas.DrawColor(DlColor(SK_ColorRED), DlBlendMode::kSrc);, false);
|
RUN_TESTS2(canvas.DrawColor(DlColor(SK_ColorRED), DlBlendMode::kSrc);, false);
|
||||||
RUN_TESTS(canvas.DrawLine({0, 0}, {10, 10}, paint););
|
RUN_TESTS(canvas.DrawLine(SkPoint{0, 0}, SkPoint{10, 10}, paint););
|
||||||
RUN_TESTS(canvas.DrawRect({0, 0, 10, 10}, paint););
|
RUN_TESTS(canvas.DrawRect(SkRect{0, 0, 10, 10}, paint););
|
||||||
RUN_TESTS(canvas.DrawOval({0, 0, 10, 10}, paint););
|
RUN_TESTS(canvas.DrawOval(SkRect{0, 0, 10, 10}, paint););
|
||||||
RUN_TESTS(canvas.DrawCircle({10, 10}, 5, paint););
|
RUN_TESTS(canvas.DrawCircle(SkPoint{10, 10}, 5, paint););
|
||||||
RUN_TESTS(
|
RUN_TESTS(
|
||||||
canvas.DrawRRect(SkRRect::MakeRectXY({0, 0, 10, 10}, 2, 2), paint););
|
canvas.DrawRRect(SkRRect::MakeRectXY({0, 0, 10, 10}, 2, 2), paint););
|
||||||
RUN_TESTS(canvas.DrawDRRect(SkRRect::MakeRectXY({0, 0, 10, 10}, 2, 2),
|
RUN_TESTS(canvas.DrawDRRect(SkRRect::MakeRectXY({0, 0, 10, 10}, 2, 2),
|
||||||
SkRRect::MakeRectXY({2, 2, 8, 8}, 2, 2), paint););
|
SkRRect::MakeRectXY({2, 2, 8, 8}, 2, 2), paint););
|
||||||
RUN_TESTS(canvas.DrawPath(
|
RUN_TESTS(canvas.DrawPath(
|
||||||
SkPath().addOval({0, 0, 10, 10}).addOval({5, 5, 15, 15}), paint););
|
SkPath().addOval({0, 0, 10, 10}).addOval({5, 5, 15, 15}), paint););
|
||||||
RUN_TESTS(canvas.DrawArc({0, 0, 10, 10}, 0, math::kPi, true, paint););
|
RUN_TESTS(canvas.DrawArc(SkRect{0, 0, 10, 10}, 0, math::kPi, true, paint););
|
||||||
RUN_TESTS2(
|
RUN_TESTS2(
|
||||||
canvas.DrawPoints(PointMode::kPoints, TestPointCount, kTestPoints, paint);
|
canvas.DrawPoints(PointMode::kPoints, TestPointCount, kTestPoints, paint);
|
||||||
, false);
|
, false);
|
||||||
RUN_TESTS2(canvas.DrawVertices(kTestVertices1, DlBlendMode::kSrc, paint);
|
RUN_TESTS2(canvas.DrawVertices(kTestVertices1, DlBlendMode::kSrc, paint);
|
||||||
, false);
|
, false);
|
||||||
RUN_TESTS(canvas.DrawImage(TestImage1, {0, 0}, kLinearSampling, &paint););
|
RUN_TESTS(
|
||||||
RUN_TESTS2(canvas.DrawImage(TestImage1, {0, 0}, kLinearSampling, nullptr);
|
canvas.DrawImage(TestImage1, SkPoint{0, 0}, kLinearSampling, &paint););
|
||||||
|
RUN_TESTS2(
|
||||||
|
canvas.DrawImage(TestImage1, SkPoint{0, 0}, kLinearSampling, nullptr);
|
||||||
, true);
|
, true);
|
||||||
RUN_TESTS(canvas.DrawImageRect(TestImage1, SkIRect{10, 10, 20, 20},
|
RUN_TESTS(canvas.DrawImageRect(TestImage1, SkIRect{10, 10, 20, 20},
|
||||||
{0, 0, 10, 10}, kNearestSampling, &paint,
|
{0, 0, 10, 10}, kNearestSampling, &paint,
|
||||||
@ -1254,10 +1256,12 @@ TEST_F(DisplayListTest, SingleOpsMightSupportGroupOpacityBlendMode) {
|
|||||||
{0, 0, 10, 10}, kNearestSampling, nullptr,
|
{0, 0, 10, 10}, kNearestSampling, nullptr,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlCanvas::SrcRectConstraint::kFast);
|
||||||
, true);
|
, true);
|
||||||
RUN_TESTS(canvas.DrawImageNine(TestImage2, {20, 20, 30, 30}, {0, 0, 20, 20},
|
RUN_TESTS(canvas.DrawImageNine(TestImage2, SkIRect{20, 20, 30, 30},
|
||||||
DlFilterMode::kLinear, &paint););
|
SkRect{0, 0, 20, 20}, DlFilterMode::kLinear,
|
||||||
RUN_TESTS2(canvas.DrawImageNine(TestImage2, {20, 20, 30, 30}, {0, 0, 20, 20},
|
&paint););
|
||||||
DlFilterMode::kLinear, nullptr);
|
RUN_TESTS2(canvas.DrawImageNine(TestImage2, SkIRect{20, 20, 30, 30},
|
||||||
|
SkRect{0, 0, 20, 20}, DlFilterMode::kLinear,
|
||||||
|
nullptr);
|
||||||
, true);
|
, true);
|
||||||
static SkRSXform xforms[] = {{1, 0, 0, 0}, {0, 1, 0, 0}};
|
static SkRSXform xforms[] = {{1, 0, 0, 0}, {0, 1, 0, 0}};
|
||||||
static SkRect texs[] = {{10, 10, 20, 20}, {20, 20, 30, 30}};
|
static SkRect texs[] = {{10, 10, 20, 20}, {20, 20, 30, 30}};
|
||||||
@ -1273,8 +1277,8 @@ TEST_F(DisplayListTest, SingleOpsMightSupportGroupOpacityBlendMode) {
|
|||||||
RUN_TESTS2(canvas.DrawDisplayList(TestDisplayList1);, true);
|
RUN_TESTS2(canvas.DrawDisplayList(TestDisplayList1);, true);
|
||||||
{
|
{
|
||||||
static DisplayListBuilder builder;
|
static DisplayListBuilder builder;
|
||||||
builder.DrawRect({0, 0, 10, 10}, DlPaint());
|
builder.DrawRect(SkRect{0, 0, 10, 10}, DlPaint());
|
||||||
builder.DrawRect({5, 5, 15, 15}, DlPaint());
|
builder.DrawRect(SkRect{5, 5, 15, 15}, DlPaint());
|
||||||
static auto display_list = builder.Build();
|
static auto display_list = builder.Build();
|
||||||
RUN_TESTS2(canvas.DrawDisplayList(display_list);, false);
|
RUN_TESTS2(canvas.DrawDisplayList(display_list);, false);
|
||||||
}
|
}
|
||||||
@ -1346,9 +1350,10 @@ TEST_F(DisplayListTest, SaveLayerFalseWithSrcBlendSupportsGroupOpacity) {
|
|||||||
// saveLayer following it should not use that attribute to base its
|
// saveLayer following it should not use that attribute to base its
|
||||||
// decisions about group opacity and the draw rect after that comes
|
// decisions about group opacity and the draw rect after that comes
|
||||||
// with its own compatible blend mode.
|
// with its own compatible blend mode.
|
||||||
builder.DrawRect({0, 0, 0, 0}, DlPaint().setBlendMode(DlBlendMode::kSrc));
|
builder.DrawRect(SkRect{0, 0, 0, 0},
|
||||||
|
DlPaint().setBlendMode(DlBlendMode::kSrc));
|
||||||
builder.SaveLayer(nullptr, nullptr);
|
builder.SaveLayer(nullptr, nullptr);
|
||||||
builder.DrawRect({0, 0, 10, 10}, DlPaint());
|
builder.DrawRect(SkRect{0, 0, 10, 10}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
EXPECT_TRUE(display_list->can_apply_group_opacity());
|
EXPECT_TRUE(display_list->can_apply_group_opacity());
|
||||||
@ -1359,7 +1364,7 @@ TEST_F(DisplayListTest, SaveLayerTrueWithSrcBlendDoesNotSupportGroupOpacity) {
|
|||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
save_paint.setBlendMode(DlBlendMode::kSrc);
|
save_paint.setBlendMode(DlBlendMode::kSrc);
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({0, 0, 10, 10}, DlPaint());
|
builder.DrawRect(SkRect{0, 0, 10, 10}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
EXPECT_FALSE(display_list->can_apply_group_opacity());
|
EXPECT_FALSE(display_list->can_apply_group_opacity());
|
||||||
@ -1368,7 +1373,8 @@ TEST_F(DisplayListTest, SaveLayerTrueWithSrcBlendDoesNotSupportGroupOpacity) {
|
|||||||
TEST_F(DisplayListTest, SaveLayerFalseSupportsGroupOpacityWithChildSrcBlend) {
|
TEST_F(DisplayListTest, SaveLayerFalseSupportsGroupOpacityWithChildSrcBlend) {
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.SaveLayer(nullptr, nullptr);
|
builder.SaveLayer(nullptr, nullptr);
|
||||||
builder.DrawRect({0, 0, 10, 10}, DlPaint().setBlendMode(DlBlendMode::kSrc));
|
builder.DrawRect(SkRect{0, 0, 10, 10},
|
||||||
|
DlPaint().setBlendMode(DlBlendMode::kSrc));
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
EXPECT_TRUE(display_list->can_apply_group_opacity());
|
EXPECT_TRUE(display_list->can_apply_group_opacity());
|
||||||
@ -1378,7 +1384,8 @@ TEST_F(DisplayListTest, SaveLayerTrueSupportsGroupOpacityWithChildSrcBlend) {
|
|||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({0, 0, 10, 10}, DlPaint().setBlendMode(DlBlendMode::kSrc));
|
builder.DrawRect(SkRect{0, 0, 10, 10},
|
||||||
|
DlPaint().setBlendMode(DlBlendMode::kSrc));
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
EXPECT_TRUE(display_list->can_apply_group_opacity());
|
EXPECT_TRUE(display_list->can_apply_group_opacity());
|
||||||
@ -1388,12 +1395,12 @@ TEST_F(DisplayListTest, SaveLayerBoundsSnapshotsImageFilter) {
|
|||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({50, 50, 100, 100}, DlPaint());
|
builder.DrawRect(SkRect{50, 50, 100, 100}, DlPaint());
|
||||||
// This image filter should be ignored since it was not set before saveLayer
|
// This image filter should be ignored since it was not set before saveLayer
|
||||||
// And the rect drawn with it will not contribute any more area to the bounds
|
// And the rect drawn with it will not contribute any more area to the bounds
|
||||||
DlPaint draw_paint;
|
DlPaint draw_paint;
|
||||||
draw_paint.setImageFilter(&kTestBlurImageFilter1);
|
draw_paint.setImageFilter(&kTestBlurImageFilter1);
|
||||||
builder.DrawRect({70, 70, 80, 80}, draw_paint);
|
builder.DrawRect(SkRect{70, 70, 80, 80}, draw_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
SkRect bounds = builder.Build()->bounds();
|
SkRect bounds = builder.Build()->bounds();
|
||||||
EXPECT_EQ(bounds, SkRect::MakeLTRB(50, 50, 100, 100));
|
EXPECT_EQ(bounds, SkRect::MakeLTRB(50, 50, 100, 100));
|
||||||
@ -1533,7 +1540,7 @@ TEST_F(DisplayListTest, SaveLayerOneSimpleOpInheritsOpacity) {
|
|||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1547,7 +1554,7 @@ TEST_F(DisplayListTest, SaveLayerNoAttributesInheritsOpacity) {
|
|||||||
|
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.SaveLayer(nullptr, nullptr);
|
builder.SaveLayer(nullptr, nullptr);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1562,8 +1569,8 @@ TEST_F(DisplayListTest, SaveLayerTwoOverlappingOpsDoesNotInheritOpacity) {
|
|||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.DrawRect({15, 15, 25, 25}, DlPaint());
|
builder.DrawRect(SkRect{15, 15, 25, 25}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1584,9 +1591,9 @@ TEST_F(DisplayListTest, NestedSaveLayersMightInheritOpacity) {
|
|||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({15, 15, 25, 25}, DlPaint());
|
builder.DrawRect(SkRect{15, 15, 25, 25}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
@ -1608,7 +1615,7 @@ TEST_F(DisplayListTest, NestedSaveLayersCanBothSupportOpacityOptimization) {
|
|||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.SaveLayer(nullptr, nullptr);
|
builder.SaveLayer(nullptr, nullptr);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
@ -1625,7 +1632,7 @@ TEST_F(DisplayListTest, SaveLayerImageFilterDoesNotInheritOpacity) {
|
|||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
save_paint.setImageFilter(&kTestBlurImageFilter1);
|
save_paint.setImageFilter(&kTestBlurImageFilter1);
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1641,7 +1648,7 @@ TEST_F(DisplayListTest, SaveLayerColorFilterDoesNotInheritOpacity) {
|
|||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
save_paint.setColorFilter(&kTestMatrixColorFilter1);
|
save_paint.setColorFilter(&kTestMatrixColorFilter1);
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1657,7 +1664,7 @@ TEST_F(DisplayListTest, SaveLayerSrcBlendDoesNotInheritOpacity) {
|
|||||||
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
save_paint.setColor(DlColor(SkColorSetARGB(127, 255, 255, 255)));
|
||||||
save_paint.setBlendMode(DlBlendMode::kSrc);
|
save_paint.setBlendMode(DlBlendMode::kSrc);
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1675,7 +1682,7 @@ TEST_F(DisplayListTest, SaveLayerImageFilterOnChildInheritsOpacity) {
|
|||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
DlPaint draw_paint = save_paint;
|
DlPaint draw_paint = save_paint;
|
||||||
draw_paint.setImageFilter(&kTestBlurImageFilter1);
|
draw_paint.setImageFilter(&kTestBlurImageFilter1);
|
||||||
builder.DrawRect({10, 10, 20, 20}, draw_paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, draw_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1692,7 +1699,7 @@ TEST_F(DisplayListTest, SaveLayerColorFilterOnChildDoesNotInheritOpacity) {
|
|||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
DlPaint draw_paint = save_paint;
|
DlPaint draw_paint = save_paint;
|
||||||
draw_paint.setColorFilter(&kTestMatrixColorFilter1);
|
draw_paint.setColorFilter(&kTestMatrixColorFilter1);
|
||||||
builder.DrawRect({10, 10, 20, 20}, draw_paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, draw_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1709,7 +1716,7 @@ TEST_F(DisplayListTest, SaveLayerSrcBlendOnChildDoesNotInheritOpacity) {
|
|||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
DlPaint draw_paint = save_paint;
|
DlPaint draw_paint = save_paint;
|
||||||
draw_paint.setBlendMode(DlBlendMode::kSrc);
|
draw_paint.setBlendMode(DlBlendMode::kSrc);
|
||||||
builder.DrawRect({10, 10, 20, 20}, draw_paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, draw_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Build()->Dispatch(expector);
|
builder.Build()->Dispatch(expector);
|
||||||
@ -1790,14 +1797,15 @@ TEST_F(DisplayListTest, FlutterSvgIssue661BoundsWereEmpty) {
|
|||||||
DlPaint paint = DlPaint(DlColor::kWhite()).setAntiAlias(true);
|
DlPaint paint = DlPaint(DlColor::kWhite()).setAntiAlias(true);
|
||||||
{
|
{
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 100, 100}, ClipOp::kIntersect, true);
|
builder.ClipRect(SkRect{0, 0, 100, 100}, ClipOp::kIntersect, true);
|
||||||
{
|
{
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.Transform2DAffine(2.17391, 0, -2547.83, //
|
builder.Transform2DAffine(2.17391, 0, -2547.83, //
|
||||||
0, 2.04082, -500);
|
0, 2.04082, -500);
|
||||||
{
|
{
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({1172, 245, 1218, 294}, ClipOp::kIntersect, true);
|
builder.ClipRect(SkRect{1172, 245, 1218, 294}, ClipOp::kIntersect,
|
||||||
|
true);
|
||||||
{
|
{
|
||||||
builder.SaveLayer(nullptr, nullptr, nullptr);
|
builder.SaveLayer(nullptr, nullptr, nullptr);
|
||||||
{
|
{
|
||||||
@ -1974,7 +1982,7 @@ TEST_F(DisplayListTest, ClipRectAffectsClipBounds) {
|
|||||||
ASSERT_EQ(initial_destination_bounds, clip_bounds);
|
ASSERT_EQ(initial_destination_bounds, clip_bounds);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 15, 15}, ClipOp::kIntersect, false);
|
builder.ClipRect(SkRect{0, 0, 15, 15}, ClipOp::kIntersect, false);
|
||||||
// Both clip bounds have changed
|
// Both clip bounds have changed
|
||||||
ASSERT_NE(builder.GetLocalClipBounds(), clip_bounds);
|
ASSERT_NE(builder.GetLocalClipBounds(), clip_bounds);
|
||||||
ASSERT_NE(builder.GetDestinationClipBounds(), clip_bounds);
|
ASSERT_NE(builder.GetDestinationClipBounds(), clip_bounds);
|
||||||
@ -2013,7 +2021,7 @@ TEST_F(DisplayListTest, ClipRectDoAAAffectsClipBounds) {
|
|||||||
ASSERT_EQ(initial_destination_bounds, clip_expanded_bounds);
|
ASSERT_EQ(initial_destination_bounds, clip_expanded_bounds);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 15, 15}, ClipOp::kIntersect, true);
|
builder.ClipRect(SkRect{0, 0, 15, 15}, ClipOp::kIntersect, true);
|
||||||
// Both clip bounds have changed
|
// Both clip bounds have changed
|
||||||
ASSERT_NE(builder.GetLocalClipBounds(), clip_expanded_bounds);
|
ASSERT_NE(builder.GetLocalClipBounds(), clip_expanded_bounds);
|
||||||
ASSERT_NE(builder.GetDestinationClipBounds(), clip_expanded_bounds);
|
ASSERT_NE(builder.GetDestinationClipBounds(), clip_expanded_bounds);
|
||||||
@ -2071,7 +2079,7 @@ TEST_F(DisplayListTest, ClipRRectAffectsClipBounds) {
|
|||||||
ASSERT_EQ(initial_destination_bounds, clip_bounds);
|
ASSERT_EQ(initial_destination_bounds, clip_bounds);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 15, 15}, ClipOp::kIntersect, false);
|
builder.ClipRect(SkRect{0, 0, 15, 15}, ClipOp::kIntersect, false);
|
||||||
// Both clip bounds have changed
|
// Both clip bounds have changed
|
||||||
ASSERT_NE(builder.GetLocalClipBounds(), clip_bounds);
|
ASSERT_NE(builder.GetLocalClipBounds(), clip_bounds);
|
||||||
ASSERT_NE(builder.GetDestinationClipBounds(), clip_bounds);
|
ASSERT_NE(builder.GetDestinationClipBounds(), clip_bounds);
|
||||||
@ -2111,7 +2119,7 @@ TEST_F(DisplayListTest, ClipRRectDoAAAffectsClipBounds) {
|
|||||||
ASSERT_EQ(initial_destination_bounds, clip_expanded_bounds);
|
ASSERT_EQ(initial_destination_bounds, clip_expanded_bounds);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 15, 15}, ClipOp::kIntersect, true);
|
builder.ClipRect(SkRect{0, 0, 15, 15}, ClipOp::kIntersect, true);
|
||||||
// Both clip bounds have changed
|
// Both clip bounds have changed
|
||||||
ASSERT_NE(builder.GetLocalClipBounds(), clip_expanded_bounds);
|
ASSERT_NE(builder.GetLocalClipBounds(), clip_expanded_bounds);
|
||||||
ASSERT_NE(builder.GetDestinationClipBounds(), clip_expanded_bounds);
|
ASSERT_NE(builder.GetDestinationClipBounds(), clip_expanded_bounds);
|
||||||
@ -2172,7 +2180,7 @@ TEST_F(DisplayListTest, ClipPathAffectsClipBounds) {
|
|||||||
ASSERT_EQ(initial_destination_bounds, clip_bounds);
|
ASSERT_EQ(initial_destination_bounds, clip_bounds);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 15, 15}, ClipOp::kIntersect, false);
|
builder.ClipRect(SkRect{0, 0, 15, 15}, ClipOp::kIntersect, false);
|
||||||
// Both clip bounds have changed
|
// Both clip bounds have changed
|
||||||
ASSERT_NE(builder.GetLocalClipBounds(), clip_bounds);
|
ASSERT_NE(builder.GetLocalClipBounds(), clip_bounds);
|
||||||
ASSERT_NE(builder.GetDestinationClipBounds(), clip_bounds);
|
ASSERT_NE(builder.GetDestinationClipBounds(), clip_bounds);
|
||||||
@ -2211,7 +2219,7 @@ TEST_F(DisplayListTest, ClipPathDoAAAffectsClipBounds) {
|
|||||||
ASSERT_EQ(initial_destination_bounds, clip_expanded_bounds);
|
ASSERT_EQ(initial_destination_bounds, clip_expanded_bounds);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 15, 15}, ClipOp::kIntersect, true);
|
builder.ClipRect(SkRect{0, 0, 15, 15}, ClipOp::kIntersect, true);
|
||||||
// Both clip bounds have changed
|
// Both clip bounds have changed
|
||||||
ASSERT_NE(builder.GetLocalClipBounds(), clip_expanded_bounds);
|
ASSERT_NE(builder.GetLocalClipBounds(), clip_expanded_bounds);
|
||||||
ASSERT_NE(builder.GetDestinationClipBounds(), clip_expanded_bounds);
|
ASSERT_NE(builder.GetDestinationClipBounds(), clip_expanded_bounds);
|
||||||
@ -2443,9 +2451,9 @@ TEST_F(DisplayListTest, RTreeOfSimpleScene) {
|
|||||||
|
|
||||||
TEST_F(DisplayListTest, RTreeOfSaveRestoreScene) {
|
TEST_F(DisplayListTest, RTreeOfSaveRestoreScene) {
|
||||||
DisplayListBuilder builder(/*prepare_rtree=*/true);
|
DisplayListBuilder builder(/*prepare_rtree=*/true);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.DrawRect({50, 50, 60, 60}, DlPaint());
|
builder.DrawRect(SkRect{50, 50, 60, 60}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
auto rtree = display_list->rtree();
|
auto rtree = display_list->rtree();
|
||||||
@ -2477,11 +2485,11 @@ TEST_F(DisplayListTest, RTreeOfSaveLayerFilterScene) {
|
|||||||
auto filter = DlBlurImageFilter(1.0, 1.0, DlTileMode::kClamp);
|
auto filter = DlBlurImageFilter(1.0, 1.0, DlTileMode::kClamp);
|
||||||
DlPaint default_paint = DlPaint();
|
DlPaint default_paint = DlPaint();
|
||||||
DlPaint filter_paint = DlPaint().setImageFilter(&filter);
|
DlPaint filter_paint = DlPaint().setImageFilter(&filter);
|
||||||
builder.DrawRect({10, 10, 20, 20}, default_paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, default_paint);
|
||||||
builder.SaveLayer(nullptr, &filter_paint);
|
builder.SaveLayer(nullptr, &filter_paint);
|
||||||
// the following rectangle will be expanded to 50,50,60,60
|
// the following rectangle will be expanded to 50,50,60,60
|
||||||
// by the saveLayer filter during the restore operation
|
// by the saveLayer filter during the restore operation
|
||||||
builder.DrawRect({53, 53, 57, 57}, default_paint);
|
builder.DrawRect(SkRect{53, 53, 57, 57}, default_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
auto rtree = display_list->rtree();
|
auto rtree = display_list->rtree();
|
||||||
@ -2509,8 +2517,8 @@ TEST_F(DisplayListTest, RTreeOfSaveLayerFilterScene) {
|
|||||||
|
|
||||||
TEST_F(DisplayListTest, NestedDisplayListRTreesAreSparse) {
|
TEST_F(DisplayListTest, NestedDisplayListRTreesAreSparse) {
|
||||||
DisplayListBuilder nested_dl_builder(/**prepare_rtree=*/true);
|
DisplayListBuilder nested_dl_builder(/**prepare_rtree=*/true);
|
||||||
nested_dl_builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
nested_dl_builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
nested_dl_builder.DrawRect({50, 50, 60, 60}, DlPaint());
|
nested_dl_builder.DrawRect(SkRect{50, 50, 60, 60}, DlPaint());
|
||||||
auto nested_display_list = nested_dl_builder.Build();
|
auto nested_display_list = nested_dl_builder.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder(/**prepare_rtree=*/true);
|
DisplayListBuilder builder(/**prepare_rtree=*/true);
|
||||||
@ -2531,38 +2539,38 @@ TEST_F(DisplayListTest, NestedDisplayListRTreesAreSparse) {
|
|||||||
TEST_F(DisplayListTest, RemoveUnnecessarySaveRestorePairs) {
|
TEST_F(DisplayListTest, RemoveUnnecessarySaveRestorePairs) {
|
||||||
{
|
{
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Save(); // This save op is unnecessary
|
builder.Save(); // This save op is unnecessary
|
||||||
builder.DrawRect({50, 50, 60, 60}, DlPaint());
|
builder.DrawRect(SkRect{50, 50, 60, 60}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder2.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder2.DrawRect({50, 50, 60, 60}, DlPaint());
|
builder2.DrawRect(SkRect{50, 50, 60, 60}, DlPaint());
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(builder.Build(), builder2.Build()));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(builder.Build(), builder2.Build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Save();
|
builder.Save();
|
||||||
{
|
{
|
||||||
builder.Translate(1.0, 1.0);
|
builder.Translate(1.0, 1.0);
|
||||||
builder.Save();
|
builder.Save();
|
||||||
{ //
|
{ //
|
||||||
builder.DrawRect({50, 50, 60, 60}, DlPaint());
|
builder.DrawRect(SkRect{50, 50, 60, 60}, DlPaint());
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder2.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder2.Save();
|
builder2.Save();
|
||||||
{ //
|
{ //
|
||||||
builder2.Translate(1.0, 1.0);
|
builder2.Translate(1.0, 1.0);
|
||||||
{ //
|
{ //
|
||||||
builder2.DrawRect({50, 50, 60, 60}, DlPaint());
|
builder2.DrawRect(SkRect{50, 50, 60, 60}, DlPaint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
@ -2580,8 +2588,8 @@ TEST_F(DisplayListTest, CollapseMultipleNestedSaveRestore) {
|
|||||||
{
|
{
|
||||||
builder1.Translate(10, 10);
|
builder1.Translate(10, 10);
|
||||||
builder1.Scale(2, 2);
|
builder1.Scale(2, 2);
|
||||||
builder1.ClipRect({10, 10, 20, 20}, ClipOp::kIntersect, false);
|
builder1.ClipRect(SkRect{10, 10, 20, 20}, ClipOp::kIntersect, false);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2595,8 +2603,8 @@ TEST_F(DisplayListTest, CollapseMultipleNestedSaveRestore) {
|
|||||||
{
|
{
|
||||||
builder2.Translate(10, 10);
|
builder2.Translate(10, 10);
|
||||||
builder2.Scale(2, 2);
|
builder2.Scale(2, 2);
|
||||||
builder2.ClipRect({10, 10, 20, 20}, ClipOp::kIntersect, false);
|
builder2.ClipRect(SkRect{10, 10, 20, 20}, ClipOp::kIntersect, false);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2610,7 +2618,7 @@ TEST_F(DisplayListTest, CollapseNestedSaveAndSaveLayerRestore) {
|
|||||||
{
|
{
|
||||||
builder1.SaveLayer(nullptr, nullptr);
|
builder1.SaveLayer(nullptr, nullptr);
|
||||||
{
|
{
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder1.Scale(2, 2);
|
builder1.Scale(2, 2);
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
@ -2621,7 +2629,7 @@ TEST_F(DisplayListTest, CollapseNestedSaveAndSaveLayerRestore) {
|
|||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.SaveLayer(nullptr, nullptr);
|
builder2.SaveLayer(nullptr, nullptr);
|
||||||
{
|
{
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.Scale(2, 2);
|
builder2.Scale(2, 2);
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
@ -2695,14 +2703,14 @@ TEST_F(DisplayListTest, TransformTriggersDeferredSave) {
|
|||||||
0, 1, 0, 100, //
|
0, 1, 0, 100, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.TransformFullPerspective(1, 0, 0, 10, //
|
builder1.TransformFullPerspective(1, 0, 0, 10, //
|
||||||
0, 1, 0, 100, //
|
0, 1, 0, 100, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
@ -2714,7 +2722,7 @@ TEST_F(DisplayListTest, TransformTriggersDeferredSave) {
|
|||||||
0, 1, 0, 100, //
|
0, 1, 0, 100, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
builder2.Save();
|
builder2.Save();
|
||||||
@ -2723,7 +2731,7 @@ TEST_F(DisplayListTest, TransformTriggersDeferredSave) {
|
|||||||
0, 1, 0, 100, //
|
0, 1, 0, 100, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2738,7 +2746,7 @@ TEST_F(DisplayListTest, Transform2DTriggersDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Transform2DAffine(0, 1, 12, 1, 0, 33);
|
builder1.Transform2DAffine(0, 1, 12, 1, 0, 33);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2749,7 +2757,7 @@ TEST_F(DisplayListTest, Transform2DTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.Transform2DAffine(0, 1, 12, 1, 0, 33);
|
builder2.Transform2DAffine(0, 1, 12, 1, 0, 33);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2767,7 +2775,7 @@ TEST_F(DisplayListTest, TransformPerspectiveTriggersDeferredSave) {
|
|||||||
1, 0, 0, 33, //
|
1, 0, 0, 33, //
|
||||||
3, 2, 5, 29, //
|
3, 2, 5, 29, //
|
||||||
0, 0, 0, 12);
|
0, 0, 0, 12);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2781,7 +2789,7 @@ TEST_F(DisplayListTest, TransformPerspectiveTriggersDeferredSave) {
|
|||||||
1, 0, 0, 33, //
|
1, 0, 0, 33, //
|
||||||
3, 2, 5, 29, //
|
3, 2, 5, 29, //
|
||||||
0, 0, 0, 12);
|
0, 0, 0, 12);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2796,7 +2804,7 @@ TEST_F(DisplayListTest, ResetTransformTriggersDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.TransformReset();
|
builder1.TransformReset();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2807,7 +2815,7 @@ TEST_F(DisplayListTest, ResetTransformTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.TransformReset();
|
builder2.TransformReset();
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2822,7 +2830,7 @@ TEST_F(DisplayListTest, SkewTriggersDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Skew(10, 10);
|
builder1.Skew(10, 10);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2833,7 +2841,7 @@ TEST_F(DisplayListTest, SkewTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.Skew(10, 10);
|
builder2.Skew(10, 10);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2848,7 +2856,7 @@ TEST_F(DisplayListTest, TranslateTriggersDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Translate(10, 10);
|
builder1.Translate(10, 10);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2859,7 +2867,7 @@ TEST_F(DisplayListTest, TranslateTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.Translate(10, 10);
|
builder2.Translate(10, 10);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2874,7 +2882,7 @@ TEST_F(DisplayListTest, ScaleTriggersDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Scale(0.5, 0.5);
|
builder1.Scale(0.5, 0.5);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
}
|
}
|
||||||
@ -2885,7 +2893,7 @@ TEST_F(DisplayListTest, ScaleTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.Scale(0.5, 0.5);
|
builder2.Scale(0.5, 0.5);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
@ -2901,14 +2909,14 @@ TEST_F(DisplayListTest, ClipRectTriggersDeferredSave) {
|
|||||||
{
|
{
|
||||||
builder1.ClipRect(SkRect::MakeLTRB(0, 0, 100, 100), ClipOp::kIntersect,
|
builder1.ClipRect(SkRect::MakeLTRB(0, 0, 100, 100), ClipOp::kIntersect,
|
||||||
true);
|
true);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
@ -2918,14 +2926,14 @@ TEST_F(DisplayListTest, ClipRectTriggersDeferredSave) {
|
|||||||
{
|
{
|
||||||
builder2.ClipRect(SkRect::MakeLTRB(0, 0, 100, 100), ClipOp::kIntersect,
|
builder2.ClipRect(SkRect::MakeLTRB(0, 0, 100, 100), ClipOp::kIntersect,
|
||||||
true);
|
true);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
builder2.TransformFullPerspective(1, 0, 0, 0, //
|
builder2.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -2939,14 +2947,14 @@ TEST_F(DisplayListTest, ClipRRectTriggersDeferredSave) {
|
|||||||
{
|
{
|
||||||
builder1.ClipRRect(kTestRRect, ClipOp::kIntersect, true);
|
builder1.ClipRRect(kTestRRect, ClipOp::kIntersect, true);
|
||||||
|
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
@ -2955,13 +2963,13 @@ TEST_F(DisplayListTest, ClipRRectTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
builder2.ClipRRect(kTestRRect, ClipOp::kIntersect, true);
|
builder2.ClipRRect(kTestRRect, ClipOp::kIntersect, true);
|
||||||
|
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
builder2.TransformFullPerspective(1, 0, 0, 0, //
|
builder2.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -2974,14 +2982,14 @@ TEST_F(DisplayListTest, ClipPathTriggersDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.ClipPath(kTestPath1, ClipOp::kIntersect, true);
|
builder1.ClipPath(kTestPath1, ClipOp::kIntersect, true);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
@ -2990,14 +2998,14 @@ TEST_F(DisplayListTest, ClipPathTriggersDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.ClipPath(kTestPath1, ClipOp::kIntersect, true);
|
builder2.ClipPath(kTestPath1, ClipOp::kIntersect, true);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
builder2.TransformFullPerspective(1, 0, 0, 0, //
|
builder2.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3010,17 +3018,17 @@ TEST_F(DisplayListTest, NOPTranslateDoesNotTriggerDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Translate(0, 0);
|
builder1.Translate(0, 0);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3033,17 +3041,17 @@ TEST_F(DisplayListTest, NOPScaleDoesNotTriggerDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Scale(1.0, 1.0);
|
builder1.Scale(1.0, 1.0);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3056,17 +3064,17 @@ TEST_F(DisplayListTest, NOPRotationDoesNotTriggerDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Rotate(360);
|
builder1.Rotate(360);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3079,17 +3087,17 @@ TEST_F(DisplayListTest, NOPSkewDoesNotTriggerDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Skew(0, 0);
|
builder1.Skew(0, 0);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3105,21 +3113,21 @@ TEST_F(DisplayListTest, NOPTransformDoesNotTriggerDeferredSave) {
|
|||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
builder1.TransformFullPerspective(1, 0, 0, 0, //
|
||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3132,17 +3140,17 @@ TEST_F(DisplayListTest, NOPTransform2DDoesNotTriggerDeferredSave) {
|
|||||||
builder1.Save();
|
builder1.Save();
|
||||||
{
|
{
|
||||||
builder1.Transform2DAffine(1, 0, 0, 0, 1, 0);
|
builder1.Transform2DAffine(1, 0, 0, 0, 1, 0);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3159,17 +3167,17 @@ TEST_F(DisplayListTest, NOPTransformFullPerspectiveDoesNotTriggerDeferredSave) {
|
|||||||
0, 1, 0, 0, //
|
0, 1, 0, 0, //
|
||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3186,10 +3194,10 @@ TEST_F(DisplayListTest, NOPTransformFullPerspectiveDoesNotTriggerDeferredSave) {
|
|||||||
0, 0, 1, 0, //
|
0, 0, 1, 0, //
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
builder1.TransformReset();
|
builder1.TransformReset();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
@ -3198,10 +3206,10 @@ TEST_F(DisplayListTest, NOPTransformFullPerspectiveDoesNotTriggerDeferredSave) {
|
|||||||
builder2.Save();
|
builder2.Save();
|
||||||
{
|
{
|
||||||
builder2.TransformReset();
|
builder2.TransformReset();
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder2.Restore();
|
builder2.Restore();
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3216,17 +3224,17 @@ TEST_F(DisplayListTest, NOPClipDoesNotTriggerDeferredSave) {
|
|||||||
{
|
{
|
||||||
builder1.ClipRect(SkRect::MakeLTRB(0, SK_ScalarNaN, SK_ScalarNaN, 0),
|
builder1.ClipRect(SkRect::MakeLTRB(0, SK_ScalarNaN, SK_ScalarNaN, 0),
|
||||||
ClipOp::kIntersect, true);
|
ClipOp::kIntersect, true);
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
builder1.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder1.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
}
|
}
|
||||||
builder1.Restore();
|
builder1.Restore();
|
||||||
auto display_list1 = builder1.Build();
|
auto display_list1 = builder1.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder2;
|
DisplayListBuilder builder2;
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder2.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder2.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
auto display_list2 = builder2.Build();
|
auto display_list2 = builder2.Build();
|
||||||
|
|
||||||
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
ASSERT_TRUE(DisplayListsEQ_Verbose(display_list1, display_list2));
|
||||||
@ -3238,13 +3246,13 @@ TEST_F(DisplayListTest, RTreeOfClippedSaveLayerFilterScene) {
|
|||||||
auto filter = DlBlurImageFilter(10.0, 10.0, DlTileMode::kClamp);
|
auto filter = DlBlurImageFilter(10.0, 10.0, DlTileMode::kClamp);
|
||||||
DlPaint default_paint = DlPaint();
|
DlPaint default_paint = DlPaint();
|
||||||
DlPaint filter_paint = DlPaint().setImageFilter(&filter);
|
DlPaint filter_paint = DlPaint().setImageFilter(&filter);
|
||||||
builder.DrawRect({10, 10, 20, 20}, default_paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, default_paint);
|
||||||
builder.ClipRect({50, 50, 60, 60}, ClipOp::kIntersect, false);
|
builder.ClipRect(SkRect{50, 50, 60, 60}, ClipOp::kIntersect, false);
|
||||||
builder.SaveLayer(nullptr, &filter_paint);
|
builder.SaveLayer(nullptr, &filter_paint);
|
||||||
// the following rectangle will be expanded to 23,23,87,87
|
// the following rectangle will be expanded to 23,23,87,87
|
||||||
// by the saveLayer filter during the restore operation
|
// by the saveLayer filter during the restore operation
|
||||||
// but it will then be clipped to 50,50,60,60
|
// but it will then be clipped to 50,50,60,60
|
||||||
builder.DrawRect({53, 53, 57, 57}, default_paint);
|
builder.DrawRect(SkRect{53, 53, 57, 57}, default_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
auto rtree = display_list->rtree();
|
auto rtree = display_list->rtree();
|
||||||
@ -3393,10 +3401,10 @@ TEST_F(DisplayListTest, RTreeRenderCulling) {
|
|||||||
|
|
||||||
TEST_F(DisplayListTest, DrawSaveDrawCannotInheritOpacity) {
|
TEST_F(DisplayListTest, DrawSaveDrawCannotInheritOpacity) {
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawCircle({10, 10}, 5, DlPaint());
|
builder.DrawCircle(SkPoint{10, 10}, 5, DlPaint());
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect({0, 0, 20, 20}, DlCanvas::ClipOp::kIntersect, false);
|
builder.ClipRect(SkRect{0, 0, 20, 20}, DlCanvas::ClipOp::kIntersect, false);
|
||||||
builder.DrawRect({5, 5, 15, 15}, DlPaint());
|
builder.DrawRect(SkRect{5, 5, 15, 15}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
|
|
||||||
@ -3493,31 +3501,31 @@ TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
|
|||||||
run_one_test(
|
run_one_test(
|
||||||
name + " DrawRect",
|
name + " DrawRect",
|
||||||
[](DisplayListBuilder& builder, DlPaint& paint) {
|
[](DisplayListBuilder& builder, DlPaint& paint) {
|
||||||
builder.DrawRect({10, 10, 20, 20}, paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, paint);
|
||||||
},
|
},
|
||||||
expected_op_count, expected_total_depth);
|
expected_op_count, expected_total_depth);
|
||||||
run_one_test(
|
run_one_test(
|
||||||
name + " Other Draw Ops",
|
name + " Other Draw Ops",
|
||||||
[](DisplayListBuilder& builder, DlPaint& paint) {
|
[](DisplayListBuilder& builder, DlPaint& paint) {
|
||||||
builder.DrawLine({10, 10}, {20, 20}, paint);
|
builder.DrawLine(SkPoint{10, 10}, SkPoint{20, 20}, paint);
|
||||||
builder.DrawOval({10, 10, 20, 20}, paint);
|
builder.DrawOval(SkRect{10, 10, 20, 20}, paint);
|
||||||
builder.DrawCircle({50, 50}, 20, paint);
|
builder.DrawCircle(SkPoint{50, 50}, 20, paint);
|
||||||
builder.DrawRRect(SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5), paint);
|
builder.DrawRRect(SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5), paint);
|
||||||
builder.DrawDRRect(SkRRect::MakeRectXY({5, 5, 100, 100}, 5, 5),
|
builder.DrawDRRect(SkRRect::MakeRectXY({5, 5, 100, 100}, 5, 5),
|
||||||
SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5),
|
SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5),
|
||||||
paint);
|
paint);
|
||||||
builder.DrawPath(kTestPath1, paint);
|
builder.DrawPath(kTestPath1, paint);
|
||||||
builder.DrawArc({10, 10, 20, 20}, 45, 90, true, paint);
|
builder.DrawArc(SkRect{10, 10, 20, 20}, 45, 90, true, paint);
|
||||||
SkPoint pts[] = {{10, 10}, {20, 20}};
|
SkPoint pts[] = {{10, 10}, {20, 20}};
|
||||||
builder.DrawPoints(PointMode::kLines, 2, pts, paint);
|
builder.DrawPoints(PointMode::kLines, 2, pts, paint);
|
||||||
builder.DrawVertices(kTestVertices1, DlBlendMode::kSrcOver, paint);
|
builder.DrawVertices(kTestVertices1, DlBlendMode::kSrcOver, paint);
|
||||||
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear,
|
builder.DrawImage(TestImage1, SkPoint{10, 10},
|
||||||
&paint);
|
DlImageSampling::kLinear, &paint);
|
||||||
builder.DrawImageRect(TestImage1, SkRect{0.0f, 0.0f, 10.0f, 10.0f},
|
builder.DrawImageRect(TestImage1, SkRect{0.0f, 0.0f, 10.0f, 10.0f},
|
||||||
SkRect{10.0f, 10.0f, 25.0f, 25.0f},
|
SkRect{10.0f, 10.0f, 25.0f, 25.0f},
|
||||||
DlImageSampling::kLinear, &paint);
|
DlImageSampling::kLinear, &paint);
|
||||||
builder.DrawImageNine(TestImage1, {10, 10, 20, 20},
|
builder.DrawImageNine(TestImage1, SkIRect{10, 10, 20, 20},
|
||||||
{10, 10, 100, 100}, DlFilterMode::kLinear,
|
SkRect{10, 10, 100, 100}, DlFilterMode::kLinear,
|
||||||
&paint);
|
&paint);
|
||||||
SkRSXform xforms[] = {{1, 0, 10, 10}, {0, 1, 10, 10}};
|
SkRSXform xforms[] = {{1, 0, 10, 10}, {0, 1, 10, 10}};
|
||||||
SkRect rects[] = {{10, 10, 20, 20}, {10, 20, 30, 20}};
|
SkRect rects[] = {{10, 10, 20, 20}, {10, 20, 30, 20}};
|
||||||
@ -3538,7 +3546,7 @@ TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
|
|||||||
name + " SaveLayer",
|
name + " SaveLayer",
|
||||||
[](DisplayListBuilder& builder, DlPaint& paint) {
|
[](DisplayListBuilder& builder, DlPaint& paint) {
|
||||||
builder.SaveLayer(nullptr, &paint, nullptr);
|
builder.SaveLayer(nullptr, &paint, nullptr);
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
},
|
},
|
||||||
expected_op_count, expected_total_depth);
|
expected_op_count, expected_total_depth);
|
||||||
@ -3546,7 +3554,7 @@ TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
|
|||||||
name + " inside Save",
|
name + " inside Save",
|
||||||
[](DisplayListBuilder& builder, DlPaint& paint) {
|
[](DisplayListBuilder& builder, DlPaint& paint) {
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.DrawRect({10, 10, 20, 20}, paint);
|
builder.DrawRect(SkRect{10, 10, 20, 20}, paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
},
|
},
|
||||||
expected_op_count, expected_total_depth);
|
expected_op_count, expected_total_depth);
|
||||||
@ -3614,7 +3622,8 @@ TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
|
|||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
save_paint.setColor(DlColor::kTransparent());
|
save_paint.setColor(DlColor::kTransparent());
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear);
|
builder.DrawImage(TestImage1, SkPoint{10, 10},
|
||||||
|
DlImageSampling::kLinear);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4150,33 +4159,33 @@ class DepthExpector : public virtual DlOpReceiver,
|
|||||||
|
|
||||||
TEST_F(DisplayListTest, SaveContentDepthTest) {
|
TEST_F(DisplayListTest, SaveContentDepthTest) {
|
||||||
DisplayListBuilder child_builder;
|
DisplayListBuilder child_builder;
|
||||||
child_builder.DrawRect({10, 10, 20, 20}, DlPaint()); // depth 1
|
child_builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint()); // depth 1
|
||||||
auto child = child_builder.Build();
|
auto child = child_builder.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint()); // depth 1
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint()); // depth 1
|
||||||
|
|
||||||
builder.Save(); // covers depth 1->9
|
builder.Save(); // covers depth 1->9
|
||||||
{
|
{
|
||||||
builder.Translate(5, 5); // triggers deferred save at depth 1
|
builder.Translate(5, 5); // triggers deferred save at depth 1
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint()); // depth 2
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint()); // depth 2
|
||||||
|
|
||||||
builder.DrawDisplayList(child, 1.0f); // depth 3 (content) + 4 (self)
|
builder.DrawDisplayList(child, 1.0f); // depth 3 (content) + 4 (self)
|
||||||
|
|
||||||
builder.SaveLayer(nullptr, nullptr); // covers depth 5->6
|
builder.SaveLayer(nullptr, nullptr); // covers depth 5->6
|
||||||
{
|
{
|
||||||
builder.DrawRect({12, 12, 22, 22}, DlPaint()); // depth 5
|
builder.DrawRect(SkRect{12, 12, 22, 22}, DlPaint()); // depth 5
|
||||||
builder.DrawRect({14, 14, 24, 24}, DlPaint()); // depth 6
|
builder.DrawRect(SkRect{14, 14, 24, 24}, DlPaint()); // depth 6
|
||||||
}
|
}
|
||||||
builder.Restore(); // layer is restored with depth 6
|
builder.Restore(); // layer is restored with depth 6
|
||||||
|
|
||||||
builder.DrawRect({16, 16, 26, 26}, DlPaint()); // depth 8
|
builder.DrawRect(SkRect{16, 16, 26, 26}, DlPaint()); // depth 8
|
||||||
builder.DrawRect({18, 18, 28, 28}, DlPaint()); // depth 9
|
builder.DrawRect(SkRect{18, 18, 28, 28}, DlPaint()); // depth 9
|
||||||
}
|
}
|
||||||
builder.Restore(); // save is restored with depth 9
|
builder.Restore(); // save is restored with depth 9
|
||||||
|
|
||||||
builder.DrawRect({16, 16, 26, 26}, DlPaint()); // depth 10
|
builder.DrawRect(SkRect{16, 16, 26, 26}, DlPaint()); // depth 10
|
||||||
builder.DrawRect({18, 18, 28, 28}, DlPaint()); // depth 11
|
builder.DrawRect(SkRect{18, 18, 28, 28}, DlPaint()); // depth 11
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
|
|
||||||
EXPECT_EQ(display_list->total_depth(), 11u);
|
EXPECT_EQ(display_list->total_depth(), 11u);
|
||||||
@ -5420,12 +5429,12 @@ TEST_F(DisplayListTest, BoundedRenderOpsDoNotReportUnbounded) {
|
|||||||
|
|
||||||
test_bounded("DrawLine", [](DlCanvas& builder) {
|
test_bounded("DrawLine", [](DlCanvas& builder) {
|
||||||
builder.DrawLine(
|
builder.DrawLine(
|
||||||
{draw_rect.left() + 1.0f, draw_rect.top() + 1.0f},
|
SkPoint{draw_rect.left() + 1.0f, draw_rect.top() + 1.0f},
|
||||||
{draw_rect.right() - 1.0f, draw_rect.top() + 1.0f},
|
SkPoint{draw_rect.right() - 1.0f, draw_rect.top() + 1.0f},
|
||||||
DlPaint().setStrokeWidth(2.0f).setStrokeCap(DlStrokeCap::kSquare));
|
DlPaint().setStrokeWidth(2.0f).setStrokeCap(DlStrokeCap::kSquare));
|
||||||
builder.DrawLine(
|
builder.DrawLine(
|
||||||
{draw_rect.left() + 1.0f, draw_rect.bottom() - 1.0f},
|
SkPoint{draw_rect.left() + 1.0f, draw_rect.bottom() - 1.0f},
|
||||||
{draw_rect.right() - 1.0f, draw_rect.bottom() - 1.0f},
|
SkPoint{draw_rect.right() - 1.0f, draw_rect.bottom() - 1.0f},
|
||||||
DlPaint().setStrokeWidth(2.0f).setStrokeCap(DlStrokeCap::kSquare));
|
DlPaint().setStrokeWidth(2.0f).setStrokeCap(DlStrokeCap::kSquare));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -5559,7 +5568,7 @@ TEST_F(DisplayListTest, BoundedRenderOpsDoNotReportUnbounded) {
|
|||||||
|
|
||||||
test_bounded("DrawImage", [](DlCanvas& builder) {
|
test_bounded("DrawImage", [](DlCanvas& builder) {
|
||||||
auto image = MakeTestImage(draw_rect.width(), draw_rect.height(), 5);
|
auto image = MakeTestImage(draw_rect.width(), draw_rect.height(), 5);
|
||||||
builder.DrawImage(image, {draw_rect.left(), draw_rect.top()},
|
builder.DrawImage(image, SkPoint{draw_rect.left(), draw_rect.top()},
|
||||||
DlImageSampling::kLinear);
|
DlImageSampling::kLinear);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -147,8 +147,8 @@ DisplayListBuilder::~DisplayListBuilder() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkISize DisplayListBuilder::GetBaseLayerSize() const {
|
DlISize DisplayListBuilder::GetBaseLayerDimensions() const {
|
||||||
return ToSkISize(DlIRect::RoundOut(original_cull_rect_).GetSize());
|
return DlIRect::RoundOut(original_cull_rect_).GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkImageInfo DisplayListBuilder::GetImageInfo() const {
|
SkImageInfo DisplayListBuilder::GetImageInfo() const {
|
||||||
@ -540,14 +540,14 @@ void DisplayListBuilder::saveLayer(const DlRect& bounds,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::SaveLayer(const SkRect* bounds,
|
void DisplayListBuilder::SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
const DlImageFilter* backdrop) {
|
const DlImageFilter* backdrop) {
|
||||||
SaveLayerOptions options;
|
SaveLayerOptions options;
|
||||||
DlRect temp_bounds;
|
DlRect temp_bounds;
|
||||||
if (bounds) {
|
if (bounds.has_value()) {
|
||||||
options = options.with_bounds_from_caller();
|
options = options.with_bounds_from_caller();
|
||||||
temp_bounds = ToDlRect(*bounds);
|
temp_bounds = *bounds;
|
||||||
} else {
|
} else {
|
||||||
FML_DCHECK(temp_bounds.IsEmpty());
|
FML_DCHECK(temp_bounds.IsEmpty());
|
||||||
}
|
}
|
||||||
@ -867,7 +867,7 @@ void DisplayListBuilder::TransformFullPerspective(
|
|||||||
myz == 0 &&
|
myz == 0 &&
|
||||||
mzx == 0 && mzy == 0 && mzz == 1 && mzt == 0 &&
|
mzx == 0 && mzy == 0 && mzz == 1 && mzt == 0 &&
|
||||||
mwx == 0 && mwy == 0 && mwz == 0 && mwt == 1) {
|
mwx == 0 && mwy == 0 && mwz == 0 && mwt == 1) {
|
||||||
Transform2DAffine(mxx, mxy, mxt,
|
transform2DAffine(mxx, mxy, mxt,
|
||||||
myx, myy, myt);
|
myx, myy, myt);
|
||||||
} else if (std::isfinite(mxx) && std::isfinite(mxy) &&
|
} else if (std::isfinite(mxx) && std::isfinite(mxy) &&
|
||||||
std::isfinite(mxz) && std::isfinite(mxt) &&
|
std::isfinite(mxz) && std::isfinite(mxt) &&
|
||||||
@ -920,25 +920,18 @@ void DisplayListBuilder::TransformReset() {
|
|||||||
|
|
||||||
global_state().setIdentity();
|
global_state().setIdentity();
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::Transform(const SkMatrix* matrix) {
|
void DisplayListBuilder::Transform(const DlMatrix& matrix) {
|
||||||
if (matrix != nullptr) {
|
TransformFullPerspective(
|
||||||
Transform(SkM44(*matrix));
|
matrix.e[0][0], matrix.e[1][0], matrix.e[2][0], matrix.e[3][0],
|
||||||
}
|
matrix.e[0][1], matrix.e[1][1], matrix.e[2][1], matrix.e[3][1],
|
||||||
}
|
matrix.e[0][2], matrix.e[1][2], matrix.e[2][2], matrix.e[3][2],
|
||||||
void DisplayListBuilder::Transform(const SkM44* m44) {
|
matrix.e[0][3], matrix.e[1][3], matrix.e[2][3], matrix.e[3][3]);
|
||||||
if (m44 != nullptr) {
|
|
||||||
transformFullPerspective(
|
|
||||||
m44->rc(0, 0), m44->rc(0, 1), m44->rc(0, 2), m44->rc(0, 3),
|
|
||||||
m44->rc(1, 0), m44->rc(1, 1), m44->rc(1, 2), m44->rc(1, 3),
|
|
||||||
m44->rc(2, 0), m44->rc(2, 1), m44->rc(2, 2), m44->rc(2, 3),
|
|
||||||
m44->rc(3, 0), m44->rc(3, 1), m44->rc(3, 2), m44->rc(3, 3));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListBuilder::ClipRect(const SkRect& rect,
|
void DisplayListBuilder::ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op,
|
ClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (!rect.isFinite()) {
|
if (!rect.IsFinite()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
@ -960,17 +953,17 @@ void DisplayListBuilder::ClipRect(const SkRect& rect,
|
|||||||
checkForDeferredSave();
|
checkForDeferredSave();
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case ClipOp::kIntersect:
|
case ClipOp::kIntersect:
|
||||||
Push<ClipIntersectRectOp>(0, ToDlRect(rect), is_aa);
|
Push<ClipIntersectRectOp>(0, rect, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case ClipOp::kDifference:
|
||||||
Push<ClipDifferenceRectOp>(0, ToDlRect(rect), is_aa);
|
Push<ClipDifferenceRectOp>(0, rect, is_aa);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::ClipOval(const SkRect& bounds,
|
void DisplayListBuilder::ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op,
|
ClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (!bounds.isFinite()) {
|
if (!bounds.IsFinite()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
@ -992,10 +985,10 @@ void DisplayListBuilder::ClipOval(const SkRect& bounds,
|
|||||||
checkForDeferredSave();
|
checkForDeferredSave();
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case ClipOp::kIntersect:
|
case ClipOp::kIntersect:
|
||||||
Push<ClipIntersectOvalOp>(0, ToDlRect(bounds), is_aa);
|
Push<ClipIntersectOvalOp>(0, bounds, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case ClipOp::kDifference:
|
||||||
Push<ClipDifferenceOvalOp>(0, ToDlRect(bounds), is_aa);
|
Push<ClipDifferenceOvalOp>(0, bounds, is_aa);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1003,11 +996,11 @@ void DisplayListBuilder::ClipRRect(const SkRRect& rrect,
|
|||||||
ClipOp clip_op,
|
ClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (rrect.isRect()) {
|
if (rrect.isRect()) {
|
||||||
ClipRect(rrect.rect(), clip_op, is_aa);
|
ClipRect(ToDlRect(rrect.rect()), clip_op, is_aa);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rrect.isOval()) {
|
if (rrect.isOval()) {
|
||||||
ClipOval(rrect.rect(), clip_op, is_aa);
|
ClipOval(ToDlRect(rrect.rect()), clip_op, is_aa);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
@ -1043,12 +1036,12 @@ void DisplayListBuilder::ClipPath(const DlPath& path,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!path.IsInverseFillType()) {
|
if (!path.IsInverseFillType()) {
|
||||||
SkRect rect;
|
DlRect rect;
|
||||||
if (path.IsSkRect(&rect)) {
|
if (path.IsRect(&rect)) {
|
||||||
ClipRect(rect, clip_op, is_aa);
|
ClipRect(rect, clip_op, is_aa);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (path.IsSkOval(&rect)) {
|
if (path.IsOval(&rect)) {
|
||||||
ClipOval(rect, clip_op, is_aa);
|
ClipOval(rect, clip_op, is_aa);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1077,7 +1070,7 @@ void DisplayListBuilder::ClipPath(const DlPath& path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisplayListBuilder::QuickReject(const SkRect& bounds) const {
|
bool DisplayListBuilder::QuickReject(const DlRect& bounds) const {
|
||||||
return global_state().content_culled(bounds);
|
return global_state().content_culled(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,11 +1106,11 @@ void DisplayListBuilder::drawLine(const DlPoint& p0, const DlPoint& p1) {
|
|||||||
UpdateLayerResult(result);
|
UpdateLayerResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawLine(const SkPoint& p0,
|
void DisplayListBuilder::DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawLineFlags);
|
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawLineFlags);
|
||||||
drawLine(ToDlPoint(p0), ToDlPoint(p1));
|
drawLine(p0, p1);
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawDashedLine(const DlPoint& p0,
|
void DisplayListBuilder::drawDashedLine(const DlPoint& p0,
|
||||||
const DlPoint& p1,
|
const DlPoint& p1,
|
||||||
@ -1152,9 +1145,9 @@ void DisplayListBuilder::drawRect(const DlRect& rect) {
|
|||||||
UpdateLayerResult(result);
|
UpdateLayerResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawRect(const SkRect& rect, const DlPaint& paint) {
|
void DisplayListBuilder::DrawRect(const DlRect& rect, const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawRectFlags);
|
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawRectFlags);
|
||||||
drawRect(ToDlRect(rect));
|
drawRect(rect);
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawOval(const DlRect& bounds) {
|
void DisplayListBuilder::drawOval(const DlRect& bounds) {
|
||||||
DisplayListAttributeFlags flags = kDrawOvalFlags;
|
DisplayListAttributeFlags flags = kDrawOvalFlags;
|
||||||
@ -1166,9 +1159,9 @@ void DisplayListBuilder::drawOval(const DlRect& bounds) {
|
|||||||
UpdateLayerResult(result);
|
UpdateLayerResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawOval(const SkRect& bounds, const DlPaint& paint) {
|
void DisplayListBuilder::DrawOval(const DlRect& bounds, const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawOvalFlags);
|
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawOvalFlags);
|
||||||
drawOval(ToDlRect(bounds));
|
drawOval(bounds);
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawCircle(const DlPoint& center, DlScalar radius) {
|
void DisplayListBuilder::drawCircle(const DlPoint& center, DlScalar radius) {
|
||||||
DisplayListAttributeFlags flags = kDrawCircleFlags;
|
DisplayListAttributeFlags flags = kDrawCircleFlags;
|
||||||
@ -1183,11 +1176,11 @@ void DisplayListBuilder::drawCircle(const DlPoint& center, DlScalar radius) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawCircle(const SkPoint& center,
|
void DisplayListBuilder::DrawCircle(const DlPoint& center,
|
||||||
DlScalar radius,
|
DlScalar radius,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawCircleFlags);
|
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawCircleFlags);
|
||||||
drawCircle(ToDlPoint(center), radius);
|
drawCircle(center, radius);
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawRRect(const SkRRect& rrect) {
|
void DisplayListBuilder::drawRRect(const SkRRect& rrect) {
|
||||||
if (rrect.isRect()) {
|
if (rrect.isRect()) {
|
||||||
@ -1241,11 +1234,6 @@ void DisplayListBuilder::drawPath(const DlPath& path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawPath(const SkPath& path, const DlPaint& paint) {
|
|
||||||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawPathFlags);
|
|
||||||
DlPath dl_path(path);
|
|
||||||
drawPath(dl_path);
|
|
||||||
}
|
|
||||||
void DisplayListBuilder::DrawPath(const DlPath& path, const DlPaint& paint) {
|
void DisplayListBuilder::DrawPath(const DlPath& path, const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawPathFlags);
|
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawPathFlags);
|
||||||
drawPath(path);
|
drawPath(path);
|
||||||
@ -1274,14 +1262,14 @@ void DisplayListBuilder::drawArc(const DlRect& bounds,
|
|||||||
UpdateLayerResult(result);
|
UpdateLayerResult(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawArc(const SkRect& bounds,
|
void DisplayListBuilder::DrawArc(const DlRect& bounds,
|
||||||
DlScalar start,
|
DlScalar start,
|
||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(
|
SetAttributesFromPaint(
|
||||||
paint, useCenter ? kDrawArcWithCenterFlags : kDrawArcNoCenterFlags);
|
paint, useCenter ? kDrawArcWithCenterFlags : kDrawArcNoCenterFlags);
|
||||||
drawArc(ToDlRect(bounds), start, sweep, useCenter);
|
drawArc(bounds, start, sweep, useCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayListAttributeFlags DisplayListBuilder::FlagsForPointMode(
|
DisplayListAttributeFlags DisplayListBuilder::FlagsForPointMode(
|
||||||
@ -1350,10 +1338,10 @@ void DisplayListBuilder::drawPoints(PointMode mode,
|
|||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawPoints(PointMode mode,
|
void DisplayListBuilder::DrawPoints(PointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
SetAttributesFromPaint(paint, FlagsForPointMode(mode));
|
SetAttributesFromPaint(paint, FlagsForPointMode(mode));
|
||||||
drawPoints(mode, count, ToDlPoints(pts));
|
drawPoints(mode, count, pts);
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawVertices(
|
void DisplayListBuilder::drawVertices(
|
||||||
const std::shared_ptr<DlVertices>& vertices,
|
const std::shared_ptr<DlVertices>& vertices,
|
||||||
@ -1411,15 +1399,15 @@ void DisplayListBuilder::drawImage(const sk_sp<DlImage> image,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawImage(const sk_sp<DlImage>& image,
|
void DisplayListBuilder::DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
if (paint != nullptr) {
|
if (paint != nullptr) {
|
||||||
SetAttributesFromPaint(*paint,
|
SetAttributesFromPaint(*paint,
|
||||||
DisplayListOpFlags::kDrawImageWithPaintFlags);
|
DisplayListOpFlags::kDrawImageWithPaintFlags);
|
||||||
drawImage(image, ToDlPoint(point), sampling, true);
|
drawImage(image, point, sampling, true);
|
||||||
} else {
|
} else {
|
||||||
drawImage(image, ToDlPoint(point), sampling, false);
|
drawImage(image, point, sampling, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawImageRect(const sk_sp<DlImage> image,
|
void DisplayListBuilder::drawImageRect(const sk_sp<DlImage> image,
|
||||||
@ -1442,19 +1430,17 @@ void DisplayListBuilder::drawImageRect(const sk_sp<DlImage> image,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawImageRect(const sk_sp<DlImage>& image,
|
void DisplayListBuilder::DrawImageRect(const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const DlRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
SrcRectConstraint constraint) {
|
SrcRectConstraint constraint) {
|
||||||
if (paint != nullptr) {
|
if (paint != nullptr) {
|
||||||
SetAttributesFromPaint(*paint,
|
SetAttributesFromPaint(*paint,
|
||||||
DisplayListOpFlags::kDrawImageRectWithPaintFlags);
|
DisplayListOpFlags::kDrawImageRectWithPaintFlags);
|
||||||
drawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, true,
|
drawImageRect(image, src, dst, sampling, true, constraint);
|
||||||
constraint);
|
|
||||||
} else {
|
} else {
|
||||||
drawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, false,
|
drawImageRect(image, src, dst, sampling, false, constraint);
|
||||||
constraint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawImageNine(const sk_sp<DlImage> image,
|
void DisplayListBuilder::drawImageNine(const sk_sp<DlImage> image,
|
||||||
@ -1477,16 +1463,16 @@ void DisplayListBuilder::drawImageNine(const sk_sp<DlImage> image,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawImageNine(const sk_sp<DlImage>& image,
|
void DisplayListBuilder::DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
if (paint != nullptr) {
|
if (paint != nullptr) {
|
||||||
SetAttributesFromPaint(*paint,
|
SetAttributesFromPaint(*paint,
|
||||||
DisplayListOpFlags::kDrawImageNineWithPaintFlags);
|
DisplayListOpFlags::kDrawImageNineWithPaintFlags);
|
||||||
drawImageNine(image, ToDlIRect(center), ToDlRect(dst), filter, true);
|
drawImageNine(image, center, dst, filter, true);
|
||||||
} else {
|
} else {
|
||||||
drawImageNine(image, ToDlIRect(center), ToDlRect(dst), filter, false);
|
drawImageNine(image, center, dst, filter, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawAtlas(const sk_sp<DlImage> atlas,
|
void DisplayListBuilder::drawAtlas(const sk_sp<DlImage> atlas,
|
||||||
@ -1565,21 +1551,21 @@ void DisplayListBuilder::drawAtlas(const sk_sp<DlImage> atlas,
|
|||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawAtlas(const sk_sp<DlImage>& atlas,
|
void DisplayListBuilder::DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
const SkRSXform xform[],
|
const SkRSXform xform[],
|
||||||
const SkRect tex[],
|
const DlRect tex[],
|
||||||
const DlColor colors[],
|
const DlColor colors[],
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const SkRect* cull_rect,
|
const DlRect* cull_rect,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
if (paint != nullptr) {
|
if (paint != nullptr) {
|
||||||
SetAttributesFromPaint(*paint,
|
SetAttributesFromPaint(*paint,
|
||||||
DisplayListOpFlags::kDrawAtlasWithPaintFlags);
|
DisplayListOpFlags::kDrawAtlasWithPaintFlags);
|
||||||
drawAtlas(atlas, xform, ToDlRects(tex), colors, count, mode, sampling,
|
drawAtlas(atlas, xform, tex, colors, count, mode, sampling, cull_rect,
|
||||||
ToDlRect(cull_rect), true);
|
true);
|
||||||
} else {
|
} else {
|
||||||
drawAtlas(atlas, xform, ToDlRects(tex), colors, count, mode, sampling,
|
drawAtlas(atlas, xform, tex, colors, count, mode, sampling, cull_rect,
|
||||||
ToDlRect(cull_rect), false);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
~DisplayListBuilder();
|
~DisplayListBuilder();
|
||||||
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
SkISize GetBaseLayerSize() const override;
|
DlISize GetBaseLayerDimensions() const override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
SkImageInfo GetImageInfo() const override;
|
SkImageInfo GetImageInfo() const override;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
void Save() override;
|
void Save() override;
|
||||||
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void SaveLayer(const SkRect* bounds,
|
void SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
const DlImageFilter* backdrop = nullptr) override;
|
const DlImageFilter* backdrop = nullptr) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
@ -84,40 +84,25 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void TransformReset() override;
|
void TransformReset() override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void Transform(const SkMatrix* matrix) override;
|
void Transform(const DlMatrix& matrix) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void Transform(const SkM44* matrix44) override;
|
void SetTransform(const DlMatrix& matrix) override {
|
||||||
// |DlCanvas|
|
|
||||||
void SetTransform(const SkMatrix* matrix) override {
|
|
||||||
TransformReset();
|
TransformReset();
|
||||||
Transform(matrix);
|
Transform(matrix);
|
||||||
}
|
}
|
||||||
// |DlCanvas|
|
|
||||||
void SetTransform(const SkM44* matrix44) override {
|
|
||||||
TransformReset();
|
|
||||||
Transform(matrix44);
|
|
||||||
}
|
|
||||||
using DlCanvas::Transform;
|
|
||||||
|
|
||||||
/// Returns the 4x4 full perspective transform representing all transform
|
/// Returns the 4x4 full perspective transform representing all transform
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
/// operations executed so far in this DisplayList within the enclosing
|
||||||
/// save stack.
|
/// save stack.
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
SkM44 GetTransformFullPerspective() const override {
|
DlMatrix GetMatrix() const override { return global_state().matrix(); }
|
||||||
return global_state().matrix_4x4();
|
|
||||||
}
|
|
||||||
/// Returns the 3x3 partial perspective transform representing all transform
|
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
|
||||||
/// save stack.
|
|
||||||
// |DlCanvas|
|
|
||||||
SkMatrix GetTransform() const override { return global_state().matrix_3x3(); }
|
|
||||||
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipRect(const SkRect& rect,
|
void ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipOval(const SkRect& bounds,
|
void ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
@ -125,12 +110,6 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipPath(const SkPath& path,
|
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
|
||||||
bool is_aa = false) override {
|
|
||||||
ClipPath(DlPath(path), clip_op, is_aa);
|
|
||||||
}
|
|
||||||
// |DlCanvas|
|
|
||||||
void ClipPath(const DlPath& path,
|
void ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
@ -139,30 +118,30 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
/// measured in the coordinate space within which this DisplayList will
|
/// measured in the coordinate space within which this DisplayList will
|
||||||
/// be rendered.
|
/// be rendered.
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
SkRect GetDestinationClipBounds() const override {
|
DlRect GetDestinationClipCoverage() const override {
|
||||||
return global_state().device_cull_rect();
|
return global_state().GetDeviceCullCoverage();
|
||||||
}
|
}
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// transformed into the local coordinate space in which currently
|
/// transformed into the local coordinate space in which currently
|
||||||
/// recorded rendering operations are interpreted.
|
/// recorded rendering operations are interpreted.
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
SkRect GetLocalClipBounds() const override {
|
DlRect GetLocalClipCoverage() const override {
|
||||||
return global_state().local_cull_rect();
|
return global_state().GetLocalCullCoverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true iff the supplied bounds are easily shown to be outside
|
/// Return true iff the supplied bounds are easily shown to be outside
|
||||||
/// of the current clip bounds. This method may conservatively return
|
/// of the current clip bounds. This method may conservatively return
|
||||||
/// false if it cannot make the determination.
|
/// false if it cannot make the determination.
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
bool QuickReject(const SkRect& bounds) const override;
|
bool QuickReject(const DlRect& bounds) const override;
|
||||||
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawPaint(const DlPaint& paint) override;
|
void DrawPaint(const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawColor(DlColor color, DlBlendMode mode) override;
|
void DrawColor(DlColor color, DlBlendMode mode) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawLine(const SkPoint& p0,
|
void DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawDashedLine(const DlPoint& p0,
|
void DrawDashedLine(const DlPoint& p0,
|
||||||
@ -171,11 +150,11 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
DlScalar off_length,
|
DlScalar off_length,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawRect(const SkRect& rect, const DlPaint& paint) override;
|
void DrawRect(const DlRect& rect, const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawOval(const SkRect& bounds, const DlPaint& paint) override;
|
void DrawOval(const DlRect& bounds, const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawCircle(const SkPoint& center,
|
void DrawCircle(const DlPoint& center,
|
||||||
DlScalar radius,
|
DlScalar radius,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
@ -185,11 +164,9 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
const SkRRect& inner,
|
const SkRRect& inner,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawPath(const SkPath& path, const DlPaint& paint) override;
|
|
||||||
// |DlCanvas|
|
|
||||||
void DrawPath(const DlPath& path, const DlPaint& paint) override;
|
void DrawPath(const DlPath& path, const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawArc(const SkRect& bounds,
|
void DrawArc(const DlRect& bounds,
|
||||||
DlScalar start,
|
DlScalar start,
|
||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
@ -197,7 +174,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawPoints(PointMode mode,
|
void DrawPoints(PointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
@ -205,33 +182,32 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawImage(const sk_sp<DlImage>& image,
|
void DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawImageRect(
|
void DrawImageRect(
|
||||||
const sk_sp<DlImage>& image,
|
const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const DlRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
||||||
using DlCanvas::DrawImageRect;
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawImageNine(const sk_sp<DlImage>& image,
|
void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
const SkRSXform xform[],
|
const SkRSXform xform[],
|
||||||
const SkRect tex[],
|
const DlRect tex[],
|
||||||
const DlColor colors[],
|
const DlColor colors[],
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const SkRect* cullRect,
|
const DlRect* cullRect,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
||||||
@ -251,14 +227,6 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
DlScalar y,
|
DlScalar y,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
|
|
||||||
// |DlCanvas|
|
|
||||||
void DrawShadow(const SkPath& path,
|
|
||||||
const DlColor color,
|
|
||||||
const DlScalar elevation,
|
|
||||||
bool transparent_occluder,
|
|
||||||
DlScalar dpr) override {
|
|
||||||
DrawShadow(DlPath(path), color, elevation, transparent_occluder, dpr);
|
|
||||||
}
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawShadow(const DlPath& path,
|
void DrawShadow(const DlPath& path,
|
||||||
const DlColor color,
|
const DlColor color,
|
||||||
@ -271,6 +239,8 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
|
|
||||||
sk_sp<DisplayList> Build();
|
sk_sp<DisplayList> Build();
|
||||||
|
|
||||||
|
ENABLE_DL_CANVAS_BACKWARDS_COMPATIBILITY
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init(bool prepare_rtree);
|
void Init(bool prepare_rtree);
|
||||||
|
|
||||||
@ -417,11 +387,11 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
|
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override {
|
void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override {
|
||||||
ClipRect(ToSkRect(rect), clip_op, is_aa);
|
ClipRect(rect, clip_op, is_aa);
|
||||||
}
|
}
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override {
|
void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override {
|
||||||
ClipOval(ToSkRect(bounds), clip_op, is_aa);
|
ClipOval(bounds, clip_op, is_aa);
|
||||||
}
|
}
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override {
|
void clipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override {
|
||||||
|
@ -9,16 +9,16 @@
|
|||||||
|
|
||||||
namespace flutter {
|
namespace flutter {
|
||||||
|
|
||||||
SkRect DlCanvas::ComputeShadowBounds(const SkPath& path,
|
DlRect DlCanvas::ComputeShadowBounds(const DlPath& path,
|
||||||
float elevation,
|
float elevation,
|
||||||
SkScalar dpr,
|
DlScalar dpr,
|
||||||
const SkMatrix& ctm) {
|
const DlMatrix& ctm) {
|
||||||
SkRect shadow_bounds(path.getBounds());
|
SkRect shadow_bounds(path.GetSkBounds());
|
||||||
SkShadowUtils::GetLocalBounds(
|
SkShadowUtils::GetLocalBounds(
|
||||||
ctm, path, SkPoint3::Make(0, 0, dpr * elevation),
|
ToSkMatrix(ctm), path.GetSkPath(), SkPoint3::Make(0, 0, dpr * elevation),
|
||||||
SkPoint3::Make(0, -1, 1), kShadowLightRadius / kShadowLightHeight,
|
SkPoint3::Make(0, -1, 1), kShadowLightRadius / kShadowLightHeight,
|
||||||
SkShadowFlags::kDirectionalLight_ShadowFlag, &shadow_bounds);
|
SkShadowFlags::kDirectionalLight_ShadowFlag, &shadow_bounds);
|
||||||
return shadow_bounds;
|
return ToDlRect(shadow_bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace flutter
|
} // namespace flutter
|
||||||
|
@ -56,11 +56,11 @@ class DlCanvas {
|
|||||||
|
|
||||||
virtual ~DlCanvas() = default;
|
virtual ~DlCanvas() = default;
|
||||||
|
|
||||||
virtual SkISize GetBaseLayerSize() const = 0;
|
virtual DlISize GetBaseLayerDimensions() const = 0;
|
||||||
virtual SkImageInfo GetImageInfo() const = 0;
|
virtual SkImageInfo GetImageInfo() const = 0;
|
||||||
|
|
||||||
virtual void Save() = 0;
|
virtual void Save() = 0;
|
||||||
virtual void SaveLayer(const SkRect* bounds,
|
virtual void SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
const DlImageFilter* backdrop = nullptr) = 0;
|
const DlImageFilter* backdrop = nullptr) = 0;
|
||||||
virtual void Restore() = 0;
|
virtual void Restore() = 0;
|
||||||
@ -85,133 +85,114 @@ class DlCanvas {
|
|||||||
DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt) = 0;
|
DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt) = 0;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
virtual void TransformReset() = 0;
|
virtual void TransformReset() = 0;
|
||||||
virtual void Transform(const SkMatrix* matrix) = 0;
|
virtual void Transform(const DlMatrix& matrix) = 0;
|
||||||
virtual void Transform(const SkM44* matrix44) = 0;
|
virtual void SetTransform(const DlMatrix& matrix) = 0;
|
||||||
void Transform(const SkMatrix& matrix) { Transform(&matrix); }
|
|
||||||
void Transform(const SkM44& matrix44) { Transform(&matrix44); }
|
|
||||||
virtual void SetTransform(const SkMatrix* matrix) = 0;
|
|
||||||
virtual void SetTransform(const SkM44* matrix44) = 0;
|
|
||||||
virtual void SetTransform(const SkMatrix& matrix) { SetTransform(&matrix); }
|
|
||||||
virtual void SetTransform(const SkM44& matrix44) { SetTransform(&matrix44); }
|
|
||||||
|
|
||||||
/// Returns the 4x4 full perspective transform representing all transform
|
virtual DlMatrix GetMatrix() const = 0;
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
|
||||||
/// save stack.
|
|
||||||
virtual SkM44 GetTransformFullPerspective() const = 0;
|
|
||||||
/// Returns the 3x3 partial perspective transform representing all transform
|
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
|
||||||
/// save stack.
|
|
||||||
virtual SkMatrix GetTransform() const = 0;
|
|
||||||
|
|
||||||
virtual void ClipRect(const SkRect& rect,
|
virtual void ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
virtual void ClipOval(const SkRect& bounds,
|
virtual void ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
virtual void ClipRRect(const SkRRect& rrect,
|
virtual void ClipRRect(const SkRRect& rrect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
virtual void ClipPath(const SkPath& path,
|
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
|
||||||
bool is_aa = false) = 0;
|
|
||||||
virtual void ClipPath(const DlPath& path,
|
virtual void ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
bool is_aa = false) {
|
bool is_aa = false) = 0;
|
||||||
ClipPath(path.GetSkPath(), clip_op, is_aa);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// measured in the coordinate space within which this DisplayList will
|
/// measured in the coordinate space within which this DisplayList will
|
||||||
/// be rendered.
|
/// be rendered.
|
||||||
virtual SkRect GetDestinationClipBounds() const = 0;
|
virtual DlRect GetDestinationClipCoverage() const = 0;
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// transformed into the local coordinate space in which currently
|
/// transformed into the local coordinate space in which currently
|
||||||
/// recorded rendering operations are interpreted.
|
/// recorded rendering operations are interpreted.
|
||||||
virtual SkRect GetLocalClipBounds() const = 0;
|
virtual DlRect GetLocalClipCoverage() const = 0;
|
||||||
|
|
||||||
/// Return true iff the supplied bounds are easily shown to be outside
|
/// Return true iff the supplied bounds are easily shown to be outside
|
||||||
/// of the current clip bounds. This method may conservatively return
|
/// of the current clip bounds. This method may conservatively return
|
||||||
/// false if it cannot make the determination.
|
/// false if it cannot make the determination.
|
||||||
virtual bool QuickReject(const SkRect& bounds) const = 0;
|
virtual bool QuickReject(const DlRect& bounds) const = 0;
|
||||||
|
|
||||||
virtual void DrawPaint(const DlPaint& paint) = 0;
|
virtual void DrawPaint(const DlPaint& paint) = 0;
|
||||||
virtual void DrawColor(DlColor color,
|
virtual void DrawColor(DlColor color,
|
||||||
DlBlendMode mode = DlBlendMode::kSrcOver) = 0;
|
DlBlendMode mode = DlBlendMode::kSrcOver) = 0;
|
||||||
void Clear(DlColor color) { DrawColor(color, DlBlendMode::kSrc); }
|
void Clear(DlColor color) { DrawColor(color, DlBlendMode::kSrc); }
|
||||||
virtual void DrawLine(const SkPoint& p0,
|
virtual void DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawDashedLine(const DlPoint& p0,
|
virtual void DrawDashedLine(const DlPoint& p0,
|
||||||
const DlPoint& p1,
|
const DlPoint& p1,
|
||||||
DlScalar on_length,
|
DlScalar on_length,
|
||||||
DlScalar off_length,
|
DlScalar off_length,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawRect(const SkRect& rect, const DlPaint& paint) = 0;
|
virtual void DrawRect(const DlRect& rect, const DlPaint& paint) = 0;
|
||||||
virtual void DrawOval(const SkRect& bounds, const DlPaint& paint) = 0;
|
virtual void DrawOval(const DlRect& bounds, const DlPaint& paint) = 0;
|
||||||
virtual void DrawCircle(const SkPoint& center,
|
virtual void DrawCircle(const DlPoint& center,
|
||||||
DlScalar radius,
|
DlScalar radius,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawRRect(const SkRRect& rrect, const DlPaint& paint) = 0;
|
virtual void DrawRRect(const SkRRect& rrect, const DlPaint& paint) = 0;
|
||||||
virtual void DrawDRRect(const SkRRect& outer,
|
virtual void DrawDRRect(const SkRRect& outer,
|
||||||
const SkRRect& inner,
|
const SkRRect& inner,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawPath(const SkPath& path, const DlPaint& paint) = 0;
|
virtual void DrawPath(const DlPath& path, const DlPaint& paint) = 0;
|
||||||
virtual void DrawPath(const DlPath& path, const DlPaint& paint) {
|
virtual void DrawArc(const DlRect& bounds,
|
||||||
DrawPath(path.GetSkPath(), paint);
|
|
||||||
}
|
|
||||||
virtual void DrawArc(const SkRect& bounds,
|
|
||||||
DlScalar start,
|
DlScalar start,
|
||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawPoints(PointMode mode,
|
virtual void DrawPoints(PointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
virtual void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawImage(const sk_sp<DlImage>& image,
|
virtual void DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr) = 0;
|
const DlPaint* paint = nullptr) = 0;
|
||||||
virtual void DrawImageRect(
|
virtual void DrawImageRect(
|
||||||
const sk_sp<DlImage>& image,
|
const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const DlRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) = 0;
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) = 0;
|
||||||
virtual void DrawImageRect(
|
virtual void DrawImageRect(
|
||||||
const sk_sp<DlImage>& image,
|
const sk_sp<DlImage>& image,
|
||||||
const SkIRect& src,
|
const DlIRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
||||||
DrawImageRect(image, SkRect::Make(src), dst, sampling, paint, constraint);
|
auto float_src = DlRect::MakeLTRB(src.GetLeft(), src.GetTop(),
|
||||||
|
src.GetRight(), src.GetBottom());
|
||||||
|
DrawImageRect(image, float_src, dst, sampling, paint, constraint);
|
||||||
}
|
}
|
||||||
void DrawImageRect(const sk_sp<DlImage>& image,
|
void DrawImageRect(const sk_sp<DlImage>& image,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
||||||
DrawImageRect(image, image->bounds(), dst, sampling, paint, constraint);
|
DrawImageRect(image, image->GetBounds(), dst, sampling, paint, constraint);
|
||||||
}
|
}
|
||||||
virtual void DrawImageNine(const sk_sp<DlImage>& image,
|
virtual void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint = nullptr) = 0;
|
const DlPaint* paint = nullptr) = 0;
|
||||||
virtual void DrawAtlas(const sk_sp<DlImage>& atlas,
|
virtual void DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
const SkRSXform xform[],
|
const SkRSXform xform[],
|
||||||
const SkRect tex[],
|
const DlRect tex[],
|
||||||
const DlColor colors[],
|
const DlColor colors[],
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const SkRect* cullRect,
|
const DlRect* cullRect,
|
||||||
const DlPaint* paint = nullptr) = 0;
|
const DlPaint* paint = nullptr) = 0;
|
||||||
virtual void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
virtual void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
||||||
DlScalar opacity = SK_Scalar1) = 0;
|
DlScalar opacity = SK_Scalar1) = 0;
|
||||||
@ -226,28 +207,225 @@ class DlCanvas {
|
|||||||
DlScalar x,
|
DlScalar x,
|
||||||
DlScalar y,
|
DlScalar y,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawShadow(const SkPath& path,
|
|
||||||
const DlColor color,
|
|
||||||
const DlScalar elevation,
|
|
||||||
bool transparent_occluder,
|
|
||||||
DlScalar dpr) = 0;
|
|
||||||
virtual void DrawShadow(const DlPath& path,
|
virtual void DrawShadow(const DlPath& path,
|
||||||
const DlColor color,
|
const DlColor color,
|
||||||
const DlScalar elevation,
|
const DlScalar elevation,
|
||||||
bool transparent_occluder,
|
bool transparent_occluder,
|
||||||
DlScalar dpr) {
|
DlScalar dpr) = 0;
|
||||||
DrawShadow(path.GetSkPath(), color, elevation, transparent_occluder, dpr);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Flush() = 0;
|
virtual void Flush() = 0;
|
||||||
|
|
||||||
static constexpr DlScalar kShadowLightHeight = 600;
|
static constexpr DlScalar kShadowLightHeight = 600;
|
||||||
static constexpr DlScalar kShadowLightRadius = 800;
|
static constexpr DlScalar kShadowLightRadius = 800;
|
||||||
|
|
||||||
|
static DlRect ComputeShadowBounds(const DlPath& path,
|
||||||
|
float elevation,
|
||||||
|
DlScalar dpr,
|
||||||
|
const DlMatrix& ctm);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// SkObject Compatibility section - deprecated...
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
|
||||||
|
SkISize GetBaseLayerSize() const {
|
||||||
|
return ToSkISize(GetBaseLayerDimensions());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveLayer(const SkRect* bounds,
|
||||||
|
const DlPaint* paint = nullptr,
|
||||||
|
const DlImageFilter* backdrop = nullptr) {
|
||||||
|
auto optional_bounds = ToOptDlRect(bounds);
|
||||||
|
SaveLayer(optional_bounds, paint, backdrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Transform(const SkMatrix* matrix) {
|
||||||
|
if (matrix) {
|
||||||
|
Transform(*matrix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Transform(const SkM44* matrix44) {
|
||||||
|
if (matrix44) {
|
||||||
|
Transform(*matrix44);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Transform(const SkMatrix& matrix) { Transform(ToDlMatrix(matrix)); }
|
||||||
|
void Transform(const SkM44& m44) { Transform(ToDlMatrix(m44)); }
|
||||||
|
void SetTransform(const SkMatrix* matrix) {
|
||||||
|
if (matrix) {
|
||||||
|
SetTransform(*matrix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void SetTransform(const SkM44* matrix44) {
|
||||||
|
if (matrix44) {
|
||||||
|
SetTransform(*matrix44);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void SetTransform(const SkMatrix& matrix) {
|
||||||
|
SetTransform(ToDlMatrix(matrix));
|
||||||
|
}
|
||||||
|
void SetTransform(const SkM44& m44) { SetTransform(ToDlMatrix(m44)); }
|
||||||
|
|
||||||
|
/// Returns the 4x4 full perspective transform representing all transform
|
||||||
|
/// operations executed so far in this DisplayList within the enclosing
|
||||||
|
/// save stack.
|
||||||
|
SkM44 GetTransformFullPerspective() const { return ToSkM44(GetMatrix()); }
|
||||||
|
/// Returns the 3x3 partial perspective transform representing all transform
|
||||||
|
/// operations executed so far in this DisplayList within the enclosing
|
||||||
|
/// save stack.
|
||||||
|
SkMatrix GetTransform() const { return ToSkMatrix(GetMatrix()); }
|
||||||
|
|
||||||
|
void ClipRect(const SkRect& rect,
|
||||||
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
|
bool is_aa = false) {
|
||||||
|
ClipRect(ToDlRect(rect), clip_op, is_aa);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClipOval(const SkRect& bounds,
|
||||||
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
|
bool is_aa = false) {
|
||||||
|
ClipOval(ToDlRect(bounds), clip_op, is_aa);
|
||||||
|
}
|
||||||
|
void ClipPath(const SkPath& path,
|
||||||
|
ClipOp clip_op = ClipOp::kIntersect,
|
||||||
|
bool is_aa = false) {
|
||||||
|
ClipPath(DlPath(path), clip_op, is_aa);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkRect GetDestinationClipBounds() const {
|
||||||
|
return ToSkRect(GetDestinationClipCoverage());
|
||||||
|
}
|
||||||
|
SkRect GetLocalClipBounds() const { return ToSkRect(GetLocalClipCoverage()); }
|
||||||
|
bool QuickReject(const SkRect& bounds) const {
|
||||||
|
return QuickReject(ToDlRect(bounds));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawLine(const SkPoint& p0, const SkPoint& p1, const DlPaint& paint) {
|
||||||
|
DrawLine(ToDlPoint(p0), ToDlPoint(p1), paint);
|
||||||
|
}
|
||||||
|
void DrawRect(const SkRect& rect, const DlPaint& paint) {
|
||||||
|
DrawRect(ToDlRect(rect), paint);
|
||||||
|
}
|
||||||
|
void DrawOval(const SkRect& bounds, const DlPaint& paint) {
|
||||||
|
DrawOval(ToDlRect(bounds), paint);
|
||||||
|
}
|
||||||
|
void DrawCircle(const SkPoint& center,
|
||||||
|
DlScalar radius,
|
||||||
|
const DlPaint& paint) {
|
||||||
|
DrawCircle(ToDlPoint(center), radius, paint);
|
||||||
|
}
|
||||||
|
void DrawPath(const SkPath& path, const DlPaint& paint) {
|
||||||
|
DrawPath(DlPath(path), paint);
|
||||||
|
}
|
||||||
|
void DrawArc(const SkRect& bounds,
|
||||||
|
DlScalar start,
|
||||||
|
DlScalar sweep,
|
||||||
|
bool useCenter,
|
||||||
|
const DlPaint& paint) {
|
||||||
|
DrawArc(ToDlRect(bounds), start, sweep, useCenter, paint);
|
||||||
|
}
|
||||||
|
void DrawPoints(PointMode mode,
|
||||||
|
uint32_t count,
|
||||||
|
const SkPoint pts[],
|
||||||
|
const DlPaint& paint) {
|
||||||
|
DrawPoints(mode, count, ToDlPoints(pts), paint);
|
||||||
|
}
|
||||||
|
void DrawImage(const sk_sp<DlImage>& image,
|
||||||
|
const SkPoint& point,
|
||||||
|
DlImageSampling sampling,
|
||||||
|
const DlPaint* paint = nullptr) {
|
||||||
|
DrawImage(image, ToDlPoint(point), sampling, paint);
|
||||||
|
}
|
||||||
|
void DrawImageRect(const sk_sp<DlImage>& image,
|
||||||
|
const SkRect& src,
|
||||||
|
const SkRect& dst,
|
||||||
|
DlImageSampling sampling,
|
||||||
|
const DlPaint* paint = nullptr,
|
||||||
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
||||||
|
DrawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, paint,
|
||||||
|
constraint);
|
||||||
|
}
|
||||||
|
void DrawImageRect(const sk_sp<DlImage>& image,
|
||||||
|
const SkIRect& src,
|
||||||
|
const SkRect& dst,
|
||||||
|
DlImageSampling sampling,
|
||||||
|
const DlPaint* paint = nullptr,
|
||||||
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
||||||
|
DrawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, paint,
|
||||||
|
constraint);
|
||||||
|
}
|
||||||
|
void DrawImageRect(const sk_sp<DlImage>& image,
|
||||||
|
const SkRect& dst,
|
||||||
|
DlImageSampling sampling,
|
||||||
|
const DlPaint* paint = nullptr,
|
||||||
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
||||||
|
DrawImageRect(image, image->GetBounds(), ToDlRect(dst), sampling, paint,
|
||||||
|
constraint);
|
||||||
|
}
|
||||||
|
void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
|
const SkIRect& center,
|
||||||
|
const SkRect& dst,
|
||||||
|
DlFilterMode filter,
|
||||||
|
const DlPaint* paint = nullptr) {
|
||||||
|
DrawImageNine(image, ToDlIRect(center), ToDlRect(dst), filter, paint);
|
||||||
|
}
|
||||||
|
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
|
const SkRSXform xform[],
|
||||||
|
const SkRect tex[],
|
||||||
|
const DlColor colors[],
|
||||||
|
int count,
|
||||||
|
DlBlendMode mode,
|
||||||
|
DlImageSampling sampling,
|
||||||
|
const SkRect* cullRect,
|
||||||
|
const DlPaint* paint = nullptr) {
|
||||||
|
DrawAtlas(atlas, xform, ToDlRects(tex), colors, count, mode, sampling,
|
||||||
|
ToDlRect(cullRect), paint);
|
||||||
|
}
|
||||||
|
void DrawShadow(const SkPath& path,
|
||||||
|
const DlColor color,
|
||||||
|
const DlScalar elevation,
|
||||||
|
bool transparent_occluder,
|
||||||
|
DlScalar dpr) {
|
||||||
|
DrawShadow(DlPath(path), color, elevation, transparent_occluder, dpr);
|
||||||
|
}
|
||||||
|
|
||||||
static SkRect ComputeShadowBounds(const SkPath& path,
|
static SkRect ComputeShadowBounds(const SkPath& path,
|
||||||
float elevation,
|
float elevation,
|
||||||
DlScalar dpr,
|
DlScalar dpr,
|
||||||
const SkMatrix& ctm);
|
const SkMatrix& ctm) {
|
||||||
|
return ToSkRect(
|
||||||
|
ComputeShadowBounds(DlPath(path), elevation, dpr, ToDlMatrix(ctm)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ENABLE_DL_CANVAS_BACKWARDS_COMPATIBILITY \
|
||||||
|
using DlCanvas::GetBaseLayerSize; \
|
||||||
|
\
|
||||||
|
using DlCanvas::SaveLayer; \
|
||||||
|
\
|
||||||
|
using DlCanvas::Transform; \
|
||||||
|
using DlCanvas::SetTransform; \
|
||||||
|
using DlCanvas::GetTransformFullPerspective; \
|
||||||
|
using DlCanvas::GetTransform; \
|
||||||
|
\
|
||||||
|
using DlCanvas::ClipRect; \
|
||||||
|
using DlCanvas::ClipOval; \
|
||||||
|
using DlCanvas::ClipPath; \
|
||||||
|
\
|
||||||
|
using DlCanvas::GetDestinationClipBounds; \
|
||||||
|
using DlCanvas::GetLocalClipBounds; \
|
||||||
|
using DlCanvas::QuickReject; \
|
||||||
|
\
|
||||||
|
using DlCanvas::DrawLine; \
|
||||||
|
using DlCanvas::DrawRect; \
|
||||||
|
using DlCanvas::DrawOval; \
|
||||||
|
using DlCanvas::DrawCircle; \
|
||||||
|
using DlCanvas::DrawPath; \
|
||||||
|
using DlCanvas::DrawArc; \
|
||||||
|
using DlCanvas::DrawPoints; \
|
||||||
|
using DlCanvas::DrawImage; \
|
||||||
|
using DlCanvas::DrawImageRect; \
|
||||||
|
using DlCanvas::DrawImageNine; \
|
||||||
|
using DlCanvas::DrawAtlas; \
|
||||||
|
using DlCanvas::DrawShadow;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DlAutoCanvasRestore {
|
class DlAutoCanvasRestore {
|
||||||
|
@ -47,6 +47,10 @@ inline const DlRect& ToDlRect(const SkRect& rect) {
|
|||||||
return *reinterpret_cast<const DlRect*>(&rect);
|
return *reinterpret_cast<const DlRect*>(&rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const DlRect ToDlRect(const SkIRect& rect) {
|
||||||
|
return DlRect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
|
||||||
|
}
|
||||||
|
|
||||||
inline const DlIRect& ToDlIRect(const SkIRect& rect) {
|
inline const DlIRect& ToDlIRect(const SkIRect& rect) {
|
||||||
return *reinterpret_cast<const DlIRect*>(&rect);
|
return *reinterpret_cast<const DlIRect*>(&rect);
|
||||||
}
|
}
|
||||||
@ -59,6 +63,10 @@ inline const DlRect* ToDlRect(const SkRect* rect) {
|
|||||||
return rect == nullptr ? nullptr : reinterpret_cast<const DlRect*>(rect);
|
return rect == nullptr ? nullptr : reinterpret_cast<const DlRect*>(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::optional<const DlRect> ToOptDlRect(const SkRect* rect) {
|
||||||
|
return rect == nullptr ? std::nullopt : std::optional(ToDlRect(*rect));
|
||||||
|
}
|
||||||
|
|
||||||
inline const DlRect* ToDlRects(const SkRect* rects) {
|
inline const DlRect* ToDlRects(const SkRect* rects) {
|
||||||
return rects == nullptr ? nullptr : reinterpret_cast<const DlRect*>(rects);
|
return rects == nullptr ? nullptr : reinterpret_cast<const DlRect*>(rects);
|
||||||
}
|
}
|
||||||
@ -104,6 +112,10 @@ inline const SkRect* ToSkRect(const DlRect* rect) {
|
|||||||
return rect == nullptr ? nullptr : reinterpret_cast<const SkRect*>(rect);
|
return rect == nullptr ? nullptr : reinterpret_cast<const SkRect*>(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const SkRect* ToSkRect(std::optional<const DlRect>& rect) {
|
||||||
|
return rect.has_value() ? &ToSkRect(rect.value()) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
inline SkRect* ToSkRect(DlRect* rect) {
|
inline SkRect* ToSkRect(DlRect* rect) {
|
||||||
return rect == nullptr ? nullptr : reinterpret_cast<SkRect*>(rect);
|
return rect == nullptr ? nullptr : reinterpret_cast<SkRect*>(rect);
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ void DlSkCanvasAdapter::set_canvas(SkCanvas* canvas) {
|
|||||||
delegate_ = canvas;
|
delegate_ = canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkISize DlSkCanvasAdapter::GetBaseLayerSize() const {
|
DlISize DlSkCanvasAdapter::GetBaseLayerDimensions() const {
|
||||||
return delegate_->getBaseLayerSize();
|
return ToDlISize(delegate_->getBaseLayerSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
SkImageInfo DlSkCanvasAdapter::GetImageInfo() const {
|
SkImageInfo DlSkCanvasAdapter::GetImageInfo() const {
|
||||||
@ -52,13 +52,14 @@ void DlSkCanvasAdapter::Save() {
|
|||||||
delegate_->save();
|
delegate_->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::SaveLayer(const SkRect* bounds,
|
void DlSkCanvasAdapter::SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
const DlImageFilter* backdrop) {
|
const DlImageFilter* backdrop) {
|
||||||
sk_sp<SkImageFilter> sk_backdrop = ToSk(backdrop);
|
sk_sp<SkImageFilter> sk_backdrop = ToSk(backdrop);
|
||||||
SkOptionalPaint sk_paint(paint);
|
SkOptionalPaint sk_paint(paint);
|
||||||
TRACE_EVENT0("flutter", "Canvas::saveLayer");
|
TRACE_EVENT0("flutter", "Canvas::saveLayer");
|
||||||
SkCanvas::SaveLayerRec params(bounds, sk_paint(), sk_backdrop.get(), 0);
|
SkCanvas::SaveLayerRec params(ToSkRect(bounds), sk_paint(), sk_backdrop.get(),
|
||||||
|
0);
|
||||||
if (sk_backdrop && backdrop->asBlur()) {
|
if (sk_backdrop && backdrop->asBlur()) {
|
||||||
params.fBackdropTileMode = ToSk(backdrop->asBlur()->tile_mode());
|
params.fBackdropTileMode = ToSk(backdrop->asBlur()->tile_mode());
|
||||||
}
|
}
|
||||||
@ -120,46 +121,32 @@ void DlSkCanvasAdapter::TransformReset() {
|
|||||||
delegate_->resetMatrix();
|
delegate_->resetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::Transform(const SkMatrix* matrix) {
|
void DlSkCanvasAdapter::Transform(const DlMatrix& matrix) {
|
||||||
delegate_->concat(*matrix);
|
delegate_->concat(ToSkM44(matrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::Transform(const SkM44* matrix44) {
|
void DlSkCanvasAdapter::SetTransform(const DlMatrix& matrix) {
|
||||||
delegate_->concat(*matrix44);
|
delegate_->setMatrix(ToSkM44(matrix));
|
||||||
}
|
|
||||||
|
|
||||||
void DlSkCanvasAdapter::SetTransform(const SkMatrix* matrix) {
|
|
||||||
delegate_->setMatrix(*matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DlSkCanvasAdapter::SetTransform(const SkM44* matrix44) {
|
|
||||||
delegate_->setMatrix(*matrix44);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the 4x4 full perspective transform representing all transform
|
/// Returns the 4x4 full perspective transform representing all transform
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
/// operations executed so far in this DisplayList within the enclosing
|
||||||
/// save stack.
|
/// save stack.
|
||||||
SkM44 DlSkCanvasAdapter::GetTransformFullPerspective() const {
|
DlMatrix DlSkCanvasAdapter::GetMatrix() const {
|
||||||
return delegate_->getLocalToDevice();
|
return ToDlMatrix(delegate_->getLocalToDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the 3x3 partial perspective transform representing all transform
|
void DlSkCanvasAdapter::ClipRect(const DlRect& rect,
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
|
||||||
/// save stack.
|
|
||||||
SkMatrix DlSkCanvasAdapter::GetTransform() const {
|
|
||||||
return delegate_->getTotalMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipRect(const SkRect& rect,
|
|
||||||
ClipOp clip_op,
|
ClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
delegate_->clipRect(rect, ToSk(clip_op), is_aa);
|
delegate_->clipRect(ToSkRect(rect), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipOval(const SkRect& bounds,
|
void DlSkCanvasAdapter::ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op,
|
ClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
delegate_->clipRRect(SkRRect::MakeOval(bounds), ToSk(clip_op), is_aa);
|
delegate_->clipRRect(SkRRect::MakeOval(ToSkRect(bounds)), ToSk(clip_op),
|
||||||
|
is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipRRect(const SkRRect& rrect,
|
void DlSkCanvasAdapter::ClipRRect(const SkRRect& rrect,
|
||||||
@ -168,31 +155,32 @@ void DlSkCanvasAdapter::ClipRRect(const SkRRect& rrect,
|
|||||||
delegate_->clipRRect(rrect, ToSk(clip_op), is_aa);
|
delegate_->clipRRect(rrect, ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipPath(const SkPath& path,
|
void DlSkCanvasAdapter::ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op,
|
ClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
delegate_->clipPath(path, ToSk(clip_op), is_aa);
|
path.WillRenderSkPath();
|
||||||
|
delegate_->clipPath(path.GetSkPath(), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// measured in the coordinate space within which this DisplayList will
|
/// measured in the coordinate space within which this DisplayList will
|
||||||
/// be rendered.
|
/// be rendered.
|
||||||
SkRect DlSkCanvasAdapter::GetDestinationClipBounds() const {
|
DlRect DlSkCanvasAdapter::GetDestinationClipCoverage() const {
|
||||||
return SkRect::Make(delegate_->getDeviceClipBounds());
|
return ToDlRect(delegate_->getDeviceClipBounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// transformed into the local coordinate space in which currently
|
/// transformed into the local coordinate space in which currently
|
||||||
/// recorded rendering operations are interpreted.
|
/// recorded rendering operations are interpreted.
|
||||||
SkRect DlSkCanvasAdapter::GetLocalClipBounds() const {
|
DlRect DlSkCanvasAdapter::GetLocalClipCoverage() const {
|
||||||
return delegate_->getLocalClipBounds();
|
return ToDlRect(delegate_->getLocalClipBounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true iff the supplied bounds are easily shown to be outside
|
/// Return true iff the supplied bounds are easily shown to be outside
|
||||||
/// of the current clip bounds. This method may conservatively return
|
/// of the current clip bounds. This method may conservatively return
|
||||||
/// false if it cannot make the determination.
|
/// false if it cannot make the determination.
|
||||||
bool DlSkCanvasAdapter::QuickReject(const SkRect& bounds) const {
|
bool DlSkCanvasAdapter::QuickReject(const DlRect& bounds) const {
|
||||||
return delegate_->quickReject(bounds);
|
return delegate_->quickReject(ToSkRect(bounds));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawPaint(const DlPaint& paint) {
|
void DlSkCanvasAdapter::DrawPaint(const DlPaint& paint) {
|
||||||
@ -203,10 +191,10 @@ void DlSkCanvasAdapter::DrawColor(DlColor color, DlBlendMode mode) {
|
|||||||
delegate_->drawColor(ToSk(color), ToSk(mode));
|
delegate_->drawColor(ToSk(color), ToSk(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawLine(const SkPoint& p0,
|
void DlSkCanvasAdapter::DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
delegate_->drawLine(p0, p1, ToStrokedSk(paint));
|
delegate_->drawLine(ToSkPoint(p0), ToSkPoint(p1), ToStrokedSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawDashedLine(const DlPoint& p0,
|
void DlSkCanvasAdapter::DrawDashedLine(const DlPoint& p0,
|
||||||
@ -220,18 +208,18 @@ void DlSkCanvasAdapter::DrawDashedLine(const DlPoint& p0,
|
|||||||
delegate_->drawLine(ToSkPoint(p0), ToSkPoint(p1), dashed_paint);
|
delegate_->drawLine(ToSkPoint(p0), ToSkPoint(p1), dashed_paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawRect(const SkRect& rect, const DlPaint& paint) {
|
void DlSkCanvasAdapter::DrawRect(const DlRect& rect, const DlPaint& paint) {
|
||||||
delegate_->drawRect(rect, ToSk(paint));
|
delegate_->drawRect(ToSkRect(rect), ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawOval(const SkRect& bounds, const DlPaint& paint) {
|
void DlSkCanvasAdapter::DrawOval(const DlRect& bounds, const DlPaint& paint) {
|
||||||
delegate_->drawOval(bounds, ToSk(paint));
|
delegate_->drawOval(ToSkRect(bounds), ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawCircle(const SkPoint& center,
|
void DlSkCanvasAdapter::DrawCircle(const DlPoint& center,
|
||||||
SkScalar radius,
|
SkScalar radius,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
delegate_->drawCircle(center, radius, ToSk(paint));
|
delegate_->drawCircle(ToSkPoint(center), radius, ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawRRect(const SkRRect& rrect, const DlPaint& paint) {
|
void DlSkCanvasAdapter::DrawRRect(const SkRRect& rrect, const DlPaint& paint) {
|
||||||
@ -244,23 +232,24 @@ void DlSkCanvasAdapter::DrawDRRect(const SkRRect& outer,
|
|||||||
delegate_->drawDRRect(outer, inner, ToSk(paint));
|
delegate_->drawDRRect(outer, inner, ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawPath(const SkPath& path, const DlPaint& paint) {
|
void DlSkCanvasAdapter::DrawPath(const DlPath& path, const DlPaint& paint) {
|
||||||
delegate_->drawPath(path, ToSk(paint));
|
path.WillRenderSkPath();
|
||||||
|
delegate_->drawPath(path.GetSkPath(), ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawArc(const SkRect& bounds,
|
void DlSkCanvasAdapter::DrawArc(const DlRect& bounds,
|
||||||
SkScalar start,
|
DlScalar start,
|
||||||
SkScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
delegate_->drawArc(bounds, start, sweep, useCenter, ToSk(paint));
|
delegate_->drawArc(ToSkRect(bounds), start, sweep, useCenter, ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawPoints(PointMode mode,
|
void DlSkCanvasAdapter::DrawPoints(PointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
delegate_->drawPoints(ToSk(mode), count, pts, ToStrokedSk(paint));
|
delegate_->drawPoints(ToSk(mode), count, ToSkPoints(pts), ToStrokedSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawVertices(
|
void DlSkCanvasAdapter::DrawVertices(
|
||||||
@ -271,46 +260,46 @@ void DlSkCanvasAdapter::DrawVertices(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawImage(const sk_sp<DlImage>& image,
|
void DlSkCanvasAdapter::DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
SkOptionalPaint sk_paint(paint);
|
SkOptionalPaint sk_paint(paint);
|
||||||
sk_sp<SkImage> sk_image = image->skia_image();
|
sk_sp<SkImage> sk_image = image->skia_image();
|
||||||
delegate_->drawImage(sk_image.get(), point.fX, point.fY, ToSk(sampling),
|
delegate_->drawImage(sk_image.get(), point.x, point.y, ToSk(sampling),
|
||||||
sk_paint());
|
sk_paint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawImageRect(const sk_sp<DlImage>& image,
|
void DlSkCanvasAdapter::DrawImageRect(const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const DlRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
SrcRectConstraint constraint) {
|
SrcRectConstraint constraint) {
|
||||||
SkOptionalPaint sk_paint(paint);
|
SkOptionalPaint sk_paint(paint);
|
||||||
sk_sp<SkImage> sk_image = image->skia_image();
|
sk_sp<SkImage> sk_image = image->skia_image();
|
||||||
delegate_->drawImageRect(sk_image.get(), src, dst, ToSk(sampling), sk_paint(),
|
delegate_->drawImageRect(sk_image.get(), ToSkRect(src), ToSkRect(dst),
|
||||||
ToSk(constraint));
|
ToSk(sampling), sk_paint(), ToSk(constraint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawImageNine(const sk_sp<DlImage>& image,
|
void DlSkCanvasAdapter::DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
SkOptionalPaint sk_paint(paint);
|
SkOptionalPaint sk_paint(paint);
|
||||||
sk_sp<SkImage> sk_image = image->skia_image();
|
sk_sp<SkImage> sk_image = image->skia_image();
|
||||||
delegate_->drawImageNine(sk_image.get(), center, dst, ToSk(filter),
|
delegate_->drawImageNine(sk_image.get(), ToSkIRect(center), ToSkRect(dst),
|
||||||
sk_paint());
|
ToSk(filter), sk_paint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawAtlas(const sk_sp<DlImage>& atlas,
|
void DlSkCanvasAdapter::DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
const SkRSXform xform[],
|
const SkRSXform xform[],
|
||||||
const SkRect tex[],
|
const DlRect tex[],
|
||||||
const DlColor colors[],
|
const DlColor colors[],
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const SkRect* cullRect,
|
const DlRect* cullRect,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
SkOptionalPaint sk_paint(paint);
|
SkOptionalPaint sk_paint(paint);
|
||||||
sk_sp<SkImage> sk_image = atlas->skia_image();
|
sk_sp<SkImage> sk_image = atlas->skia_image();
|
||||||
@ -319,8 +308,9 @@ void DlSkCanvasAdapter::DrawAtlas(const sk_sp<DlImage>& atlas,
|
|||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
sk_colors.push_back(colors[i].argb());
|
sk_colors.push_back(colors[i].argb());
|
||||||
}
|
}
|
||||||
delegate_->drawAtlas(sk_image.get(), xform, tex, sk_colors.data(), count,
|
delegate_->drawAtlas(sk_image.get(), xform, ToSkRects(tex), sk_colors.data(),
|
||||||
ToSk(mode), ToSk(sampling), cullRect, sk_paint());
|
count, ToSk(mode), ToSk(sampling), ToSkRect(cullRect),
|
||||||
|
sk_paint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawDisplayList(const sk_sp<DisplayList> display_list,
|
void DlSkCanvasAdapter::DrawDisplayList(const sk_sp<DisplayList> display_list,
|
||||||
@ -362,13 +352,14 @@ void DlSkCanvasAdapter::DrawTextFrame(
|
|||||||
FML_CHECK(false);
|
FML_CHECK(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawShadow(const SkPath& path,
|
void DlSkCanvasAdapter::DrawShadow(const DlPath& path,
|
||||||
const DlColor color,
|
const DlColor color,
|
||||||
const SkScalar elevation,
|
const SkScalar elevation,
|
||||||
bool transparent_occluder,
|
bool transparent_occluder,
|
||||||
SkScalar dpr) {
|
SkScalar dpr) {
|
||||||
DlSkCanvasDispatcher::DrawShadow(delegate_, path, color, elevation,
|
path.WillRenderSkPath();
|
||||||
transparent_occluder, dpr);
|
DlSkCanvasDispatcher::DrawShadow(delegate_, path.GetSkPath(), color,
|
||||||
|
elevation, transparent_occluder, dpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::Flush() {
|
void DlSkCanvasAdapter::Flush() {
|
||||||
|
@ -26,161 +26,139 @@ class DlSkCanvasAdapter final : public virtual DlCanvas {
|
|||||||
void set_canvas(SkCanvas* canvas);
|
void set_canvas(SkCanvas* canvas);
|
||||||
SkCanvas* canvas() { return delegate_; }
|
SkCanvas* canvas() { return delegate_; }
|
||||||
|
|
||||||
SkISize GetBaseLayerSize() const override;
|
DlISize GetBaseLayerDimensions() const override;
|
||||||
SkImageInfo GetImageInfo() const override;
|
SkImageInfo GetImageInfo() const override;
|
||||||
|
|
||||||
void Save() override;
|
void Save() override;
|
||||||
void SaveLayer(const SkRect* bounds,
|
void SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
const DlImageFilter* backdrop = nullptr) override;
|
const DlImageFilter* backdrop = nullptr) override;
|
||||||
void Restore() override;
|
void Restore() override;
|
||||||
int GetSaveCount() const override;
|
int GetSaveCount() const override;
|
||||||
void RestoreToCount(int restore_count) override;
|
void RestoreToCount(int restore_count) override;
|
||||||
|
|
||||||
void Translate(SkScalar tx, SkScalar ty) override;
|
void Translate(DlScalar tx, DlScalar ty) override;
|
||||||
void Scale(SkScalar sx, SkScalar sy) override;
|
void Scale(DlScalar sx, DlScalar sy) override;
|
||||||
void Rotate(SkScalar degrees) override;
|
void Rotate(DlScalar degrees) override;
|
||||||
void Skew(SkScalar sx, SkScalar sy) override;
|
void Skew(DlScalar sx, DlScalar sy) override;
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
// 2x3 2D affine subset of a 4x4 transform in row major order
|
// 2x3 2D affine subset of a 4x4 transform in row major order
|
||||||
void Transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt,
|
void Transform2DAffine(DlScalar mxx, DlScalar mxy, DlScalar mxt,
|
||||||
SkScalar myx, SkScalar myy, SkScalar myt) override;
|
DlScalar myx, DlScalar myy, DlScalar myt) override;
|
||||||
// full 4x4 transform in row major order
|
// full 4x4 transform in row major order
|
||||||
void TransformFullPerspective(
|
void TransformFullPerspective(
|
||||||
SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt,
|
DlScalar mxx, DlScalar mxy, DlScalar mxz, DlScalar mxt,
|
||||||
SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
|
DlScalar myx, DlScalar myy, DlScalar myz, DlScalar myt,
|
||||||
SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
|
DlScalar mzx, DlScalar mzy, DlScalar mzz, DlScalar mzt,
|
||||||
SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override;
|
DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt) override;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
void TransformReset() override;
|
void TransformReset() override;
|
||||||
void Transform(const SkMatrix* matrix) override;
|
void Transform(const DlMatrix& matrix) override;
|
||||||
void Transform(const SkM44* matrix44) override;
|
void SetTransform(const DlMatrix& matrix) override;
|
||||||
void SetTransform(const SkMatrix* matrix) override;
|
|
||||||
void SetTransform(const SkM44* matrix44) override;
|
|
||||||
using DlCanvas::SetTransform;
|
|
||||||
using DlCanvas::Transform;
|
|
||||||
|
|
||||||
/// Returns the 4x4 full perspective transform representing all transform
|
/// Returns the 4x4 full perspective transform representing all transform
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
/// operations executed so far in this DisplayList within the enclosing
|
||||||
/// save stack.
|
/// save stack.
|
||||||
SkM44 GetTransformFullPerspective() const override;
|
DlMatrix GetMatrix() const override;
|
||||||
/// Returns the 3x3 partial perspective transform representing all transform
|
|
||||||
/// operations executed so far in this DisplayList within the enclosing
|
|
||||||
/// save stack.
|
|
||||||
SkMatrix GetTransform() const override;
|
|
||||||
|
|
||||||
void ClipRect(const SkRect& rect, ClipOp clip_op, bool is_aa) override;
|
void ClipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipOval(const SkRect& bounds, ClipOp clip_op, bool is_aa) override;
|
void ClipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
|
void ClipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipPath(const SkPath& path, ClipOp clip_op, bool is_aa) override;
|
void ClipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override {
|
|
||||||
path.WillRenderSkPath();
|
|
||||||
ClipPath(path.GetSkPath(), clip_op, is_aa);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// measured in the coordinate space within which this DisplayList will
|
/// measured in the coordinate space within which this DisplayList will
|
||||||
/// be rendered.
|
/// be rendered.
|
||||||
SkRect GetDestinationClipBounds() const override;
|
DlRect GetDestinationClipCoverage() const override;
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// transformed into the local coordinate space in which currently
|
/// transformed into the local coordinate space in which currently
|
||||||
/// recorded rendering operations are interpreted.
|
/// recorded rendering operations are interpreted.
|
||||||
SkRect GetLocalClipBounds() const override;
|
DlRect GetLocalClipCoverage() const override;
|
||||||
|
|
||||||
/// Return true iff the supplied bounds are easily shown to be outside
|
/// Return true iff the supplied bounds are easily shown to be outside
|
||||||
/// of the current clip bounds. This method may conservatively return
|
/// of the current clip bounds. This method may conservatively return
|
||||||
/// false if it cannot make the determination.
|
/// false if it cannot make the determination.
|
||||||
bool QuickReject(const SkRect& bounds) const override;
|
bool QuickReject(const DlRect& bounds) const override;
|
||||||
|
|
||||||
void DrawPaint(const DlPaint& paint) override;
|
void DrawPaint(const DlPaint& paint) override;
|
||||||
void DrawColor(DlColor color, DlBlendMode mode) override;
|
void DrawColor(DlColor color, DlBlendMode mode) override;
|
||||||
void DrawLine(const SkPoint& p0,
|
void DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawDashedLine(const DlPoint& p0,
|
void DrawDashedLine(const DlPoint& p0,
|
||||||
const DlPoint& p1,
|
const DlPoint& p1,
|
||||||
DlScalar on_length,
|
DlScalar on_length,
|
||||||
DlScalar off_length,
|
DlScalar off_length,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawRect(const SkRect& rect, const DlPaint& paint) override;
|
void DrawRect(const DlRect& rect, const DlPaint& paint) override;
|
||||||
void DrawOval(const SkRect& bounds, const DlPaint& paint) override;
|
void DrawOval(const DlRect& bounds, const DlPaint& paint) override;
|
||||||
void DrawCircle(const SkPoint& center,
|
void DrawCircle(const DlPoint& center,
|
||||||
SkScalar radius,
|
DlScalar radius,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawRRect(const SkRRect& rrect, const DlPaint& paint) override;
|
void DrawRRect(const SkRRect& rrect, const DlPaint& paint) override;
|
||||||
void DrawDRRect(const SkRRect& outer,
|
void DrawDRRect(const SkRRect& outer,
|
||||||
const SkRRect& inner,
|
const SkRRect& inner,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawPath(const SkPath& path, const DlPaint& paint) override;
|
void DrawPath(const DlPath& path, const DlPaint& paint) override;
|
||||||
void DrawPath(const DlPath& path, const DlPaint& paint) override {
|
void DrawArc(const DlRect& bounds,
|
||||||
path.WillRenderSkPath();
|
DlScalar start,
|
||||||
DrawPath(path.GetSkPath(), paint);
|
DlScalar sweep,
|
||||||
}
|
|
||||||
void DrawArc(const SkRect& bounds,
|
|
||||||
SkScalar start,
|
|
||||||
SkScalar sweep,
|
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawPoints(PointMode mode,
|
void DrawPoints(PointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawImage(const sk_sp<DlImage>& image,
|
void DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
void DrawImageRect(
|
void DrawImageRect(
|
||||||
const sk_sp<DlImage>& image,
|
const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const DlRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
||||||
void DrawImageNine(const sk_sp<DlImage>& image,
|
void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
const SkRSXform xform[],
|
const SkRSXform xform[],
|
||||||
const SkRect tex[],
|
const DlRect tex[],
|
||||||
const DlColor colors[],
|
const DlColor colors[],
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const SkRect* cullRect,
|
const DlRect* cullRect,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
||||||
SkScalar opacity = SK_Scalar1) override;
|
DlScalar opacity = SK_Scalar1) override;
|
||||||
void DrawTextBlob(const sk_sp<SkTextBlob>& blob,
|
void DrawTextBlob(const sk_sp<SkTextBlob>& blob,
|
||||||
SkScalar x,
|
DlScalar x,
|
||||||
SkScalar y,
|
DlScalar y,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
|
void DrawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
|
||||||
SkScalar x,
|
DlScalar x,
|
||||||
SkScalar y,
|
DlScalar y,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawShadow(const SkPath& path,
|
|
||||||
const DlColor color,
|
|
||||||
const SkScalar elevation,
|
|
||||||
bool transparent_occluder,
|
|
||||||
SkScalar dpr) override;
|
|
||||||
void DrawShadow(const DlPath& path,
|
void DrawShadow(const DlPath& path,
|
||||||
const DlColor color,
|
const DlColor color,
|
||||||
const SkScalar elevation,
|
const DlScalar elevation,
|
||||||
bool transparent_occluder,
|
bool transparent_occluder,
|
||||||
SkScalar dpr) override {
|
DlScalar dpr) override;
|
||||||
path.WillRenderSkPath();
|
|
||||||
DrawShadow(path.GetSkPath(), color, elevation, transparent_occluder, dpr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
ENABLE_DL_CANVAS_BACKWARDS_COMPATIBILITY
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkCanvas* delegate_;
|
SkCanvas* delegate_;
|
||||||
};
|
};
|
||||||
|
@ -3719,17 +3719,19 @@ sk_sp<DisplayList> makeTestDisplayList() {
|
|||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setDrawStyle(DlDrawStyle::kFill);
|
paint.setDrawStyle(DlDrawStyle::kFill);
|
||||||
paint.setColor(DlColor(SK_ColorRED));
|
paint.setColor(DlColor(SK_ColorRED));
|
||||||
builder.DrawRect({kRenderLeft, kRenderTop, kRenderCenterX, kRenderCenterY},
|
builder.DrawRect(
|
||||||
paint);
|
SkRect{kRenderLeft, kRenderTop, kRenderCenterX, kRenderCenterY}, paint);
|
||||||
paint.setColor(DlColor(SK_ColorBLUE));
|
paint.setColor(DlColor(SK_ColorBLUE));
|
||||||
builder.DrawRect({kRenderCenterX, kRenderTop, kRenderRight, kRenderCenterY},
|
builder.DrawRect(
|
||||||
paint);
|
SkRect{kRenderCenterX, kRenderTop, kRenderRight, kRenderCenterY}, paint);
|
||||||
paint.setColor(DlColor(SK_ColorGREEN));
|
paint.setColor(DlColor(SK_ColorGREEN));
|
||||||
builder.DrawRect({kRenderLeft, kRenderCenterY, kRenderCenterX, kRenderBottom},
|
builder.DrawRect(
|
||||||
|
SkRect{kRenderLeft, kRenderCenterY, kRenderCenterX, kRenderBottom},
|
||||||
paint);
|
paint);
|
||||||
paint.setColor(DlColor(SK_ColorYELLOW));
|
paint.setColor(DlColor(SK_ColorYELLOW));
|
||||||
builder.DrawRect(
|
builder.DrawRect(
|
||||||
{kRenderCenterX, kRenderCenterY, kRenderRight, kRenderBottom}, paint);
|
SkRect{kRenderCenterX, kRenderCenterY, kRenderRight, kRenderBottom},
|
||||||
|
paint);
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4603,7 +4605,7 @@ class DisplayListNopTest : public DisplayListRendering {
|
|||||||
std::string desc = desc_stream.str();
|
std::string desc = desc_stream.str();
|
||||||
DisplayListBuilder builder({0.0f, 0.0f, 100.0f, 100.0f});
|
DisplayListBuilder builder({0.0f, 0.0f, 100.0f, 100.0f});
|
||||||
DlPaint paint = DlPaint(color).setBlendMode(mode);
|
DlPaint paint = DlPaint(color).setBlendMode(mode);
|
||||||
builder.DrawRect({0.0f, 0.0f, 10.0f, 10.0f}, paint);
|
builder.DrawRect(SkRect{0.0f, 0.0f, 10.0f, 10.0f}, paint);
|
||||||
auto dl = builder.Build();
|
auto dl = builder.Build();
|
||||||
if (dl->modifies_transparent_black()) {
|
if (dl->modifies_transparent_black()) {
|
||||||
ASSERT_TRUE(dl->op_count() != 0u);
|
ASSERT_TRUE(dl->op_count() != 0u);
|
||||||
@ -4700,8 +4702,8 @@ class DisplayListNopTest : public DisplayListRendering {
|
|||||||
.setBlendMode(mode) //
|
.setBlendMode(mode) //
|
||||||
.setColorFilter(color_filter) //
|
.setColorFilter(color_filter) //
|
||||||
.setImageFilter(image_filter);
|
.setImageFilter(image_filter);
|
||||||
builder.DrawImage(DlImage::Make(test_image_src_data->image()), {0, 0},
|
builder.DrawImage(DlImage::Make(test_image_src_data->image()),
|
||||||
DlImageSampling::kNearestNeighbor, &paint);
|
SkPoint{0, 0}, DlImageSampling::kNearestNeighbor, &paint);
|
||||||
auto dl = builder.Build();
|
auto dl = builder.Build();
|
||||||
|
|
||||||
int w = test_image_src_data->width();
|
int w = test_image_src_data->width();
|
||||||
|
@ -123,12 +123,12 @@ void DisplayListMatrixClipState::clipRRect(const SkRRect& rrect,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMatrixClipState::clipPath(const SkPath& path,
|
void DisplayListMatrixClipState::clipPath(const DlPath& path,
|
||||||
ClipOp op,
|
ClipOp op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
// Map "kDifference of inverse path" to "kIntersect of the original path" and
|
// Map "kDifference of inverse path" to "kIntersect of the original path" and
|
||||||
// map "kIntersect of inverse path" to "kDifference of the original path"
|
// map "kIntersect of inverse path" to "kDifference of the original path"
|
||||||
if (path.isInverseFillType()) {
|
if (path.IsInverseFillType()) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case ClipOp::kIntersect:
|
case ClipOp::kIntersect:
|
||||||
op = ClipOp::kDifference;
|
op = ClipOp::kDifference;
|
||||||
@ -139,8 +139,8 @@ void DisplayListMatrixClipState::clipPath(const SkPath& path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DlRect bounds = ToDlRect(path.getBounds());
|
DlRect bounds = path.GetBounds();
|
||||||
if (path.isRect(nullptr)) {
|
if (path.IsRect(nullptr)) {
|
||||||
return clipRect(bounds, op, is_aa);
|
return clipRect(bounds, op, is_aa);
|
||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
@ -231,23 +231,23 @@ void DisplayListMatrixClipState::adjustCullRect(const DlRect& clip,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkRect DisplayListMatrixClipState::local_cull_rect() const {
|
DlRect DisplayListMatrixClipState::GetLocalCullCoverage() const {
|
||||||
if (cull_rect_.IsEmpty()) {
|
if (cull_rect_.IsEmpty()) {
|
||||||
return SkRect::MakeEmpty();
|
return DlRect();
|
||||||
}
|
}
|
||||||
if (!is_matrix_invertable()) {
|
if (!is_matrix_invertable()) {
|
||||||
return SkRect::MakeEmpty();
|
return DlRect();
|
||||||
}
|
}
|
||||||
if (matrix_.HasPerspective2D()) {
|
if (matrix_.HasPerspective2D()) {
|
||||||
// We could do a 4-point long-form conversion, but since this is
|
// We could do a 4-point long-form conversion, but since this is
|
||||||
// only used for culling, let's just return a non-constricting
|
// only used for culling, let's just return a non-constricting
|
||||||
// cull rect.
|
// cull rect.
|
||||||
return DisplayListBuilder::kMaxCullRect;
|
return ToDlRect(DisplayListBuilder::kMaxCullRect);
|
||||||
}
|
}
|
||||||
DlMatrix inverse = matrix_.Invert();
|
DlMatrix inverse = matrix_.Invert();
|
||||||
// We eliminated perspective above so we can use the cheaper non-clipping
|
// We eliminated perspective above so we can use the cheaper non-clipping
|
||||||
// bounds transform method.
|
// bounds transform method.
|
||||||
return ToSkRect(cull_rect_.TransformBounds(inverse));
|
return cull_rect_.TransformBounds(inverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisplayListMatrixClipState::rect_covers_cull(const DlRect& content) const {
|
bool DisplayListMatrixClipState::rect_covers_cull(const DlRect& content) const {
|
||||||
|
@ -60,8 +60,10 @@ class DisplayListMatrixClipState {
|
|||||||
SkM44 matrix_4x4() const { return SkM44::ColMajor(matrix_.m); }
|
SkM44 matrix_4x4() const { return SkM44::ColMajor(matrix_.m); }
|
||||||
SkMatrix matrix_3x3() const { return ToSkMatrix(matrix_); }
|
SkMatrix matrix_3x3() const { return ToSkMatrix(matrix_); }
|
||||||
|
|
||||||
SkRect local_cull_rect() const;
|
SkRect local_cull_rect() const { return ToSkRect(GetLocalCullCoverage()); }
|
||||||
|
DlRect GetLocalCullCoverage() const;
|
||||||
SkRect device_cull_rect() const { return ToSkRect(cull_rect_); }
|
SkRect device_cull_rect() const { return ToSkRect(cull_rect_); }
|
||||||
|
DlRect GetDeviceCullCoverage() const { return cull_rect_; }
|
||||||
|
|
||||||
bool rect_covers_cull(const DlRect& content) const;
|
bool rect_covers_cull(const DlRect& content) const;
|
||||||
bool rect_covers_cull(const SkRect& content) const {
|
bool rect_covers_cull(const SkRect& content) const {
|
||||||
@ -154,7 +156,10 @@ class DisplayListMatrixClipState {
|
|||||||
clipRect(ToDlRect(bounds), op, is_aa);
|
clipRect(ToDlRect(bounds), op, is_aa);
|
||||||
}
|
}
|
||||||
void clipRRect(const SkRRect& rrect, ClipOp op, bool is_aa);
|
void clipRRect(const SkRRect& rrect, ClipOp op, bool is_aa);
|
||||||
void clipPath(const SkPath& path, ClipOp op, bool is_aa);
|
void clipPath(const SkPath& path, ClipOp op, bool is_aa) {
|
||||||
|
clipPath(DlPath(path), op, is_aa);
|
||||||
|
}
|
||||||
|
void clipPath(const DlPath& path, ClipOp op, bool is_aa);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DlRect cull_rect_;
|
DlRect cull_rect_;
|
||||||
|
@ -101,7 +101,7 @@ TEST_F(DisplayListLayerTest, SimpleDisplayList) {
|
|||||||
TEST_F(DisplayListLayerTest, CachingDoesNotChangeCullRect) {
|
TEST_F(DisplayListLayerTest, CachingDoesNotChangeCullRect) {
|
||||||
const SkPoint layer_offset = SkPoint::Make(10, 10);
|
const SkPoint layer_offset = SkPoint::Make(10, 10);
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawRect({10, 10, 20, 20}, DlPaint());
|
builder.DrawRect(SkRect{10, 10, 20, 20}, DlPaint());
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
auto layer = std::make_shared<DisplayListLayer>(layer_offset, display_list,
|
auto layer = std::make_shared<DisplayListLayer>(layer_offset, display_list,
|
||||||
true, false);
|
true, false);
|
||||||
@ -546,8 +546,8 @@ TEST_F(DisplayListLayerTest, OverflowCachedDisplayListOpacityInheritance) {
|
|||||||
std::vector<std::shared_ptr<DisplayListLayer>> layers;
|
std::vector<std::shared_ptr<DisplayListLayer>> layers;
|
||||||
for (int i = 0; i < layer_count; i++) {
|
for (int i = 0; i < layer_count; i++) {
|
||||||
DisplayListBuilder builder(false);
|
DisplayListBuilder builder(false);
|
||||||
builder.DrawRect({0, 0, 100, 100}, DlPaint());
|
builder.DrawRect(SkRect{0, 0, 100, 100}, DlPaint());
|
||||||
builder.DrawRect({50, 50, 100, 100}, DlPaint());
|
builder.DrawRect(SkRect{50, 50, 100, 100}, DlPaint());
|
||||||
auto display_list = builder.Build();
|
auto display_list = builder.Build();
|
||||||
ASSERT_FALSE(display_list->can_apply_group_opacity());
|
ASSERT_FALSE(display_list->can_apply_group_opacity());
|
||||||
SkPoint offset = {i * 200.0f, 0};
|
SkPoint offset = {i * 200.0f, 0};
|
||||||
|
@ -48,7 +48,7 @@ void RasterCacheResult::draw(DlCanvas& canvas,
|
|||||||
canvas.TransformReset();
|
canvas.TransformReset();
|
||||||
flow_.Step();
|
flow_.Step();
|
||||||
if (!preserve_rtree || !rtree_) {
|
if (!preserve_rtree || !rtree_) {
|
||||||
canvas.DrawImage(image_, {bounds.fLeft, bounds.fTop},
|
canvas.DrawImage(image_, SkPoint{bounds.fLeft, bounds.fTop},
|
||||||
DlImageSampling::kNearestNeighbor, paint);
|
DlImageSampling::kNearestNeighbor, paint);
|
||||||
} else {
|
} else {
|
||||||
// On some platforms RTree from overlay layers is used for unobstructed
|
// On some platforms RTree from overlay layers is used for unobstructed
|
||||||
|
@ -180,7 +180,7 @@ void SkStopwatchVisualizer::Visualize(DlCanvas* canvas,
|
|||||||
|
|
||||||
// Draw the cached surface onto the output canvas.
|
// Draw the cached surface onto the output canvas.
|
||||||
auto image = DlImage::Make(visualize_cache_surface_->makeImageSnapshot());
|
auto image = DlImage::Make(visualize_cache_surface_->makeImageSnapshot());
|
||||||
canvas->DrawImage(image, {rect.x(), rect.y()},
|
canvas->DrawImage(image, SkPoint{rect.x(), rect.y()},
|
||||||
DlImageSampling::kNearestNeighbor);
|
DlImageSampling::kNearestNeighbor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ TEST_P(AiksTest, CanSaveLayerStandalone) {
|
|||||||
|
|
||||||
builder.SaveLayer(nullptr, &alpha);
|
builder.SaveLayer(nullptr, &alpha);
|
||||||
|
|
||||||
builder.DrawCircle({125, 125}, 125, red);
|
builder.DrawCircle(SkPoint{125, 125}, 125, red);
|
||||||
|
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ TEST_P(AiksTest, CanRenderDifferentShapesWithSameColorSource) {
|
|||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.Translate(100, 400);
|
builder.Translate(100, 400);
|
||||||
builder.DrawCircle({100, 100}, 100, paint);
|
builder.DrawCircle(SkPoint{100, 100}, 100, paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -430,7 +430,7 @@ TEST_P(AiksTest, FilledCirclesRenderCorrectly) {
|
|||||||
int radius = 600;
|
int radius = 600;
|
||||||
while (radius > 0) {
|
while (radius > 0) {
|
||||||
paint.setColor(colors[(c_index++) % color_count]);
|
paint.setColor(colors[(c_index++) % color_count]);
|
||||||
builder.DrawCircle({10, 10}, radius, paint);
|
builder.DrawCircle(SkPoint{10, 10}, radius, paint);
|
||||||
if (radius > 30) {
|
if (radius > 30) {
|
||||||
radius -= 10;
|
radius -= 10;
|
||||||
} else {
|
} else {
|
||||||
@ -462,14 +462,14 @@ TEST_P(AiksTest, FilledCirclesRenderCorrectly) {
|
|||||||
|
|
||||||
paint.setColorSource(DlColorSource::MakeRadial(
|
paint.setColorSource(DlColorSource::MakeRadial(
|
||||||
{500, 600}, 75, 7, gradient_colors, stops, DlTileMode::kMirror));
|
{500, 600}, 75, 7, gradient_colors, stops, DlTileMode::kMirror));
|
||||||
builder.DrawCircle({500, 600}, 100, paint);
|
builder.DrawCircle(SkPoint{500, 600}, 100, paint);
|
||||||
|
|
||||||
SkMatrix local_matrix = SkMatrix::Translate(700, 200);
|
SkMatrix local_matrix = SkMatrix::Translate(700, 200);
|
||||||
DlImageColorSource image_source(
|
DlImageColorSource image_source(
|
||||||
image, DlTileMode::kRepeat, DlTileMode::kRepeat,
|
image, DlTileMode::kRepeat, DlTileMode::kRepeat,
|
||||||
DlImageSampling::kNearestNeighbor, &local_matrix);
|
DlImageSampling::kNearestNeighbor, &local_matrix);
|
||||||
paint.setColorSource(&image_source);
|
paint.setColorSource(&image_source);
|
||||||
builder.DrawCircle({800, 300}, 100, paint);
|
builder.DrawCircle(SkPoint{800, 300}, 100, paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -744,7 +744,7 @@ TEST_P(AiksTest, SolidColorCirclesOvalsRRectsMaskBlurCorrectly) {
|
|||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
Scalar x = (i + 1) * 100;
|
Scalar x = (i + 1) * 100;
|
||||||
Scalar radius = x / 10.0f;
|
Scalar radius = x / 10.0f;
|
||||||
builder.DrawCircle({x + 25, y + 25}, radius, paint);
|
builder.DrawCircle(SkPoint{x + 25, y + 25}, radius, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
@ -875,7 +875,7 @@ TEST_P(AiksTest, CanDrawPerspectiveTransformWithClips) {
|
|||||||
// 4. Draw a semi-translucent blue circle atop all previous draws.
|
// 4. Draw a semi-translucent blue circle atop all previous draws.
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kBlue().modulateOpacity(0.4));
|
paint.setColor(DlColor::kBlue().modulateOpacity(0.4));
|
||||||
builder.DrawCircle({}, 230, paint);
|
builder.DrawCircle(SkPoint{}, 230, paint);
|
||||||
}
|
}
|
||||||
builder.Restore(); // Restore translation.
|
builder.Restore(); // Restore translation.
|
||||||
|
|
||||||
@ -983,7 +983,7 @@ TEST_P(AiksTest, MatrixImageFilterDoesntCullWhenTranslatedFromOffscreen) {
|
|||||||
|
|
||||||
DlPaint circle_paint;
|
DlPaint circle_paint;
|
||||||
circle_paint.setColor(DlColor::kGreen());
|
circle_paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawCircle({-300, 0}, 100, circle_paint);
|
builder.DrawCircle(SkPoint{-300, 0}, 100, circle_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -1006,7 +1006,7 @@ TEST_P(AiksTest,
|
|||||||
|
|
||||||
DlPaint circle_paint;
|
DlPaint circle_paint;
|
||||||
circle_paint.setColor(DlColor::kGreen());
|
circle_paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawCircle({-150, 0}, 50, circle_paint);
|
builder.DrawCircle(SkPoint{-150, 0}, 50, circle_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -1058,7 +1058,7 @@ TEST_P(AiksTest, EmptySaveLayerRendersWithClear) {
|
|||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.Scale(GetContentScale().x, GetContentScale().y);
|
builder.Scale(GetContentScale().x, GetContentScale().y);
|
||||||
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
||||||
builder.DrawImage(image, {10, 10}, {});
|
builder.DrawImage(image, SkPoint{10, 10}, {});
|
||||||
builder.ClipRect(SkRect::MakeXYWH(100, 100, 200, 200));
|
builder.ClipRect(SkRect::MakeXYWH(100, 100, 200, 200));
|
||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
@ -1443,7 +1443,7 @@ TEST_P(AiksTest, SaveLayerFiltersScaleWithTransform) {
|
|||||||
auto texture = DlImageImpeller::Make(CreateTextureForFixture("boston.jpg"));
|
auto texture = DlImageImpeller::Make(CreateTextureForFixture("boston.jpg"));
|
||||||
auto draw_image_layer = [&builder, &texture](const DlPaint& paint) {
|
auto draw_image_layer = [&builder, &texture](const DlPaint& paint) {
|
||||||
builder.SaveLayer(nullptr, &paint);
|
builder.SaveLayer(nullptr, &paint);
|
||||||
builder.DrawImage(texture, {}, DlImageSampling::kLinear);
|
builder.DrawImage(texture, SkPoint{}, DlImageSampling::kLinear);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ TEST_P(AiksTest, DrawPaintWithAdvancedBlendOverFilter) {
|
|||||||
paint.setColor(DlColor::kWhite());
|
paint.setColor(DlColor::kWhite());
|
||||||
builder.DrawPaint(paint);
|
builder.DrawPaint(paint);
|
||||||
paint.setColor(DlColor::kBlack());
|
paint.setColor(DlColor::kBlack());
|
||||||
builder.DrawCircle({300, 300}, 200, paint);
|
builder.DrawCircle(SkPoint{300, 300}, 200, paint);
|
||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
paint.setBlendMode(DlBlendMode::kScreen);
|
paint.setBlendMode(DlBlendMode::kScreen);
|
||||||
builder.DrawPaint(paint);
|
builder.DrawPaint(paint);
|
||||||
@ -166,7 +166,7 @@ TEST_P(AiksTest, DrawAdvancedBlendPartlyOffscreen) {
|
|||||||
));
|
));
|
||||||
paint.setBlendMode(DlBlendMode::kLighten);
|
paint.setBlendMode(DlBlendMode::kLighten);
|
||||||
|
|
||||||
builder.DrawCircle({100, 100}, 100, paint);
|
builder.DrawCircle(SkPoint{100, 100}, 100, paint);
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,21 +176,21 @@ TEST_P(AiksTest, PaintBlendModeIsRespected) {
|
|||||||
// Default is kSourceOver.
|
// Default is kSourceOver.
|
||||||
|
|
||||||
paint.setColor(DlColor::RGBA(1, 0, 0, 0.5));
|
paint.setColor(DlColor::RGBA(1, 0, 0, 0.5));
|
||||||
builder.DrawCircle({150, 200}, 100, paint);
|
builder.DrawCircle(SkPoint{150, 200}, 100, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::RGBA(0, 1, 0, 0.5));
|
paint.setColor(DlColor::RGBA(0, 1, 0, 0.5));
|
||||||
builder.DrawCircle({250, 200}, 100, paint);
|
builder.DrawCircle(SkPoint{250, 200}, 100, paint);
|
||||||
|
|
||||||
paint.setBlendMode(DlBlendMode::kPlus);
|
paint.setBlendMode(DlBlendMode::kPlus);
|
||||||
|
|
||||||
paint.setColor(DlColor::kRed());
|
paint.setColor(DlColor::kRed());
|
||||||
builder.DrawCircle({450, 250}, 100, paint);
|
builder.DrawCircle(SkPoint{450, 250}, 100, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawCircle({550, 250}, 100, paint);
|
builder.DrawCircle(SkPoint{550, 250}, 100, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kBlue());
|
paint.setColor(DlColor::kBlue());
|
||||||
builder.DrawCircle({500, 150}, 100, paint);
|
builder.DrawCircle(SkPoint{500, 150}, 100, paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -225,8 +225,8 @@ TEST_P(AiksTest, ColorFilterBlend) {
|
|||||||
builder.Scale(0.4, 0.4);
|
builder.Scale(0.4, 0.4);
|
||||||
{
|
{
|
||||||
DlPaint dstPaint;
|
DlPaint dstPaint;
|
||||||
builder.DrawImage(dst_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(dst_image, SkPoint{0, 0},
|
||||||
&dstPaint);
|
DlImageSampling::kMipmapLinear, &dstPaint);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DlPaint srcPaint;
|
DlPaint srcPaint;
|
||||||
@ -237,8 +237,8 @@ TEST_P(AiksTest, ColorFilterBlend) {
|
|||||||
DlBlendMode::kSrcIn);
|
DlBlendMode::kSrcIn);
|
||||||
srcPaint.setColorFilter(color_filter);
|
srcPaint.setColorFilter(color_filter);
|
||||||
}
|
}
|
||||||
builder.DrawImage(src_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(src_image, SkPoint{0, 0},
|
||||||
&srcPaint);
|
DlImageSampling::kMipmapLinear, &srcPaint);
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
}
|
}
|
||||||
@ -282,8 +282,8 @@ TEST_P(AiksTest, ColorFilterAdvancedBlend) {
|
|||||||
builder.Scale(0.4, 0.4);
|
builder.Scale(0.4, 0.4);
|
||||||
{
|
{
|
||||||
DlPaint dstPaint;
|
DlPaint dstPaint;
|
||||||
builder.DrawImage(dst_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(dst_image, SkPoint{0, 0},
|
||||||
&dstPaint);
|
DlImageSampling::kMipmapLinear, &dstPaint);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DlPaint srcPaint;
|
DlPaint srcPaint;
|
||||||
@ -294,8 +294,8 @@ TEST_P(AiksTest, ColorFilterAdvancedBlend) {
|
|||||||
DlBlendMode::kSrcIn);
|
DlBlendMode::kSrcIn);
|
||||||
srcPaint.setColorFilter(color_filter);
|
srcPaint.setColorFilter(color_filter);
|
||||||
}
|
}
|
||||||
builder.DrawImage(src_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(src_image, SkPoint{0, 0},
|
||||||
&srcPaint);
|
DlImageSampling::kMipmapLinear, &srcPaint);
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
}
|
}
|
||||||
@ -373,8 +373,8 @@ TEST_P(AiksTest, ColorFilterAdvancedBlendNoFbFetch) {
|
|||||||
builder.Scale(0.4, 0.4);
|
builder.Scale(0.4, 0.4);
|
||||||
{
|
{
|
||||||
DlPaint dstPaint;
|
DlPaint dstPaint;
|
||||||
builder.DrawImage(dst_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(dst_image, SkPoint{0, 0},
|
||||||
&dstPaint);
|
DlImageSampling::kMipmapLinear, &dstPaint);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DlPaint srcPaint;
|
DlPaint srcPaint;
|
||||||
@ -385,8 +385,8 @@ TEST_P(AiksTest, ColorFilterAdvancedBlendNoFbFetch) {
|
|||||||
DlBlendMode::kMultiply);
|
DlBlendMode::kMultiply);
|
||||||
srcPaint.setColorFilter(color_filter);
|
srcPaint.setColorFilter(color_filter);
|
||||||
}
|
}
|
||||||
builder.DrawImage(src_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(src_image, SkPoint{0, 0},
|
||||||
&srcPaint);
|
DlImageSampling::kMipmapLinear, &srcPaint);
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
}
|
}
|
||||||
@ -493,7 +493,7 @@ TEST_P(AiksTest, ClearBlend) {
|
|||||||
DlPaint clear;
|
DlPaint clear;
|
||||||
clear.setBlendMode(DlBlendMode::kClear);
|
clear.setBlendMode(DlBlendMode::kClear);
|
||||||
|
|
||||||
builder.DrawCircle({300.0, 300.0}, 200.0, clear);
|
builder.DrawCircle(SkPoint{300.0, 300.0}, 200.0, clear);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -616,12 +616,12 @@ static sk_sp<DisplayList> BlendModeTest(Vector2 content_scale,
|
|||||||
builder.Save();
|
builder.Save();
|
||||||
builder.SaveLayer(nullptr, &paint);
|
builder.SaveLayer(nullptr, &paint);
|
||||||
{
|
{
|
||||||
builder.DrawImage(dst_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(dst_image, SkPoint{0, 0}, DlImageSampling::kMipmapLinear,
|
||||||
&paint);
|
&paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kWhite().withAlpha(src_alpha * 255));
|
paint.setColor(DlColor::kWhite().withAlpha(src_alpha * 255));
|
||||||
paint.setBlendMode(static_cast<DlBlendMode>(blend_mode));
|
paint.setBlendMode(static_cast<DlBlendMode>(blend_mode));
|
||||||
builder.DrawImage(src_image, {0, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(src_image, SkPoint{0, 0}, DlImageSampling::kMipmapLinear,
|
||||||
&paint);
|
&paint);
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
@ -633,16 +633,16 @@ static sk_sp<DisplayList> BlendModeTest(Vector2 content_scale,
|
|||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
{
|
{
|
||||||
builder.DrawImage(dst_image, {400, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(dst_image, SkPoint{400, 0},
|
||||||
nullptr);
|
DlImageSampling::kMipmapLinear, nullptr);
|
||||||
|
|
||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
save_paint.setColor(DlColor::kWhite().withAlpha(src_alpha * 255));
|
save_paint.setColor(DlColor::kWhite().withAlpha(src_alpha * 255));
|
||||||
save_paint.setBlendMode(static_cast<DlBlendMode>(blend_mode));
|
save_paint.setBlendMode(static_cast<DlBlendMode>(blend_mode));
|
||||||
builder.SaveLayer(nullptr, &save_paint);
|
builder.SaveLayer(nullptr, &save_paint);
|
||||||
{
|
{
|
||||||
builder.DrawImage(src_image, {400, 0}, DlImageSampling::kMipmapLinear,
|
builder.DrawImage(src_image, SkPoint{400, 0},
|
||||||
nullptr);
|
DlImageSampling::kMipmapLinear, nullptr);
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ TEST_P(AiksTest, ForegroundPipelineBlendAppliesTransformCorrectly) {
|
|||||||
DlColor::RGBA(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f),
|
DlColor::RGBA(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f),
|
||||||
DlBlendMode::kSrcIn));
|
DlBlendMode::kSrcIn));
|
||||||
|
|
||||||
builder.DrawImage(DlImageImpeller::Make(texture), {200, 200},
|
builder.DrawImage(DlImageImpeller::Make(texture), SkPoint{200, 200},
|
||||||
DlImageSampling::kMipmapLinear, &image_paint);
|
DlImageSampling::kMipmapLinear, &image_paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -742,7 +742,7 @@ TEST_P(AiksTest, ForegroundAdvancedBlendAppliesTransformCorrectly) {
|
|||||||
DlColor::RGBA(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f),
|
DlColor::RGBA(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f, 1.0f),
|
||||||
DlBlendMode::kColorDodge));
|
DlBlendMode::kColorDodge));
|
||||||
|
|
||||||
builder.DrawImage(DlImageImpeller::Make(texture), {200, 200},
|
builder.DrawImage(DlImageImpeller::Make(texture), SkPoint{200, 200},
|
||||||
DlImageSampling::kMipmapLinear, &image_paint);
|
DlImageSampling::kMipmapLinear, &image_paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -765,7 +765,7 @@ TEST_P(AiksTest, FramebufferAdvancedBlendCoverage) {
|
|||||||
DlPaint image_paint;
|
DlPaint image_paint;
|
||||||
image_paint.setBlendMode(DlBlendMode::kMultiply);
|
image_paint.setBlendMode(DlBlendMode::kMultiply);
|
||||||
|
|
||||||
builder.DrawImage(DlImageImpeller::Make(texture), {20, 20},
|
builder.DrawImage(DlImageImpeller::Make(texture), SkPoint{20, 20},
|
||||||
DlImageSampling::kMipmapLinear, &image_paint);
|
DlImageSampling::kMipmapLinear, &image_paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
|
@ -88,8 +88,8 @@ sk_sp<flutter::DisplayList> DoGradientOvalStrokeMaskBlur(Vector2 content_Scale,
|
|||||||
{
|
{
|
||||||
DlPaint line_paint;
|
DlPaint line_paint;
|
||||||
line_paint.setColor(DlColor::kWhite());
|
line_paint.setColor(DlColor::kWhite());
|
||||||
builder.DrawLine({100, 0}, {100, 60}, line_paint);
|
builder.DrawLine(SkPoint{100, 0}, SkPoint{100, 60}, line_paint);
|
||||||
builder.DrawLine({0, 30}, {200, 30}, line_paint);
|
builder.DrawLine(SkPoint{0, 30}, SkPoint{200, 30}, line_paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkRRect rrect =
|
SkRRect rrect =
|
||||||
@ -156,7 +156,7 @@ TEST_P(AiksTest, CanRenderMaskBlurHugeSigma) {
|
|||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
paint.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 99999));
|
paint.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 99999));
|
||||||
builder.DrawCircle({400, 400}, 300, paint);
|
builder.DrawCircle(SkPoint{400, 400}, 300, paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -176,7 +176,7 @@ TEST_P(AiksTest, CanRenderForegroundBlendWithMaskBlur) {
|
|||||||
DlBlurMaskFilter::Make(DlBlurStyle::kNormal, sigma.sigma));
|
DlBlurMaskFilter::Make(DlBlurStyle::kNormal, sigma.sigma));
|
||||||
paint.setColorFilter(
|
paint.setColorFilter(
|
||||||
DlBlendColorFilter::Make(DlColor::kGreen(), DlBlendMode::kSrc));
|
DlBlendColorFilter::Make(DlColor::kGreen(), DlBlendMode::kSrc));
|
||||||
builder.DrawCircle({400, 400}, 200, paint);
|
builder.DrawCircle(SkPoint{400, 400}, 200, paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ TEST_P(AiksTest, CanRenderForegroundAdvancedBlendWithMaskBlur) {
|
|||||||
DlBlurMaskFilter::Make(DlBlurStyle::kNormal, sigma.sigma));
|
DlBlurMaskFilter::Make(DlBlurStyle::kNormal, sigma.sigma));
|
||||||
paint.setColorFilter(
|
paint.setColorFilter(
|
||||||
DlBlendColorFilter::Make(DlColor::kGreen(), DlBlendMode::kColor));
|
DlBlendColorFilter::Make(DlColor::kGreen(), DlBlendMode::kColor));
|
||||||
builder.DrawCircle({400, 400}, 200, paint);
|
builder.DrawCircle(SkPoint{400, 400}, 200, paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -211,16 +211,16 @@ TEST_P(AiksTest, CanRenderBackdropBlurInteractive) {
|
|||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kCornflowerBlue());
|
paint.setColor(DlColor::kCornflowerBlue());
|
||||||
builder.DrawCircle({100, 100}, 50, paint);
|
builder.DrawCircle(SkPoint{100, 100}, 50, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kGreenYellow());
|
paint.setColor(DlColor::kGreenYellow());
|
||||||
builder.DrawCircle({300, 200}, 100, paint);
|
builder.DrawCircle(SkPoint{300, 200}, 100, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kDarkMagenta());
|
paint.setColor(DlColor::kDarkMagenta());
|
||||||
builder.DrawCircle({140, 170}, 75, paint);
|
builder.DrawCircle(SkPoint{140, 170}, 75, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kOrangeRed());
|
paint.setColor(DlColor::kOrangeRed());
|
||||||
builder.DrawCircle({180, 120}, 100, paint);
|
builder.DrawCircle(SkPoint{180, 120}, 100, paint);
|
||||||
|
|
||||||
SkRRect rrect =
|
SkRRect rrect =
|
||||||
SkRRect::MakeRectXY(SkRect::MakeLTRB(a.x, a.y, b.x, b.y), 20, 20);
|
SkRRect::MakeRectXY(SkRect::MakeLTRB(a.x, a.y, b.x, b.y), 20, 20);
|
||||||
@ -244,16 +244,16 @@ TEST_P(AiksTest, CanRenderBackdropBlur) {
|
|||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kCornflowerBlue());
|
paint.setColor(DlColor::kCornflowerBlue());
|
||||||
builder.DrawCircle({100, 100}, 50, paint);
|
builder.DrawCircle(SkPoint{100, 100}, 50, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kGreenYellow());
|
paint.setColor(DlColor::kGreenYellow());
|
||||||
builder.DrawCircle({300, 200}, 100, paint);
|
builder.DrawCircle(SkPoint{300, 200}, 100, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kDarkMagenta());
|
paint.setColor(DlColor::kDarkMagenta());
|
||||||
builder.DrawCircle({140, 170}, 75, paint);
|
builder.DrawCircle(SkPoint{140, 170}, 75, paint);
|
||||||
|
|
||||||
paint.setColor(DlColor::kOrangeRed());
|
paint.setColor(DlColor::kOrangeRed());
|
||||||
builder.DrawCircle({180, 120}, 100, paint);
|
builder.DrawCircle(SkPoint{180, 120}, 100, paint);
|
||||||
|
|
||||||
SkRRect rrect =
|
SkRRect rrect =
|
||||||
SkRRect::MakeRectXY(SkRect::MakeLTRB(75, 50, 375, 275), 20, 20);
|
SkRRect::MakeRectXY(SkRect::MakeLTRB(75, 50, 375, 275), 20, 20);
|
||||||
@ -273,7 +273,7 @@ TEST_P(AiksTest, CanRenderBackdropBlurHugeSigma) {
|
|||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawCircle({400, 400}, 300, paint);
|
builder.DrawCircle(SkPoint{400, 400}, 300, paint);
|
||||||
|
|
||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
save_paint.setBlendMode(DlBlendMode::kSrc);
|
save_paint.setBlendMode(DlBlendMode::kSrc);
|
||||||
@ -293,7 +293,7 @@ TEST_P(AiksTest, CanRenderClippedBlur) {
|
|||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
paint.setImageFilter(DlBlurImageFilter::Make(20, 20, DlTileMode::kDecal));
|
paint.setImageFilter(DlBlurImageFilter::Make(20, 20, DlTileMode::kDecal));
|
||||||
builder.DrawCircle({400, 400}, 200, paint);
|
builder.DrawCircle(SkPoint{400, 400}, 200, paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -350,7 +350,7 @@ TEST_P(AiksTest, ClearBlendWithBlur) {
|
|||||||
clear.setBlendMode(DlBlendMode::kClear);
|
clear.setBlendMode(DlBlendMode::kClear);
|
||||||
clear.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 20));
|
clear.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 20));
|
||||||
|
|
||||||
builder.DrawCircle({300.0, 300.0}, 200.0, clear);
|
builder.DrawCircle(SkPoint{300.0, 300.0}, 200.0, clear);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ TEST_P(AiksTest, MaskBlurWithZeroSigmaIsSkipped) {
|
|||||||
paint.setColor(DlColor::kBlue());
|
paint.setColor(DlColor::kBlue());
|
||||||
paint.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 0));
|
paint.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 0));
|
||||||
|
|
||||||
builder.DrawCircle({300, 300}, 200, paint);
|
builder.DrawCircle(SkPoint{300, 300}, 200, paint);
|
||||||
builder.DrawRect(SkRect::MakeLTRB(100, 300, 500, 600), paint);
|
builder.DrawRect(SkRect::MakeLTRB(100, 300, 500, 600), paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -434,7 +434,7 @@ static sk_sp<DisplayList> MaskBlurVariantTest(
|
|||||||
|
|
||||||
y += y_spacing;
|
y += y_spacing;
|
||||||
paint.setColor(DlColor::kBlue().withAlpha(alpha));
|
paint.setColor(DlColor::kBlue().withAlpha(alpha));
|
||||||
builder.DrawCircle({x + 25, y + 25}, radius, paint);
|
builder.DrawCircle(SkPoint{x + 25, y + 25}, radius, paint);
|
||||||
|
|
||||||
y += y_spacing;
|
y += y_spacing;
|
||||||
paint.setColor(DlColor::kGreen().withAlpha(alpha));
|
paint.setColor(DlColor::kGreen().withAlpha(alpha));
|
||||||
@ -643,7 +643,7 @@ TEST_P(AiksTest, MaskBlurTexture) {
|
|||||||
|
|
||||||
builder.DrawImage(
|
builder.DrawImage(
|
||||||
DlImageImpeller::Make(CreateTextureForFixture("boston.jpg")),
|
DlImageImpeller::Make(CreateTextureForFixture("boston.jpg")),
|
||||||
{200, 200}, DlImageSampling::kNearestNeighbor, &paint);
|
SkPoint{200, 200}, DlImageSampling::kNearestNeighbor, &paint);
|
||||||
|
|
||||||
DlPaint red;
|
DlPaint red;
|
||||||
red.setColor(DlColor::kRed());
|
red.setColor(DlColor::kRed());
|
||||||
@ -1000,7 +1000,7 @@ TEST_P(AiksTest, GaussianBlurOneDimension) {
|
|||||||
builder.Scale(0.5, 0.5);
|
builder.Scale(0.5, 0.5);
|
||||||
|
|
||||||
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
|
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
|
||||||
builder.DrawImage(DlImageImpeller::Make(boston), {100, 100}, {});
|
builder.DrawImage(DlImageImpeller::Make(boston), SkPoint{100, 100}, {});
|
||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setBlendMode(DlBlendMode::kSrc);
|
paint.setBlendMode(DlBlendMode::kSrc);
|
||||||
@ -1250,7 +1250,7 @@ TEST_P(AiksTest, GaussianBlurBackdropTinyMipMap) {
|
|||||||
auto blur_filter = DlBlurImageFilter::Make(0.1, 0.1, DlTileMode::kDecal);
|
auto blur_filter = DlBlurImageFilter::Make(0.1, 0.1, DlTileMode::kDecal);
|
||||||
paint.setImageFilter(blur_filter);
|
paint.setImageFilter(blur_filter);
|
||||||
|
|
||||||
builder.DrawCircle({400, 400}, 200, paint);
|
builder.DrawCircle(SkPoint{400, 400}, 200, paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
auto image = DisplayListToTexture(builder.Build(), {1024, 768}, renderer);
|
auto image = DisplayListToTexture(builder.Build(), {1024, 768}, renderer);
|
||||||
|
@ -362,7 +362,7 @@ TEST_P(AiksTest, CanRenderLinearGradientMaskBlur) {
|
|||||||
DlTileMode::kClamp));
|
DlTileMode::kClamp));
|
||||||
paint.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 20));
|
paint.setMaskFilter(DlBlurMaskFilter::Make(DlBlurStyle::kNormal, 20));
|
||||||
|
|
||||||
builder.DrawCircle({300, 300}, 200, paint);
|
builder.DrawCircle(SkPoint{300, 300}, 200, paint);
|
||||||
builder.DrawRect(SkRect::MakeLTRB(100, 300, 500, 600), paint);
|
builder.DrawRect(SkRect::MakeLTRB(100, 300, 500, 600), paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
|
@ -168,8 +168,8 @@ TEST_P(AiksTest, CanRenderDifferencePaths) {
|
|||||||
path.setFillType(SkPathFillType::kEvenOdd);
|
path.setFillType(SkPathFillType::kEvenOdd);
|
||||||
|
|
||||||
builder.DrawImage(
|
builder.DrawImage(
|
||||||
DlImageImpeller::Make(CreateTextureForFixture("boston.jpg")), {10, 10},
|
DlImageImpeller::Make(CreateTextureForFixture("boston.jpg")),
|
||||||
{});
|
SkPoint{10, 10}, {});
|
||||||
builder.DrawPath(path, paint);
|
builder.DrawPath(path, paint);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -317,7 +317,7 @@ TEST_P(AiksTest, DrawLinesRenderCorrectly) {
|
|||||||
{DlStrokeCap::kButt, DlStrokeCap::kSquare, DlStrokeCap::kRound}) {
|
{DlStrokeCap::kButt, DlStrokeCap::kSquare, DlStrokeCap::kRound}) {
|
||||||
paint.setStrokeCap(cap);
|
paint.setStrokeCap(cap);
|
||||||
SkPoint origin = {100, 100};
|
SkPoint origin = {100, 100};
|
||||||
builder.DrawLine({150, 100}, {250, 100}, paint);
|
builder.DrawLine(SkPoint{150, 100}, SkPoint{250, 100}, paint);
|
||||||
for (int d = 15; d < 90; d += 15) {
|
for (int d = 15; d < 90; d += 15) {
|
||||||
Matrix m = Matrix::MakeRotationZ(Degrees(d));
|
Matrix m = Matrix::MakeRotationZ(Degrees(d));
|
||||||
Point origin = {100, 100};
|
Point origin = {100, 100};
|
||||||
@ -329,10 +329,10 @@ TEST_P(AiksTest, DrawLinesRenderCorrectly) {
|
|||||||
builder.DrawLine(SkPoint::Make(a.x, a.y), SkPoint::Make(b.x, b.y),
|
builder.DrawLine(SkPoint::Make(a.x, a.y), SkPoint::Make(b.x, b.y),
|
||||||
paint);
|
paint);
|
||||||
}
|
}
|
||||||
builder.DrawLine({100, 150}, {100, 250}, paint);
|
builder.DrawLine(SkPoint{100, 150}, SkPoint{100, 250}, paint);
|
||||||
builder.DrawCircle({origin}, 35, paint);
|
builder.DrawCircle({origin}, 35, paint);
|
||||||
|
|
||||||
builder.DrawLine({250, 250}, {250, 250}, paint);
|
builder.DrawLine(SkPoint{250, 250}, SkPoint{250, 250}, paint);
|
||||||
|
|
||||||
builder.Translate(250, 0);
|
builder.Translate(250, 0);
|
||||||
}
|
}
|
||||||
|
@ -242,12 +242,12 @@ TEST_P(AiksTest, TranslucentSaveLayerImageDrawsCorrectly) {
|
|||||||
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
||||||
|
|
||||||
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
||||||
builder.DrawImage(image, {100, 100}, DlImageSampling::kMipmapLinear);
|
builder.DrawImage(image, SkPoint{100, 100}, DlImageSampling::kMipmapLinear);
|
||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
paint.setColor(DlColor::kBlack().withAlpha(128));
|
paint.setColor(DlColor::kBlack().withAlpha(128));
|
||||||
builder.SaveLayer(nullptr, &paint);
|
builder.SaveLayer(nullptr, &paint);
|
||||||
builder.DrawImage(image, {100, 500}, DlImageSampling::kMipmapLinear);
|
builder.DrawImage(image, SkPoint{100, 500}, DlImageSampling::kMipmapLinear);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -257,7 +257,7 @@ TEST_P(AiksTest, TranslucentSaveLayerWithColorMatrixColorFilterDrawsCorrectly) {
|
|||||||
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
||||||
|
|
||||||
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
||||||
builder.DrawImage(image, {100, 100}, {});
|
builder.DrawImage(image, SkPoint{100, 100}, {});
|
||||||
|
|
||||||
const float matrix[20] = {
|
const float matrix[20] = {
|
||||||
1, 0, 0, 0, 0, //
|
1, 0, 0, 0, 0, //
|
||||||
@ -269,7 +269,7 @@ TEST_P(AiksTest, TranslucentSaveLayerWithColorMatrixColorFilterDrawsCorrectly) {
|
|||||||
paint.setColor(DlColor::kBlack().withAlpha(128));
|
paint.setColor(DlColor::kBlack().withAlpha(128));
|
||||||
paint.setColorFilter(DlMatrixColorFilter::Make(matrix));
|
paint.setColorFilter(DlMatrixColorFilter::Make(matrix));
|
||||||
builder.SaveLayer(nullptr, &paint);
|
builder.SaveLayer(nullptr, &paint);
|
||||||
builder.DrawImage(image, {100, 500}, {});
|
builder.DrawImage(image, SkPoint{100, 500}, {});
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -279,7 +279,7 @@ TEST_P(AiksTest, TranslucentSaveLayerWithColorMatrixImageFilterDrawsCorrectly) {
|
|||||||
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
||||||
|
|
||||||
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
||||||
builder.DrawImage(image, {100, 100}, {});
|
builder.DrawImage(image, SkPoint{100, 100}, {});
|
||||||
|
|
||||||
const float matrix[20] = {
|
const float matrix[20] = {
|
||||||
1, 0, 0, 0, 0, //
|
1, 0, 0, 0, 0, //
|
||||||
@ -291,7 +291,7 @@ TEST_P(AiksTest, TranslucentSaveLayerWithColorMatrixImageFilterDrawsCorrectly) {
|
|||||||
paint.setColor(DlColor::kBlack().withAlpha(128));
|
paint.setColor(DlColor::kBlack().withAlpha(128));
|
||||||
paint.setColorFilter(DlMatrixColorFilter::Make(matrix));
|
paint.setColorFilter(DlMatrixColorFilter::Make(matrix));
|
||||||
builder.SaveLayer(nullptr, &paint);
|
builder.SaveLayer(nullptr, &paint);
|
||||||
builder.DrawImage(image, {100, 500}, {});
|
builder.DrawImage(image, SkPoint{100, 500}, {});
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -302,7 +302,7 @@ TEST_P(AiksTest,
|
|||||||
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
DisplayListBuilder builder(GetCullRect(GetWindowSize()));
|
||||||
|
|
||||||
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
auto image = DlImageImpeller::Make(CreateTextureForFixture("airplane.jpg"));
|
||||||
builder.DrawImage(image, {100, 100}, {});
|
builder.DrawImage(image, SkPoint{100, 100}, {});
|
||||||
|
|
||||||
const float matrix[20] = {
|
const float matrix[20] = {
|
||||||
1, 0, 0, 0, 0, //
|
1, 0, 0, 0, 0, //
|
||||||
@ -317,7 +317,7 @@ TEST_P(AiksTest,
|
|||||||
paint.setColorFilter(
|
paint.setColorFilter(
|
||||||
DlBlendColorFilter::Make(DlColor::kGreen(), DlBlendMode::kModulate));
|
DlBlendColorFilter::Make(DlColor::kGreen(), DlBlendMode::kModulate));
|
||||||
builder.SaveLayer(nullptr, &paint);
|
builder.SaveLayer(nullptr, &paint);
|
||||||
builder.DrawImage(image, {100, 500}, {});
|
builder.DrawImage(image, SkPoint{100, 500}, {});
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -337,7 +337,7 @@ TEST_P(AiksTest, TranslucentSaveLayerWithAdvancedBlendModeDrawsCorrectly) {
|
|||||||
|
|
||||||
DlPaint draw_paint;
|
DlPaint draw_paint;
|
||||||
draw_paint.setColor(DlColor::kGreen());
|
draw_paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawCircle({200, 200}, 100, draw_paint);
|
builder.DrawCircle(SkPoint{200, 200}, 100, draw_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -358,10 +358,10 @@ TEST_P(AiksTest, CanRenderTinyOverlappingSubpasses) {
|
|||||||
|
|
||||||
DlPaint yellow_paint;
|
DlPaint yellow_paint;
|
||||||
yellow_paint.setColor(DlColor::kYellow());
|
yellow_paint.setColor(DlColor::kYellow());
|
||||||
builder.DrawCircle({100, 100}, 0.1, yellow_paint);
|
builder.DrawCircle(SkPoint{100, 100}, 0.1, yellow_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
builder.SaveLayer({});
|
builder.SaveLayer({});
|
||||||
builder.DrawCircle({100, 100}, 0.1, yellow_paint);
|
builder.DrawCircle(SkPoint{100, 100}, 0.1, yellow_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
DlPaint draw_paint;
|
DlPaint draw_paint;
|
||||||
@ -387,7 +387,7 @@ TEST_P(AiksTest, CanRenderDestructiveSaveLayer) {
|
|||||||
|
|
||||||
DlPaint draw_paint;
|
DlPaint draw_paint;
|
||||||
draw_paint.setColor(DlColor::kGreen());
|
draw_paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawCircle({300, 300}, 100, draw_paint);
|
builder.DrawCircle(SkPoint{300, 300}, 100, draw_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -576,7 +576,7 @@ TEST_P(AiksTest, SetContentsWithRegion) {
|
|||||||
auto image = DlImageImpeller::Make(bridge);
|
auto image = DlImageImpeller::Make(bridge);
|
||||||
|
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
builder.DrawImage(image, {0, 0}, {});
|
builder.DrawImage(image, SkPoint{0, 0}, {});
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -639,7 +639,8 @@ TEST_P(AiksTest, MatrixImageFilterMagnify) {
|
|||||||
|
|
||||||
DlPaint rect_paint;
|
DlPaint rect_paint;
|
||||||
rect_paint.setAlpha(0.5 * 255);
|
rect_paint.setAlpha(0.5 * 255);
|
||||||
builder.DrawImage(image, {0, 0}, DlImageSampling::kLinear, &rect_paint);
|
builder.DrawImage(image, SkPoint{0, 0}, DlImageSampling::kLinear,
|
||||||
|
&rect_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
@ -782,7 +783,7 @@ TEST_P(AiksTest, MatrixSaveLayerFilter) {
|
|||||||
{
|
{
|
||||||
paint.setColor(DlColor::kGreen().withAlpha(255 * 0.5));
|
paint.setColor(DlColor::kGreen().withAlpha(255 * 0.5));
|
||||||
paint.setBlendMode(DlBlendMode::kPlus);
|
paint.setBlendMode(DlBlendMode::kPlus);
|
||||||
builder.DrawCircle({200, 200}, 100, paint);
|
builder.DrawCircle(SkPoint{200, 200}, 100, paint);
|
||||||
// Should render a second circle, centered on the bottom-right-most edge of
|
// Should render a second circle, centered on the bottom-right-most edge of
|
||||||
// the circle.
|
// the circle.
|
||||||
|
|
||||||
@ -799,7 +800,7 @@ TEST_P(AiksTest, MatrixSaveLayerFilter) {
|
|||||||
DlPaint circle_paint;
|
DlPaint circle_paint;
|
||||||
circle_paint.setColor(DlColor::kGreen().withAlpha(255 * 0.5));
|
circle_paint.setColor(DlColor::kGreen().withAlpha(255 * 0.5));
|
||||||
circle_paint.setBlendMode(DlBlendMode::kPlus);
|
circle_paint.setBlendMode(DlBlendMode::kPlus);
|
||||||
builder.DrawCircle({200, 200}, 100, circle_paint);
|
builder.DrawCircle(SkPoint{200, 200}, 100, circle_paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
}
|
}
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
@ -941,7 +942,7 @@ TEST_P(AiksTest, CanPictureConvertToImage) {
|
|||||||
auto image =
|
auto image =
|
||||||
DisplayListToTexture(recorder_canvas.Build(), {1000, 1000}, renderer);
|
DisplayListToTexture(recorder_canvas.Build(), {1000, 1000}, renderer);
|
||||||
if (image) {
|
if (image) {
|
||||||
canvas.DrawImage(DlImageImpeller::Make(image), {}, {});
|
canvas.DrawImage(DlImageImpeller::Make(image), SkPoint{}, {});
|
||||||
paint.setColor(DlColor::RGBA(0.1, 0.1, 0.1, 0.2));
|
paint.setColor(DlColor::RGBA(0.1, 0.1, 0.1, 0.2));
|
||||||
canvas.DrawRect(SkRect::MakeSize({1000, 1000}), paint);
|
canvas.DrawRect(SkRect::MakeSize({1000, 1000}), paint);
|
||||||
}
|
}
|
||||||
@ -965,7 +966,8 @@ TEST_P(AiksTest, CanEmptyPictureConvertToImage) {
|
|||||||
auto result_image =
|
auto result_image =
|
||||||
DisplayListToTexture(builder.Build(), ISize{1000, 1000}, renderer);
|
DisplayListToTexture(builder.Build(), ISize{1000, 1000}, renderer);
|
||||||
if (result_image) {
|
if (result_image) {
|
||||||
recorder_builder.DrawImage(DlImageImpeller::Make(result_image), {}, {});
|
recorder_builder.DrawImage(DlImageImpeller::Make(result_image), SkPoint{},
|
||||||
|
{});
|
||||||
|
|
||||||
paint.setColor(DlColor::RGBA(0.1, 0.1, 0.1, 0.2));
|
paint.setColor(DlColor::RGBA(0.1, 0.1, 0.1, 0.2));
|
||||||
recorder_builder.DrawRect(SkRect::MakeSize({1000, 1000}), paint);
|
recorder_builder.DrawRect(SkRect::MakeSize({1000, 1000}), paint);
|
||||||
|
@ -705,7 +705,7 @@ TEST_P(DisplayListTest, CanDrawBackdropFilter) {
|
|||||||
paint.setStrokeJoin(flutter::DlStrokeJoin::kBevel);
|
paint.setStrokeJoin(flutter::DlStrokeJoin::kBevel);
|
||||||
paint.setStrokeWidth(10);
|
paint.setStrokeWidth(10);
|
||||||
paint.setColor(flutter::DlColor::kRed().withAlpha(100));
|
paint.setColor(flutter::DlColor::kRed().withAlpha(100));
|
||||||
builder.DrawCircle({circle_center.x, circle_center.y}, 100, paint);
|
builder.DrawCircle(SkPoint{circle_center.x, circle_center.y}, 100, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
@ -854,7 +854,7 @@ TEST_P(DisplayListTest, CanDrawZeroLengthLine) {
|
|||||||
SkPath path = SkPath().addPoly({{150, 50}, {150, 50}}, false);
|
SkPath path = SkPath().addPoly({{150, 50}, {150, 50}}, false);
|
||||||
for (auto cap : caps) {
|
for (auto cap : caps) {
|
||||||
paint.setStrokeCap(cap);
|
paint.setStrokeCap(cap);
|
||||||
builder.DrawLine({50, 50}, {50, 50}, paint);
|
builder.DrawLine(SkPoint{50, 50}, SkPoint{50, 50}, paint);
|
||||||
builder.DrawPath(path, paint);
|
builder.DrawPath(path, paint);
|
||||||
builder.Translate(0, 150);
|
builder.Translate(0, 150);
|
||||||
}
|
}
|
||||||
@ -931,11 +931,11 @@ TEST_P(DisplayListTest, CanDrawZeroWidthLine) {
|
|||||||
SkPath path = SkPath().addPoly({{150, 50}, {160, 50}}, false);
|
SkPath path = SkPath().addPoly({{150, 50}, {160, 50}}, false);
|
||||||
for (auto cap : caps) {
|
for (auto cap : caps) {
|
||||||
paint.setStrokeCap(cap);
|
paint.setStrokeCap(cap);
|
||||||
builder.DrawLine({50, 50}, {60, 50}, paint);
|
builder.DrawLine(SkPoint{50, 50}, SkPoint{60, 50}, paint);
|
||||||
builder.DrawRect({45, 45, 65, 55}, outline_paint);
|
builder.DrawRect(SkRect{45, 45, 65, 55}, outline_paint);
|
||||||
builder.DrawLine({100, 50}, {100, 50}, paint);
|
builder.DrawLine(SkPoint{100, 50}, SkPoint{100, 50}, paint);
|
||||||
if (cap != flutter::DlStrokeCap::kButt) {
|
if (cap != flutter::DlStrokeCap::kButt) {
|
||||||
builder.DrawRect({95, 45, 105, 55}, outline_paint);
|
builder.DrawRect(SkRect{95, 45, 105, 55}, outline_paint);
|
||||||
}
|
}
|
||||||
builder.DrawPath(path, paint);
|
builder.DrawPath(path, paint);
|
||||||
builder.DrawRect(path.getBounds().makeOutset(5, 5), outline_paint);
|
builder.DrawRect(path.getBounds().makeOutset(5, 5), outline_paint);
|
||||||
@ -1034,7 +1034,7 @@ TEST_P(DisplayListTest, CanDrawWithMatrixFilter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.DrawImage(DlImageImpeller::Make(boston), {},
|
builder.DrawImage(DlImageImpeller::Make(boston), SkPoint{},
|
||||||
flutter::DlImageSampling::kLinear, &paint);
|
flutter::DlImageSampling::kLinear, &paint);
|
||||||
}
|
}
|
||||||
if (enable_savelayer) {
|
if (enable_savelayer) {
|
||||||
@ -1320,8 +1320,8 @@ TEST_P(DisplayListTest, DrawShapes) {
|
|||||||
builder.DrawRRect(
|
builder.DrawRRect(
|
||||||
SkRRect::MakeRectXY(SkRect::MakeXYWH(150, 150, 100, 100), 30, 30),
|
SkRRect::MakeRectXY(SkRect::MakeXYWH(150, 150, 100, 100), 30, 30),
|
||||||
stroke_paint);
|
stroke_paint);
|
||||||
builder.DrawCircle({350, 50}, 50, paint);
|
builder.DrawCircle(SkPoint{350, 50}, 50, paint);
|
||||||
builder.DrawCircle({350, 200}, 50, stroke_paint);
|
builder.DrawCircle(SkPoint{350, 200}, 50, stroke_paint);
|
||||||
builder.Translate(0, 300);
|
builder.Translate(0, 300);
|
||||||
}
|
}
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -1485,7 +1485,7 @@ TEST_P(DisplayListTest, DrawPaintIgnoresMaskFilter) {
|
|||||||
builder.DrawPaint(flutter::DlPaint().setColor(flutter::DlColor::kWhite()));
|
builder.DrawPaint(flutter::DlPaint().setColor(flutter::DlColor::kWhite()));
|
||||||
|
|
||||||
auto filter = flutter::DlBlurMaskFilter(flutter::DlBlurStyle::kNormal, 10.0f);
|
auto filter = flutter::DlBlurMaskFilter(flutter::DlBlurStyle::kNormal, 10.0f);
|
||||||
builder.DrawCircle({300, 300}, 200,
|
builder.DrawCircle(SkPoint{300, 300}, 200,
|
||||||
flutter::DlPaint().setMaskFilter(&filter));
|
flutter::DlPaint().setMaskFilter(&filter));
|
||||||
|
|
||||||
std::vector<flutter::DlColor> colors = {flutter::DlColor::kGreen(),
|
std::vector<flutter::DlColor> colors = {flutter::DlColor::kGreen(),
|
||||||
|
@ -84,7 +84,8 @@ void SurfaceTextureExternalTexture::DrawFrame(
|
|||||||
transform = inverted;
|
transform = inverted;
|
||||||
|
|
||||||
if (transform.isIdentity()) {
|
if (transform.isIdentity()) {
|
||||||
context.canvas->DrawImage(dl_image_, {0, 0}, sampling, context.paint);
|
context.canvas->DrawImage(dl_image_, SkPoint{0, 0}, sampling,
|
||||||
|
context.paint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ void SurfaceTextureExternalTextureVKImpeller::DrawFrame(
|
|||||||
PaintContext& context,
|
PaintContext& context,
|
||||||
const SkRect& bounds,
|
const SkRect& bounds,
|
||||||
const DlImageSampling sampling) const {
|
const DlImageSampling sampling) const {
|
||||||
context.canvas->DrawImage(dl_image_, {0, 0}, sampling, context.paint);
|
context.canvas->DrawImage(dl_image_, SkPoint{0, 0}, sampling, context.paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace flutter
|
} // namespace flutter
|
||||||
|
@ -51,7 +51,8 @@ void EmbedderExternalTextureGL::Paint(PaintContext& context,
|
|||||||
if (bounds != image_bounds) {
|
if (bounds != image_bounds) {
|
||||||
canvas->DrawImageRect(last_image_, image_bounds, bounds, sampling, paint);
|
canvas->DrawImageRect(last_image_, image_bounds, bounds, sampling, paint);
|
||||||
} else {
|
} else {
|
||||||
canvas->DrawImage(last_image_, {bounds.x(), bounds.y()}, sampling, paint);
|
canvas->DrawImage(last_image_, SkPoint{bounds.x(), bounds.y()}, sampling,
|
||||||
|
paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ void EmbedderExternalTextureMetal::Paint(PaintContext& context,
|
|||||||
if (bounds != image_bounds) {
|
if (bounds != image_bounds) {
|
||||||
canvas->DrawImageRect(last_image_, image_bounds, bounds, sampling, paint);
|
canvas->DrawImageRect(last_image_, image_bounds, bounds, sampling, paint);
|
||||||
} else {
|
} else {
|
||||||
canvas->DrawImage(last_image_, {bounds.x(), bounds.y()}, sampling, paint);
|
canvas->DrawImage(last_image_, SkPoint{bounds.x(), bounds.y()}, sampling, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ TEST(CanvasSpyTest, DrawingIsTracked) {
|
|||||||
ASSERT_FALSE(canvas_spy.DidDrawIntoCanvas());
|
ASSERT_FALSE(canvas_spy.DidDrawIntoCanvas());
|
||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
spy->DrawCircle({0, 0}, 60, paint);
|
spy->DrawCircle(SkPoint{0, 0}, 60, paint);
|
||||||
ASSERT_TRUE(canvas_spy.DidDrawIntoCanvas());
|
ASSERT_TRUE(canvas_spy.DidDrawIntoCanvas());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ constexpr SkISize kSize = SkISize::Make(64, 64);
|
|||||||
MockCanvas::MockCanvas() : MockCanvas(kSize.fWidth, kSize.fHeight) {}
|
MockCanvas::MockCanvas() : MockCanvas(kSize.fWidth, kSize.fHeight) {}
|
||||||
|
|
||||||
MockCanvas::MockCanvas(int width, int height)
|
MockCanvas::MockCanvas(int width, int height)
|
||||||
: base_layer_size_({width, height}), current_layer_(0) {
|
: base_layer_size_(width, height), current_layer_(0) {
|
||||||
state_stack_.emplace_back(DlRect::MakeXYWH(0, 0, width, height), DlMatrix());
|
state_stack_.emplace_back(DlRect::MakeXYWH(0, 0, width, height), DlMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,13 +27,13 @@ MockCanvas::~MockCanvas() {
|
|||||||
EXPECT_EQ(current_layer_, 0);
|
EXPECT_EQ(current_layer_, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkISize MockCanvas::GetBaseLayerSize() const {
|
DlISize MockCanvas::GetBaseLayerDimensions() const {
|
||||||
return base_layer_size_;
|
return base_layer_size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkImageInfo MockCanvas::GetImageInfo() const {
|
SkImageInfo MockCanvas::GetImageInfo() const {
|
||||||
SkISize size = GetBaseLayerSize();
|
return SkImageInfo::MakeUnknown(base_layer_size_.width,
|
||||||
return SkImageInfo::MakeUnknown(size.width(), size.height());
|
base_layer_size_.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::Save() {
|
void MockCanvas::Save() {
|
||||||
@ -43,14 +43,13 @@ void MockCanvas::Save() {
|
|||||||
current_layer_++; // Must go here; func params order of eval is undefined
|
current_layer_++; // Must go here; func params order of eval is undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::SaveLayer(const SkRect* bounds,
|
void MockCanvas::SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
const DlImageFilter* backdrop) {
|
const DlImageFilter* backdrop) {
|
||||||
// saveLayer calls this prior to running, so we use it to track saveLayer
|
|
||||||
// calls
|
|
||||||
draw_calls_.emplace_back(DrawCall{
|
draw_calls_.emplace_back(DrawCall{
|
||||||
current_layer_,
|
current_layer_,
|
||||||
SaveLayerData{bounds ? *bounds : SkRect(), paint ? *paint : DlPaint(),
|
SaveLayerData{bounds.has_value() ? ToSkRect(bounds.value()) : SkRect(),
|
||||||
|
paint ? *paint : DlPaint(),
|
||||||
backdrop ? backdrop->shared() : nullptr,
|
backdrop ? backdrop->shared() : nullptr,
|
||||||
current_layer_ + 1}});
|
current_layer_ + 1}});
|
||||||
state_stack_.emplace_back(state_stack_.back());
|
state_stack_.emplace_back(state_stack_.back());
|
||||||
@ -71,7 +70,10 @@ void MockCanvas::Restore() {
|
|||||||
// 2x3 2D affine subset of a 4x4 transform in row major order
|
// 2x3 2D affine subset of a 4x4 transform in row major order
|
||||||
void MockCanvas::Transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt,
|
void MockCanvas::Transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt,
|
||||||
SkScalar myx, SkScalar myy, SkScalar myt) {
|
SkScalar myx, SkScalar myy, SkScalar myt) {
|
||||||
Transform(SkMatrix::MakeAll(mxx, mxy, mxt, myx, myy, myt, 0, 0, 1));
|
Transform(DlMatrix::MakeRow(mxx, mxy, 0, mxt,
|
||||||
|
myx, myy, 0, myt,
|
||||||
|
0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// full 4x4 transform in row major order
|
// full 4x4 transform in row major order
|
||||||
@ -80,7 +82,7 @@ void MockCanvas::TransformFullPerspective(
|
|||||||
SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
|
SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
|
||||||
SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
|
SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
|
||||||
SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) {
|
SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) {
|
||||||
Transform(SkM44(mxx, mxy, mxz, mxt,
|
Transform(DlMatrix::MakeRow(mxx, mxy, mxz, mxt,
|
||||||
myx, myy, myz, myt,
|
myx, myy, myz, myt,
|
||||||
mzx, mzy, mzz, mzt,
|
mzx, mzy, mzz, mzt,
|
||||||
mwx, mwy, mwz, mwt));
|
mwx, mwy, mwz, mwt));
|
||||||
@ -88,26 +90,16 @@ void MockCanvas::TransformFullPerspective(
|
|||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
void MockCanvas::Transform(const SkMatrix* matrix) {
|
void MockCanvas::Transform(const DlMatrix& matrix) {
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_, ConcatMatrixData{SkM44(*matrix)}});
|
DrawCall{current_layer_, ConcatMatrixData{ToSkM44(matrix)}});
|
||||||
state_stack_.back().transform(*matrix);
|
state_stack_.back().transform(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::Transform(const SkM44* matrix) {
|
void MockCanvas::SetTransform(const DlMatrix& matrix) {
|
||||||
draw_calls_.emplace_back(DrawCall{current_layer_, ConcatMatrixData{*matrix}});
|
|
||||||
state_stack_.back().transform(*matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MockCanvas::SetTransform(const SkMatrix* matrix) {
|
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_, SetMatrixData{SkM44(*matrix)}});
|
DrawCall{current_layer_, SetMatrixData{ToSkM44(matrix)}});
|
||||||
state_stack_.back().setTransform(*matrix);
|
state_stack_.back().setTransform(matrix);
|
||||||
}
|
|
||||||
|
|
||||||
void MockCanvas::SetTransform(const SkM44* matrix) {
|
|
||||||
draw_calls_.emplace_back(DrawCall{current_layer_, SetMatrixData{*matrix}});
|
|
||||||
state_stack_.back().setTransform(*matrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::TransformReset() {
|
void MockCanvas::TransformReset() {
|
||||||
@ -116,27 +108,23 @@ void MockCanvas::TransformReset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::Translate(SkScalar x, SkScalar y) {
|
void MockCanvas::Translate(SkScalar x, SkScalar y) {
|
||||||
this->Transform(SkM44::Translate(x, y));
|
this->Transform(DlMatrix::MakeTranslation({x, y, 0}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::Scale(SkScalar x, SkScalar y) {
|
void MockCanvas::Scale(SkScalar x, SkScalar y) {
|
||||||
this->Transform(SkM44::Scale(x, y));
|
this->Transform(DlMatrix::MakeScale({x, y, 1}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::Rotate(SkScalar degrees) {
|
void MockCanvas::Rotate(SkScalar degrees) {
|
||||||
this->Transform(SkMatrix::RotateDeg(degrees));
|
this->Transform(DlMatrix::MakeRotationZ(DlDegrees(degrees)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::Skew(SkScalar sx, SkScalar sy) {
|
void MockCanvas::Skew(SkScalar sx, SkScalar sy) {
|
||||||
this->Transform(SkMatrix::Skew(sx, sy));
|
this->Transform(DlMatrix::MakeSkew(sx, sy));
|
||||||
}
|
}
|
||||||
|
|
||||||
SkM44 MockCanvas::GetTransformFullPerspective() const {
|
DlMatrix MockCanvas::GetMatrix() const {
|
||||||
return state_stack_.back().matrix_4x4();
|
return state_stack_.back().matrix();
|
||||||
}
|
|
||||||
|
|
||||||
SkMatrix MockCanvas::GetTransform() const {
|
|
||||||
return state_stack_.back().matrix_3x3();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawTextBlob(const sk_sp<SkTextBlob>& text,
|
void MockCanvas::DrawTextBlob(const sk_sp<SkTextBlob>& text,
|
||||||
@ -168,36 +156,38 @@ void MockCanvas::DrawTextFrame(
|
|||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawRect(const SkRect& rect, const DlPaint& paint) {
|
void MockCanvas::DrawRect(const DlRect& rect, const DlPaint& paint) {
|
||||||
draw_calls_.emplace_back(DrawCall{current_layer_, DrawRectData{rect, paint}});
|
draw_calls_.emplace_back(
|
||||||
|
DrawCall{current_layer_, DrawRectData{ToSkRect(rect), paint}});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawPath(const SkPath& path, const DlPaint& paint) {
|
void MockCanvas::DrawPath(const DlPath& path, const DlPaint& paint) {
|
||||||
draw_calls_.emplace_back(DrawCall{current_layer_, DrawPathData{path, paint}});
|
draw_calls_.emplace_back(
|
||||||
|
DrawCall{current_layer_, DrawPathData{path.GetSkPath(), paint}});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawShadow(const SkPath& path,
|
void MockCanvas::DrawShadow(const DlPath& path,
|
||||||
const DlColor color,
|
const DlColor color,
|
||||||
const SkScalar elevation,
|
const SkScalar elevation,
|
||||||
bool transparent_occluder,
|
bool transparent_occluder,
|
||||||
SkScalar dpr) {
|
SkScalar dpr) {
|
||||||
draw_calls_.emplace_back(DrawCall{
|
draw_calls_.emplace_back(DrawCall{
|
||||||
current_layer_,
|
current_layer_, DrawShadowData{path.GetSkPath(), color, elevation,
|
||||||
DrawShadowData{path, color, elevation, transparent_occluder, dpr}});
|
transparent_occluder, dpr}});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawImage(const sk_sp<DlImage>& image,
|
void MockCanvas::DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
const DlImageSampling options,
|
const DlImageSampling options,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
if (paint) {
|
if (paint) {
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_,
|
DrawCall{current_layer_,
|
||||||
DrawImageData{image, point.fX, point.fY, options, *paint}});
|
DrawImageData{image, point.x, point.y, options, *paint}});
|
||||||
} else {
|
} else {
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_,
|
DrawCall{current_layer_,
|
||||||
DrawImageDataNoPaint{image, point.fX, point.fY, options}});
|
DrawImageDataNoPaint{image, point.x, point.y, options}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,17 +197,17 @@ void MockCanvas::DrawDisplayList(const sk_sp<DisplayList> display_list,
|
|||||||
DrawCall{current_layer_, DrawDisplayListData{display_list, opacity}});
|
DrawCall{current_layer_, DrawDisplayListData{display_list, opacity}});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::ClipRect(const SkRect& rect, ClipOp op, bool is_aa) {
|
void MockCanvas::ClipRect(const DlRect& rect, ClipOp op, bool is_aa) {
|
||||||
ClipEdgeStyle style = is_aa ? kSoftClipEdgeStyle : kHardClipEdgeStyle;
|
ClipEdgeStyle style = is_aa ? kSoftClipEdgeStyle : kHardClipEdgeStyle;
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_, ClipRectData{rect, op, style}});
|
DrawCall{current_layer_, ClipRectData{ToSkRect(rect), op, style}});
|
||||||
state_stack_.back().clipRect(rect, op, is_aa);
|
state_stack_.back().clipRect(rect, op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::ClipOval(const SkRect& bounds, ClipOp op, bool is_aa) {
|
void MockCanvas::ClipOval(const DlRect& bounds, ClipOp op, bool is_aa) {
|
||||||
ClipEdgeStyle style = is_aa ? kSoftClipEdgeStyle : kHardClipEdgeStyle;
|
ClipEdgeStyle style = is_aa ? kSoftClipEdgeStyle : kHardClipEdgeStyle;
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_, ClipOvalData{bounds, op, style}});
|
DrawCall{current_layer_, ClipOvalData{ToSkRect(bounds), op, style}});
|
||||||
state_stack_.back().clipOval(bounds, op, is_aa);
|
state_stack_.back().clipOval(bounds, op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,22 +218,22 @@ void MockCanvas::ClipRRect(const SkRRect& rrect, ClipOp op, bool is_aa) {
|
|||||||
state_stack_.back().clipRRect(rrect, op, is_aa);
|
state_stack_.back().clipRRect(rrect, op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::ClipPath(const SkPath& path, ClipOp op, bool is_aa) {
|
void MockCanvas::ClipPath(const DlPath& path, ClipOp op, bool is_aa) {
|
||||||
ClipEdgeStyle style = is_aa ? kSoftClipEdgeStyle : kHardClipEdgeStyle;
|
ClipEdgeStyle style = is_aa ? kSoftClipEdgeStyle : kHardClipEdgeStyle;
|
||||||
draw_calls_.emplace_back(
|
draw_calls_.emplace_back(
|
||||||
DrawCall{current_layer_, ClipPathData{path, op, style}});
|
DrawCall{current_layer_, ClipPathData{path.GetSkPath(), op, style}});
|
||||||
state_stack_.back().clipPath(path, op, is_aa);
|
state_stack_.back().clipPath(path, op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkRect MockCanvas::GetDestinationClipBounds() const {
|
DlRect MockCanvas::GetDestinationClipCoverage() const {
|
||||||
return state_stack_.back().device_cull_rect();
|
return state_stack_.back().GetDeviceCullCoverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
SkRect MockCanvas::GetLocalClipBounds() const {
|
DlRect MockCanvas::GetLocalClipCoverage() const {
|
||||||
return state_stack_.back().local_cull_rect();
|
return state_stack_.back().GetLocalCullCoverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MockCanvas::QuickReject(const SkRect& bounds) const {
|
bool MockCanvas::QuickReject(const DlRect& bounds) const {
|
||||||
return state_stack_.back().content_culled(bounds);
|
return state_stack_.back().content_culled(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,8 +249,8 @@ void MockCanvas::DrawColor(DlColor color, DlBlendMode mode) {
|
|||||||
DrawPaint(DlPaint(color).setBlendMode(mode));
|
DrawPaint(DlPaint(color).setBlendMode(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawLine(const SkPoint& p0,
|
void MockCanvas::DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
}
|
}
|
||||||
@ -275,22 +265,22 @@ void MockCanvas::DrawDashedLine(const DlPoint& p0,
|
|||||||
|
|
||||||
void MockCanvas::DrawPoints(PointMode,
|
void MockCanvas::DrawPoints(PointMode,
|
||||||
uint32_t,
|
uint32_t,
|
||||||
const SkPoint[],
|
const DlPoint[],
|
||||||
const DlPaint&) {
|
const DlPaint&) {
|
||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawOval(const SkRect&, const DlPaint&) {
|
void MockCanvas::DrawOval(const DlRect&, const DlPaint&) {
|
||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawCircle(const SkPoint& center,
|
void MockCanvas::DrawCircle(const DlPoint& center,
|
||||||
SkScalar radius,
|
SkScalar radius,
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawArc(const SkRect&,
|
void MockCanvas::DrawArc(const DlRect&,
|
||||||
SkScalar,
|
SkScalar,
|
||||||
SkScalar,
|
SkScalar,
|
||||||
bool,
|
bool,
|
||||||
@ -303,8 +293,8 @@ void MockCanvas::DrawRRect(const SkRRect&, const DlPaint&) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawImageRect(const sk_sp<DlImage>&,
|
void MockCanvas::DrawImageRect(const sk_sp<DlImage>&,
|
||||||
const SkRect&,
|
const DlRect&,
|
||||||
const SkRect&,
|
const DlRect&,
|
||||||
const DlImageSampling,
|
const DlImageSampling,
|
||||||
const DlPaint*,
|
const DlPaint*,
|
||||||
SrcRectConstraint constraint) {
|
SrcRectConstraint constraint) {
|
||||||
@ -312,8 +302,8 @@ void MockCanvas::DrawImageRect(const sk_sp<DlImage>&,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MockCanvas::DrawImageNine(const sk_sp<DlImage>& image,
|
void MockCanvas::DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint) {
|
const DlPaint* paint) {
|
||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
@ -327,12 +317,12 @@ void MockCanvas::DrawVertices(const std::shared_ptr<DlVertices>&,
|
|||||||
|
|
||||||
void MockCanvas::DrawAtlas(const sk_sp<DlImage>&,
|
void MockCanvas::DrawAtlas(const sk_sp<DlImage>&,
|
||||||
const SkRSXform[],
|
const SkRSXform[],
|
||||||
const SkRect[],
|
const DlRect[],
|
||||||
const DlColor[],
|
const DlColor[],
|
||||||
int,
|
int,
|
||||||
DlBlendMode,
|
DlBlendMode,
|
||||||
const DlImageSampling,
|
const DlImageSampling,
|
||||||
const SkRect*,
|
const DlRect*,
|
||||||
const DlPaint*) {
|
const DlPaint*) {
|
||||||
FML_DCHECK(false);
|
FML_DCHECK(false);
|
||||||
}
|
}
|
||||||
|
@ -82,30 +82,30 @@ class MockCanvas final : public DlCanvas {
|
|||||||
|
|
||||||
struct DrawImageDataNoPaint {
|
struct DrawImageDataNoPaint {
|
||||||
sk_sp<DlImage> image;
|
sk_sp<DlImage> image;
|
||||||
SkScalar x;
|
DlScalar x;
|
||||||
SkScalar y;
|
DlScalar y;
|
||||||
DlImageSampling options;
|
DlImageSampling options;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DrawImageData {
|
struct DrawImageData {
|
||||||
sk_sp<DlImage> image;
|
sk_sp<DlImage> image;
|
||||||
SkScalar x;
|
DlScalar x;
|
||||||
SkScalar y;
|
DlScalar y;
|
||||||
DlImageSampling options;
|
DlImageSampling options;
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DrawDisplayListData {
|
struct DrawDisplayListData {
|
||||||
sk_sp<DisplayList> display_list;
|
sk_sp<DisplayList> display_list;
|
||||||
SkScalar opacity;
|
DlScalar opacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DrawShadowData {
|
struct DrawShadowData {
|
||||||
SkPath path;
|
SkPath path;
|
||||||
DlColor color;
|
DlColor color;
|
||||||
SkScalar elevation;
|
DlScalar elevation;
|
||||||
bool transparent_occluder;
|
bool transparent_occluder;
|
||||||
SkScalar dpr;
|
DlScalar dpr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClipRectData {
|
struct ClipRectData {
|
||||||
@ -169,11 +169,11 @@ class MockCanvas final : public DlCanvas {
|
|||||||
const std::vector<DrawCall>& draw_calls() const { return draw_calls_; }
|
const std::vector<DrawCall>& draw_calls() const { return draw_calls_; }
|
||||||
void reset_draw_calls() { draw_calls_.clear(); }
|
void reset_draw_calls() { draw_calls_.clear(); }
|
||||||
|
|
||||||
SkISize GetBaseLayerSize() const override;
|
DlISize GetBaseLayerDimensions() const override;
|
||||||
SkImageInfo GetImageInfo() const override;
|
SkImageInfo GetImageInfo() const override;
|
||||||
|
|
||||||
void Save() override;
|
void Save() override;
|
||||||
void SaveLayer(const SkRect* bounds,
|
void SaveLayer(std::optional<const DlRect>& bounds,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
const DlImageFilter* backdrop = nullptr) override;
|
const DlImageFilter* backdrop = nullptr) override;
|
||||||
void Restore() override;
|
void Restore() override;
|
||||||
@ -187,119 +187,116 @@ class MockCanvas final : public DlCanvas {
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
// 2x3 2D affine subset of a 4x4 transform in row major order
|
// 2x3 2D affine subset of a 4x4 transform in row major order
|
||||||
void Transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt,
|
void Transform2DAffine(DlScalar mxx, DlScalar mxy, DlScalar mxt,
|
||||||
SkScalar myx, SkScalar myy, SkScalar myt) override;
|
DlScalar myx, DlScalar myy, DlScalar myt) override;
|
||||||
// full 4x4 transform in row major order
|
// full 4x4 transform in row major order
|
||||||
void TransformFullPerspective(
|
void TransformFullPerspective(
|
||||||
SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt,
|
DlScalar mxx, DlScalar mxy, DlScalar mxz, DlScalar mxt,
|
||||||
SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
|
DlScalar myx, DlScalar myy, DlScalar myz, DlScalar myt,
|
||||||
SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
|
DlScalar mzx, DlScalar mzy, DlScalar mzz, DlScalar mzt,
|
||||||
SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override;
|
DlScalar mwx, DlScalar mwy, DlScalar mwz, DlScalar mwt) override;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
void Translate(SkScalar tx, SkScalar ty) override;
|
void Translate(DlScalar tx, DlScalar ty) override;
|
||||||
void Scale(SkScalar sx, SkScalar sy) override;
|
void Scale(DlScalar sx, DlScalar sy) override;
|
||||||
void Rotate(SkScalar degrees) override;
|
void Rotate(DlScalar degrees) override;
|
||||||
void Skew(SkScalar sx, SkScalar sy) override;
|
void Skew(DlScalar sx, DlScalar sy) override;
|
||||||
void TransformReset() override;
|
void TransformReset() override;
|
||||||
void Transform(const SkMatrix* matrix) override;
|
void Transform(const DlMatrix& matrix) override;
|
||||||
void Transform(const SkM44* matrix44) override;
|
void SetTransform(const DlMatrix& matrix) override;
|
||||||
void SetTransform(const SkMatrix* matrix) override;
|
|
||||||
void SetTransform(const SkM44* matrix44) override;
|
|
||||||
using DlCanvas::SetTransform;
|
|
||||||
using DlCanvas::Transform;
|
|
||||||
|
|
||||||
SkM44 GetTransformFullPerspective() const override;
|
DlMatrix GetMatrix() const override;
|
||||||
SkMatrix GetTransform() const override;
|
|
||||||
|
|
||||||
void ClipRect(const SkRect& rect, ClipOp clip_op, bool is_aa) override;
|
void ClipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipOval(const SkRect& bounds, ClipOp clip_op, bool is_aa) override;
|
void ClipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
|
void ClipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
|
||||||
void ClipPath(const SkPath& path, ClipOp clip_op, bool is_aa) override;
|
void ClipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override;
|
||||||
|
|
||||||
SkRect GetDestinationClipBounds() const override;
|
DlRect GetDestinationClipCoverage() const override;
|
||||||
SkRect GetLocalClipBounds() const override;
|
DlRect GetLocalClipCoverage() const override;
|
||||||
bool QuickReject(const SkRect& bounds) const override;
|
bool QuickReject(const DlRect& bounds) const override;
|
||||||
|
|
||||||
void DrawPaint(const DlPaint& paint) override;
|
void DrawPaint(const DlPaint& paint) override;
|
||||||
void DrawColor(DlColor color, DlBlendMode mode) override;
|
void DrawColor(DlColor color, DlBlendMode mode) override;
|
||||||
void DrawLine(const SkPoint& p0,
|
void DrawLine(const DlPoint& p0,
|
||||||
const SkPoint& p1,
|
const DlPoint& p1,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawDashedLine(const DlPoint& p0,
|
void DrawDashedLine(const DlPoint& p0,
|
||||||
const DlPoint& p1,
|
const DlPoint& p1,
|
||||||
DlScalar on_length,
|
DlScalar on_length,
|
||||||
DlScalar off_length,
|
DlScalar off_length,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawRect(const SkRect& rect, const DlPaint& paint) override;
|
void DrawRect(const DlRect& rect, const DlPaint& paint) override;
|
||||||
void DrawOval(const SkRect& bounds, const DlPaint& paint) override;
|
void DrawOval(const DlRect& bounds, const DlPaint& paint) override;
|
||||||
void DrawCircle(const SkPoint& center,
|
void DrawCircle(const DlPoint& center,
|
||||||
SkScalar radius,
|
DlScalar radius,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawRRect(const SkRRect& rrect, const DlPaint& paint) override;
|
void DrawRRect(const SkRRect& rrect, const DlPaint& paint) override;
|
||||||
void DrawDRRect(const SkRRect& outer,
|
void DrawDRRect(const SkRRect& outer,
|
||||||
const SkRRect& inner,
|
const SkRRect& inner,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawPath(const SkPath& path, const DlPaint& paint) override;
|
void DrawPath(const DlPath& path, const DlPaint& paint) override;
|
||||||
void DrawArc(const SkRect& bounds,
|
void DrawArc(const DlRect& bounds,
|
||||||
SkScalar start,
|
DlScalar start,
|
||||||
SkScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawPoints(PointMode mode,
|
void DrawPoints(PointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void DrawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
|
|
||||||
void DrawImage(const sk_sp<DlImage>& image,
|
void DrawImage(const sk_sp<DlImage>& image,
|
||||||
const SkPoint& point,
|
const DlPoint& point,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
void DrawImageRect(
|
void DrawImageRect(
|
||||||
const sk_sp<DlImage>& image,
|
const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const DlRect& src,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
||||||
void DrawImageNine(const sk_sp<DlImage>& image,
|
void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const SkIRect& center,
|
const DlIRect& center,
|
||||||
const SkRect& dst,
|
const DlRect& dst,
|
||||||
DlFilterMode filter,
|
DlFilterMode filter,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
void DrawAtlas(const sk_sp<DlImage>& atlas,
|
||||||
const SkRSXform xform[],
|
const SkRSXform xform[],
|
||||||
const SkRect tex[],
|
const DlRect tex[],
|
||||||
const DlColor colors[],
|
const DlColor colors[],
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const SkRect* cullRect,
|
const DlRect* cullRect,
|
||||||
const DlPaint* paint = nullptr) override;
|
const DlPaint* paint = nullptr) override;
|
||||||
|
|
||||||
void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
void DrawDisplayList(const sk_sp<DisplayList> display_list,
|
||||||
SkScalar opacity) override;
|
DlScalar opacity) override;
|
||||||
void DrawTextBlob(const sk_sp<SkTextBlob>& blob,
|
void DrawTextBlob(const sk_sp<SkTextBlob>& blob,
|
||||||
SkScalar x,
|
DlScalar x,
|
||||||
SkScalar y,
|
DlScalar y,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
|
void DrawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
|
||||||
SkScalar x,
|
DlScalar x,
|
||||||
SkScalar y,
|
DlScalar y,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawShadow(const SkPath& path,
|
void DrawShadow(const DlPath& path,
|
||||||
const DlColor color,
|
const DlColor color,
|
||||||
const SkScalar elevation,
|
const DlScalar elevation,
|
||||||
bool transparent_occluder,
|
bool transparent_occluder,
|
||||||
SkScalar dpr) override;
|
DlScalar dpr) override;
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
ENABLE_DL_CANVAS_BACKWARDS_COMPATIBILITY
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkISize base_layer_size_;
|
DlISize base_layer_size_;
|
||||||
std::vector<DisplayListMatrixClipState> state_stack_;
|
std::vector<DisplayListMatrixClipState> state_stack_;
|
||||||
std::vector<DrawCall> draw_calls_;
|
std::vector<DrawCall> draw_calls_;
|
||||||
int current_layer_;
|
int current_layer_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user