diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index c6f0bb183c717..f626a64282896 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -147,7 +147,9 @@ bool GenerateMipmap(const std::shared_ptr& 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", @@ -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); @@ -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; diff --git a/impeller/entity/geometry/fill_path_geometry.cc b/impeller/entity/geometry/fill_path_geometry.cc index af0767f596e06..e6104d2dae967 100644 --- a/impeller/entity/geometry/fill_path_geometry.cc +++ b/impeller/entity/geometry/fill_path_geometry.cc @@ -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++) { @@ -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); diff --git a/impeller/entity/geometry/geometry.cc b/impeller/entity/geometry/geometry.cc index 2842b7974fe5c..708d8b1f5f9d7 100644 --- a/impeller/entity/geometry/geometry.cc +++ b/impeller/entity/geometry/geometry.cc @@ -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; @@ -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{