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

Commit 7325563

Browse files
committed
[Impeller] Fix glyph atlas transform.
1 parent a1e6c06 commit 7325563

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,14 +2995,11 @@ TEST_P(AiksTest, SolidColorApplyColorFilter) {
29952995

29962996
TEST_P(AiksTest, DrawScaledTextWithPerspectiveNoSaveLayer) {
29972997
Canvas canvas;
2998-
// clang-format off
2999-
canvas.Transform(Matrix(
3000-
2.000000, 0.000000, 0.000000, 0.000000,
3001-
1.445767, 2.637070, -0.507928, 0.001524,
3002-
-2.451887, -0.534662, 0.861399, -0.002584,
3003-
1063.481934, 1025.951416, -48.300270, 1.144901
3004-
));
3005-
// clang-format on
2998+
canvas.Transform(Matrix(1.0, 0.0, 0.0, 0.0, //
2999+
0.0, 1.0, 0.0, 0.0, //
3000+
0.0, 0.0, 1.0, 0.01, //
3001+
0.0, 0.0, 0.0, 1.0) * //
3002+
Matrix::MakeRotationY({Degrees{10}}));
30063003

30073004
ASSERT_TRUE(RenderTextInCanvasSkia(GetContext(), canvas, "Hello world",
30083005
"Roboto-Regular.ttf"));
@@ -3014,14 +3011,11 @@ TEST_P(AiksTest, DrawScaledTextWithPerspectiveSaveLayer) {
30143011
Canvas canvas;
30153012
Paint save_paint;
30163013
canvas.SaveLayer(save_paint);
3017-
// clang-format off
3018-
canvas.Transform(Matrix(
3019-
2.000000, 0.000000, 0.000000, 0.000000,
3020-
1.445767, 2.637070, -0.507928, 0.001524,
3021-
-2.451887, -0.534662, 0.861399, -0.002584,
3022-
1063.481934, 1025.951416, -48.300270, 1.144901
3023-
));
3024-
// clang-format on
3014+
canvas.Transform(Matrix(1.0, 0.0, 0.0, 0.0, //
3015+
0.0, 1.0, 0.0, 0.0, //
3016+
0.0, 0.0, 1.0, 0.01, //
3017+
0.0, 0.0, 0.0, 1.0) * //
3018+
Matrix::MakeRotationY({Degrees{10}}));
30253019

30263020
ASSERT_TRUE(RenderTextInCanvasSkia(GetContext(), canvas, "Hello world",
30273021
"Roboto-Regular.ttf"));

impeller/entity/shaders/glyph_atlas.vert

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ void main() {
8080
0.0, 1.0);
8181
}
8282

83-
gl_Position = frame_info.mvp * vec4(position.xy, 0.0, 1.0);
83+
gl_Position = frame_info.mvp * position;
84+
gl_Position = gl_Position / gl_Position.w;
8485
gl_Position.z = frame_info.depth;
8586
v_uv = uv_origin + unit_position * uv_size;
8687
v_text_color = frame_info.text_color;

0 commit comments

Comments
 (0)