mirror of
https://github.com/brl/mutter.git
synced 2025-08-08 01:24:46 +00:00
Bug 918 - Group doesn't clip if it's children are clipped
* clutter/cogl/common/cogl-clip-stack.h: * clutter/cogl/common/cogl-clip-stack.c: Added functions to maintain a stack of clipping rectangles. * clutter/cogl/gles/cogl.c: * clutter/cogl/gl/cogl.c: The cogl_clip_set and unset functions have moved into cogl-clip-stack.c which calls back to cogl.c to set the actual rectangles. Multiple clip rectangles are combined by merging the stencil buffers. * clutter/cogl/gles/cogl-primitives.c (_cogl_path_fill_nodes): * clutter/cogl/gl/cogl-primitives.c (_cogl_path_fill_nodes): Merge the stencil buffer with the contents of the clipping stack after drawing the path. * clutter/cogl/gles/cogl-context.h (CoglContext): * clutter/cogl/gl/cogl-context.h (CoglContext): Store the number of available stencil bits. * clutter/cogl/common/Makefile.am (libclutter_cogl_common_la_SOURCES): Added cogl-clip-stack.c
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-clip-stack.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
@@ -177,23 +178,29 @@ _cogl_path_fill_nodes ()
|
||||
GE( glClear (GL_STENCIL_BUFFER_BIT) );
|
||||
|
||||
GE( cogl_wrap_glEnable (GL_STENCIL_TEST) );
|
||||
GE( glStencilFunc (GL_ALWAYS, 0x0, 0x0) );
|
||||
GE( glStencilFunc (GL_NEVER, 0x0, 0x1) );
|
||||
GE( glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT) );
|
||||
GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE) );
|
||||
|
||||
GE( glStencilMask (1) );
|
||||
|
||||
cogl_enable (COGL_ENABLE_VERTEX_ARRAY
|
||||
| (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0));
|
||||
|
||||
GE( cogl_wrap_glVertexPointer (2, GL_FIXED, 0, ctx->path_nodes) );
|
||||
GE( cogl_wrap_glDrawArrays (GL_TRIANGLE_FAN, 0, ctx->path_nodes_size) );
|
||||
|
||||
GE( glStencilMask (~(GLuint) 0) );
|
||||
|
||||
/* Merge the stencil buffer with any clipping rectangles */
|
||||
_cogl_clip_stack_merge ();
|
||||
|
||||
GE( glStencilFunc (GL_EQUAL, 0x1, 0x1) );
|
||||
GE( glStencilOp (GL_ZERO, GL_ZERO, GL_ZERO) );
|
||||
GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
|
||||
GE( glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP) );
|
||||
|
||||
cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h);
|
||||
|
||||
GE( cogl_wrap_glDisable (GL_STENCIL_TEST) );
|
||||
/* Rebuild the stencil clip */
|
||||
_cogl_clip_stack_rebuild (TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user