diff --git a/gfx/wr/webrender/res/cs_radial_gradient.glsl b/gfx/wr/webrender/res/cs_radial_gradient.glsl index 99d73f08ed35..e47475788258 100644 --- a/gfx/wr/webrender/res/cs_radial_gradient.glsl +++ b/gfx/wr/webrender/res/cs_radial_gradient.glsl @@ -6,9 +6,7 @@ varying vec2 v_pos; -flat varying vec2 v_center; flat varying float v_start_radius; -flat varying float v_end_radius; #ifdef WR_VERTEX_SHADER @@ -37,12 +35,9 @@ void main(void) { // Transform all coordinates by the y scale so the // fragment shader can work with circles - // v_pos and v_center are in a coordinate space relative to the task rect - // (so they are independent of the task origin). - v_center = aCenter * radius_scale; - v_center.y *= aXYRatio; - - v_pos = aTaskRect.zw * aPosition.xy * radius_scale; + // v_pos is in a coordinate space relative to the task rect + // (so it is independent of the task origin). + v_pos = (aTaskRect.zw * aPosition.xy - aCenter) * radius_scale; v_pos.y *= aXYRatio; v_gradient_repeat = float(aExtendMode == EXTEND_MODE_REPEAT); @@ -55,9 +50,21 @@ void main(void) { void main(void) { // Solve for t in length(pd) = v_start_radius + t * rd - float offset = length(v_pos - v_center) - v_start_radius; + float offset = length(v_pos) - v_start_radius; oFragColor = sample_gradient(offset); } +#ifdef SWGL_DRAW_SPAN +void swgl_drawSpanRGBA8() { + int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address), + int(GRADIENT_ENTRIES + 2.0)); + if (address < 0) { + return; + } + swgl_commitRadialGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat != 0.0, + v_pos, v_start_radius); +} +#endif + #endif diff --git a/gfx/wr/wrench/reftests/border/reftest.list b/gfx/wr/wrench/reftests/border/reftest.list index 3744c1971594..a5551e827059 100644 --- a/gfx/wr/wrench/reftests/border/reftest.list +++ b/gfx/wr/wrench/reftests/border/reftest.list @@ -1,7 +1,7 @@ platform(linux,mac) == border-clamp-corner-radius.yaml border-clamp-corner-radius.png fuzzy(1,840) == border-gradient-simple.yaml border-gradient-simple-ref.yaml platform(linux,mac) == border-gradient-nine-patch.yaml border-gradient-nine-patch.png -== border-radial-gradient-simple.yaml border-radial-gradient-simple-ref.yaml +fuzzy-if(platform(swgl),1,4) == border-radial-gradient-simple.yaml border-radial-gradient-simple-ref.yaml platform(linux,mac) == border-radial-gradient-nine-patch.yaml border-radial-gradient-nine-patch.png == fuzzy(1,10) border-radii.yaml border-radii.png == border-none.yaml border-none-ref.yaml diff --git a/layout/reftests/border-image/reftest.list b/layout/reftests/border-image/reftest.list index 11f5fd6e426c..6ee24cb23002 100644 --- a/layout/reftests/border-image/reftest.list +++ b/layout/reftests/border-image/reftest.list @@ -73,7 +73,7 @@ fuzzy(0-1,0-19200) fails-if(OSX) fuzzy-if(skiaContent,0-3,0-20000) fuzzy-if(webr fuzzy(0-1,0-912) fuzzy-if(webrender,0-3,0-3008) == border-image-repeating-radial-gradient.html border-image-repeating-radial-gradient-ref.html fuzzy(0-1,0-1720) fuzzy-if(skiaContent,0-3,0-1044) fuzzy-if(webrender,0-3,0-62078) == border-image-repeating-radial-gradient-slice-1.html border-image-repeating-radial-gradient-slice-1-ref.html fuzzy(0-1,0-2119) fuzzy-if(skiaContent,0-3,0-936) fuzzy-if(webrender,0-3,0-40536) == border-image-repeating-radial-gradient-slice-2.html border-image-repeating-radial-gradient-slice-2-ref.html -fuzzy(0-1,0-3170) fuzzy-if(skiaContent,0-3,0-1794) fuzzy-if(webrender&&!geckoview,1-3,30-12000) == border-image-repeating-radial-gradient-slice-fill-1.html border-image-repeating-radial-gradient-slice-fill-1-ref.html +fuzzy(0-1,0-3170) fuzzy-if(skiaContent,0-3,0-1794) fuzzy-if(webrender&&!geckoview,1-3,30-12193) == border-image-repeating-radial-gradient-slice-fill-1.html border-image-repeating-radial-gradient-slice-fill-1-ref.html fuzzy(0-1,0-3281) fails-if(OSX) fuzzy-if(skiaContent,0-3,0-1435) fuzzy-if(webrender&&!geckoview,1-2,20-8000) == border-image-repeating-radial-gradient-slice-fill-2.html border-image-repeating-radial-gradient-slice-fill-2-ref.html fuzzy(0-1,0-1328) fuzzy-if(webrender,0-3,0-7441) == border-image-repeating-radial-gradient-width.html border-image-repeating-radial-gradient-width-ref.html fuzzy(0-4,0-21628) fails-if(OSX) fuzzy-if(webrender,0-8,0-99728) == border-image-repeating-radial-gradient-slice-width.html border-image-repeating-radial-gradient-slice-width-ref.html