55#include " impeller/entity/geometry.h"
66#include " impeller/entity/contents/content_context.h"
77#include " impeller/entity/position_color.vert.h"
8+ #include " impeller/geometry/matrix.h"
89#include " impeller/geometry/path_builder.h"
910#include " impeller/renderer/device_buffer.h"
1011#include " impeller/renderer/render_pass.h"
@@ -106,6 +107,8 @@ GeometryResult VerticesGeometry::GetPositionBuffer(
106107 .index_count = vertices_.GetIndices ().size (),
107108 .index_type = IndexType::k16bit,
108109 },
110+ .transform = Matrix::MakeOrthographic (pass.GetRenderTargetSize ()) *
111+ entity.GetTransformation (),
109112 .prevent_overdraw = false ,
110113 };
111114}
@@ -168,6 +171,8 @@ GeometryResult VerticesGeometry::GetPositionColorBuffer(
168171 .index_count = vertices_.GetIndices ().size (),
169172 .index_type = IndexType::k16bit,
170173 },
174+ .transform = Matrix::MakeOrthographic (pass.GetRenderTargetSize ()) *
175+ entity.GetTransformation (),
171176 .prevent_overdraw = false ,
172177 };
173178}
@@ -224,6 +229,8 @@ GeometryResult FillPathGeometry::GetPositionBuffer(
224229 return GeometryResult{
225230 .type = PrimitiveType::kTriangle ,
226231 .vertex_buffer = vertex_buffer,
232+ .transform = Matrix::MakeOrthographic (pass.GetRenderTargetSize ()) *
233+ entity.GetTransformation (),
227234 .prevent_overdraw = false ,
228235 };
229236}
@@ -577,6 +584,8 @@ GeometryResult StrokePathGeometry::GetPositionBuffer(
577584 return GeometryResult{
578585 .type = PrimitiveType::kTriangleStrip ,
579586 .vertex_buffer = vertex_buffer,
587+ .transform = Matrix::MakeOrthographic (pass.GetRenderTargetSize ()) *
588+ entity.GetTransformation (),
580589 .prevent_overdraw = true ,
581590 };
582591}
@@ -627,14 +636,16 @@ GeometryResult CoverGeometry::GetPositionBuffer(const ContentContext& renderer,
627636 auto & host_buffer = pass.GetTransientsBuffer ();
628637 return GeometryResult{
629638 .type = PrimitiveType::kTriangleStrip ,
630- .vertex_buffer = {.vertex_buffer = host_buffer.Emplace (
631- rect.GetPoints ().data (), 8 * sizeof (float ),
632- alignof (float )),
633- .index_buffer = host_buffer.Emplace (
634- kRectIndicies , 4 * sizeof (uint16_t ),
635- alignof (uint16_t )),
636- .index_count = 4 ,
637- .index_type = IndexType::k16bit},
639+ .vertex_buffer =
640+ {
641+ .vertex_buffer = host_buffer.Emplace (
642+ rect.GetPoints ().data (), 8 * sizeof (float ), alignof (float )),
643+ .index_buffer = host_buffer.Emplace (
644+ kRectIndicies , 4 * sizeof (uint16_t ), alignof (uint16_t )),
645+ .index_count = 4 ,
646+ .index_type = IndexType::k16bit,
647+ },
648+ .transform = Matrix::MakeOrthographic (pass.GetRenderTargetSize ()),
638649 .prevent_overdraw = false ,
639650 };
640651}
@@ -660,14 +671,17 @@ GeometryResult RectGeometry::GetPositionBuffer(const ContentContext& renderer,
660671 auto & host_buffer = pass.GetTransientsBuffer ();
661672 return GeometryResult{
662673 .type = PrimitiveType::kTriangleStrip ,
663- .vertex_buffer = {.vertex_buffer = host_buffer.Emplace (
664- rect_.GetPoints ().data (), 8 * sizeof (float ),
665- alignof (float )),
666- .index_buffer = host_buffer.Emplace (
667- kRectIndicies , 4 * sizeof (uint16_t ),
668- alignof (uint16_t )),
669- .index_count = 4 ,
670- .index_type = IndexType::k16bit},
674+ .vertex_buffer =
675+ {
676+ .vertex_buffer = host_buffer.Emplace (
677+ rect_.GetPoints ().data (), 8 * sizeof (float ), alignof (float )),
678+ .index_buffer = host_buffer.Emplace (
679+ kRectIndicies , 4 * sizeof (uint16_t ), alignof (uint16_t )),
680+ .index_count = 4 ,
681+ .index_type = IndexType::k16bit,
682+ },
683+ .transform = Matrix::MakeOrthographic (pass.GetRenderTargetSize ()) *
684+ entity.GetTransformation (),
671685 .prevent_overdraw = false ,
672686 };
673687}
0 commit comments