Bug 1615613 - Use write_vertex in the text run shader. r=gw

Baby step towards making text and brush shaders more similar.

Differential Revision: https://phabricator.services.mozilla.com/D62925

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2020-02-18 13:23:57 +00:00
Родитель bc43d9263d
Коммит 2d252c6548
3 изменённых файлов: 16 добавлений и 20 удалений

Просмотреть файл

@ -164,8 +164,12 @@ void main(void) {
// Write the normal vertex information out.
if (transform.is_axis_aligned) {
// Select the corner of the local rect that we are processing.
vec2 local_pos = segment_rect.p0 + segment_rect.size * aPosition.xy;
vi = write_vertex(
segment_rect,
local_pos,
ph.local_clip_rect,
ph.z,
transform,

Просмотреть файл

@ -109,15 +109,11 @@ struct VertexInfo {
vec4 world_pos;
};
VertexInfo write_vertex(RectWithSize instance_rect,
VertexInfo write_vertex(vec2 local_pos,
RectWithSize local_clip_rect,
float z,
Transform transform,
PictureTask task) {
// Select the corner of the local rect that we are processing.
vec2 local_pos = instance_rect.p0 + instance_rect.size * aPosition.xy;
// Clamp to the two local clip rects.
vec2 clamped_local_pos = clamp_rect(local_pos, local_clip_rect);

Просмотреть файл

@ -220,26 +220,22 @@ void main(void) {
vec2 local_pos = glyph_rect.p0 + glyph_rect.size * aPosition.xy;
#endif
// Clamp to the local clip rect.
local_pos = clamp_rect(local_pos, ph.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 * task.device_pixel_scale;
// Apply offsets for the render task to get correct screen location.
vec2 final_offset = -task.content_origin + task.common_data.task_rect.p0;
gl_Position = uTransform * vec4(device_pos + final_offset * world_pos.w, ph.z * world_pos.w, world_pos.w);
VertexInfo vi = write_vertex(
local_pos,
ph.local_clip_rect,
ph.z,
transform,
task
);
#ifdef WR_FEATURE_GLYPH_TRANSFORM
vec2 f = (glyph_transform * local_pos - glyph_rect.p0) / glyph_rect.size;
vec2 f = (glyph_transform * vi.local_pos - glyph_rect.p0) / glyph_rect.size;
V_UV_CLIP = vec4(f, 1.0 - f);
#else
vec2 f = (local_pos - glyph_rect.p0) / glyph_rect.size;
vec2 f = (vi.local_pos - glyph_rect.p0) / glyph_rect.size;
#endif
write_clip(world_pos, clip_area);
write_clip(vi.world_pos, clip_area);
switch (color_mode) {
case COLOR_MODE_ALPHA: