       // This is the conversion factor for transformations and device pixel scaling.
       float pixelsPerFragment = length(fwidth(localPos.xy));
       oFragColor = get_fragment_color(distanceFromMixLine, pixelsPerFragment);
-      draw_antialiased_solid_border_corner(localPos, pixelsPerFragment);
+
+      if (vRadii.x > 0.0) {
+        float alpha = alpha_for_solid_border_corner(localPos, vRadii.z, vRadii.x, pixelsPerFragment);
+        oFragColor *= vec4(1, 1, 1, alpha);
+      }
+
       break;
     }
     default:

  return mix(white, circleColor, circleColor.a);
}

vec4 draw_double_edge(float pos, float len) {
  // Devided border to 3 parts, draw color on first and third part,
  // leave second part blank.
  float one_third_len = len / 3.0;

  float in_first_part = step(pos, one_third_len);
  float in_third_part = step(len - one_third_len, pos);

  // The result of this should be 1.0 if we're in the 1st or 3rd part.
  // And 0.0 for the blank part.
  float should_fill = in_first_part + in_third_part;

  // This is the conversion factor for transformations and device pixel scaling.
  float pixels_per_fragment = length(fwidth(vLocalPos.xy));
  vec4 white = vec4(1.0, 1.0, 1.0, 1.0);
  return mix(white, get_fragment_color(vDistanceFromMixLine, pixels_per_fragment), should_fill);
}

vec4 draw_double_edge_vertical() {
  // Get our position within this specific segment
  float position = vLocalPos.x - vLocalRect.x;
  return draw_double_edge(position, vLocalRect.z);
}

vec4 draw_double_edge_horizontal() {
  // Get our position within this specific segment
  float position = vLocalPos.y - vLocalRect.y;
  return draw_double_edge(position, vLocalRect.w);
}

vec4 draw_double_edge_with_radius() {
  // Get our position within this specific segment
  float position = distance(vRefPoint, vLocalPos) - vRadii.z;
  float len = vRadii.x - vRadii.z;
  return draw_double_edge(position, len);
}

vec4 draw_double_edge_corner() {
  if (vRadii.x > 0) {
    return draw_double_edge_with_radius();
  }

  bool is_vertical = (vBorderPart == PST_TOP_LEFT) ? vDistanceFromMixLine < 0 :
                                                     vDistanceFromMixLine >= 0;
  if (is_vertical) {
    return draw_double_edge_vertical();
  } else {
    return draw_double_edge_horizontal();
  }
}


    case PST_BOTTOM_LEFT:
    case PST_BOTTOM_RIGHT:
    {
      oFragColor = draw_double_edge_corner(pixelsPerFragment);
      break;
    }
    case PST_BOTTOM:
    case PST_TOP:
    {
      oFragColor = draw_double_edge_horizontal(pixelsPerFragment);
      break;
    }
    case PST_LEFT:
    case PST_RIGHT:
    {
      oFragColor = draw_double_edge_vertical(pixelsPerFragment);
      break;
    }
  }
}

#endif

void draw_solid_border(float distanceFromMixLine, vec2 localPos) {
  switch (vBorderPart) {
