diff --git a/webrender/res/ps_text_run.glsl b/webrender/res/ps_text_run.glsl index 767a4dba48..edfe45f3ed 100644 --- a/webrender/res/ps_text_run.glsl +++ b/webrender/res/ps_text_run.glsl @@ -130,14 +130,12 @@ VertexInfo write_text_vertex(RectWithSize local_clip_rect, // Map the clamped local space corner into device space. vec4 world_pos = transform.m * vec4(local_pos, 0.0, 1.0); - vec2 device_pos = world_pos.xy / world_pos.w * task.common_data.device_pixel_scale; + vec2 device_pos = world_pos.xy * task.common_data.device_pixel_scale; // Apply offsets for the render task to get correct screen location. - vec2 final_pos = device_pos - - task.content_origin + - task.common_data.task_rect.p0; + vec2 final_offset = -task.content_origin + task.common_data.task_rect.p0; - gl_Position = uTransform * vec4(final_pos, z, 1.0); + gl_Position = uTransform * vec4(device_pos + final_offset * world_pos.w, z * world_pos.w, world_pos.w); VertexInfo vi = VertexInfo( local_pos, diff --git a/wrench/reftests/text/perspective-clip.png b/wrench/reftests/text/perspective-clip.png new file mode 100644 index 0000000000..a9859ee8c4 Binary files /dev/null and b/wrench/reftests/text/perspective-clip.png differ diff --git a/wrench/reftests/text/perspective-clip.yaml b/wrench/reftests/text/perspective-clip.yaml new file mode 100644 index 0000000000..1fdf50f529 --- /dev/null +++ b/wrench/reftests/text/perspective-clip.yaml @@ -0,0 +1,27 @@ +--- +root: + items: + - + type: stacking-context + perspective: 1 + perspective-origin: 0 0 + items: + - + type: stacking-context + transform: 10 0 0 0 0 10 0 0 0 0 10 0 0 0 -9 1 + items: + - type: clip + bounds: [50, 50, 200, 200] + complex: + - rect: [50, 50, 200, 200] + radius: 8 + items: + - + type: rect + bounds: [50, 50, 200, 200] + color: green + - + text: "X" + origin: 100 150 + size: 100 + font: "Ahem.ttf" diff --git a/wrench/reftests/text/reftest.list b/wrench/reftests/text/reftest.list index 7c31588bea..5f234e71dc 100644 --- a/wrench/reftests/text/reftest.list +++ b/wrench/reftests/text/reftest.list @@ -67,3 +67,4 @@ fuzzy(1,71) platform(linux) == raster-space.yaml raster-space.png == shadow-border.yaml shadow-solid-ref.yaml == shadow-image.yaml shadow-solid-ref.yaml options(disable-aa) == snap-clip.yaml snap-clip-ref.yaml +platform(linux) == perspective-clip.yaml perspective-clip.png diff --git a/wrench/reftests/text/shadow-transforms.png b/wrench/reftests/text/shadow-transforms.png index 964ea7d46b..b1afd94275 100644 Binary files a/wrench/reftests/text/shadow-transforms.png and b/wrench/reftests/text/shadow-transforms.png differ