From b40712e509532ae664a8520f750311f720f25b8c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 3 Oct 2007 12:29:00 +0100 Subject: Protect the REGION macros to avoid conflicts when used inside X server. --- src/glitz.c | 2 +- src/glitz_context.c | 6 +++--- src/glitz_drawable.c | 2 +- src/glitz_framebuffer.c | 2 +- src/glitz_pixel.c | 2 +- src/glitz_region.c | 4 ++-- src/glitz_surface.c | 56 ++++++++++++++++++++++++------------------------- src/glitzint.h | 20 +++++++++--------- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/glitz.c b/src/glitz.c index 4e4c952..fa18e54 100644 --- a/src/glitz.c +++ b/src/glitz.c @@ -416,7 +416,7 @@ glitz_copy_area (glitz_surface_t *src, glitz_box_t box, *clip = dst->clip; int n_clip = dst->n_clip; - if (REGION_NOTEMPTY (&src->drawable_damage)) + if (GLITZ_REGION_NOTEMPTY (&src->drawable_damage)) { glitz_surface_push_current (src, GLITZ_DRAWABLE_CURRENT); glitz_surface_pop_current (src); diff --git a/src/glitz_context.c b/src/glitz_context.c index 377dd59..f07e755 100644 --- a/src/glitz_context.c +++ b/src/glitz_context.c @@ -124,7 +124,7 @@ glitz_context_make_current (glitz_context_t *context, if (drawable->front) { - if (REGION_NOTEMPTY (&drawable->front->drawable_damage)) + if (GLITZ_REGION_NOTEMPTY (&drawable->front->drawable_damage)) { glitz_surface_push_current (drawable->front, GLITZ_DRAWABLE_CURRENT); @@ -138,7 +138,7 @@ glitz_context_make_current (glitz_context_t *context, if (drawable->back) { - if (REGION_NOTEMPTY (&drawable->back->drawable_damage)) + if (GLITZ_REGION_NOTEMPTY (&drawable->back->drawable_damage)) { glitz_surface_push_current (drawable->back, GLITZ_DRAWABLE_CURRENT); @@ -162,7 +162,7 @@ glitz_context_bind_texture (glitz_context_t *context, { glitz_gl_proc_address_list_t *gl = context->drawable->backend->gl; - if (REGION_NOTEMPTY (&texture->surface->texture_damage)) + if (GLITZ_REGION_NOTEMPTY (&texture->surface->texture_damage)) { glitz_lose_current_function_t lose_current; diff --git a/src/glitz_drawable.c b/src/glitz_drawable.c index 66dce22..f6ed856 100644 --- a/src/glitz_drawable.c +++ b/src/glitz_drawable.c @@ -224,7 +224,7 @@ glitz_drawable_swap_buffer_region (glitz_drawable_t *drawable, { if (drawable->front) { - REGION_EMPTY (&drawable->front->drawable_damage); + GLITZ_REGION_EMPTY (&drawable->front->drawable_damage); glitz_surface_damage (drawable->front, NULL, GLITZ_DAMAGE_TEXTURE_MASK | GLITZ_DAMAGE_SOLID_MASK); diff --git a/src/glitz_framebuffer.c b/src/glitz_framebuffer.c index ca3a2e2..04ef416 100644 --- a/src/glitz_framebuffer.c +++ b/src/glitz_framebuffer.c @@ -210,7 +210,7 @@ _glitz_fbo_attach_notify (void *abstract_drawable, return; } - REGION_EMPTY (&surface->drawable_damage); + GLITZ_REGION_EMPTY (&surface->drawable_damage); } static void diff --git a/src/glitz_pixel.c b/src/glitz_pixel.c index d27b1d5..ca03585 100644 --- a/src/glitz_pixel.c +++ b/src/glitz_pixel.c @@ -1049,7 +1049,7 @@ glitz_set_pixels (glitz_surface_t *dst, /* avoid context switch in this case */ if (!dst->attached && TEXTURE_ALLOCATED (&dst->texture) && - !REGION_NOTEMPTY (&dst->texture_damage)) + !GLITZ_REGION_NOTEMPTY (&dst->texture_damage)) { dst->drawable->backend->push_current (dst->drawable, dst, GLITZ_ANY_CONTEXT_CURRENT, diff --git a/src/glitz_region.c b/src/glitz_region.c index f853ef9..ff0aaed 100644 --- a/src/glitz_region.c +++ b/src/glitz_region.c @@ -29,7 +29,7 @@ #include "glitzint.h" -#define REGION_ALLOC_CHUNK 16 +#define GLITZ_REGION_ALLOC_CHUNK 16 #define BOX_SUBSUMS_BOX(b1, b2) \ ((b2)->x1 >= (b1)->x1 && \ @@ -146,7 +146,7 @@ glitz_region_union (glitz_region_t *region, * Add box to region */ if (region->size < (region->n_box + 1)) { - region->size += REGION_ALLOC_CHUNK; + region->size += GLITZ_REGION_ALLOC_CHUNK; region->data = (void *) realloc (region->data, sizeof (glitz_box_t) * region->size); if (!region->data) diff --git a/src/glitz_surface.c b/src/glitz_surface.c index d870fb3..6ba8e85 100644 --- a/src/glitz_surface.c +++ b/src/glitz_surface.c @@ -79,13 +79,13 @@ glitz_surface_create (glitz_drawable_t *drawable, surface->flags |= GLITZ_SURFACE_FLAG_SOLID_MASK; surface->solid.alpha = 0xffff; - REGION_INIT (&surface->texture_damage, &surface->box); - REGION_INIT (&surface->drawable_damage, &surface->box); + GLITZ_REGION_INIT (&surface->texture_damage, &surface->box); + GLITZ_REGION_INIT (&surface->drawable_damage, &surface->box); } else { - REGION_INIT (&surface->texture_damage, NULL_BOX); - REGION_INIT (&surface->drawable_damage, NULL_BOX); + GLITZ_REGION_INIT (&surface->texture_damage, GLITZ_NULL_BOX); + GLITZ_REGION_INIT (&surface->drawable_damage, GLITZ_NULL_BOX); } glitz_texture_init (&surface->texture, width, height, @@ -141,8 +141,8 @@ glitz_surface_destroy (glitz_surface_t *surface) glitz_surface_pop_current (surface); } - REGION_UNINIT (&surface->texture_damage); - REGION_UNINIT (&surface->drawable_damage); + GLITZ_REGION_UNINIT (&surface->texture_damage); + GLITZ_REGION_UNINIT (&surface->drawable_damage); if (surface->geometry.buffer) glitz_buffer_destroy (surface->geometry.buffer); @@ -173,7 +173,7 @@ glitz_surface_reference (glitz_surface_t *surface) void _glitz_surface_sync_texture (glitz_surface_t *surface) { - if (REGION_NOTEMPTY (&surface->texture_damage)) + if (GLITZ_REGION_NOTEMPTY (&surface->texture_damage)) { glitz_box_t *box; int n_box; @@ -202,7 +202,7 @@ _glitz_surface_sync_texture (glitz_surface_t *surface) GLITZ_GL_FLOAT, color); glitz_texture_unbind (gl, &surface->texture); } - REGION_EMPTY (&surface->texture_damage); + GLITZ_REGION_EMPTY (&surface->texture_damage); return; } @@ -215,8 +215,8 @@ _glitz_surface_sync_texture (glitz_surface_t *surface) glitz_texture_bind (gl, &surface->texture); - box = REGION_RECTS (&surface->texture_damage); - n_box = REGION_NUM_RECTS (&surface->texture_damage); + box = GLITZ_REGION_RECTS (&surface->texture_damage); + n_box = GLITZ_REGION_NUM_RECTS (&surface->texture_damage); while (n_box--) { @@ -233,7 +233,7 @@ _glitz_surface_sync_texture (glitz_surface_t *surface) box++; } - REGION_EMPTY (&surface->texture_damage); + GLITZ_REGION_EMPTY (&surface->texture_damage); glitz_texture_unbind (gl, &surface->texture); @@ -246,7 +246,7 @@ _glitz_surface_sync_texture (glitz_surface_t *surface) void glitz_surface_sync_drawable (glitz_surface_t *surface) { - if (REGION_NOTEMPTY (&surface->drawable_damage)) + if (GLITZ_REGION_NOTEMPTY (&surface->drawable_damage)) { glitz_texture_t *texture; glitz_texture_parameters_t param; @@ -259,9 +259,9 @@ glitz_surface_sync_drawable (glitz_surface_t *surface) if (!texture) return; - box = REGION_RECTS (&surface->drawable_damage); - ext = REGION_EXTENTS (&surface->drawable_damage); - n_box = REGION_NUM_RECTS (&surface->drawable_damage); + box = GLITZ_REGION_RECTS (&surface->drawable_damage); + ext = GLITZ_REGION_EXTENTS (&surface->drawable_damage); + n_box = GLITZ_REGION_NUM_RECTS (&surface->drawable_damage); glitz_texture_bind (gl, texture); @@ -329,7 +329,7 @@ glitz_surface_sync_drawable (glitz_surface_t *surface) glitz_texture_unbind (gl, texture); - REGION_EMPTY (&surface->drawable_damage); + GLITZ_REGION_EMPTY (&surface->drawable_damage); } } @@ -374,7 +374,7 @@ glitz_surface_get_texture (glitz_surface_t *surface, { GLITZ_GL_SURFACE (surface); - if (REGION_NOTEMPTY (&surface->texture_damage)) + if (GLITZ_REGION_NOTEMPTY (&surface->texture_damage)) { _glitz_surface_sync_texture (surface); } @@ -400,23 +400,23 @@ glitz_surface_damage (glitz_surface_t *surface, if (box) { if (what & GLITZ_DAMAGE_DRAWABLE_MASK) - REGION_UNION (&surface->drawable_damage, box); + GLITZ_REGION_UNION (&surface->drawable_damage, box); if (surface->attached && (what & GLITZ_DAMAGE_TEXTURE_MASK)) - REGION_UNION (&surface->texture_damage, box); + GLITZ_REGION_UNION (&surface->texture_damage, box); } else { if (what & GLITZ_DAMAGE_DRAWABLE_MASK) { - REGION_EMPTY (&surface->drawable_damage); - REGION_INIT (&surface->drawable_damage, &surface->box); + GLITZ_REGION_EMPTY (&surface->drawable_damage); + GLITZ_REGION_INIT (&surface->drawable_damage, &surface->box); } if (surface->attached && (what & GLITZ_DAMAGE_TEXTURE_MASK)) { - REGION_EMPTY (&surface->texture_damage); - REGION_INIT (&surface->texture_damage, &surface->box); + GLITZ_REGION_EMPTY (&surface->texture_damage); + GLITZ_REGION_INIT (&surface->texture_damage, &surface->box); } } } @@ -544,7 +544,7 @@ glitz_surface_attach (glitz_surface_t *surface, glitz_surface_damage (surface, NULL, GLITZ_DAMAGE_DRAWABLE_MASK); if ((!SURFACE_SOLID (surface)) || SURFACE_SOLID_DAMAGE (surface)) - REGION_EMPTY (&surface->texture_damage); + GLITZ_REGION_EMPTY (&surface->texture_damage); } } @@ -554,7 +554,7 @@ glitz_surface_detach (glitz_surface_t *surface) if (!surface->attached) return; - if (REGION_NOTEMPTY (&surface->texture_damage)) + if (GLITZ_REGION_NOTEMPTY (&surface->texture_damage)) { glitz_surface_push_current (surface, GLITZ_DRAWABLE_CURRENT); _glitz_surface_sync_texture (surface); @@ -573,8 +573,8 @@ glitz_surface_detach (glitz_surface_t *surface) surface->attached = NULL; - REGION_EMPTY (&surface->drawable_damage); - REGION_INIT (&surface->drawable_damage, &surface->box); + GLITZ_REGION_EMPTY (&surface->drawable_damage); + GLITZ_REGION_INIT (&surface->drawable_damage, &surface->box); } glitz_drawable_t * @@ -913,7 +913,7 @@ glitz_surface_flush (glitz_surface_t *surface) if (!DRAWABLE_IS_FBO (surface->attached)) { - if (REGION_NOTEMPTY (&surface->drawable_damage)) + if (GLITZ_REGION_NOTEMPTY (&surface->drawable_damage)) { glitz_surface_push_current (surface, GLITZ_DRAWABLE_CURRENT); glitz_surface_pop_current (surface); diff --git a/src/glitzint.h b/src/glitzint.h index eb9aac6..e9c8d22 100644 --- a/src/glitzint.h +++ b/src/glitzint.h @@ -285,9 +285,9 @@ typedef struct _glitz_region_t { int size; } glitz_region_t; -#define NULL_BOX ((glitz_box_t *) 0) +#define GLITZ_NULL_BOX ((glitz_box_t *) 0) -#define REGION_INIT(region, __box) \ +#define GLITZ_REGION_INIT(region, __box) \ { \ if (__box) { \ (region)->extents = *(__box); \ @@ -303,7 +303,7 @@ typedef struct _glitz_region_t { } \ } -#define REGION_EMPTY(region) \ +#define GLITZ_REGION_EMPTY(region) \ { \ (region)->extents.x1 = 0; \ (region)->extents.y1 = 0; \ @@ -313,28 +313,28 @@ typedef struct _glitz_region_t { (region)->n_box = 0; \ } -#define REGION_UNINIT(region) \ +#define GLITZ_REGION_UNINIT(region) \ { \ - REGION_EMPTY (region); \ + GLITZ_REGION_EMPTY (region); \ if ((region)->data) \ free ((region)->data); \ (region)->data = NULL; \ (region)->size = 0; \ } -#define REGION_NOTEMPTY(region) \ +#define GLITZ_REGION_NOTEMPTY(region) \ ((region)->n_box) -#define REGION_RECTS(region) \ +#define GLITZ_REGION_RECTS(region) \ ((region)->box) -#define REGION_NUM_RECTS(region) \ +#define GLITZ_REGION_NUM_RECTS(region) \ ((region)->n_box) -#define REGION_EXTENTS(region) \ +#define GLITZ_REGION_EXTENTS(region) \ (&(region)->extents) -#define REGION_UNION(region, box) \ +#define GLITZ_REGION_UNION(region, box) \ glitz_region_union (region, box) extern glitz_status_t __internal_linkage -- cgit v1.2.3