const OpBorder *op)
{
const GskRoundedRect *o = &op->outline;
- float outline[4];
- float widths[4];
- float heights[4];
- int i;
OP_PRINT (" -> Border Outline");
- outline[0] = o->bounds.origin.x;
- outline[1] = o->bounds.origin.y;
- outline[2] = o->bounds.size.width;
- outline[3] = o->bounds.size.height;
-
- for (i = 0; i < 4; i ++)
- {
- widths[i] = o->corner[i].width;
- heights[i] = o->corner[i].height;
- }
-
- glUniform4fv (program->border.outline_location, 1, outline);
- glUniform4fv (program->border.corner_widths_location, 1, widths);
- glUniform4fv (program->border.corner_heights_location, 1, heights);
+ glUniform4fv (program->border.outline_location, 1, (float *)&o->bounds);
+ glUniform2fv (program->border.corner_sizes_location, 4, (float *)&o->corner);
}
static inline void
INIT_PROGRAM_UNIFORM_LOCATION (border, color);
INIT_PROGRAM_UNIFORM_LOCATION (border, widths);
INIT_PROGRAM_UNIFORM_LOCATION (border, outline);
- INIT_PROGRAM_UNIFORM_LOCATION (border, corner_widths);
- INIT_PROGRAM_UNIFORM_LOCATION (border, corner_heights);
+ INIT_PROGRAM_UNIFORM_LOCATION (border, corner_sizes);
/* cross fade */
INIT_PROGRAM_UNIFORM_LOCATION (cross_fade, progress);
uniform vec4 u_widths;
uniform vec4 u_outline;
-uniform vec4 u_corner_widths;
-uniform vec4 u_corner_heights;
+uniform vec2 u_corner_sizes[4];
void main() {
vec4 bounds = u_outline;
f.x += u_viewport.x;
f.y = (u_viewport.y + u_viewport.w) - f.y;
- RoundedRect routside = RoundedRect (bounds, u_corner_widths, u_corner_heights);
+ vec4 corner_widths = vec4(u_corner_sizes[0].x, u_corner_sizes[1].x, u_corner_sizes[2].x, u_corner_sizes[3].x);
+ vec4 corner_heights = vec4(u_corner_sizes[0].y, u_corner_sizes[1].y, u_corner_sizes[2].y, u_corner_sizes[3].y);
+ RoundedRect routside = RoundedRect (bounds, corner_widths, corner_heights);
RoundedRect rinside = rounded_rect_shrink (routside, u_widths);
float alpha = clamp (rounded_rect_coverage (routside, f.xy) -