Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ bool GenerateMipmap(const std::shared_ptr<Context>& context,
return buffer->SubmitCommands();
}

void CanRenderTiledTexture(AiksTest* aiks_test, Entity::TileMode tile_mode) {
void CanRenderTiledTexture(AiksTest* aiks_test,
Entity::TileMode tile_mode,
Matrix local_matrix = {}) {
auto context = aiks_test->GetContext();
ASSERT_TRUE(context);
auto texture = aiks_test->CreateTextureForFixture("table_mountain_nx.png",
Expand All @@ -158,7 +160,7 @@ void CanRenderTiledTexture(AiksTest* aiks_test, Entity::TileMode tile_mode) {
canvas.Translate({100.0f, 100.0f, 0});
Paint paint;
paint.color_source =
ColorSource::MakeImage(texture, tile_mode, tile_mode, {}, {});
ColorSource::MakeImage(texture, tile_mode, tile_mode, {}, local_matrix);
paint.color = Color(1, 1, 1, 1);
canvas.DrawRect({0, 0, 600, 600}, paint);

Expand Down Expand Up @@ -199,6 +201,11 @@ TEST_P(AiksTest, CanRenderTiledTextureDecal) {
CanRenderTiledTexture(this, Entity::TileMode::kDecal);
}

TEST_P(AiksTest, CanRenderTiledTextureClampWithTranslate) {
CanRenderTiledTexture(this, Entity::TileMode::kClamp,
Matrix::MakeTranslation({172.f, 172.f, 0.f}));
}

TEST_P(AiksTest, CanRenderImageRect) {
Canvas canvas;
Paint paint;
Expand Down
12 changes: 6 additions & 6 deletions impeller/entity/geometry/fill_path_geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ GeometryResult FillPathGeometry::GetPositionUVBuffer(
for (auto i = 0u; i < points.size(); i++) {
VS::PerVertexData data;
data.position = points[i];
auto coverage_coords =
(points[i] - texture_coverage.origin) / texture_coverage.size;
data.texture_coords = effect_transform * coverage_coords;
data.texture_coords = effect_transform *
(points[i] - texture_coverage.origin) /
texture_coverage.size;
vertex_builder.AppendVertex(data);
}
for (auto i = 0u; i < indices.size(); i++) {
Expand Down Expand Up @@ -114,9 +114,9 @@ GeometryResult FillPathGeometry::GetPositionUVBuffer(
VS::PerVertexData data;
Point vtx = {vertices[i], vertices[i + 1]};
data.position = vtx;
auto coverage_coords =
(vtx - texture_coverage.origin) / texture_coverage.size;
data.texture_coords = effect_transform * coverage_coords;
data.texture_coords = effect_transform *
(vtx - texture_coverage.origin) /
texture_coverage.size;
vertex_builder.AppendVertex(data);
}
FML_DCHECK(vertex_builder.GetVertexCount() == vertices_count / 2);
Expand Down
10 changes: 5 additions & 5 deletions impeller/entity/geometry/geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ ComputeUVGeometryCPU(
&texture_origin](SolidFillVertexShader::PerVertexData old_vtx) {
TextureFillVertexShader::PerVertexData data;
data.position = old_vtx.position;
auto coverage_coords =
(old_vtx.position - texture_origin) / texture_coverage;
data.texture_coords = effect_transform * coverage_coords;
data.texture_coords = effect_transform *
(old_vtx.position - texture_origin) /
texture_coverage;
vertex_builder.AppendVertex(data);
});
return vertex_builder;
Expand All @@ -76,8 +76,8 @@ GeometryResult ComputeUVGeometryForRect(Rect source_rect,
auto points = source_rect.GetPoints();
for (auto i = 0u, j = 0u; i < 8; i += 2, j++) {
data[i] = points[j];
data[i + 1] = effect_transform * ((points[j] - texture_coverage.origin) /
texture_coverage.size);
data[i + 1] = effect_transform * (points[j] - texture_coverage.origin) /
texture_coverage.size;
}

return GeometryResult{
Expand Down