mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
Changes cogl_rectangle to take x1, y1, x2, y2 args not x1, y1, width, height
This makes it consistent with cogl_rectangle_with_{multi,}texture_coords. Notably the reason cogl_rectangle_with_{multi,}texture_coords wasn't changed instead is that the former approach lets you describe back facing rectangles. (though technically you could pass negative width/height values to achieve this; it doesn't seem as neat.)
This commit is contained in:
parent
1d86b04e06
commit
c4b4500059
16
cogl-path.h
16
cogl-path.h
@ -52,17 +52,17 @@ G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* cogl_rectangle:
|
||||
* @x: X coordinate of the top-left corner
|
||||
* @y: Y coordinate of the top-left corner
|
||||
* @width: Width of the rectangle
|
||||
* @height: Height of the rectangle
|
||||
* @x1: X coordinate of the top-left corner
|
||||
* @y1: Y coordinate of the top-left corner
|
||||
* @x2: X coordinate of the bottom-right corner
|
||||
* @y2: Y coordinate of the bottom-right corner
|
||||
*
|
||||
* Fills a rectangle at the given coordinates with the current source material
|
||||
**/
|
||||
void cogl_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height);
|
||||
void cogl_rectangle (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2);
|
||||
|
||||
/**
|
||||
* cogl_path_fill:
|
||||
|
@ -45,14 +45,13 @@ void _cogl_path_fill_nodes ();
|
||||
void _cogl_path_stroke_nodes ();
|
||||
|
||||
void
|
||||
cogl_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height)
|
||||
cogl_rectangle (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2)
|
||||
{
|
||||
cogl_rectangle_with_multitexture_coords (x, y,
|
||||
x+width,
|
||||
y+height,
|
||||
cogl_rectangle_with_multitexture_coords (x1, y1,
|
||||
x2, y2,
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
|
@ -174,7 +174,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||
significant bit */
|
||||
GE( glStencilMask (merge ? 6 : 3) );
|
||||
GE( glStencilOp (GL_ZERO, GL_REPLACE, GL_REPLACE) );
|
||||
cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h);
|
||||
cogl_rectangle (bounds_x, bounds_y,
|
||||
bounds_x + bounds_w, bounds_y + bounds_h);
|
||||
|
||||
GE( glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT) );
|
||||
}
|
||||
@ -200,8 +201,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||
GE( glMatrixMode (GL_PROJECTION) );
|
||||
GE( glPushMatrix () );
|
||||
GE( glLoadIdentity () );
|
||||
cogl_rectangle (-1.0, -1.0, 2, 2);
|
||||
cogl_rectangle (-1.0, -1.0, 2, 2);
|
||||
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
|
||||
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
|
||||
GE( glPopMatrix () );
|
||||
GE( glMatrixMode (GL_MODELVIEW) );
|
||||
GE( glPopMatrix () );
|
||||
@ -235,7 +236,8 @@ _cogl_path_fill_nodes ()
|
||||
CoglPathNode, 0),
|
||||
ctx->clip.stencil_used);
|
||||
|
||||
cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h);
|
||||
cogl_rectangle (bounds_x, bounds_y,
|
||||
bounds_x + bounds_w, bounds_y + bounds_h);
|
||||
|
||||
/* The stencil buffer now contains garbage so the clip area needs to
|
||||
be rebuilt */
|
||||
|
@ -180,7 +180,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||
significant bit */
|
||||
GE( glStencilMask (merge ? 6 : 3) );
|
||||
GE( glStencilOp (GL_ZERO, GL_REPLACE, GL_REPLACE) );
|
||||
cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h);
|
||||
cogl_rectangle (bounds_x, bounds_y,
|
||||
bounds_x + bounds_w, bounds_y + bounds_h);
|
||||
|
||||
GE( glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT) );
|
||||
}
|
||||
@ -206,8 +207,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||
GE( glMatrixMode (GL_PROJECTION) );
|
||||
GE( glPushMatrix () );
|
||||
GE( glLoadIdentity () );
|
||||
cogl_rectangle (-1.0, -1.0, 2, 2);
|
||||
cogl_rectangle (-1.0, -1.0, 2, 2);
|
||||
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
|
||||
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
|
||||
GE( glPopMatrix () );
|
||||
GE( glMatrixMode (GL_MODELVIEW) );
|
||||
GE( glPopMatrix () );
|
||||
@ -412,7 +413,8 @@ _cogl_path_fill_nodes ()
|
||||
CoglPathNode, 0),
|
||||
ctx->clip.stencil_used);
|
||||
|
||||
cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h);
|
||||
cogl_rectangle (bounds_x, bounds_y,
|
||||
bounds_x + bounds_w, bounds_y + bounds_h);
|
||||
|
||||
/* The stencil buffer now contains garbage so the clip area needs to
|
||||
be rebuilt */
|
||||
|
@ -404,7 +404,8 @@ _cogl_add_stencil_clip (float x_offset,
|
||||
GE( glStencilFunc (GL_NEVER, 0x1, 0x1) );
|
||||
GE( glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE) );
|
||||
|
||||
cogl_rectangle (x_offset, y_offset, width, height);
|
||||
cogl_rectangle (x_offset, y_offset,
|
||||
x_offset + width, y_offset + height);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -412,7 +413,8 @@ _cogl_add_stencil_clip (float x_offset,
|
||||
rectangle */
|
||||
GE( glStencilFunc (GL_NEVER, 0x1, 0x3) );
|
||||
GE( glStencilOp (GL_INCR, GL_INCR, GL_INCR) );
|
||||
cogl_rectangle (x_offset, y_offset, width, height);
|
||||
cogl_rectangle (x_offset, y_offset,
|
||||
x_offset + width, y_offset + height);
|
||||
|
||||
/* Subtract one from all pixels in the stencil buffer so that
|
||||
only pixels where both the original stencil buffer and the
|
||||
@ -423,7 +425,7 @@ _cogl_add_stencil_clip (float x_offset,
|
||||
GE( glMatrixMode (GL_PROJECTION) );
|
||||
GE( glPushMatrix () );
|
||||
GE( glLoadIdentity () );
|
||||
cogl_rectangle (-1.0, -1.0, 2, 2);
|
||||
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
|
||||
GE( glPopMatrix () );
|
||||
GE( glMatrixMode (GL_MODELVIEW) );
|
||||
GE( glPopMatrix () );
|
||||
|
Loading…
Reference in New Issue
Block a user