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

Commit c7c73c9

Browse files
committed
Fix restore
1 parent b2d8c1c commit c7c73c9

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

impeller/aiks/canvas.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,16 @@ bool Canvas::Restore() {
209209
if (transform_stack_.size() == 1) {
210210
return false;
211211
}
212+
size_t num_clips = transform_stack_.back().num_clips;
212213
if (transform_stack_.back().rendering_mode ==
213214
Entity::RenderingMode::kSubpass) {
215+
current_pass_->PopClips(num_clips, current_depth_);
214216
current_pass_ = GetCurrentPass().GetSuperpass();
215217
FML_DCHECK(current_pass_);
216218
}
217219

218-
size_t num_clips = transform_stack_.back().num_clips;
219220
transform_stack_.pop_back();
220-
221221
if (num_clips > 0) {
222-
GetCurrentPass().PopClips(num_clips, current_depth_);
223222
RestoreClip();
224223
}
225224

@@ -561,7 +560,7 @@ void Canvas::ClipGeometry(const std::shared_ptr<Geometry>& geometry,
561560
GetCurrentPass().PushClip(std::move(entity));
562561

563562
++transform_stack_.back().clip_depth;
564-
transform_stack_.back().num_clips++;
563+
++transform_stack_.back().num_clips;
565564
}
566565

567566
void Canvas::IntersectCulling(Rect clip_rect) {

impeller/aiks/canvas.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ struct CanvasStackEntry {
3333
// |cull_rect| is conservative screen-space bounds of the clipped output area
3434
std::optional<Rect> cull_rect;
3535
size_t clip_depth = 0u;
36+
// The number of clips tracked for this canvas stack entry.
37+
size_t num_clips = 0u;
3638
Entity::RenderingMode rendering_mode = Entity::RenderingMode::kDirect;
37-
size_t num_clips = false;
3839
};
3940

4041
enum class PointStyle {

impeller/entity/entity_pass.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ void EntityPass::PushClip(Entity entity) {
8686

8787
void EntityPass::PopClips(size_t num_clips, uint64_t depth) {
8888
if (num_clips > active_clips_.size()) {
89-
VALIDATION_LOG << "Attempted to pop more clips than are currently active.";
89+
VALIDATION_LOG
90+
<< "Attempted to pop more clips than are currently active. Active: "
91+
<< active_clips_.size() << ", Popped: " << num_clips
92+
<< ", Depth: " << depth;
9093
}
9194
for (size_t i = 0; i < std::min(num_clips, active_clips_.size()); i++) {
9295
FML_DCHECK(active_clips_.back() < elements_.size());

0 commit comments

Comments
 (0)