Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit cfc5c1b

Browse files
authored
Synchronize accounting for render op depths (#54794)
Experimental Canvas was getting depth assertion errors while trying to use the depth values supplied by DisplayList. This was mainly due to a difference in understanding as to how many depth values to allocate to a drawImageNine operation. n case there are additional discrepancies, debugging code is added to assert the understanding of how many depth values the experimental canvas uses on each rendering operation. The depth debugging can be turned on and off with a #define
1 parent 82ee3d4 commit cfc5c1b

File tree

4 files changed

+180
-7
lines changed

4 files changed

+180
-7
lines changed

display_list/dl_op_records.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ struct DrawImageRectOp final : DrawOpBase {
790790
#define DEFINE_DRAW_IMAGE_NINE_OP(name, render_with_attributes) \
791791
struct name##Op final : DrawOpBase { \
792792
static constexpr auto kType = DisplayListOpType::k##name; \
793+
static constexpr uint32_t kDepthInc = 9; \
793794
\
794795
name##Op(const sk_sp<DlImage>& image, \
795796
const SkIRect& center, \

display_list/testing/dl_test_snippets.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -835,37 +835,37 @@ std::vector<DisplayListInvocationGroup> CreateAllRenderingOps() {
835835
}},
836836
{"DrawImageNine",
837837
{
838-
{1, 48, 1,
838+
{1, 48, 9,
839839
[](DlOpReceiver& r) {
840840
r.drawImageNine(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
841841
DlFilterMode::kNearest, false);
842842
}},
843-
{1, 48, 1,
843+
{1, 48, 9,
844844
[](DlOpReceiver& r) {
845845
r.drawImageNine(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
846846
DlFilterMode::kNearest, true);
847847
}},
848-
{1, 48, 1,
848+
{1, 48, 9,
849849
[](DlOpReceiver& r) {
850850
r.drawImageNine(TestImage1, {10, 10, 25, 20}, {10, 10, 80, 80},
851851
DlFilterMode::kNearest, false);
852852
}},
853-
{1, 48, 1,
853+
{1, 48, 9,
854854
[](DlOpReceiver& r) {
855855
r.drawImageNine(TestImage1, {10, 10, 20, 20}, {10, 10, 85, 80},
856856
DlFilterMode::kNearest, false);
857857
}},
858-
{1, 48, 1,
858+
{1, 48, 9,
859859
[](DlOpReceiver& r) {
860860
r.drawImageNine(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
861861
DlFilterMode::kLinear, false);
862862
}},
863-
{1, 48, 1,
863+
{1, 48, 9,
864864
[](DlOpReceiver& r) {
865865
r.drawImageNine(TestImage2, {10, 10, 15, 15}, {10, 10, 80, 80},
866866
DlFilterMode::kNearest, false);
867867
}},
868-
{1, 48, 1,
868+
{1, 48, 9,
869869
[](DlOpReceiver& r) {
870870
auto dl_image = DlImage::Make(TestSkImage);
871871
r.drawImageNine(dl_image, {10, 10, 15, 15}, {10, 10, 80, 80},

impeller/aiks/canvas.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ class Canvas {
177177

178178
Picture EndRecordingAsPicture();
179179

180+
uint64_t GetOpDepth() const { return current_depth_; }
181+
uint64_t GetMaxOpDepth() const { return transform_stack_.back().clip_depth; }
182+
180183
protected:
181184
std::deque<CanvasStackEntry> transform_stack_;
182185
std::optional<Rect> initial_cull_rect_;

0 commit comments

Comments
 (0)