| author | Nicolas Silva <nsilva@mozilla.com> |
| Thu, 23 Jan 2020 14:24:11 +0000 | |
| changeset 511473 | 8b8a272428800614fcbc975c1ed93b663950ba89 |
| parent 511472 | 52234324a69eb012bac0b0897a66b754f416e413 |
| child 511474 | 6b61867f80b123f11aa3e9252f0ac005a12787c0 |
| push id | 37048 |
| push user | rmaries@mozilla.com |
| push date | Thu, 23 Jan 2020 21:42:24 +0000 |
| treeherder | mozilla-central@fb6b61e49217 [default view] [failures only] |
| perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
| reviewers | gw |
| bugs | 1608156 |
| milestone | 74.0a1 |
| first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
| last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/wr/webrender/res/brush_image.glsl +++ b/gfx/wr/webrender/res/brush_image.glsl @@ -88,33 +88,38 @@ void image_brush_vs( } // If this segment should interpolate relative to the // segment, modify the parameters for that. if ((brush_flags & BRUSH_FLAG_SEGMENT_RELATIVE) != 0) { local_rect = segment_rect; stretch_size = local_rect.size; - if ((brush_flags & BRUSH_FLAG_SEGMENT_REPEAT_X) != 0) { - stretch_size.x = (segment_data.z - segment_data.x); - } - if ((brush_flags & BRUSH_FLAG_SEGMENT_REPEAT_Y) != 0) { - stretch_size.y = (segment_data.w - segment_data.y); - } + float dx = segment_data.z - segment_data.x; + float dy = segment_data.w - segment_data.y; // If the extra data is a texel rect, modify the UVs. if ((brush_flags & BRUSH_FLAG_TEXEL_RECT) != 0) { + vec2 uv_size = res.uv_rect.p1 - res.uv_rect.p0; uv0 = res.uv_rect.p0 + segment_data.xy * uv_size; uv1 = res.uv_rect.p0 + segment_data.zw * uv_size; + if ((brush_flags & BRUSH_FLAG_SEGMENT_REPEAT_X) != 0) { - stretch_size.x = stretch_size.x * uv_size.x; + stretch_size.x = local_rect.size.y / dy * dx; } if ((brush_flags & BRUSH_FLAG_SEGMENT_REPEAT_Y) != 0) { - stretch_size.y = stretch_size.y * uv_size.y; + stretch_size.y = local_rect.size.x / dx * dy; + } + } else { + if ((brush_flags & BRUSH_FLAG_SEGMENT_REPEAT_X) != 0) { + stretch_size.x = dx; + } + if ((brush_flags & BRUSH_FLAG_SEGMENT_REPEAT_Y) != 0) { + stretch_size.y = dy; } } } float perspective_interpolate = (brush_flags & BRUSH_FLAG_PERSPECTIVE_INTERPOLATION) != 0 ? 1.0 : 0.0; V_LAYER = res.layer; V_PERSPECTIVE = perspective_interpolate;