[cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer

Using cogl_rectangle (and thus the journal) in
_cogl_add_path_to_stencil_buffer means we have to consider all the state
that the journal may change in case it may interfer with the direct GL calls
used.  This has proven to be error prone and in this case the journal is an
unnecissary overhead.  We now simply call glRectf instead of using
cogl_rectangle.
This commit is contained in:
Robert Bragg 2009-06-22 00:05:02 +01:00
parent 6562f3224a
commit 7b7787b050

View File

@ -169,12 +169,10 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
GE( glColorMask (FALSE, FALSE, FALSE, FALSE) ); GE( glColorMask (FALSE, FALSE, FALSE, FALSE) );
GE( glDepthMask (FALSE) ); GE( glDepthMask (FALSE) );
while (path_start < path_size)
{
/* NB: after calling _cogl_journal_flush the current matrix
* state is undefined */
_cogl_current_matrix_state_flush (); _cogl_current_matrix_state_flush ();
while (path_start < path_size)
{
GE( glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode), GE( glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
(guchar *) path (guchar *) path
+ G_STRUCT_OFFSET (CoglPathNode, x)) ); + G_STRUCT_OFFSET (CoglPathNode, x)) );
@ -186,9 +184,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
significant bit */ significant bit */
GE( glStencilMask (merge ? 6 : 3) ); GE( glStencilMask (merge ? 6 : 3) );
GE( glStencilOp (GL_ZERO, GL_REPLACE, GL_REPLACE) ); GE( glStencilOp (GL_ZERO, GL_REPLACE, GL_REPLACE) );
cogl_rectangle (bounds_x, bounds_y, glRectf (bounds_x, bounds_y,
bounds_x + bounds_w, bounds_y + bounds_h); bounds_x + bounds_w, bounds_y + bounds_h);
_cogl_journal_flush ();
GE( glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT) ); GE( glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT) );
} }
@ -221,9 +218,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
_cogl_current_matrix_push (); _cogl_current_matrix_push ();
_cogl_current_matrix_identity (); _cogl_current_matrix_identity ();
cogl_rectangle (-1.0, -1.0, 1.0, 1.0); glRectf (-1.0, -1.0, 1.0, 1.0);
cogl_rectangle (-1.0, -1.0, 1.0, 1.0); glRectf (-1.0, -1.0, 1.0, 1.0);
_cogl_journal_flush ();
_cogl_current_matrix_pop (); _cogl_current_matrix_pop ();