             };
             vec4 c0 = mix(color1, color0, swizzled_factor);
             vec4 c1 = mix(color0, color1, swizzled_factor);
-            return mix(c0, c1, alpha);
+            color0 = mix(c0, c1, alpha);
+            break;
         }
         default:
             break;

}

vec4 evaluate_color_for_style_in_edge(
    vec2 pos,
    int style,
    vec4 color0,
    vec4 color1,
    float aa_range,
    int edge_axis
) {
    switch (style) {
        case BORDER_STYLE_DOUBLE: {
            float d0 = -1.0;
            float d1 = -1.0;
            if (vPartialWidths[edge_axis] > 1.0) {
                vec2 ref = vec2(
                    vEdgeReference[edge_axis] + vPartialWidths[edge_axis],
                    vEdgeReference[edge_axis+2] - vPartialWidths[edge_axis]
                );
                d0 = pos[edge_axis] - ref.x;
                d1 = ref.y - pos[edge_axis];
            }
            float d = min(d0, d1);
            float alpha = distance_aa(aa_range, d);
            return alpha * color0;
        }
        case BORDER_STYLE_GROOVE:
        case BORDER_STYLE_RIDGE: {
            float ref = vEdgeReference[edge_axis] + vPartialWidths[edge_axis+2];
            float d = pos[edge_axis] - ref;
            float alpha = distance_aa(aa_range, d);
            return mix(color0, color1, alpha);
        }
        default:
            break;

        case SEGMENT_TOP:
        case SEGMENT_BOTTOM:
            edge_axis = ivec2(1, 1);
            break;
        case SEGMENT_LEFT:
        case SEGMENT_RIGHT:
        default:
            break;
    }

