diff options
author | David Reveman <davidr@novell.com> | 2004-05-10 21:00:31 +0000 |
---|---|---|
committer | David Reveman <davidr@novell.com> | 2004-05-10 21:00:31 +0000 |
commit | bd929a49e21d7745ef623bbce42e26a17e79bd45 (patch) | |
tree | 16a9a837bcb318ee8f1ed49ce7464d4dbab479de | |
parent | 25b0a3d18350943b622ff2745f5d307c7e0b7a51 (diff) |
Added polygon opacity support
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/glitz.h | 4 | ||||
-rw-r--r-- | src/glitz_surface.c | 9 | ||||
-rw-r--r-- | src/glitz_trap.c | 27 | ||||
-rw-r--r-- | src/glitz_tri.c | 25 | ||||
-rw-r--r-- | src/glitzint.h | 2 |
7 files changed, 77 insertions, 9 deletions
@@ -1,5 +1,22 @@ 2004-05-10 David Reveman <c99drn@cs.umu.se> + * TODO: Added polygon opacity support. + + * src/glitz_tri.c (glitz_int_composite_triangles): Added polygon + opacity support. + + * src/glitz_trap.c (glitz_composite_trapezoids): Added polygon + opacity support. + + * src/glitz_surface.c (glitz_surface_init): Initialize polyopacity + to 1.0. + Added glitz_surface_set_polyopacity. + + * src/glitzint.h: Added surface attribute polyopacity. + Added glitz_surface_set_polyopacity. + + * src/glitz.h: Added glitz_surface_set_polyopacity. + * src/glitz_agl_surface.c: region_box -> bounding_box, sub_pixel_region_box -> bounding_box_double. @@ -3,8 +3,6 @@ * Copy area operation. -* Alpha scaling of source surface with polygon rendering. - * Text support. Glyph set management, glyph and string compositing operations. Some ideas: Multi-texturing for compositing multiple glyphs per render pass, Sub-pixel rendering, vector text; glyphs loaded into diff --git a/src/glitz.h b/src/glitz.h index 63a62d7..b1de62c 100644 --- a/src/glitz.h +++ b/src/glitz.h @@ -299,6 +299,10 @@ void glitz_surface_set_polyedge (glitz_surface_t *surface, glitz_polyedge_t polyedge); +void +glitz_surface_set_polyopacity (glitz_surface_t *surface, + unsigned short polyopacity); + typedef enum { GLITZ_CLIP_OPERATOR_SET, GLITZ_CLIP_OPERATOR_UNION, diff --git a/src/glitz_surface.c b/src/glitz_surface.c index 9579fad..0e04fe2 100644 --- a/src/glitz_surface.c +++ b/src/glitz_surface.c @@ -48,6 +48,7 @@ glitz_surface_init (glitz_surface_t *surface, surface->filter = GLITZ_FILTER_NEAREST; surface->polyedge = GLITZ_POLYEDGE_SMOOTH; + surface->polyopacity = 0xffff; surface->programs = programs; surface->format = format; @@ -380,6 +381,14 @@ glitz_surface_set_polyedge (glitz_surface_t *surface, } slim_hidden_def(glitz_surface_set_polyedge); +void +glitz_surface_set_polyopacity (glitz_surface_t *surface, + unsigned short polyopacity) +{ + surface->polyopacity = polyopacity; +} +slim_hidden_def(glitz_surface_set_polyopacity); + int glitz_surface_get_width (glitz_surface_t *surface) { diff --git a/src/glitz_trap.c b/src/glitz_trap.c index 0170161..ab1100f 100644 --- a/src/glitz_trap.c +++ b/src/glitz_trap.c @@ -187,7 +187,7 @@ glitz_composite_trapezoids (glitz_operator_t op, int width, height; if (n_traps == 0) - return; + return; x_dst = traps[0].left.p1.x >> 16; y_dst = traps[0].left.p1.y >> 16; @@ -238,6 +238,17 @@ glitz_composite_trapezoids (glitz_operator_t op, mask, -bounds.x1, -bounds.y1, &color, traps, n_traps); + if (dst->polyopacity != 0xffff) { + glitz_rectangle_t rect; + glitz_color_t color; + + rect.x = rect.y = 0; + rect.width = mask->width; + rect.height = mask->height; + color.red = color.green = color.blue = color.alpha = dst->polyopacity; + glitz_int_fill_rectangles (GLITZ_OPERATOR_IN, mask, &color, &rect, 1); + } + glitz_surface_dirty (mask, NULL); glitz_surface_pop_current (mask); @@ -267,7 +278,14 @@ glitz_composite_trapezoids (glitz_operator_t op, y_offset = trap_bounds.y1; width = trap_bounds.x2 - trap_bounds.x1; height = trap_bounds.y2 - trap_bounds.y1; - mask = NULL; + + if (dst->polyopacity != 0xffff) { + glitz_color_t color; + + color.red = color.green = color.blue = color.alpha = dst->polyopacity; + mask = glitz_surface_create_solid (&color); + } else + mask = NULL; } glitz_composite (op, @@ -280,9 +298,10 @@ glitz_composite_trapezoids (glitz_operator_t op, x_offset, y_offset, width, height); - if (use_mask) { + if (mask) glitz_surface_destroy (mask); - } else { + + if (!use_mask) { glitz_int_clip_operator_t clip_op; static glitz_rectangle_t rect = { 0, 0, MAXSHORT, MAXSHORT }; diff --git a/src/glitz_tri.c b/src/glitz_tri.c index 1a27155..a991a09 100644 --- a/src/glitz_tri.c +++ b/src/glitz_tri.c @@ -203,6 +203,17 @@ glitz_int_composite_triangles (glitz_operator_t op, -bounds.x1, -bounds.y1, &color, points, n_points); + if (dst->polyopacity != 0xffff) { + glitz_rectangle_t rect; + glitz_color_t color; + + rect.x = rect.y = 0; + rect.width = mask->width; + rect.height = mask->height; + color.red = color.green = color.blue = color.alpha = dst->polyopacity; + glitz_int_fill_rectangles (GLITZ_OPERATOR_IN, mask, &color, &rect, 1); + } + glitz_surface_dirty (mask, NULL); glitz_surface_pop_current (mask); @@ -233,7 +244,14 @@ glitz_int_composite_triangles (glitz_operator_t op, y_offset = tri_bounds.y1; width = tri_bounds.x2 - tri_bounds.x1; height = tri_bounds.y2 - tri_bounds.y1; - mask = NULL; + + if (dst->polyopacity != 0xffff) { + glitz_color_t color; + + color.red = color.green = color.blue = color.alpha = dst->polyopacity; + mask = glitz_surface_create_solid (&color); + } else + mask = NULL; } glitz_composite (op, @@ -246,9 +264,10 @@ glitz_int_composite_triangles (glitz_operator_t op, x_offset, y_offset, width, height); - if (use_mask) { + if (mask) glitz_surface_destroy (mask); - } else { + + if (!use_mask) { glitz_int_clip_operator_t clip_op; static glitz_rectangle_t rect = { 0, 0, MAXSHORT, MAXSHORT }; diff --git a/src/glitzint.h b/src/glitzint.h index 8c0ddc2..e32a583 100644 --- a/src/glitzint.h +++ b/src/glitzint.h @@ -312,6 +312,7 @@ struct _glitz_surface { glitz_matrix_t *convolution; unsigned int clip_mask; unsigned long hint_mask; + unsigned short polyopacity; }; #define GLITZ_COLOR_RANGE_UPDATE_TEXTURE_MASK (1L << 0) @@ -730,6 +731,7 @@ slim_hidden_proto(glitz_surface_set_convolution) slim_hidden_proto(glitz_surface_set_repeat) slim_hidden_proto(glitz_surface_set_filter) slim_hidden_proto(glitz_surface_set_polyedge) +slim_hidden_proto(glitz_surface_set_polyopacity) slim_hidden_proto(glitz_surface_get_width) slim_hidden_proto(glitz_surface_get_height) slim_hidden_proto(glitz_surface_update_size) |