@@ -218,7 +218,7 @@ void Canvas::Save(bool create_subpass,
218
218
auto entry = CanvasStackEntry{};
219
219
entry.transform = transform_stack_.back ().transform ;
220
220
entry.cull_rect = transform_stack_.back ().cull_rect ;
221
- entry.clip_depth = transform_stack_.back ().clip_depth ;
221
+ entry.clip_height = transform_stack_.back ().clip_height ;
222
222
if (create_subpass) {
223
223
entry.rendering_mode = Entity::RenderingMode::kSubpass ;
224
224
auto subpass = std::make_unique<EntityPass>();
@@ -244,7 +244,7 @@ void Canvas::Save(bool create_subpass,
244
244
subpass->SetBlendMode (blend_mode);
245
245
current_pass_ = GetCurrentPass ().AddSubpass (std::move (subpass));
246
246
current_pass_->SetTransform (transform_stack_.back ().transform );
247
- current_pass_->SetClipDepth (transform_stack_.back ().clip_depth );
247
+ current_pass_->SetClipDepth (transform_stack_.back ().clip_height );
248
248
}
249
249
transform_stack_.emplace_back (entry);
250
250
}
@@ -336,7 +336,7 @@ void Canvas::RestoreToCount(size_t count) {
336
336
void Canvas::DrawPath (const Path& path, const Paint& paint) {
337
337
Entity entity;
338
338
entity.SetTransform (GetCurrentTransform ());
339
- entity.SetClipDepth (GetClipDepth ());
339
+ entity.SetClipDepth (GetClipHeight ());
340
340
entity.SetBlendMode (paint.blend_mode );
341
341
entity.SetContents (CreatePathContentsWithFilters (paint, path));
342
342
@@ -346,7 +346,7 @@ void Canvas::DrawPath(const Path& path, const Paint& paint) {
346
346
void Canvas::DrawPaint (const Paint& paint) {
347
347
Entity entity;
348
348
entity.SetTransform (GetCurrentTransform ());
349
- entity.SetClipDepth (GetClipDepth ());
349
+ entity.SetClipDepth (GetClipHeight ());
350
350
entity.SetBlendMode (paint.blend_mode );
351
351
entity.SetContents (CreateCoverContentsWithFilters (paint));
352
352
@@ -427,7 +427,7 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
427
427
428
428
Entity blurred_rrect_entity;
429
429
blurred_rrect_entity.SetTransform (GetCurrentTransform ());
430
- blurred_rrect_entity.SetClipDepth (GetClipDepth ());
430
+ blurred_rrect_entity.SetClipDepth (GetClipHeight ());
431
431
blurred_rrect_entity.SetBlendMode (rrect_paint.blend_mode );
432
432
433
433
rrect_paint.mask_blur_descriptor = std::nullopt;
@@ -447,7 +447,7 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
447
447
// Then, draw the non-blurred RRect on top.
448
448
Entity entity;
449
449
entity.SetTransform (GetCurrentTransform ());
450
- entity.SetClipDepth (GetClipDepth ());
450
+ entity.SetClipDepth (GetClipHeight ());
451
451
entity.SetBlendMode (rrect_paint.blend_mode );
452
452
entity.SetContents (CreateContentsForGeometryWithFilters (
453
453
rrect_paint, Geometry::MakeRoundRect (rect, corner_radii)));
@@ -474,7 +474,7 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect,
474
474
void Canvas::DrawLine (const Point & p0, const Point & p1, const Paint& paint) {
475
475
Entity entity;
476
476
entity.SetTransform (GetCurrentTransform ());
477
- entity.SetClipDepth (GetClipDepth ());
477
+ entity.SetClipDepth (GetClipHeight ());
478
478
entity.SetBlendMode (paint.blend_mode );
479
479
entity.SetContents (CreateContentsForGeometryWithFilters (
480
480
paint, Geometry::MakeLine (p0, p1, paint.stroke_width , paint.stroke_cap )));
@@ -494,7 +494,7 @@ void Canvas::DrawRect(const Rect& rect, const Paint& paint) {
494
494
495
495
Entity entity;
496
496
entity.SetTransform (GetCurrentTransform ());
497
- entity.SetClipDepth (GetClipDepth ());
497
+ entity.SetClipDepth (GetClipHeight ());
498
498
entity.SetBlendMode (paint.blend_mode );
499
499
entity.SetContents (
500
500
CreateContentsForGeometryWithFilters (paint, Geometry::MakeRect (rect)));
@@ -521,7 +521,7 @@ void Canvas::DrawOval(const Rect& rect, const Paint& paint) {
521
521
522
522
Entity entity;
523
523
entity.SetTransform (GetCurrentTransform ());
524
- entity.SetClipDepth (GetClipDepth ());
524
+ entity.SetClipDepth (GetClipHeight ());
525
525
entity.SetBlendMode (paint.blend_mode );
526
526
entity.SetContents (
527
527
CreateContentsForGeometryWithFilters (paint, Geometry::MakeOval (rect)));
@@ -539,7 +539,7 @@ void Canvas::DrawRRect(const Rect& rect,
539
539
if (paint.style == Paint::Style ::kFill ) {
540
540
Entity entity;
541
541
entity.SetTransform (GetCurrentTransform ());
542
- entity.SetClipDepth (GetClipDepth ());
542
+ entity.SetClipDepth (GetClipHeight ());
543
543
entity.SetBlendMode (paint.blend_mode );
544
544
entity.SetContents (CreateContentsForGeometryWithFilters (
545
545
paint, Geometry::MakeRoundRect (rect, corner_radii)));
@@ -568,7 +568,7 @@ void Canvas::DrawCircle(const Point& center,
568
568
569
569
Entity entity;
570
570
entity.SetTransform (GetCurrentTransform ());
571
- entity.SetClipDepth (GetClipDepth ());
571
+ entity.SetClipDepth (GetClipHeight ());
572
572
entity.SetBlendMode (paint.blend_mode );
573
573
auto geometry =
574
574
paint.style == Paint::Style ::kStroke
@@ -680,11 +680,11 @@ void Canvas::ClipGeometry(const std::shared_ptr<Geometry>& geometry,
680
680
Entity entity;
681
681
entity.SetTransform (GetCurrentTransform ());
682
682
entity.SetContents (std::move (contents));
683
- entity.SetClipDepth (GetClipDepth ());
683
+ entity.SetClipDepth (GetClipHeight ());
684
684
685
685
GetCurrentPass ().PushClip (std::move (entity));
686
686
687
- ++transform_stack_.back ().clip_depth ;
687
+ ++transform_stack_.back ().clip_height ;
688
688
++transform_stack_.back ().num_clips ;
689
689
}
690
690
@@ -718,8 +718,9 @@ void Canvas::RestoreClip() {
718
718
entity.SetTransform (GetCurrentTransform ());
719
719
// This path is empty because ClipRestoreContents just generates a quad that
720
720
// takes up the full render target.
721
- entity.SetContents (std::make_shared<ClipRestoreContents>());
722
- entity.SetClipDepth (GetClipDepth ());
721
+ auto clip_restore = std::make_shared<ClipRestoreContents>();
722
+ clip_restore->SetRestoreHeight (GetClipHeight ());
723
+ entity.SetContents (std::move (clip_restore));
723
724
724
725
AddEntityToCurrentPass (std::move (entity));
725
726
}
@@ -734,7 +735,7 @@ void Canvas::DrawPoints(std::vector<Point> points,
734
735
735
736
Entity entity;
736
737
entity.SetTransform (GetCurrentTransform ());
737
- entity.SetClipDepth (GetClipDepth ());
738
+ entity.SetClipDepth (GetClipHeight ());
738
739
entity.SetBlendMode (paint.blend_mode );
739
740
entity.SetContents (CreateContentsForGeometryWithFilters (
740
741
paint,
@@ -790,7 +791,7 @@ void Canvas::DrawImageRect(const std::shared_ptr<Image>& image,
790
791
791
792
Entity entity;
792
793
entity.SetBlendMode (paint.blend_mode );
793
- entity.SetClipDepth (GetClipDepth ());
794
+ entity.SetClipDepth (GetClipHeight ());
794
795
entity.SetContents (paint.WithFilters (contents));
795
796
entity.SetTransform (GetCurrentTransform ());
796
797
@@ -818,8 +819,8 @@ EntityPass& Canvas::GetCurrentPass() {
818
819
return *current_pass_;
819
820
}
820
821
821
- size_t Canvas::GetClipDepth () const {
822
- return transform_stack_.back ().clip_depth ;
822
+ size_t Canvas::GetClipHeight () const {
823
+ return transform_stack_.back ().clip_height ;
823
824
}
824
825
825
826
void Canvas::AddEntityToCurrentPass (Entity entity) {
@@ -866,7 +867,7 @@ void Canvas::DrawTextFrame(const std::shared_ptr<TextFrame>& text_frame,
866
867
Point position,
867
868
const Paint& paint) {
868
869
Entity entity;
869
- entity.SetClipDepth (GetClipDepth ());
870
+ entity.SetClipDepth (GetClipHeight ());
870
871
entity.SetBlendMode (paint.blend_mode );
871
872
872
873
auto text_contents = std::make_shared<TextContents>();
@@ -918,7 +919,7 @@ void Canvas::DrawVertices(const std::shared_ptr<VerticesGeometry>& vertices,
918
919
919
920
Entity entity;
920
921
entity.SetTransform (GetCurrentTransform ());
921
- entity.SetClipDepth (GetClipDepth ());
922
+ entity.SetClipDepth (GetClipHeight ());
922
923
entity.SetBlendMode (paint.blend_mode );
923
924
924
925
// If there are no vertex color or texture coordinates. Or if there
@@ -1011,7 +1012,7 @@ void Canvas::DrawAtlas(const std::shared_ptr<Image>& atlas,
1011
1012
1012
1013
Entity entity;
1013
1014
entity.SetTransform (GetCurrentTransform ());
1014
- entity.SetClipDepth (GetClipDepth ());
1015
+ entity.SetClipDepth (GetClipHeight ());
1015
1016
entity.SetBlendMode (paint.blend_mode );
1016
1017
entity.SetContents (paint.WithFilters (contents));
1017
1018
0 commit comments