   }
 }
 
-void draw_antialiased_solid_border_corner(vec2 local_pos) {
+void draw_antialiased_solid_border_corner(vec2 local_pos, float pixelsPerFragment) {
   if (vRadii.x <= 0.0) {
     return;
   }
-
-  // This is the conversion factor for transformations and device pixel scaling.
-  float pixelsPerFragment = length(fwidth(local_pos.xy));
 
   float distanceFromRef = distance(vRefPoint, local_pos);
 

  if (vRadii.x > 0.0 && (distanceFromRef > vRadii.x || distanceFromRef < vRadii.z)) {
      discard;
  }
}

#ifdef WR_FEATURE_TRANSFORM

    case PST_TOP_LEFT:
    case PST_TOP_RIGHT:
    case PST_BOTTOM_LEFT:
    case PST_BOTTOM_RIGHT: {
      // This is the conversion factor for transformations and device pixel scaling.
      float pixelsPerFragment = length(fwidth(localPos.xy));
      oFragColor = get_fragment_color(vF, pixelsPerFragment);
      draw_antialiased_solid_border_corner(localPos, pixelsPerFragment);
      break;
    }
    default:
      oFragColor = vHorizontalColor;
      discard_pixels_in_rounded_borders(localPos);
