[cairo-commit] glitz/src glitz.c, 1.34, 1.35 glitz.h, 1.33,
1.34 glitz_buffer.c, 1.7, 1.8 glitz_compose.c, 1.13,
1.14 glitz_context.c, 1.2, 1.3 glitz_drawable.c, 1.2,
1.3 glitz_filter.c, 1.9, 1.10 glitz_format.c, 1.10,
1.11 glitz_framebuffer.c, 1.2, 1.3 glitz_geometry.c, 1.6,
1.7 glitz_gl.h, 1.15, 1.16 glitz_operator.c, 1.7,
1.8 glitz_pixel.c, 1.20, 1.21 glitz_program.c, 1.17,
1.18 glitz_rect.c, 1.17, 1.18 glitz_region.c, 1.2,
1.3 glitz_status.c, 1.4, 1.5 glitz_surface.c, 1.30,
1.31 glitz_texture.c, 1.19, 1.20 glitz_trap.c, 1.10,
1.11 glitz_trapimp.h, 1.3, 1.4 glitz_util.c, 1.14,
1.15 glitzint.h, 1.35, 1.36
David Reveman
commit at pdx.freedesktop.org
Wed Sep 14 08:57:19 PDT 2005
- Previous message: [cairo-commit] glitz/src/glx glitz-glx.h, 1.3,
1.4 glitz_glx_context.c, 1.6, 1.7 glitz_glx_drawable.c, 1.3,
1.4 glitz_glx_extension.c, 1.2, 1.3 glitz_glx_format.c, 1.3,
1.4 glitz_glx_info.c, 1.4, 1.5 glitz_glx_pbuffer.c, 1.2,
1.3 glitz_glxext.h, 1.2, 1.3 glitz_glxint.h, 1.4, 1.5
- Next message: [cairo-commit] glitzinfo glitzinfo.c,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: davidr
Update of /cvs/cairo/glitz/src
In directory gabe:/tmp/cvs-serv6486/src
Modified Files:
glitz.c glitz.h glitz_buffer.c glitz_compose.c glitz_context.c
glitz_drawable.c glitz_filter.c glitz_format.c
glitz_framebuffer.c glitz_geometry.c glitz_gl.h
glitz_operator.c glitz_pixel.c glitz_program.c glitz_rect.c
glitz_region.c glitz_status.c glitz_surface.c glitz_texture.c
glitz_trap.c glitz_trapimp.h glitz_util.c glitzint.h
Log Message:
Merge new code
Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- glitz.c 4 Jul 2005 10:33:01 -0000 1.34
+++ glitz.c 14 Sep 2005 15:57:16 -0000 1.35
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...1072 lines suppressed...]
+ GLITZ_DAMAGE_SOLID_MASK);
+ }
+
+ clip++;
+ }
+
+ glitz_texture_unbind (gl, texture);
+
+ gl->enable (GLITZ_GL_SCISSOR_TEST);
+
+ status = GLITZ_STATUS_SUCCESS;
+ }
+ }
+ glitz_surface_pop_current (src);
}
if (status)
- glitz_surface_status_add (dst, glitz_status_to_status_mask (status));
+ glitz_surface_status_add (dst, glitz_status_to_status_mask (status));
}
Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- glitz.h 4 Jul 2005 10:33:01 -0000 1.33
+++ glitz.h 14 Sep 2005 15:57:16 -0000 1.34
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -37,8 +37,8 @@
#endif
#define GLITZ_MAJOR 0
-#define GLITZ_MINOR 4
-#define GLITZ_REVISION 4
+#define GLITZ_MINOR 5
+#define GLITZ_REVISION 0
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -51,6 +51,9 @@
typedef double glitz_double_t;
typedef int glitz_fixed16_16_t;
+typedef struct _glitz_drawable glitz_drawable_t;
+typedef struct _glitz_surface glitz_surface_t;
+
typedef struct _glitz_rectangle_t {
short x, y;
unsigned short width, height;
@@ -78,7 +81,7 @@
typedef struct _glitz_span_fixed_t {
glitz_fixed16_16_t left, right, y;
} glitz_span_fixed_t;
-
+
typedef struct _glitz_trap_t {
glitz_span_fixed_t top, bottom;
} glitz_trap_t;
@@ -93,7 +96,7 @@
unsigned short blue;
unsigned short alpha;
} glitz_color_t;
-
+
typedef enum {
GLITZ_FILTER_NEAREST,
GLITZ_FILTER_BILINEAR,
@@ -137,13 +140,16 @@
#define GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK (1L << 15)
#define GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK (1L << 16)
+
+/* glitz_format.c */
+
typedef enum {
GLITZ_STANDARD_ARGB32,
GLITZ_STANDARD_RGB24,
GLITZ_STANDARD_A8,
GLITZ_STANDARD_A1
} glitz_format_name_t;
-
+
#define GLITZ_FORMAT_ID_MASK (1L << 0)
#define GLITZ_FORMAT_RED_SIZE_MASK (1L << 1)
#define GLITZ_FORMAT_GREEN_SIZE_MASK (1L << 2)
@@ -159,9 +165,57 @@
unsigned short alpha_size;
} glitz_color_format_t;
-
+#define GLITZ_FORMAT_DEPTH_SIZE_MASK (1L << 5)
+#define GLITZ_FORMAT_STENCIL_SIZE_MASK (1L << 6)
+#define GLITZ_FORMAT_DOUBLEBUFFER_MASK (1L << 7)
+#define GLITZ_FORMAT_SAMPLES_MASK (1L << 8)
+
+typedef struct _glitz_drawable_format_t {
+ glitz_format_id_t id;
+ glitz_color_format_t color;
+ unsigned short depth_size;
+ unsigned short stencil_size;
+ unsigned short samples;
+ glitz_bool_t doublebuffer;
+} glitz_drawable_format_t;
+
+#define GLITZ_FORMAT_TYPE_MASK (1L << 5)
+
+typedef enum {
+ GLITZ_FORMAT_TYPE_COLOR
+} glitz_format_type_t;
+
+typedef struct _glitz_format_t {
+ glitz_format_id_t id;
+ glitz_format_type_t type;
+ glitz_color_format_t color;
+} glitz_format_t;
+
+glitz_format_t *
+glitz_find_standard_format (glitz_drawable_t *drawable,
+ glitz_format_name_t format_name);
+
+glitz_format_t *
+glitz_find_format (glitz_drawable_t *drawable,
+ unsigned long mask,
+ const glitz_format_t *templ,
+ int count);
+
+glitz_drawable_format_t *
+glitz_find_drawable_format (glitz_drawable_t *other,
+ unsigned long mask,
+ const glitz_drawable_format_t *templ,
+ int count);
+
+glitz_drawable_format_t *
+glitz_find_pbuffer_format (glitz_drawable_t *other,
+ unsigned long mask,
+ const glitz_drawable_format_t *templ,
+ int count);
+
+
/* glitz_status.c */
-
+
typedef enum {
GLITZ_STATUS_SUCCESS = 0,
GLITZ_STATUS_NO_MEMORY,
@@ -176,46 +230,22 @@
/* glitz_drawable.c */
-typedef struct _glitz_drawable glitz_drawable_t;
-
typedef enum {
GLITZ_DRAWABLE_BUFFER_FRONT_COLOR,
GLITZ_DRAWABLE_BUFFER_BACK_COLOR
} glitz_drawable_buffer_t;
-
-#define GLITZ_FORMAT_DEPTH_SIZE_MASK (1L << 5)
-#define GLITZ_FORMAT_STENCIL_SIZE_MASK (1L << 6)
-#define GLITZ_FORMAT_DOUBLEBUFFER_MASK (1L << 7)
-#define GLITZ_FORMAT_SAMPLES_MASK (1L << 8)
-#define GLITZ_FORMAT_WINDOW_MASK (1L << 9)
-#define GLITZ_FORMAT_PBUFFER_MASK (1L << 10)
-
-typedef struct _glitz_drawable_types_t {
- glitz_bool_t window;
- glitz_bool_t pbuffer;
-} glitz_drawable_types_t;
-typedef struct _glitz_drawable_format_t {
- glitz_format_id_t id;
- glitz_color_format_t color;
- unsigned short depth_size;
- unsigned short stencil_size;
- unsigned short samples;
- glitz_bool_t doublebuffer;
- glitz_drawable_types_t types;
-} glitz_drawable_format_t;
+glitz_drawable_t *
+glitz_create_drawable (glitz_drawable_t *other,
+ glitz_drawable_format_t *format,
+ unsigned int width,
+ unsigned int height);
-glitz_drawable_format_t *
-glitz_find_similar_drawable_format (glitz_drawable_t *other,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
glitz_drawable_t *
glitz_create_pbuffer_drawable (glitz_drawable_t *other,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
+ glitz_drawable_format_t *format,
+ unsigned int width,
+ unsigned int height);
void
glitz_drawable_destroy (glitz_drawable_t *drawable);
@@ -225,8 +255,8 @@
void
glitz_drawable_update_size (glitz_drawable_t *drawable,
- unsigned int width,
- unsigned int height);
+ unsigned int width,
+ unsigned int height);
unsigned int
glitz_drawable_get_width (glitz_drawable_t *drawable);
@@ -235,6 +265,13 @@
glitz_drawable_get_height (glitz_drawable_t *drawable);
void
+glitz_drawable_swap_buffer_region (glitz_drawable_t *drawable,
+ int x_origin,
+ int y_origin,
+ glitz_box_t *box,
+ int n_box);
+
+void
glitz_drawable_swap_buffers (glitz_drawable_t *drawable);
void
@@ -249,49 +286,22 @@
glitz_drawable_format_t *
glitz_drawable_get_format (glitz_drawable_t *drawable);
-
-/* glitz_format.c */
-
-#define GLITZ_FORMAT_TYPE_MASK (1L << 5)
-
-typedef enum {
- GLITZ_FORMAT_TYPE_COLOR
-} glitz_format_type_t;
-
-typedef struct _glitz_format_t {
- glitz_format_id_t id;
- glitz_format_type_t type;
- glitz_color_format_t color;
-} glitz_format_t;
-
-glitz_format_t *
-glitz_find_standard_format (glitz_drawable_t *drawable,
- glitz_format_name_t format_name);
-
-glitz_format_t *
-glitz_find_format (glitz_drawable_t *drawable,
- unsigned long mask,
- const glitz_format_t *templ,
- int count);
-
/* glitz_surface.c */
-typedef struct _glitz_surface glitz_surface_t;
-
#define GLITZ_SURFACE_UNNORMALIZED_MASK (1L << 0)
typedef struct _glitz_surface_attributes_t {
glitz_bool_t unnormalized;
} glitz_surface_attributes_t;
-
+
glitz_surface_t *
glitz_surface_create (glitz_drawable_t *drawable,
- glitz_format_t *format,
- unsigned int width,
- unsigned int height,
- unsigned long mask,
- glitz_surface_attributes_t *attributes);
+ glitz_format_t *format,
+ unsigned int width,
+ unsigned int height,
+ unsigned long mask,
+ glitz_surface_attributes_t *attributes);
void
glitz_surface_destroy (glitz_surface_t *surface);
@@ -301,10 +311,8 @@
void
glitz_surface_attach (glitz_surface_t *surface,
- glitz_drawable_t *drawable,
- glitz_drawable_buffer_t buffer,
- int x,
- int y);
+ glitz_drawable_t *drawable,
+ glitz_drawable_buffer_t buffer);
void
glitz_surface_detach (glitz_surface_t *surface);
@@ -320,7 +328,7 @@
void
glitz_surface_set_transform (glitz_surface_t *surface,
- glitz_transform_t *transform);
+ glitz_transform_t *transform);
typedef enum {
GLITZ_FILL_TRANSPARENT,
@@ -331,21 +339,21 @@
void
glitz_surface_set_fill (glitz_surface_t *surface,
- glitz_fill_t fill);
+ glitz_fill_t fill);
void
glitz_surface_set_component_alpha (glitz_surface_t *surface,
- glitz_bool_t component_alpha);
+ glitz_bool_t component_alpha);
void
glitz_surface_set_filter (glitz_surface_t *surface,
- glitz_filter_t filter,
- glitz_fixed16_16_t *params,
- int n_params);
+ glitz_filter_t filter,
+ glitz_fixed16_16_t *params,
+ int n_params);
void
glitz_surface_set_dither (glitz_surface_t *surface,
- glitz_bool_t dither);
+ glitz_bool_t dither);
unsigned int
glitz_surface_get_width (glitz_surface_t *surface);
@@ -361,27 +369,87 @@
void
glitz_surface_translate_point (glitz_surface_t *surface,
- glitz_point_fixed_t *src,
- glitz_point_fixed_t *dst);
+ glitz_point_fixed_t *src,
+ glitz_point_fixed_t *dst);
void
glitz_surface_set_clip_region (glitz_surface_t *surface,
- int x_origin,
- int y_origin,
- glitz_box_t *box,
- int n_box);
+ int x_origin,
+ int y_origin,
+ glitz_box_t *box,
+ int n_box);
glitz_bool_t
glitz_surface_valid_target (glitz_surface_t *surface);
+/* glitz_texture.c */
+
+typedef struct _glitz_texture_object glitz_texture_object_t;
+
+glitz_texture_object_t *
+glitz_texture_object_create (glitz_surface_t *surface);
+
+void
+glitz_texture_object_destroy (glitz_texture_object_t *texture);
+
+void
+glitz_texture_object_reference (glitz_texture_object_t *texture);
+
+typedef enum {
+ GLITZ_TEXTURE_FILTER_TYPE_MAG = 0,
+ GLITZ_TEXTURE_FILTER_TYPE_MIN = 1
+} glitz_texture_filter_type_t;
+
+typedef enum {
+ GLITZ_TEXTURE_FILTER_NEAREST = 0,
+ GLITZ_TEXTURE_FILTER_LINEAR = 1
+} glitz_texture_filter_t;
+
+void
+glitz_texture_object_set_filter (glitz_texture_object_t *texture,
+ glitz_texture_filter_type_t type,
+ glitz_texture_filter_t filter);
+
+typedef enum {
+ GLITZ_TEXTURE_WRAP_TYPE_S = 0,
+ GLITZ_TEXTURE_WRAP_TYPE_T = 1
+} glitz_texture_wrap_type_t;
+
+typedef enum {
+ GLITZ_TEXTURE_WRAP_CLAMP = 0,
+ GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE = 1,
+ GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER = 2,
+ GLITZ_TEXTURE_WRAP_REPEAT = 3,
+ GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT = 4
+} glitz_texture_wrap_t;
+
+void
+glitz_texture_object_set_wrap (glitz_texture_object_t *texture,
+ glitz_texture_wrap_type_t type,
+ glitz_texture_wrap_t wrap);
+
+void
+glitz_texture_object_set_border_color (glitz_texture_object_t *texture,
+ glitz_color_t *color);
+
+typedef enum {
+ GLITZ_TEXTURE_TARGET_2D = 0,
+ GLITZ_TEXTURE_TARGET_RECT = 1
+} glitz_texture_target_t;
+
+glitz_texture_target_t
+glitz_texture_object_get_target (glitz_texture_object_t *texture);
+
+
/* glitz_context.c */
typedef struct _glitz_context glitz_context_t;
glitz_context_t *
glitz_context_create (glitz_drawable_t *drawable,
- glitz_drawable_format_t *format);
+ glitz_drawable_format_t *format);
+
void
glitz_context_destroy (glitz_context_t *context);
@@ -390,51 +458,52 @@
void
glitz_context_copy (glitz_context_t *src,
- glitz_context_t *dst,
- unsigned long mask);
+ glitz_context_t *dst,
+ unsigned long mask);
typedef void (*glitz_lose_current_function_t) (void *closure);
void
glitz_context_set_user_data (glitz_context_t *context,
- void *closure,
- glitz_lose_current_function_t lose_current);
+ void *closure,
+ glitz_lose_current_function_t lose_current);
typedef void (*glitz_function_pointer_t) (void);
glitz_function_pointer_t
glitz_context_get_proc_address (glitz_context_t *context,
- const char *name);
+ const char *name);
void
-glitz_context_make_current (glitz_context_t *context);
+glitz_context_make_current (glitz_context_t *context,
+ glitz_drawable_t *drawable);
void
-glitz_context_bind_texture (glitz_context_t *context,
- glitz_surface_t *surface);
+glitz_context_bind_texture (glitz_context_t *context,
+ glitz_texture_object_t *texture);
/* glitz_rect.c */
void
glitz_set_rectangle (glitz_surface_t *dst,
- const glitz_color_t *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height);
-
+ const glitz_color_t *color,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height);
+
void
glitz_set_rectangles (glitz_surface_t *dst,
- const glitz_color_t *color,
- const glitz_rectangle_t *rects,
- int n_rects);
+ const glitz_color_t *color,
+ const glitz_rectangle_t *rects,
+ int n_rects);
/* glitz_buffer.c */
typedef struct _glitz_buffer glitz_buffer_t;
-
+
typedef enum {
GLITZ_BUFFER_HINT_STREAM_DRAW,
GLITZ_BUFFER_HINT_STREAM_READ,
@@ -455,19 +524,19 @@
glitz_buffer_t *
glitz_vertex_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint);
+ void *data,
+ unsigned int size,
+ glitz_buffer_hint_t hint);
glitz_buffer_t *
glitz_pixel_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint);
+ void *data,
+ unsigned int size,
+ glitz_buffer_hint_t hint);
glitz_buffer_t *
glitz_buffer_create_for_data (void *data);
-
+
void
glitz_buffer_destroy (glitz_buffer_t *buffer);
@@ -476,26 +545,26 @@
void
glitz_buffer_set_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- const void *data);
+ int offset,
+ unsigned int size,
+ const void *data);
void
glitz_buffer_get_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- void *data);
-
+ int offset,
+ unsigned int size,
+ void *data);
+
void *
glitz_buffer_map (glitz_buffer_t *buffer,
- glitz_buffer_access_t access);
-
+ glitz_buffer_access_t access);
+
glitz_status_t
glitz_buffer_unmap (glitz_buffer_t *buffer);
-
+
/* glitz_pixel.c */
-
+
typedef enum {
GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN,
GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
@@ -519,23 +588,23 @@
void
glitz_set_pixels (glitz_surface_t *dst,
- int x_dst,
- int y_dst,
- int width,
- int height,
- glitz_pixel_format_t *format,
- glitz_buffer_t *buffer);
+ int x_dst,
+ int y_dst,
+ int width,
+ int height,
+ glitz_pixel_format_t *format,
+ glitz_buffer_t *buffer);
void
glitz_get_pixels (glitz_surface_t *src,
- int x_src,
- int y_src,
- int width,
- int height,
- glitz_pixel_format_t *format,
- glitz_buffer_t *buffer);
-
-
+ int x_src,
+ int y_src,
+ int width,
+ int height,
+ glitz_pixel_format_t *format,
+ glitz_buffer_t *buffer);
+
+
/* glitz_geometry.c */
typedef enum {
@@ -562,7 +631,7 @@
GLITZ_COORDINATE_SIZE_X,
GLITZ_COORDINATE_SIZE_XY
} glitz_coordinate_size_t;
-
+
typedef struct _glitz_coordinate_attribute {
glitz_data_type_t type;
glitz_coordinate_size_t size;
@@ -600,17 +669,17 @@
void
glitz_set_geometry (glitz_surface_t *dst,
- glitz_geometry_type_t type,
- glitz_geometry_format_t *format,
- glitz_buffer_t *buffer);
+ glitz_geometry_type_t type,
+ glitz_geometry_format_t *format,
+ glitz_buffer_t *buffer);
void
glitz_set_array (glitz_surface_t *dst,
- int first,
- int size,
- unsigned int count,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off);
+ int first,
+ int size,
+ unsigned int count,
+ glitz_fixed16_16_t x_off,
+ glitz_fixed16_16_t y_off);
typedef struct _glitz_multi_array glitz_multi_array_t;
@@ -625,71 +694,71 @@
void
glitz_multi_array_add (glitz_multi_array_t *array,
- int first,
- int size,
- unsigned int count,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off);
+ int first,
+ int size,
+ unsigned int count,
+ glitz_fixed16_16_t x_off,
+ glitz_fixed16_16_t y_off);
void
glitz_multi_array_reset (glitz_multi_array_t *array);
void
glitz_set_multi_array (glitz_surface_t *dst,
- glitz_multi_array_t *array,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off);
+ glitz_multi_array_t *array,
+ glitz_fixed16_16_t x_off,
+ glitz_fixed16_16_t y_off);
/* glitz_trap.c */
int
glitz_add_trapezoids (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- glitz_data_type_t type,
- glitz_surface_t *mask,
- glitz_trapezoid_t *traps,
- int n_traps,
- int *n_added);
+ int offset,
+ unsigned int size,
+ glitz_data_type_t type,
+ glitz_surface_t *mask,
+ glitz_trapezoid_t *traps,
+ int n_traps,
+ int *n_added);
int
glitz_add_traps (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- glitz_data_type_t type,
- glitz_surface_t *mask,
- glitz_trap_t *traps,
- int n_traps,
- int *n_added);
+ int offset,
+ unsigned int size,
+ glitz_data_type_t type,
+ glitz_surface_t *mask,
+ glitz_trap_t *traps,
+ int n_traps,
+ int *n_added);
/* glitz.c */
void
glitz_composite (glitz_operator_t op,
- glitz_surface_t *src,
- glitz_surface_t *mask,
- glitz_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height);
+ glitz_surface_t *src,
+ glitz_surface_t *mask,
+ glitz_surface_t *dst,
+ int x_src,
+ int y_src,
+ int x_mask,
+ int y_mask,
+ int x_dst,
+ int y_dst,
+ int width,
+ int height);
void
glitz_copy_area (glitz_surface_t *src,
- glitz_surface_t *dst,
- int x_src,
- int y_src,
- int width,
- int height,
- int x_dst,
- int y_dst);
-
+ glitz_surface_t *dst,
+ int x_src,
+ int y_src,
+ int width,
+ int height,
+ int x_dst,
+ int y_dst);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
Index: glitz_buffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_buffer.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- glitz_buffer.c 25 Jan 2005 19:50:26 -0000 1.7
+++ glitz_buffer.c 14 Sep 2005 15:57:16 -0000 1.8
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -31,334 +31,335 @@
static glitz_status_t
_glitz_buffer_init (glitz_buffer_t *buffer,
- glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint)
+ glitz_drawable_t *drawable,
+ void *data,
+ unsigned int size,
+ glitz_buffer_hint_t hint)
{
glitz_gl_enum_t usage;
-
+
buffer->ref_count = 1;
buffer->name = 0;
if (drawable)
{
- GLITZ_GL_DRAWABLE (drawable);
-
- switch (hint) {
- case GLITZ_BUFFER_HINT_STREAM_DRAW:
- usage = GLITZ_GL_STREAM_DRAW;
- break;
- case GLITZ_BUFFER_HINT_STREAM_READ:
- usage = GLITZ_GL_STREAM_READ;
- break;
- case GLITZ_BUFFER_HINT_STREAM_COPY:
- usage = GLITZ_GL_STREAM_COPY;
- break;
- case GLITZ_BUFFER_HINT_STATIC_DRAW:
- usage = GLITZ_GL_STATIC_DRAW;
- break;
- case GLITZ_BUFFER_HINT_STATIC_READ:
- usage = GLITZ_GL_STATIC_READ;
- break;
- case GLITZ_BUFFER_HINT_STATIC_COPY:
- usage = GLITZ_GL_STATIC_COPY;
- break;
- case GLITZ_BUFFER_HINT_DYNAMIC_DRAW:
- usage = GLITZ_GL_DYNAMIC_DRAW;
- break;
- case GLITZ_BUFFER_HINT_DYNAMIC_READ:
- usage = GLITZ_GL_DYNAMIC_READ;
- break;
- default:
- usage = GLITZ_GL_DYNAMIC_COPY;
- break;
- }
+ GLITZ_GL_DRAWABLE (drawable);
- buffer->owns_data = 1;
- buffer->drawable = drawable;
- glitz_drawable_reference (drawable);
-
- drawable->backend->push_current (drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT);
-
- gl->gen_buffers (1, &buffer->name);
- if (buffer->name) {
- gl->bind_buffer (buffer->target, buffer->name);
- gl->buffer_data (buffer->target, size, data, usage);
- gl->bind_buffer (buffer->target, 0);
- }
-
- drawable->backend->pop_current (drawable);
+ switch (hint) {
+ case GLITZ_BUFFER_HINT_STREAM_DRAW:
+ usage = GLITZ_GL_STREAM_DRAW;
+ break;
+ case GLITZ_BUFFER_HINT_STREAM_READ:
+ usage = GLITZ_GL_STREAM_READ;
+ break;
+ case GLITZ_BUFFER_HINT_STREAM_COPY:
+ usage = GLITZ_GL_STREAM_COPY;
+ break;
+ case GLITZ_BUFFER_HINT_STATIC_DRAW:
+ usage = GLITZ_GL_STATIC_DRAW;
+ break;
+ case GLITZ_BUFFER_HINT_STATIC_READ:
+ usage = GLITZ_GL_STATIC_READ;
+ break;
+ case GLITZ_BUFFER_HINT_STATIC_COPY:
+ usage = GLITZ_GL_STATIC_COPY;
+ break;
+ case GLITZ_BUFFER_HINT_DYNAMIC_DRAW:
+ usage = GLITZ_GL_DYNAMIC_DRAW;
+ break;
+ case GLITZ_BUFFER_HINT_DYNAMIC_READ:
+ usage = GLITZ_GL_DYNAMIC_READ;
+ break;
+ default:
+ usage = GLITZ_GL_DYNAMIC_COPY;
+ break;
+ }
+
+ buffer->owns_data = 1;
+ buffer->drawable = drawable;
+ glitz_drawable_reference (drawable);
+
+ drawable->backend->push_current (drawable, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+
+ gl->gen_buffers (1, &buffer->name);
+ if (buffer->name) {
+ gl->bind_buffer (buffer->target, buffer->name);
+ gl->buffer_data (buffer->target, size, data, usage);
+ gl->bind_buffer (buffer->target, 0);
+ }
+
+ drawable->backend->pop_current (drawable);
}
else
{
- buffer->drawable = NULL;
- usage = GLITZ_GL_DYNAMIC_COPY;
+ buffer->drawable = NULL;
+ usage = GLITZ_GL_DYNAMIC_COPY;
}
-
+
if (size > 0 && buffer->name == 0)
{
- buffer->data = malloc (size);
- if (buffer->data == NULL)
- return GLITZ_STATUS_NO_MEMORY;
-
- if (data)
- memcpy (buffer->data, data, size);
-
- buffer->owns_data = 1;
+ buffer->data = malloc (size);
+ if (buffer->data == NULL)
+ return GLITZ_STATUS_NO_MEMORY;
+
+ if (data)
+ memcpy (buffer->data, data, size);
+
+ buffer->owns_data = 1;
}
else
{
- buffer->owns_data = 0;
- buffer->data = data;
+ buffer->owns_data = 0;
+ buffer->data = data;
}
-
+
return GLITZ_STATUS_SUCCESS;
}
glitz_buffer_t *
glitz_vertex_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint)
+ void *data,
+ unsigned int size,
+ glitz_buffer_hint_t hint)
{
- glitz_buffer_t *buffer;
- glitz_status_t status;
+ glitz_buffer_t *buffer;
+ glitz_status_t status;
- if (size == 0)
- return NULL;
+ if (size == 0)
+ return NULL;
- buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
- if (buffer == NULL)
- return NULL;
-
- buffer->target = GLITZ_GL_ARRAY_BUFFER;
-
- if (drawable->backend->feature_mask &
- GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
- status = _glitz_buffer_init (buffer, drawable, data, size, hint);
- else
- status = _glitz_buffer_init (buffer, NULL, data, size, hint);
-
- if (status != GLITZ_STATUS_SUCCESS) {
- free (buffer);
- return NULL;
- }
-
- return buffer;
+ buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
+ if (buffer == NULL)
+ return NULL;
+
+ buffer->target = GLITZ_GL_ARRAY_BUFFER;
+
+ if (drawable->backend->feature_mask &
+ GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
+ status = _glitz_buffer_init (buffer, drawable, data, size, hint);
+ else
+ status = _glitz_buffer_init (buffer, NULL, data, size, hint);
+
+ if (status != GLITZ_STATUS_SUCCESS) {
+ free (buffer);
+ return NULL;
+ }
+
+ return buffer;
}
glitz_buffer_t *
glitz_pixel_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint)
+ void *data,
+ unsigned int size,
+ glitz_buffer_hint_t hint)
{
- glitz_buffer_t *buffer;
- glitz_status_t status;
+ glitz_buffer_t *buffer;
+ glitz_status_t status;
- if (size == 0)
- return NULL;
-
- buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
- if (buffer == NULL)
- return NULL;
-
- switch (hint) {
- case GLITZ_BUFFER_HINT_STREAM_READ:
- case GLITZ_BUFFER_HINT_STATIC_READ:
- case GLITZ_BUFFER_HINT_DYNAMIC_READ:
- buffer->target = GLITZ_GL_PIXEL_PACK_BUFFER;
- break;
- default:
- buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
- break;
- }
+ if (size == 0)
+ return NULL;
- if (drawable->backend->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
- status = _glitz_buffer_init (buffer, drawable, data, size, hint);
- else
- status = _glitz_buffer_init (buffer, NULL, data, size, hint);
+ buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
+ if (buffer == NULL)
+ return NULL;
- if (status != GLITZ_STATUS_SUCCESS) {
- free (buffer);
- return NULL;
- }
-
- return buffer;
+ switch (hint) {
+ case GLITZ_BUFFER_HINT_STREAM_READ:
+ case GLITZ_BUFFER_HINT_STATIC_READ:
+ case GLITZ_BUFFER_HINT_DYNAMIC_READ:
+ buffer->target = GLITZ_GL_PIXEL_PACK_BUFFER;
+ break;
+ default:
+ buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
+ break;
+ }
+
+ if (drawable->backend->feature_mask &
+ GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
+ status = _glitz_buffer_init (buffer, drawable, data, size, hint);
+ else
+ status = _glitz_buffer_init (buffer, NULL, data, size, hint);
+
+ if (status != GLITZ_STATUS_SUCCESS) {
+ free (buffer);
+ return NULL;
+ }
+
+ return buffer;
}
glitz_buffer_t *
glitz_buffer_create_for_data (void *data)
{
- glitz_buffer_t *buffer;
-
- buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
- if (buffer == NULL)
- return NULL;
+ glitz_buffer_t *buffer;
- if (_glitz_buffer_init (buffer, NULL, data, 0, 0)) {
- free (buffer);
- return NULL;
- }
-
- return buffer;
+ buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
+ if (buffer == NULL)
+ return NULL;
+
+ if (_glitz_buffer_init (buffer, NULL, data, 0, 0)) {
+ free (buffer);
+ return NULL;
+ }
+
+ return buffer;
}
void
glitz_buffer_destroy (glitz_buffer_t *buffer)
{
- if (!buffer)
- return;
+ if (!buffer)
+ return;
- buffer->ref_count--;
- if (buffer->ref_count)
- return;
-
- if (buffer->drawable) {
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT);
- buffer->drawable->backend->gl.delete_buffers (1, &buffer->name);
- buffer->drawable->backend->pop_current (buffer->drawable);
- glitz_drawable_destroy (buffer->drawable);
- } else if (buffer->owns_data)
- free (buffer->data);
-
- free (buffer);
+ buffer->ref_count--;
+ if (buffer->ref_count)
+ return;
+
+ if (buffer->drawable) {
+ buffer->drawable->backend->push_current (buffer->drawable, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+ buffer->drawable->backend->gl->delete_buffers (1, &buffer->name);
+ buffer->drawable->backend->pop_current (buffer->drawable);
+ glitz_drawable_destroy (buffer->drawable);
+ } else if (buffer->owns_data)
+ free (buffer->data);
+
+ free (buffer);
}
void
glitz_buffer_reference (glitz_buffer_t *buffer)
{
- if (!buffer)
- return;
+ if (!buffer)
+ return;
- buffer->ref_count++;
+ buffer->ref_count++;
}
void
glitz_buffer_set_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- const void *data)
+ int offset,
+ unsigned int size,
+ const void *data)
{
- if (buffer->drawable) {
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT);
- gl->bind_buffer (buffer->target, buffer->name);
- gl->buffer_sub_data (buffer->target, offset, size, data);
- gl->bind_buffer (buffer->target, 0);
- buffer->drawable->backend->pop_current (buffer->drawable);
- } else if (buffer->data)
- memcpy ((char *) buffer->data + offset, data, size);
+ if (buffer->drawable) {
+ GLITZ_GL_DRAWABLE (buffer->drawable);
+
+ buffer->drawable->backend->push_current (buffer->drawable, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+ gl->bind_buffer (buffer->target, buffer->name);
+ gl->buffer_sub_data (buffer->target, offset, size, data);
+ gl->bind_buffer (buffer->target, 0);
+ buffer->drawable->backend->pop_current (buffer->drawable);
+ } else if (buffer->data)
+ memcpy ((char *) buffer->data + offset, data, size);
}
slim_hidden_def(glitz_buffer_set_data);
void
glitz_buffer_get_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- void *data)
+ int offset,
+ unsigned int size,
+ void *data)
{
- if (buffer->drawable) {
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT);
-
- gl->bind_buffer (buffer->target, buffer->name);
- gl->get_buffer_sub_data (buffer->target, offset, size, data);
- gl->bind_buffer (buffer->target, 0);
+ if (buffer->drawable) {
+ GLITZ_GL_DRAWABLE (buffer->drawable);
- buffer->drawable->backend->pop_current (buffer->drawable);
- } else if (buffer->data)
- memcpy (data, (char *) buffer->data + offset, size);
+ buffer->drawable->backend->push_current (buffer->drawable, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+
+ gl->bind_buffer (buffer->target, buffer->name);
+ gl->get_buffer_sub_data (buffer->target, offset, size, data);
+ gl->bind_buffer (buffer->target, 0);
+
+ buffer->drawable->backend->pop_current (buffer->drawable);
+ } else if (buffer->data)
+ memcpy (data, (char *) buffer->data + offset, size);
}
slim_hidden_def(glitz_buffer_get_data);
void *
glitz_buffer_map (glitz_buffer_t *buffer,
- glitz_buffer_access_t access)
+ glitz_buffer_access_t access)
{
- void *pointer = NULL;
-
- if (buffer->drawable) {
- glitz_gl_enum_t buffer_access;
+ void *pointer = NULL;
- GLITZ_GL_DRAWABLE (buffer->drawable);
+ if (buffer->drawable) {
+ glitz_gl_enum_t buffer_access;
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT);
-
- switch (access) {
- case GLITZ_BUFFER_ACCESS_READ_ONLY:
- buffer_access = GLITZ_GL_READ_ONLY;
- break;
- case GLITZ_BUFFER_ACCESS_WRITE_ONLY:
- buffer_access = GLITZ_GL_WRITE_ONLY;
- break;
- default:
- buffer_access = GLITZ_GL_READ_WRITE;
- break;
+ GLITZ_GL_DRAWABLE (buffer->drawable);
+
+ buffer->drawable->backend->push_current (buffer->drawable, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+
+ switch (access) {
+ case GLITZ_BUFFER_ACCESS_READ_ONLY:
+ buffer_access = GLITZ_GL_READ_ONLY;
+ break;
+ case GLITZ_BUFFER_ACCESS_WRITE_ONLY:
+ buffer_access = GLITZ_GL_WRITE_ONLY;
+ break;
+ default:
+ buffer_access = GLITZ_GL_READ_WRITE;
+ break;
+ }
+
+ gl->bind_buffer (buffer->target, buffer->name);
+ pointer = gl->map_buffer (buffer->target, buffer_access);
+ gl->bind_buffer (buffer->target, 0);
+
+ buffer->drawable->backend->pop_current (buffer->drawable);
}
- gl->bind_buffer (buffer->target, buffer->name);
- pointer = gl->map_buffer (buffer->target, buffer_access);
- gl->bind_buffer (buffer->target, 0);
-
- buffer->drawable->backend->pop_current (buffer->drawable);
- }
-
- if (pointer == NULL)
- pointer = buffer->data;
-
- return pointer;
+ if (pointer == NULL)
+ pointer = buffer->data;
+
+ return pointer;
}
glitz_status_t
glitz_buffer_unmap (glitz_buffer_t *buffer)
{
- glitz_status_t status = GLITZ_STATUS_SUCCESS;
-
- if (buffer->drawable) {
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT);
+ glitz_status_t status = GLITZ_STATUS_SUCCESS;
- gl->bind_buffer (buffer->target, buffer->name);
-
- if (gl->unmap_buffer (buffer->target) == GLITZ_GL_FALSE)
- status = GLITZ_STATUS_CONTENT_DESTROYED;
-
- gl->bind_buffer (buffer->target, 0);
+ if (buffer->drawable) {
+ GLITZ_GL_DRAWABLE (buffer->drawable);
- buffer->drawable->backend->pop_current (buffer->drawable);
- }
+ buffer->drawable->backend->push_current (buffer->drawable, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
- return status;
+ gl->bind_buffer (buffer->target, buffer->name);
+
+ if (gl->unmap_buffer (buffer->target) == GLITZ_GL_FALSE)
+ status = GLITZ_STATUS_CONTENT_DESTROYED;
+
+ gl->bind_buffer (buffer->target, 0);
+
+ buffer->drawable->backend->pop_current (buffer->drawable);
+ }
+
+ return status;
}
void *
glitz_buffer_bind (glitz_buffer_t *buffer,
- glitz_gl_enum_t target)
+ glitz_gl_enum_t target)
{
- if (buffer->drawable) {
- buffer->drawable->backend->gl.bind_buffer (target, buffer->name);
- buffer->target = target;
-
- return NULL;
- }
-
- return buffer->data;
+ if (buffer->drawable) {
+ buffer->drawable->backend->gl->bind_buffer (target, buffer->name);
+ buffer->target = target;
+
+ return NULL;
+ }
+
+ return buffer->data;
}
void
glitz_buffer_unbind (glitz_buffer_t *buffer)
{
- if (buffer->drawable)
- buffer->drawable->backend->gl.bind_buffer (buffer->target, 0);
+ if (buffer->drawable)
+ buffer->drawable->backend->gl->bind_buffer (buffer->target, 0);
}
Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- glitz_compose.c 6 Jun 2005 12:28:40 -0000 1.13
+++ glitz_compose.c 14 Sep 2005 15:57:16 -0000 1.14
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...1048 lines suppressed...]
glitz_composite_enable (glitz_composite_op_t *op)
{
- op->combine->enable (op);
- op->count++;
+ op->combine->enable (op);
+ op->count++;
}
void
glitz_composite_disable (glitz_composite_op_t *op)
{
- if (op->fp) {
- op->gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
- op->gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
- }
+ if (op->fp) {
+ op->gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
+ op->gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
+ }
}
Index: glitz_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_context.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_context.c 6 Jun 2005 12:28:40 -0000 1.2
+++ glitz_context.c 14 Sep 2005 15:57:16 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright © 2005 Novell, Inc.
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -31,10 +31,10 @@
void
_glitz_context_init (glitz_context_t *context,
- glitz_drawable_t *drawable)
+ glitz_drawable_t *drawable)
{
glitz_drawable_reference (drawable);
-
+
context->ref_count = 1;
context->drawable = drawable;
context->closure = NULL;
@@ -49,7 +49,7 @@
glitz_context_t *
glitz_context_create (glitz_drawable_t *drawable,
- glitz_drawable_format_t *format)
+ glitz_drawable_format_t *format)
{
return drawable->backend->create_context (drawable, format);
}
@@ -59,11 +59,11 @@
glitz_context_destroy (glitz_context_t *context)
{
if (!context)
- return;
+ return;
context->ref_count--;
if (context->ref_count)
- return;
+ return;
context->drawable->backend->destroy_context (context);
}
@@ -73,16 +73,16 @@
glitz_context_reference (glitz_context_t *context)
{
if (!context)
- return;
-
+ return;
+
context->ref_count++;
}
slim_hidden_def(glitz_context_reference);
void
glitz_context_copy (glitz_context_t *src,
- glitz_context_t *dst,
- unsigned long mask)
+ glitz_context_t *dst,
+ unsigned long mask)
{
src->drawable->backend->copy_context (src, dst, mask);
}
@@ -90,8 +90,8 @@
void
glitz_context_set_user_data (glitz_context_t *context,
- void *closure,
- glitz_lose_current_function_t lose_current)
+ void *closure,
+ glitz_lose_current_function_t lose_current)
{
context->closure = closure;
context->lose_current = lose_current;
@@ -100,28 +100,82 @@
glitz_function_pointer_t
glitz_context_get_proc_address (glitz_context_t *context,
- const char *name)
+ const char *name)
{
return context->drawable->backend->get_proc_address (context, name);
}
slim_hidden_def(glitz_context_get_proc_address);
void
-glitz_context_make_current (glitz_context_t *context)
+glitz_context_make_current (glitz_context_t *context,
+ glitz_drawable_t *drawable)
{
- context->drawable->backend->make_current (context, context->drawable);
+ if (drawable != context->drawable)
+ {
+ glitz_drawable_reference (drawable);
+ glitz_drawable_destroy (context->drawable);
+ context->drawable = drawable;
+ }
+
+ if (drawable->front)
+ {
+ if (REGION_NOTEMPTY (&drawable->front->drawable_damage))
+ {
+ glitz_surface_push_current (drawable->front,
+ GLITZ_DRAWABLE_CURRENT);
+ glitz_surface_pop_current (drawable->front);
+ }
+
+ glitz_surface_damage (drawable->front, NULL,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_SOLID_MASK);
+ }
+
+ if (drawable->back)
+ {
+ if (REGION_NOTEMPTY (&drawable->back->drawable_damage))
+ {
+ glitz_surface_push_current (drawable->back,
+ GLITZ_DRAWABLE_CURRENT);
+ glitz_surface_pop_current (drawable->back);
+ }
+
+ glitz_surface_damage (drawable->back, NULL,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_SOLID_MASK);
+ }
+
+ drawable->backend->make_current (drawable, context);
}
slim_hidden_def(glitz_context_make_current);
void
-glitz_context_bind_texture (glitz_context_t *context,
- glitz_surface_t *surface)
+glitz_context_bind_texture (glitz_context_t *context,
+ glitz_texture_object_t *texture)
{
- glitz_gl_proc_address_list_t *gl = &context->drawable->backend->gl;
-
- if (!surface->texture.name)
- gl->gen_textures (1, &surface->texture.name);
-
- gl->bind_texture (surface->texture.target, surface->texture.name);
+ glitz_gl_proc_address_list_t *gl = context->drawable->backend->gl;
+
+ if (REGION_NOTEMPTY (&texture->surface->texture_damage))
+ {
+ glitz_lose_current_function_t lose_current;
+
+ lose_current = context->lose_current;
+ context->lose_current = 0;
+
+ glitz_surface_push_current (texture->surface, GLITZ_CONTEXT_CURRENT);
+ _glitz_surface_sync_texture (texture->surface);
+ glitz_surface_pop_current (texture->surface);
+
+ context->lose_current = lose_current;
+
+ glitz_context_make_current (context, context->drawable);
+ }
+
+ gl->bind_texture (texture->surface->texture.target,
+ texture->surface->texture.name);
+
+ glitz_texture_ensure_parameters (gl,
+ &texture->surface->texture,
+ &texture->param);
}
slim_hidden_def(glitz_context_bind_texture);
Index: glitz_drawable.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_drawable.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_drawable.c 25 Jan 2005 19:50:26 -0000 1.2
+++ glitz_drawable.c 14 Sep 2005 15:57:16 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -29,119 +29,312 @@
#include "glitzint.h"
-glitz_drawable_format_t *
-glitz_find_similar_drawable_format (glitz_drawable_t *other,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
+void
+_glitz_drawable_init (glitz_drawable_t *drawable,
+ glitz_int_drawable_format_t *format,
+ glitz_backend_t *backend,
+ int width,
+ int height)
{
- return glitz_drawable_format_find (other->backend->drawable_formats,
- other->backend->n_drawable_formats,
- mask, templ, count);
+ drawable->ref_count = 1;
+
+ drawable->format = format;
+ drawable->backend = backend;
+
+ drawable->width = width;
+ drawable->height = height;
+
+ drawable->front = NULL;
+ drawable->back = NULL;
+
+ drawable->viewport.x = -32767;
+ drawable->viewport.y = -32767;
+ drawable->viewport.width = 65535;
+ drawable->viewport.height = 65535;
+
+ drawable->update_all = 1;
}
-slim_hidden_def(glitz_find_similar_drawable_format);
-
+
+static glitz_bool_t
+_glitz_drawable_size_check (glitz_drawable_t *other,
+ unsigned int width,
+ unsigned int height)
+{
+ if (width == 0 || height == 0)
+ return 0;
+
+ if (width > other->backend->max_viewport_dims[0] ||
+ height > other->backend->max_viewport_dims[1])
+ return 0;
+
+ return 1;
+}
+
+glitz_drawable_t *
+glitz_create_drawable (glitz_drawable_t *other,
+ glitz_drawable_format_t *format,
+ unsigned int width,
+ unsigned int height)
+{
+ glitz_int_drawable_format_t *iformat;
+
+ if (!_glitz_drawable_size_check (other, width, height))
+ return NULL;
+
+ if (format->id >= other->backend->n_drawable_formats)
+ return NULL;
+
+ iformat = &other->backend->drawable_formats[format->id];
+ if (!(iformat->types & GLITZ_DRAWABLE_TYPE_FBO_MASK))
+ return NULL;
+
+ return _glitz_fbo_drawable_create (other, iformat, width, height);
+}
+slim_hidden_def(glitz_create_drawable);
+
glitz_drawable_t *
glitz_create_pbuffer_drawable (glitz_drawable_t *other,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
+ glitz_drawable_format_t *format,
+ unsigned int width,
+ unsigned int height)
{
- if (!format->types.pbuffer)
- return NULL;
-
- return other->backend->create_pbuffer (other, format, width, height);
+ glitz_int_drawable_format_t *iformat;
+
+ if (!_glitz_drawable_size_check (other, width, height))
+ return NULL;
+
+ if (format->id >= other->backend->n_drawable_formats)
+ return NULL;
+
+ iformat = &other->backend->drawable_formats[format->id];
+ if (!(iformat->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK))
+ return NULL;
+
+ return other->backend->create_pbuffer (other, format, width, height);
}
slim_hidden_def(glitz_create_pbuffer_drawable);
void
glitz_drawable_destroy (glitz_drawable_t *drawable)
{
- if (!drawable)
- return;
+ if (!drawable)
+ return;
- drawable->ref_count--;
- if (drawable->ref_count)
- return;
-
- drawable->backend->destroy (drawable);
+ drawable->ref_count--;
+ if (drawable->ref_count)
+ return;
+
+ drawable->backend->destroy (drawable);
}
void
glitz_drawable_reference (glitz_drawable_t *drawable)
{
- if (!drawable)
- return;
+ if (!drawable)
+ return;
- drawable->ref_count++;
+ drawable->ref_count++;
}
void
glitz_drawable_update_size (glitz_drawable_t *drawable,
- unsigned int width,
- unsigned int height)
+ unsigned int width,
+ unsigned int height)
{
- drawable->width = (int) width;
- drawable->height = (int) height;
+ drawable->width = (int) width;
+ drawable->height = (int) height;
- drawable->viewport.x = -32767;
- drawable->viewport.y = -32767;
- drawable->viewport.width = 65535;
- drawable->viewport.height = 65535;
+ drawable->viewport.x = -32767;
+ drawable->viewport.y = -32767;
+ drawable->viewport.width = 65535;
+ drawable->viewport.height = 65535;
- drawable->update_all = 1;
+ drawable->update_all = 1;
}
unsigned int
glitz_drawable_get_width (glitz_drawable_t *drawable)
{
- return (unsigned int) drawable->width;
+ return (unsigned int) drawable->width;
}
slim_hidden_def(glitz_drawable_get_width);
unsigned int
glitz_drawable_get_height (glitz_drawable_t *drawable)
{
- return (unsigned int) drawable->height;
+ return (unsigned int) drawable->height;
}
slim_hidden_def(glitz_drawable_get_height);
void
+glitz_drawable_swap_buffer_region (glitz_drawable_t *drawable,
+ int x_origin,
+ int y_origin,
+ glitz_box_t *box,
+ int n_box)
+{
+ if (drawable->format->d.doublebuffer && n_box)
+ {
+ glitz_box_t rect;
+ glitz_surface_t *surface = NULL;
+ int x_pos, y_pos;
+ int x, y, w, h;
+
+ GLITZ_GL_DRAWABLE (drawable);
+
+ if (n_box == 1)
+ {
+ rect.x1 = x_origin + box->x1;
+ rect.y1 = y_origin + box->y1;
+ rect.x2 = x_origin + box->x2;
+ rect.y2 = y_origin + box->y2;
+
+ if (rect.x1 <= 0 &&
+ rect.y1 <= 0 &&
+ rect.x2 >= drawable->width &&
+ rect.x2 >= drawable->height)
+ {
+ if (drawable->backend->swap_buffers (drawable))
+ {
+ if (drawable->front)
+ {
+ REGION_EMPTY (&drawable->front->drawable_damage);
+ glitz_surface_damage (drawable->front, NULL,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_SOLID_MASK);
+ }
+ return;
+ }
+ }
+ }
+
+ if (drawable->front)
+ {
+ if (glitz_surface_push_current (drawable->front,
+ GLITZ_DRAWABLE_CURRENT))
+ surface = drawable->front;
+ }
+
+ if (!surface)
+ {
+ if (drawable->backend->push_current (drawable, NULL,
+ GLITZ_DRAWABLE_CURRENT))
+ {
+ drawable->update_all = 1;
+
+ gl->viewport (0, 0, drawable->width, drawable->height);
+ gl->matrix_mode (GLITZ_GL_PROJECTION);
+ gl->load_identity ();
+ gl->ortho (0.0, drawable->width, 0.0,
+ drawable->height, -1.0, 1.0);
+ gl->matrix_mode (GLITZ_GL_MODELVIEW);
+ gl->load_identity ();
+ gl->scale_f (1.0f, -1.0f, 1.0f);
+ gl->translate_f (0.0f, -drawable->height, 0.0f);
+ }
+ else
+ {
+ drawable->backend->pop_current (drawable);
+ return;
+ }
+ }
+
+ gl->disable (GLITZ_GL_DITHER);
+
+ gl->read_buffer (GLITZ_GL_BACK);
+ gl->draw_buffer (GLITZ_GL_FRONT);
+
+ glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
+
+ x_pos = 0;
+ y_pos = 0;
+
+ glitz_set_raster_pos (gl, x_pos, y_pos);
+
+ while (n_box--)
+ {
+ rect.x1 = x_origin + box->x1;
+ rect.y1 = y_origin + box->y1;
+ rect.x2 = x_origin + box->x2;
+ rect.y2 = y_origin + box->y2;
+
+ if (rect.x1 < rect.x2 && rect.y1 < rect.y2)
+ {
+ x = rect.x1;
+ y = drawable->height - rect.y2;
+ w = rect.x2 - rect.x1;
+ h = rect.y2 - rect.y1;
+
+ if (x != x_pos || y != y_pos)
+ {
+ gl->bitmap (0, 0, 0, 0, x - x_pos, y - y_pos, NULL);
+
+ x_pos = x;
+ y_pos = y;
+ }
+
+ gl->scissor (x, y, w, h);
+ gl->copy_pixels (x, y, w, h, GLITZ_GL_COLOR);
+
+ if (surface)
+ glitz_surface_damage (surface, &rect,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_SOLID_MASK);
+
+ box++;
+ }
+ }
+ drawable->backend->gl->finish ();
+
+ if (surface)
+ glitz_surface_pop_current (surface);
+ else
+ drawable->backend->pop_current (drawable);
+ }
+}
+
+void
glitz_drawable_swap_buffers (glitz_drawable_t *drawable)
{
- if (drawable->format->doublebuffer)
- drawable->backend->swap_buffers (drawable);
+ glitz_box_t box;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = drawable->width;
+ box.y2 = drawable->height;
+
+ glitz_drawable_swap_buffer_region (drawable, 0, 0, &box, 1);
}
slim_hidden_def(glitz_drawable_swap_buffers);
void
glitz_drawable_flush (glitz_drawable_t *drawable)
{
- drawable->backend->push_current (drawable, NULL, GLITZ_DRAWABLE_CURRENT);
- drawable->backend->gl.flush ();
- drawable->backend->pop_current (drawable);
+ drawable->backend->push_current (drawable, NULL, GLITZ_DRAWABLE_CURRENT);
+ drawable->backend->gl->flush ();
+ drawable->backend->pop_current (drawable);
}
slim_hidden_def(glitz_drawable_flush);
void
glitz_drawable_finish (glitz_drawable_t *drawable)
{
- drawable->backend->push_current (drawable, NULL, GLITZ_DRAWABLE_CURRENT);
- drawable->backend->gl.finish ();
- drawable->backend->pop_current (drawable);
+ drawable->backend->push_current (drawable, NULL, GLITZ_DRAWABLE_CURRENT);
+ drawable->backend->gl->finish ();
+ drawable->backend->pop_current (drawable);
}
slim_hidden_def(glitz_drawable_finish);
unsigned long
glitz_drawable_get_features (glitz_drawable_t *drawable)
{
- return drawable->backend->feature_mask;
+ return drawable->backend->feature_mask;
}
slim_hidden_def(glitz_drawable_get_features);
glitz_drawable_format_t *
glitz_drawable_get_format (glitz_drawable_t *drawable)
{
- return drawable->format;
+ return &drawable->format->d;
}
slim_hidden_def(glitz_drawable_get_format);
Index: glitz_filter.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_filter.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- glitz_filter.c 1 Jul 2005 10:36:49 -0000 1.9
+++ glitz_filter.c 14 Sep 2005 15:57:16 -0000 1.10
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -30,396 +30,408 @@
#include "glitzint.h"
struct _glitz_filter_params_t {
- int fp_type;
- int id;
- glitz_vec4_t *vectors;
- int n_vectors;
+ int fp_type;
+ int id;
+ glitz_vec4_t *vectors;
+ int n_vectors;
};
static glitz_status_t
_glitz_filter_params_ensure (glitz_surface_t *surface,
- int vectors)
+ int vectors)
{
int size;
-
+
size = sizeof (glitz_filter_params_t) + vectors * sizeof (glitz_vec4_t);
-
+
if (!surface->filter_params ||
- surface->filter_params->n_vectors != vectors)
+ surface->filter_params->n_vectors != vectors)
{
- if (surface->filter_params)
- free (surface->filter_params);
-
- surface->filter_params = malloc (size);
- if (surface->filter_params == NULL)
- return GLITZ_STATUS_NO_MEMORY;
+ if (surface->filter_params)
+ free (surface->filter_params);
- surface->filter_params->fp_type = 0;
- surface->filter_params->id = 0;
- surface->filter_params->vectors =
- (glitz_vec4_t *) (surface->filter_params + 1);
- surface->filter_params->n_vectors = vectors;
+ surface->filter_params = malloc (size);
+ if (surface->filter_params == NULL)
+ return GLITZ_STATUS_NO_MEMORY;
+
+ surface->filter_params->fp_type = 0;
+ surface->filter_params->id = 0;
+ surface->filter_params->vectors =
+ (glitz_vec4_t *) (surface->filter_params + 1);
+ surface->filter_params->n_vectors = vectors;
}
-
+
return GLITZ_STATUS_SUCCESS;
}
static void
_glitz_filter_params_set (glitz_float_t *value,
- const glitz_float_t default_value,
- glitz_fixed16_16_t **params,
- int *n_params)
+ const glitz_float_t default_value,
+ glitz_fixed16_16_t **params,
+ int *n_params)
{
- if (*n_params > 0) {
- *value = FIXED_TO_FLOAT (**params);
- (*params)++;
- (*n_params)--;
- } else
- *value = default_value;
+ if (*n_params > 0) {
+ *value = FIXED_TO_FLOAT (**params);
+ (*params)++;
+ (*n_params)--;
+ } else
+ *value = default_value;
}
static int
_glitz_color_stop_compare (const void *elem1, const void *elem2)
{
- return
- (((glitz_vec4_t *) elem1)->v[2] == ((glitz_vec4_t *) elem2)->v[2]) ?
- /* equal offsets, sort on id */
- ((((glitz_vec4_t *) elem1)->v[3] <
- ((glitz_vec4_t *) elem2)->v[3]) ? -1 : 1) :
- /* sort on offset */
- ((((glitz_vec4_t *) elem1)->v[2] <
- ((glitz_vec4_t *) elem2)->v[2]) ? -1 : 1);
+ return
+ (((glitz_vec4_t *) elem1)->v[2] == ((glitz_vec4_t *) elem2)->v[2]) ?
+ /* equal offsets, sort on id */
+ ((((glitz_vec4_t *) elem1)->v[3] <
+ ((glitz_vec4_t *) elem2)->v[3]) ? -1 : 1) :
+ /* sort on offset */
+ ((((glitz_vec4_t *) elem1)->v[2] <
+ ((glitz_vec4_t *) elem2)->v[2]) ? -1 : 1);
}
glitz_status_t
glitz_filter_set_params (glitz_surface_t *surface,
- glitz_filter_t filter,
- glitz_fixed16_16_t *params,
- int n_params)
+ glitz_filter_t filter,
+ glitz_fixed16_16_t *params,
+ int n_params)
{
- glitz_vec4_t *vecs;
- int i, size = 0;
-
- switch (filter) {
- case GLITZ_FILTER_CONVOLUTION: {
- glitz_float_t dm, dn;
- int cx, cy, m, n, j;
-
- _glitz_filter_params_set (&dm, 3.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&dn, 3.0f, ¶ms, &n_params);
- m = dm;
- n = dn;
+ glitz_vec4_t *vecs;
+ int i, size = 0;
- size = m * n;
- if (_glitz_filter_params_ensure (surface, size))
- return GLITZ_STATUS_NO_MEMORY;
+ switch (filter) {
+ case GLITZ_FILTER_CONVOLUTION: {
+ glitz_float_t dm, dn;
+ int cx, cy, m, n, j;
- vecs = surface->filter_params->vectors;
-
- surface->filter_params->id = 0;
-
- /* center point is rounded down in case dimensions are not even */
- cx = m / 2;
- cy = n / 2;
+ _glitz_filter_params_set (&dm, 3.0f, ¶ms, &n_params);
+ _glitz_filter_params_set (&dn, 3.0f, ¶ms, &n_params);
+ m = dm;
+ n = dn;
- for (i = 0; i < m; i++) {
- glitz_vec4_t *vec;
- glitz_float_t weight;
-
- for (j = 0; j < n; j++) {
- _glitz_filter_params_set (&weight, 0.0f, ¶ms, &n_params);
- if (weight != 0.0f) {
- vec = &vecs[surface->filter_params->id++];
- vec->v[0] = (i - cx) * surface->texture.texcoord_width_unit;
- vec->v[1] = (cy - j) * surface->texture.texcoord_height_unit;
- vec->v[2] = weight;
- vec->v[3] = 0.0f;
- }
- }
- }
- } break;
- case GLITZ_FILTER_GAUSSIAN: {
- glitz_float_t radius, sigma, alpha, scale, xy_scale, sum;
- int half_size, x, y;
-
- _glitz_filter_params_set (&radius, 1.0f, ¶ms, &n_params);
- glitz_clamp_value (&radius, 0.0f, 1024.0f);
+ size = m * n;
+ if (_glitz_filter_params_ensure (surface, size))
+ return GLITZ_STATUS_NO_MEMORY;
- _glitz_filter_params_set (&sigma, radius / 2.0f, ¶ms, &n_params);
- glitz_clamp_value (&sigma, 0.0f, 1024.0f);
-
- _glitz_filter_params_set (&alpha, radius, ¶ms, &n_params);
- glitz_clamp_value (&alpha, 0.0f, 1024.0f);
+ vecs = surface->filter_params->vectors;
- scale = 1.0f / (2.0f * GLITZ_PI * sigma * sigma);
- half_size = alpha + 0.5f;
+ surface->filter_params->id = 0;
- if (half_size == 0)
- half_size = 1;
-
- size = half_size * 2 + 1;
- xy_scale = 2.0f * radius / size;
+ /* center point is rounded down in case dimensions are not even */
+ cx = m / 2;
+ cy = n / 2;
- if (_glitz_filter_params_ensure (surface, size * size))
- return GLITZ_STATUS_NO_MEMORY;
+ for (i = 0; i < m; i++) {
+ glitz_vec4_t *vec;
+ glitz_float_t weight;
- vecs = surface->filter_params->vectors;
+ for (j = 0; j < n; j++) {
+ _glitz_filter_params_set (&weight, 0.0f, ¶ms, &n_params);
+ if (weight != 0.0f) {
+ vec = &vecs[surface->filter_params->id++];
+ vec->v[0] = (i - cx) * surface->texture.texcoord_width_unit;
+ vec->v[1] = (cy - j) * surface->texture.texcoord_height_unit;
+ vec->v[2] = weight;
+ vec->v[3] = 0.0f;
+ }
+ }
+ }
+ } break;
+ case GLITZ_FILTER_GAUSSIAN: {
+ glitz_float_t radius, sigma, alpha, scale, xy_scale, sum;
+ int half_size, x, y;
- surface->filter_params->id = 0;
+ _glitz_filter_params_set (&radius, 1.0f, ¶ms, &n_params);
+ glitz_clamp_value (&radius, 0.0f, 1024.0f);
- sum = 0.0f;
- for (x = 0; x < size; x++) {
- glitz_vec4_t *vec;
- glitz_float_t fx, fy, amp;
-
- fx = xy_scale * (x - half_size);
-
- for (y = 0; y < size; y++) {
- fy = xy_scale * (y - half_size);
+ _glitz_filter_params_set (&sigma, radius / 2.0f, ¶ms, &n_params);
+ glitz_clamp_value (&sigma, 0.0f, 1024.0f);
- amp = scale * exp ((-1.0f * (fx * fx + fy * fy)) /
- (2.0f * sigma * sigma));
+ _glitz_filter_params_set (&alpha, radius, ¶ms, &n_params);
+ glitz_clamp_value (&alpha, 0.0f, 1024.0f);
- if (amp > 0.0f) {
- vec = &vecs[surface->filter_params->id++];
- vec->v[0] = fx * surface->texture.texcoord_width_unit;
- vec->v[1] = fy * surface->texture.texcoord_height_unit;
- vec->v[2] = amp;
- vec->v[3] = 0.0f;
- sum += amp;
- }
- }
- }
+ scale = 1.0f / (2.0f * GLITZ_PI * sigma * sigma);
+ half_size = alpha + 0.5f;
- /* normalize */
- if (sum != 0.0f)
- sum = 1.0f / sum;
-
- for (i = 0; i < surface->filter_params->id; i++)
- vecs[i].v[2] *= sum;
- } break;
- case GLITZ_FILTER_LINEAR_GRADIENT:
- case GLITZ_FILTER_RADIAL_GRADIENT:
- if (n_params <= 4) {
- if (surface->box.x2 == 1)
- size = surface->box.y2;
- else if (surface->box.y2 == 1)
- size = surface->box.x2;
- } else
- size = (n_params - 2) / 3;
-
- if (size < 2)
- size = 2;
+ if (half_size == 0)
+ half_size = 1;
- if (_glitz_filter_params_ensure (surface, size + 1))
- return GLITZ_STATUS_NO_MEMORY;
+ size = half_size * 2 + 1;
+ xy_scale = 2.0f * radius / size;
- vecs = surface->filter_params->vectors;
-
- if (filter == GLITZ_FILTER_LINEAR_GRADIENT) {
- glitz_float_t length, angle, dh, dv;
- glitz_float_t start_x, start_y, stop_x, stop_y;
+ if (_glitz_filter_params_ensure (surface, size * size))
+ return GLITZ_STATUS_NO_MEMORY;
- _glitz_filter_params_set (&start_x, 0.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&start_y, 0.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&stop_x, 1.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&stop_y, 0.0f, ¶ms, &n_params);
+ vecs = surface->filter_params->vectors;
- dh = stop_x - start_x;
- dv = stop_y - start_y;
+ surface->filter_params->id = 0;
- length = sqrtf (dh * dh + dv * dv);
+ sum = 0.0f;
+ for (x = 0; x < size; x++) {
+ glitz_vec4_t *vec;
+ glitz_float_t fx, fy, amp;
- angle = -atan2f (dv, dh);
+ fx = xy_scale * (x - half_size);
- vecs->v[2] = cosf (angle);
- vecs->v[3] = -sinf (angle);
-
- vecs->v[0] = vecs->v[2] * start_x;
- vecs->v[0] += vecs->v[3] * start_y;
+ for (y = 0; y < size; y++) {
+ fy = xy_scale * (y - half_size);
- vecs->v[1] = (length)? 1.0f / length: 2147483647.0f;
- } else {
- glitz_float_t r0, r1;
-
- _glitz_filter_params_set (&vecs->v[0], 0.5f, ¶ms, &n_params);
- _glitz_filter_params_set (&vecs->v[1], 0.5f, ¶ms, &n_params);
- _glitz_filter_params_set (&r0, 0.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&r1, 0.5f, ¶ms, &n_params);
-
- glitz_clamp_value (&r0, 0.0f, r1);
-
- vecs->v[2] = r0;
- if (r1 != r0)
- vecs->v[3] = 1.0f / (r1 - r0);
- else
- vecs->v[3] = 2147483647.0f;
- }
+ amp = scale * exp ((-1.0f * (fx * fx + fy * fy)) /
+ (2.0f * sigma * sigma));
- vecs++;
- surface->filter_params->id = size;
-
- for (i = 0; i < size; i++) {
- glitz_float_t x_default, y_default, o_default;
-
- o_default = i / (glitz_float_t) (size - 1);
- x_default = (surface->box.x2 * i) / (glitz_float_t) size;
- y_default = (surface->box.y2 * i) / (glitz_float_t) size;
-
- _glitz_filter_params_set (&vecs[i].v[2], o_default, ¶ms, &n_params);
- _glitz_filter_params_set (&vecs[i].v[0], x_default, ¶ms, &n_params);
- _glitz_filter_params_set (&vecs[i].v[1], y_default, ¶ms, &n_params);
+ if (amp > 0.0f) {
+ vec = &vecs[surface->filter_params->id++];
+ vec->v[0] = fx * surface->texture.texcoord_width_unit;
+ vec->v[1] = fy * surface->texture.texcoord_height_unit;
+ vec->v[2] = amp;
+ vec->v[3] = 0.0f;
+ sum += amp;
+ }
+ }
+ }
- glitz_clamp_value (&vecs[i].v[2], 0.0f, 1.0f);
- glitz_clamp_value (&vecs[i].v[0], 0.0f, surface->box.x2 - 1.0f);
- glitz_clamp_value (&vecs[i].v[1], 0.0f, surface->box.y2 - 1.0f);
+ /* normalize */
+ if (sum != 0.0f)
+ sum = 1.0f / sum;
- vecs[i].v[0] += 0.5f;
- vecs[i].v[1] += 0.5f;
+ for (i = 0; i < surface->filter_params->id; i++)
+ vecs[i].v[2] *= sum;
+ } break;
+ case GLITZ_FILTER_LINEAR_GRADIENT:
+ case GLITZ_FILTER_RADIAL_GRADIENT:
+ if (n_params <= 4) {
+ if (surface->box.x2 == 1)
+ size = surface->box.y2;
+ else if (surface->box.y2 == 1)
+ size = surface->box.x2;
+ } else
+ size = (n_params - 2) / 3;
- vecs[i].v[0] += surface->texture.box.x1;
- vecs[i].v[1] = surface->texture.box.y2 - vecs[i].v[1];
+ if (size < 2)
+ size = 2;
- vecs[i].v[0] *= surface->texture.texcoord_width_unit;
- vecs[i].v[1] *= surface->texture.texcoord_height_unit;
-
- vecs[i].v[3] = i;
- }
-
- /* sort color stops in ascending order */
- qsort (vecs, surface->filter_params->id, sizeof (glitz_vec4_t),
- _glitz_color_stop_compare);
-
- for (i = 0; i < size; i++) {
- glitz_float_t diff;
+ if (_glitz_filter_params_ensure (surface, size + 1))
+ return GLITZ_STATUS_NO_MEMORY;
- if ((i + 1) == size)
- diff = 1.0f - vecs[i].v[2];
- else
- diff = vecs[i + 1].v[2] - vecs[i].v[2];
-
- if (diff != 0.0f)
- vecs[i].v[3] = 1.0f / diff;
- else
- vecs[i].v[3] = 2147483647.0f; /* should be FLT_MAX, but this will do */
+ vecs = surface->filter_params->vectors;
+
+ if (filter == GLITZ_FILTER_LINEAR_GRADIENT) {
+ glitz_float_t length, angle, dh, dv;
+ glitz_float_t start_x, start_y, stop_x, stop_y;
+
+ _glitz_filter_params_set (&start_x, 0.0f, ¶ms, &n_params);
+ _glitz_filter_params_set (&start_y, 0.0f, ¶ms, &n_params);
+ _glitz_filter_params_set (&stop_x, 1.0f, ¶ms, &n_params);
+ _glitz_filter_params_set (&stop_y, 0.0f, ¶ms, &n_params);
+
+ dh = stop_x - start_x;
+ dv = stop_y - start_y;
+
+ length = sqrtf (dh * dh + dv * dv);
+
+ angle = -atan2f (dv, dh);
+
+ vecs->v[2] = cosf (angle);
+ vecs->v[3] = -sinf (angle);
+
+ vecs->v[0] = vecs->v[2] * start_x;
+ vecs->v[0] += vecs->v[3] * start_y;
+
+ vecs->v[1] = (length)? 1.0f / length: 2147483647.0f;
+ } else {
+ glitz_float_t r0, r1;
+
+ _glitz_filter_params_set (&vecs->v[0], 0.5f, ¶ms, &n_params);
+ _glitz_filter_params_set (&vecs->v[1], 0.5f, ¶ms, &n_params);
+ _glitz_filter_params_set (&r0, 0.0f, ¶ms, &n_params);
+ _glitz_filter_params_set (&r1, 0.5f, ¶ms, &n_params);
+
+ glitz_clamp_value (&r0, 0.0f, r1);
+
+ vecs->v[2] = r0;
+ if (r1 != r0)
+ vecs->v[3] = 1.0f / (r1 - r0);
+ else
+ vecs->v[3] = 2147483647.0f;
+ }
+
+ vecs++;
+ surface->filter_params->id = size;
+
+ for (i = 0; i < size; i++) {
+ glitz_float_t x_default, y_default, o_default;
+
+ o_default = i / (glitz_float_t) (size - 1);
+ x_default = (surface->box.x2 * i) / (glitz_float_t) size;
+ y_default = (surface->box.y2 * i) / (glitz_float_t) size;
+
+ _glitz_filter_params_set (&vecs[i].v[2], o_default, ¶ms,
+ &n_params);
+ _glitz_filter_params_set (&vecs[i].v[0], x_default, ¶ms,
+ &n_params);
+ _glitz_filter_params_set (&vecs[i].v[1], y_default, ¶ms,
+ &n_params);
+
+ glitz_clamp_value (&vecs[i].v[2], 0.0f, 1.0f);
+ glitz_clamp_value (&vecs[i].v[0], 0.0f, surface->box.x2 - 1.0f);
+ glitz_clamp_value (&vecs[i].v[1], 0.0f, surface->box.y2 - 1.0f);
+
+ vecs[i].v[0] += 0.5f;
+ vecs[i].v[1] += 0.5f;
+
+ vecs[i].v[0] += surface->texture.box.x1;
+ vecs[i].v[1] = surface->texture.box.y2 - vecs[i].v[1];
+
+ vecs[i].v[0] *= surface->texture.texcoord_width_unit;
+ vecs[i].v[1] *= surface->texture.texcoord_height_unit;
+
+ vecs[i].v[3] = i;
+ }
+
+ /* sort color stops in ascending order */
+ qsort (vecs, surface->filter_params->id, sizeof (glitz_vec4_t),
+ _glitz_color_stop_compare);
+
+ for (i = 0; i < size; i++) {
+ glitz_float_t diff;
+
+ if ((i + 1) == size)
+ diff = 1.0f - vecs[i].v[2];
+ else
+ diff = vecs[i + 1].v[2] - vecs[i].v[2];
+
+ if (diff != 0.0f)
+ vecs[i].v[3] = 1.0f / diff;
+ else
+ vecs[i].v[3] = 2147483647.0f;
+ }
+ break;
+ case GLITZ_FILTER_BILINEAR:
+ case GLITZ_FILTER_NEAREST:
+ if (surface->filter_params)
+ free (surface->filter_params);
+
+ surface->filter_params = NULL;
+ break;
}
- break;
- case GLITZ_FILTER_BILINEAR:
- case GLITZ_FILTER_NEAREST:
- if (surface->filter_params)
- free (surface->filter_params);
- surface->filter_params = NULL;
- break;
- }
+ glitz_filter_set_type (surface, filter);
- glitz_filter_set_type (surface, filter);
-
- return GLITZ_STATUS_SUCCESS;
+ return GLITZ_STATUS_SUCCESS;
}
glitz_gl_uint_t
glitz_filter_get_fragment_program (glitz_surface_t *surface,
- glitz_composite_op_t *op)
+ glitz_composite_op_t *op)
{
- return glitz_get_fragment_program (op,
- surface->filter_params->fp_type,
- surface->filter_params->id);
+ return glitz_get_fragment_program (op,
+ surface->filter_params->fp_type,
+ surface->filter_params->id);
}
void
glitz_filter_set_type (glitz_surface_t *surface,
- glitz_filter_t filter)
+ glitz_filter_t filter)
{
- switch (filter) {
- case GLITZ_FILTER_CONVOLUTION:
- case GLITZ_FILTER_GAUSSIAN:
- surface->filter_params->fp_type = GLITZ_FP_CONVOLUTION;
- break;
- case GLITZ_FILTER_LINEAR_GRADIENT:
- if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
- if (SURFACE_MIRRORED (surface))
- surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REFLECT;
- else
- surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REPEAT;
- } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
- surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_NEAREST;
- } else
- surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT;
- break;
- case GLITZ_FILTER_RADIAL_GRADIENT:
- if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
- if (SURFACE_MIRRORED (surface))
- surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REFLECT;
- else
- surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REPEAT;
- } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
- surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_NEAREST;
- } else
- surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT;
- break;
- case GLITZ_FILTER_BILINEAR:
- case GLITZ_FILTER_NEAREST:
- break;
- }
+ switch (filter) {
+ case GLITZ_FILTER_CONVOLUTION:
+ case GLITZ_FILTER_GAUSSIAN:
+ surface->filter_params->fp_type = GLITZ_FP_CONVOLUTION;
+ break;
+ case GLITZ_FILTER_LINEAR_GRADIENT:
+ if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
+ if (SURFACE_MIRRORED (surface))
+ surface->filter_params->fp_type =
+ GLITZ_FP_LINEAR_GRADIENT_REFLECT;
+ else
+ surface->filter_params->fp_type =
+ GLITZ_FP_LINEAR_GRADIENT_REPEAT;
+ } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
+ surface->filter_params->fp_type =
+ GLITZ_FP_LINEAR_GRADIENT_NEAREST;
+ } else
+ surface->filter_params->fp_type =
+ GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT;
+ break;
+ case GLITZ_FILTER_RADIAL_GRADIENT:
+ if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
+ if (SURFACE_MIRRORED (surface))
+ surface->filter_params->fp_type =
+ GLITZ_FP_RADIAL_GRADIENT_REFLECT;
+ else
+ surface->filter_params->fp_type =
+ GLITZ_FP_RADIAL_GRADIENT_REPEAT;
+ } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
+ surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_NEAREST;
+ } else
+ surface->filter_params->fp_type =
+ GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT;
+ break;
+ case GLITZ_FILTER_BILINEAR:
+ case GLITZ_FILTER_NEAREST:
+ break;
+ }
}
void
glitz_filter_enable (glitz_surface_t *surface,
- glitz_composite_op_t *op)
+ glitz_composite_op_t *op)
{
- glitz_gl_proc_address_list_t *gl = op->gl;
- int i;
+ glitz_gl_proc_address_list_t *gl = op->gl;
+ int i;
- gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
- gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, op->fp);
+ gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
+ gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, op->fp);
- switch (surface->filter) {
- case GLITZ_FILTER_GAUSSIAN:
- case GLITZ_FILTER_CONVOLUTION:
- for (i = 0; i < surface->filter_params->id; i++)
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i,
- surface->filter_params->vectors[i].v);
- break;
- case GLITZ_FILTER_LINEAR_GRADIENT:
- case GLITZ_FILTER_RADIAL_GRADIENT: {
- int j, fp_type = surface->filter_params->fp_type;
- glitz_vec4_t *vec;
+ switch (surface->filter) {
+ case GLITZ_FILTER_GAUSSIAN:
+ case GLITZ_FILTER_CONVOLUTION:
+ for (i = 0; i < surface->filter_params->id; i++)
+ gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i,
+ surface->filter_params->vectors[i].v);
+ break;
+ case GLITZ_FILTER_LINEAR_GRADIENT:
+ case GLITZ_FILTER_RADIAL_GRADIENT: {
+ int j, fp_type = surface->filter_params->fp_type;
+ glitz_vec4_t *vec;
- vec = surface->filter_params->vectors;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 0, vec->v);
+ vec = surface->filter_params->vectors;
- vec++;
+ gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 0, vec->v);
- if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
- fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
- glitz_vec4_t v;
+ vec++;
- v.v[0] = v.v[1] = -1.0f;
- v.v[2] = 0.0f;
- v.v[3] = (vec->v[3])? 1.0f / vec->v[3]: 1.0f;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 1, v.v);
- j = 2;
- } else
- j = 1;
-
- for (i = 0; i < surface->filter_params->id; i++, vec++)
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i + j, vec->v);
-
- if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
- fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
- glitz_vec4_t v;
+ if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
+ fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
+ glitz_vec4_t v;
- v.v[0] = v.v[1] = -1.0f;
- v.v[2] = v.v[3] = 1.0f;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i + j, v.v);
- }
- } break;
- case GLITZ_FILTER_BILINEAR:
- case GLITZ_FILTER_NEAREST:
- break;
- }
+ v.v[0] = v.v[1] = -1.0f;
+ v.v[2] = 0.0f;
+ v.v[3] = (vec->v[3])? 1.0f / vec->v[3]: 1.0f;
+
+ gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 1, v.v);
+ j = 2;
+ } else
+ j = 1;
+
+ for (i = 0; i < surface->filter_params->id; i++, vec++)
+ gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM,
+ i + j, vec->v);
+
+ if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
+ fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
+ glitz_vec4_t v;
+
+ v.v[0] = v.v[1] = -1.0f;
+ v.v[2] = v.v[3] = 1.0f;
+
+ gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM,
+ i + j, v.v);
+ }
+ } break;
+ case GLITZ_FILTER_BILINEAR:
+ case GLITZ_FILTER_NEAREST:
+ break;
+ }
}
Index: glitz_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_format.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- glitz_format.c 25 Jan 2005 19:50:26 -0000 1.10
+++ glitz_format.c 14 Sep 2005 15:57:16 -0000 1.11
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -32,254 +32,387 @@
#include <stdlib.h>
struct _texture_format {
- glitz_gl_int_t texture_format;
- glitz_format_t format;
+ glitz_gl_int_t texture_format;
+ glitz_format_t format;
} _texture_formats[] = {
- { GLITZ_GL_ALPHA4, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 4 } } },
- { GLITZ_GL_ALPHA8, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 8 } } },
- { GLITZ_GL_ALPHA12, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 12 } } },
- { GLITZ_GL_ALPHA16, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 16 } } },
- { GLITZ_GL_R3_G3_B2, { 0, GLITZ_FORMAT_TYPE_COLOR, { 3, 3, 2, 0 } } },
- { GLITZ_GL_RGB4, { 0, GLITZ_FORMAT_TYPE_COLOR, { 4, 4, 4, 0 } } },
- { GLITZ_GL_RGB5, { 0, GLITZ_FORMAT_TYPE_COLOR, { 5, 6, 5, 0 } } },
- { GLITZ_GL_RGB8, { 0, GLITZ_FORMAT_TYPE_COLOR, { 8, 8, 8, 0 } } },
- { GLITZ_GL_RGB10, { 0, GLITZ_FORMAT_TYPE_COLOR, { 10, 10, 10, 0 } } },
- { GLITZ_GL_RGB12, { 0, GLITZ_FORMAT_TYPE_COLOR, { 12, 12, 12, 0 } } },
- { GLITZ_GL_RGB16, { 0, GLITZ_FORMAT_TYPE_COLOR, { 16, 16, 16, 0 } } },
- { GLITZ_GL_RGBA2, { 0, GLITZ_FORMAT_TYPE_COLOR, { 2, 2, 2, 2 } } },
- { GLITZ_GL_RGB5_A1, { 0, GLITZ_FORMAT_TYPE_COLOR, { 5, 5, 5, 1 } } },
- { GLITZ_GL_RGBA4, { 0, GLITZ_FORMAT_TYPE_COLOR, { 4, 4, 4, 4 } } },
- { GLITZ_GL_RGBA8, { 0, GLITZ_FORMAT_TYPE_COLOR, { 8, 8, 8, 8 } } },
- { GLITZ_GL_RGB10_A2, { 0, GLITZ_FORMAT_TYPE_COLOR, { 10, 10, 10, 2 } } },
- { GLITZ_GL_RGBA12, { 0, GLITZ_FORMAT_TYPE_COLOR, { 12, 12, 12, 12 } } },
- { GLITZ_GL_RGBA16, { 0, GLITZ_FORMAT_TYPE_COLOR, { 16, 16, 16, 16 } } }
+ { GLITZ_GL_ALPHA4, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 4 } } },
+ { GLITZ_GL_ALPHA8, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 8 } } },
+ { GLITZ_GL_ALPHA12, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 12 } } },
+ { GLITZ_GL_ALPHA16, { 0, GLITZ_FORMAT_TYPE_COLOR, { 0, 0, 0, 16 } } },
+ { GLITZ_GL_R3_G3_B2, { 0, GLITZ_FORMAT_TYPE_COLOR, { 3, 3, 2, 0 } } },
+ { GLITZ_GL_RGB4, { 0, GLITZ_FORMAT_TYPE_COLOR, { 4, 4, 4, 0 } } },
+ { GLITZ_GL_RGB5, { 0, GLITZ_FORMAT_TYPE_COLOR, { 5, 6, 5, 0 } } },
+ { GLITZ_GL_RGB8, { 0, GLITZ_FORMAT_TYPE_COLOR, { 8, 8, 8, 0 } } },
+ { GLITZ_GL_RGB10, { 0, GLITZ_FORMAT_TYPE_COLOR, { 10, 10, 10, 0 } } },
+ { GLITZ_GL_RGB12, { 0, GLITZ_FORMAT_TYPE_COLOR, { 12, 12, 12, 0 } } },
+ { GLITZ_GL_RGB16, { 0, GLITZ_FORMAT_TYPE_COLOR, { 16, 16, 16, 0 } } },
+ { GLITZ_GL_RGBA2, { 0, GLITZ_FORMAT_TYPE_COLOR, { 2, 2, 2, 2 } } },
+ { GLITZ_GL_RGB5_A1, { 0, GLITZ_FORMAT_TYPE_COLOR, { 5, 5, 5, 1 } } },
+ { GLITZ_GL_RGBA4, { 0, GLITZ_FORMAT_TYPE_COLOR, { 4, 4, 4, 4 } } },
+ { GLITZ_GL_RGBA8, { 0, GLITZ_FORMAT_TYPE_COLOR, { 8, 8, 8, 8 } } },
+ { GLITZ_GL_RGB10_A2, { 0, GLITZ_FORMAT_TYPE_COLOR, { 10, 10, 10, 2 } } },
+ { GLITZ_GL_RGBA12, { 0, GLITZ_FORMAT_TYPE_COLOR, { 12, 12, 12, 12 } } },
+ { GLITZ_GL_RGBA16, { 0, GLITZ_FORMAT_TYPE_COLOR, { 16, 16, 16, 16 } } }
};
static void
_glitz_add_texture_format (glitz_format_t **formats,
- glitz_gl_int_t **texture_formats,
- int *n_formats,
- glitz_gl_int_t texture_format,
- glitz_format_t *format)
+ glitz_gl_int_t **texture_formats,
+ int *n_formats,
+ glitz_gl_int_t texture_format,
+ glitz_format_t *format)
{
- *formats = realloc (*formats, sizeof (glitz_format_t) * (*n_formats + 1));
- *texture_formats = realloc (*texture_formats,
- sizeof (glitz_gl_enum_t) * (*n_formats + 1));
+ *formats = realloc (*formats, sizeof (glitz_format_t) * (*n_formats + 1));
+ *texture_formats = realloc (*texture_formats,
+ sizeof (glitz_gl_enum_t) * (*n_formats + 1));
- if (*formats && *texture_formats) {
- (*texture_formats)[*n_formats] = texture_format;
- (*formats)[*n_formats] = *format;
- (*formats)[*n_formats].id = *n_formats;
- (*n_formats)++;
- } else
- *n_formats = 0;
+ if (*formats && *texture_formats) {
+ (*texture_formats)[*n_formats] = texture_format;
+ (*formats)[*n_formats] = *format;
+ (*formats)[*n_formats].id = *n_formats;
+ (*n_formats)++;
+ } else
+ *n_formats = 0;
}
void
glitz_create_surface_formats (glitz_gl_proc_address_list_t *gl,
- glitz_format_t **formats,
- glitz_gl_int_t **texture_formats,
- int *n_formats)
+ glitz_format_t **formats,
+ glitz_gl_int_t **texture_formats,
+ int *n_formats)
{
- glitz_gl_int_t value;
- int i, n_texture_formats;
-
- n_texture_formats =
- sizeof (_texture_formats) / sizeof (struct _texture_format);
-
- for (i = 0; i < n_texture_formats; i++) {
- gl->tex_image_2d (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- _texture_formats[i].texture_format, 1, 1, 0,
- GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, NULL);
+ glitz_gl_int_t value;
+ int i, n_texture_formats;
- switch (_texture_formats[i].format.type) {
- case GLITZ_FORMAT_TYPE_COLOR:
- if (_texture_formats[i].format.color.red_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_RED_SIZE, &value);
- if (value != _texture_formats[i].format.color.red_size)
- continue;
- }
-
- if (_texture_formats[i].format.color.green_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_GREEN_SIZE, &value);
- if (value != _texture_formats[i].format.color.green_size)
- continue;
- }
+ n_texture_formats =
+ sizeof (_texture_formats) / sizeof (struct _texture_format);
- if (_texture_formats[i].format.color.blue_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_BLUE_SIZE, &value);
- if (value != _texture_formats[i].format.color.blue_size)
- continue;
- }
+ for (i = 0; i < n_texture_formats; i++) {
+ gl->tex_image_2d (GLITZ_GL_PROXY_TEXTURE_2D, 0,
+ _texture_formats[i].texture_format, 1, 1, 0,
+ GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, NULL);
- if (_texture_formats[i].format.color.alpha_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_ALPHA_SIZE, &value);
- if (value != _texture_formats[i].format.color.alpha_size)
- continue;
- }
- break;
- default:
- continue;
+ switch (_texture_formats[i].format.type) {
+ case GLITZ_FORMAT_TYPE_COLOR:
+ if (_texture_formats[i].format.color.red_size) {
+ gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
+ GLITZ_GL_TEXTURE_RED_SIZE,
+ &value);
+ if (value != _texture_formats[i].format.color.red_size)
+ continue;
+ }
+
+ if (_texture_formats[i].format.color.green_size) {
+ gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
+ GLITZ_GL_TEXTURE_GREEN_SIZE,
+ &value);
+ if (value != _texture_formats[i].format.color.green_size)
+ continue;
+ }
+
+ if (_texture_formats[i].format.color.blue_size) {
+ gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
+ GLITZ_GL_TEXTURE_BLUE_SIZE,
+ &value);
+ if (value != _texture_formats[i].format.color.blue_size)
+ continue;
+ }
+
+ if (_texture_formats[i].format.color.alpha_size) {
+ gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
+ GLITZ_GL_TEXTURE_ALPHA_SIZE,
+ &value);
+ if (value != _texture_formats[i].format.color.alpha_size)
+ continue;
+ }
+ break;
+ default:
+ continue;
+ }
+
+ _glitz_add_texture_format (formats,
+ texture_formats,
+ n_formats,
+ _texture_formats[i].texture_format,
+ &_texture_formats[i].format);
}
-
- _glitz_add_texture_format (formats,
- texture_formats,
- n_formats,
- _texture_formats[i].texture_format,
- &_texture_formats[i].format);
- }
}
-glitz_drawable_format_t *
-glitz_drawable_format_find (glitz_drawable_format_t *formats,
- int n_formats,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
+static void
+_glitz_add_drawable_format (glitz_int_drawable_format_t *format,
+ glitz_int_drawable_format_t **formats,
+ int *n_formats)
+{
+ void *ptr;
+
+ ptr = realloc (*formats,
+ sizeof (glitz_int_drawable_format_t) * (*n_formats + 1));
+ if (ptr)
+ {
+ *formats = ptr;
+ (*formats)[*n_formats] = *format;
+ (*n_formats)++;
+ }
+}
+
+/* TODO: Available drawable formats needs to be validated is a similar way
+ as surface formats. */
+void
+_glitz_add_drawable_formats (glitz_gl_proc_address_list_t *gl,
+ unsigned long feature_mask,
+ glitz_int_drawable_format_t **formats,
+ int *n_formats)
+{
+ if (feature_mask & GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK)
+ {
+ glitz_int_drawable_format_t format;
+ glitz_drawable_format_t d[] = {
+ { 0, { 8, 8, 8, 0 }, 0, 0, 1, 0 },
+ { 0, { 8, 8, 8, 8 }, 0, 0, 1, 0 },
+ { 0, { 8, 8, 8, 0 }, 24, 8, 1, 1 },
+ { 0, { 8, 8, 8, 8 }, 24, 8, 1, 1 }
+ };
+ int i;
+
+ format.types = GLITZ_DRAWABLE_TYPE_FBO_MASK;
+ format.caveat = 0;
+ format.u.val = 0;
+
+ for (i = 0; i < sizeof (d) / sizeof (d[0]); i++)
+ {
+ format.d = d[i];
+ format.d.id = *n_formats;
+
+ _glitz_add_drawable_format (&format, formats, n_formats);
+ }
+ }
+}
+
+void
+glitz_drawable_format_copy (const glitz_drawable_format_t *src,
+ glitz_drawable_format_t *dst,
+ unsigned long mask)
{
- for (; n_formats; n_formats--, formats++) {
if (mask & GLITZ_FORMAT_ID_MASK)
- if (templ->id != formats->id)
- continue;
+ dst->id = src->id;
if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
- if (templ->color.red_size != formats->color.red_size)
- continue;
+ dst->color.red_size = src->color.red_size;
if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
- if (templ->color.green_size != formats->color.green_size)
- continue;
+ dst->color.green_size = src->color.green_size;
if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
- if (templ->color.blue_size != formats->color.blue_size)
- continue;
+ dst->color.blue_size = src->color.blue_size;
if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
- if (templ->color.alpha_size != formats->color.alpha_size)
- continue;
+ dst->color.alpha_size = src->color.alpha_size;
if (mask & GLITZ_FORMAT_DEPTH_SIZE_MASK)
- if (templ->depth_size != formats->depth_size)
- continue;
+ dst->depth_size = src->depth_size;
if (mask & GLITZ_FORMAT_STENCIL_SIZE_MASK)
- if (templ->stencil_size != formats->stencil_size)
- continue;
+ dst->stencil_size = src->stencil_size;
if (mask & GLITZ_FORMAT_DOUBLEBUFFER_MASK)
- if (templ->doublebuffer != formats->doublebuffer)
- continue;
+ dst->doublebuffer = src->doublebuffer;
if (mask & GLITZ_FORMAT_SAMPLES_MASK)
- if (templ->samples != formats->samples)
- continue;
+ dst->samples = src->samples;
+}
- if (mask & GLITZ_FORMAT_WINDOW_MASK)
- if (templ->types.window != formats->types.window)
- continue;
+glitz_drawable_format_t *
+glitz_drawable_format_find (glitz_int_drawable_format_t *formats,
+ int n_formats,
+ unsigned long mask,
+ const glitz_int_drawable_format_t *templ,
+ int count)
+{
+ for (; n_formats; n_formats--, formats++)
+ {
+ if (mask & GLITZ_FORMAT_ID_MASK)
+ if (templ->d.id != formats->d.id)
+ continue;
- if (mask & GLITZ_FORMAT_PBUFFER_MASK)
- if (templ->types.pbuffer != formats->types.pbuffer)
- continue;
-
- if (count-- == 0)
- return formats;
- }
+ if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
+ if (templ->d.color.red_size != formats->d.color.red_size)
+ continue;
- return NULL;
+ if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
+ if (templ->d.color.green_size != formats->d.color.green_size)
+ continue;
+
+ if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
+ if (templ->d.color.blue_size != formats->d.color.blue_size)
+ continue;
+
+ if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
+ if (templ->d.color.alpha_size != formats->d.color.alpha_size)
+ continue;
+
+ if (mask & GLITZ_FORMAT_DEPTH_SIZE_MASK)
+ if (templ->d.depth_size != formats->d.depth_size)
+ continue;
+
+ if (mask & GLITZ_FORMAT_STENCIL_SIZE_MASK)
+ if (templ->d.stencil_size != formats->d.stencil_size)
+ continue;
+
+ if (mask & GLITZ_FORMAT_DOUBLEBUFFER_MASK)
+ if (templ->d.doublebuffer != formats->d.doublebuffer)
+ continue;
+
+ if (mask & GLITZ_FORMAT_SAMPLES_MASK)
+ if (templ->d.samples != formats->d.samples)
+ continue;
+
+ if (mask & GLITZ_INT_FORMAT_WINDOW_MASK)
+ if ((templ->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK) !=
+ (formats->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK))
+ continue;
+
+ if (mask & GLITZ_INT_FORMAT_PBUFFER_MASK)
+ if ((templ->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK) !=
+ (formats->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK))
+ continue;
+
+ if (mask & GLITZ_INT_FORMAT_FBO_MASK)
+ if ((templ->types & GLITZ_DRAWABLE_TYPE_FBO_MASK) !=
+ (formats->types & GLITZ_DRAWABLE_TYPE_FBO_MASK))
+ continue;
+
+ if (count-- == 0)
+ return &formats->d;
+ }
+
+ return NULL;
}
static glitz_format_t *
_glitz_format_find (glitz_format_t *formats,
- int n_formats,
- unsigned long mask,
- const glitz_format_t *templ,
- int count)
+ int n_formats,
+ unsigned long mask,
+ const glitz_format_t *templ,
+ int count)
{
- for (; n_formats; n_formats--, formats++) {
- if (mask & GLITZ_FORMAT_ID_MASK)
- if (templ->id != formats->id)
- continue;
+ for (; n_formats; n_formats--, formats++) {
+ if (mask & GLITZ_FORMAT_ID_MASK)
+ if (templ->id != formats->id)
+ continue;
- if (mask & GLITZ_FORMAT_TYPE_MASK)
- if (templ->type != formats->type)
- continue;
+ if (mask & GLITZ_FORMAT_TYPE_MASK)
+ if (templ->type != formats->type)
+ continue;
- if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
- if (templ->color.red_size != formats->color.red_size)
- continue;
+ if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
+ if (templ->color.red_size != formats->color.red_size)
+ continue;
- if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
- if (templ->color.green_size != formats->color.green_size)
- continue;
+ if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
+ if (templ->color.green_size != formats->color.green_size)
+ continue;
- if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
- if (templ->color.blue_size != formats->color.blue_size)
- continue;
+ if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
+ if (templ->color.blue_size != formats->color.blue_size)
+ continue;
- if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
- if (templ->color.alpha_size != formats->color.alpha_size)
- continue;
+ if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
+ if (templ->color.alpha_size != formats->color.alpha_size)
+ continue;
- if (count-- == 0)
- return formats;
- }
+ if (count-- == 0)
+ return formats;
+ }
- return NULL;
+ return NULL;
}
glitz_format_t *
glitz_find_format (glitz_drawable_t *drawable,
- unsigned long mask,
- const glitz_format_t *templ,
- int count)
+ unsigned long mask,
+ const glitz_format_t *templ,
+ int count)
{
- return _glitz_format_find (drawable->backend->formats,
- drawable->backend->n_formats,
- mask, templ, count);
+ return _glitz_format_find (drawable->backend->formats,
+ drawable->backend->n_formats,
+ mask, templ, count);
}
glitz_format_t *
glitz_find_standard_format (glitz_drawable_t *drawable,
- glitz_format_name_t format_name)
+ glitz_format_name_t format_name)
{
- glitz_format_t templ;
- unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK | GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_ALPHA_SIZE_MASK | GLITZ_FORMAT_TYPE_MASK;
+ glitz_format_t templ;
+ unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK | GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_ALPHA_SIZE_MASK | GLITZ_FORMAT_TYPE_MASK;
- templ.type = GLITZ_FORMAT_TYPE_COLOR;
+ templ.type = GLITZ_FORMAT_TYPE_COLOR;
- switch (format_name) {
- case GLITZ_STANDARD_ARGB32:
- templ.color.red_size = 8;
- templ.color.green_size = 8;
- templ.color.blue_size = 8;
- templ.color.alpha_size = 8;
- break;
- case GLITZ_STANDARD_RGB24:
- templ.color.red_size = 8;
- templ.color.green_size = 8;
- templ.color.blue_size = 8;
- templ.color.alpha_size = 0;
- break;
- case GLITZ_STANDARD_A8:
- templ.color.red_size = 0;
- templ.color.green_size = 0;
- templ.color.blue_size = 0;
- templ.color.alpha_size = 8;
- break;
- case GLITZ_STANDARD_A1:
- templ.color.red_size = 0;
- templ.color.green_size = 0;
- templ.color.blue_size = 0;
- templ.color.alpha_size = 1;
- break;
- }
+ switch (format_name) {
+ case GLITZ_STANDARD_ARGB32:
+ templ.color.red_size = 8;
+ templ.color.green_size = 8;
+ templ.color.blue_size = 8;
+ templ.color.alpha_size = 8;
+ break;
+ case GLITZ_STANDARD_RGB24:
+ templ.color.red_size = 8;
+ templ.color.green_size = 8;
+ templ.color.blue_size = 8;
+ templ.color.alpha_size = 0;
+ break;
+ case GLITZ_STANDARD_A8:
+ templ.color.red_size = 0;
+ templ.color.green_size = 0;
+ templ.color.blue_size = 0;
+ templ.color.alpha_size = 8;
+ break;
+ case GLITZ_STANDARD_A1:
+ templ.color.red_size = 0;
+ templ.color.green_size = 0;
+ templ.color.blue_size = 0;
+ templ.color.alpha_size = 1;
+ break;
+ }
- return glitz_find_format (drawable, mask, &templ, 0);
+ return glitz_find_format (drawable, mask, &templ, 0);
}
+
+glitz_drawable_format_t *
+glitz_find_drawable_format (glitz_drawable_t *other,
+ unsigned long mask,
+ const glitz_drawable_format_t *templ,
+ int count)
+{
+ glitz_int_drawable_format_t itempl;
+
+ glitz_drawable_format_copy (templ, &itempl.d, mask);
+
+ itempl.types = GLITZ_DRAWABLE_TYPE_FBO_MASK;
+ mask |= GLITZ_INT_FORMAT_FBO_MASK;
+
+ return glitz_drawable_format_find (other->backend->drawable_formats,
+ other->backend->n_drawable_formats,
+ mask, &itempl, count);
+}
+slim_hidden_def(glitz_find_drawable_format);
+
+glitz_drawable_format_t *
+glitz_find_pbuffer_format (glitz_drawable_t *other,
+ unsigned long mask,
+ const glitz_drawable_format_t *templ,
+ int count)
+{
+ glitz_int_drawable_format_t itempl;
+
+ glitz_drawable_format_copy (templ, &itempl.d, mask);
+
+ itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
+ mask |= GLITZ_INT_FORMAT_PBUFFER_MASK;
+
+ return glitz_drawable_format_find (other->backend->drawable_formats,
+ other->backend->n_drawable_formats,
+ mask, &itempl, count);
+}
+slim_hidden_def(glitz_find_pbuffer_format);
Index: glitz_framebuffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_framebuffer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_framebuffer.c 4 Jul 2005 10:33:01 -0000 1.2
+++ glitz_framebuffer.c 14 Sep 2005 15:57:16 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright © 2005 Novell, Inc.
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -29,48 +29,375 @@
#include "glitzint.h"
-void
-glitz_framebuffer_init (glitz_framebuffer_t *framebuffer)
+typedef struct _glitz_fbo_drawable {
+ glitz_drawable_t base;
+ glitz_drawable_t *other;
+ int width;
+ int height;
+ glitz_gl_uint_t fb;
+ glitz_gl_uint_t front;
+ glitz_gl_uint_t back;
+ glitz_gl_uint_t depth;
+ glitz_gl_uint_t stencil;
+ glitz_gl_uint_t front_texture;
+ glitz_gl_uint_t back_texture;
+ glitz_gl_enum_t internal_format;
+} glitz_fbo_drawable_t;
+
+static glitz_bool_t
+_glitz_fbo_bind (glitz_fbo_drawable_t *drawable)
{
- framebuffer->name = 0;
+ glitz_bool_t update = 0;
+ glitz_gl_enum_t status;
+
+ GLITZ_GL_DRAWABLE (drawable->other);
+
+ if (!drawable->fb)
+ {
+ gl->gen_framebuffers (1, &drawable->fb);
+
+ drawable->width = drawable->base.width;
+ drawable->height = drawable->base.height;
+ update = 1;
+ }
+ else if (drawable->width != drawable->base.width ||
+ drawable->height != drawable->base.height)
+ {
+ drawable->width = drawable->base.width;
+ drawable->height = drawable->base.height;
+ update = 1;
+ }
+
+ gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, drawable->fb);
+
+ if (drawable->base.front &&
+ drawable->front_texture != drawable->base.front->texture.name)
+ {
+ gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_COLOR_ATTACHMENT0,
+ drawable->base.front->texture.target,
+ drawable->base.front->texture.name,
+ 0);
+
+ drawable->front_texture = drawable->base.front->texture.name;
+
+ if (drawable->front)
+ {
+ gl->delete_renderbuffers (1, &drawable->front);
+ drawable->front = 0;
+ }
+ }
+
+ if (!drawable->front_texture && !drawable->front)
+ {
+ gl->gen_renderbuffers (1, &drawable->front);
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, drawable->front);
+ gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
+ drawable->internal_format,
+ drawable->base.width,
+ drawable->base.height);
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
+ gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_COLOR_ATTACHMENT0,
+ GLITZ_GL_RENDERBUFFER,
+ drawable->front);
+ }
+
+ if (drawable->base.format->d.doublebuffer)
+ {
+ if (drawable->base.back &&
+ drawable->back_texture != drawable->base.back->texture.name)
+ {
+ gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_COLOR_ATTACHMENT1,
+ drawable->base.back->texture.target,
+ drawable->base.back->texture.name,
+ 0);
+
+ drawable->back_texture = drawable->base.back->texture.name;
+
+ if (drawable->back)
+ {
+ gl->delete_renderbuffers (1, &drawable->back);
+ drawable->back = 0;
+ }
+ }
+
+ if (!drawable->back_texture && !drawable->back)
+ {
+ gl->gen_renderbuffers (1, &drawable->back);
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER,
+ drawable->back);
+ gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
+ drawable->internal_format,
+ drawable->base.width,
+ drawable->base.height);
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
+ gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_COLOR_ATTACHMENT1,
+ GLITZ_GL_RENDERBUFFER,
+ drawable->back);
+ }
+ }
+
+ if (update)
+ {
+ if (drawable->base.format->d.depth_size)
+ {
+ if (!drawable->depth)
+ gl->gen_renderbuffers (1, &drawable->depth);
+
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, drawable->depth);
+ gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
+ GLITZ_GL_DEPTH_COMPONENT,
+ drawable->base.width,
+ drawable->base.height);
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
+
+ gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_DEPTH_ATTACHMENT,
+ GLITZ_GL_RENDERBUFFER,
+ drawable->depth);
+ }
+
+ if (drawable->base.format->d.stencil_size)
+ {
+ if (!drawable->stencil)
+ gl->gen_renderbuffers (1, &drawable->stencil);
+
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER,
+ drawable->stencil);
+ gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
+ GLITZ_GL_STENCIL_INDEX,
+ drawable->base.width,
+ drawable->base.height);
+ gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
+
+ gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_STENCIL_ATTACHMENT,
+ GLITZ_GL_RENDERBUFFER,
+ drawable->stencil);
+ }
+ }
+
+ status = gl->check_framebuffer_status (GLITZ_GL_FRAMEBUFFER);
+ if (status == GLITZ_GL_FRAMEBUFFER_COMPLETE)
+ return 1;
+
+ return 0;
}
-void
-glitz_framebuffer_fini (glitz_gl_proc_address_list_t *gl,
- glitz_framebuffer_t *framebuffer)
+static void
+_glitz_fbo_attach_notify (void *abstract_drawable,
+ glitz_surface_t *surface)
{
- if (framebuffer->name)
- gl->delete_framebuffers (1, &framebuffer->name);
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+ glitz_texture_t *texture;
+
+ GLITZ_GL_DRAWABLE (drawable->other);
+
+ texture = &surface->texture;
+ if (!TEXTURE_ALLOCATED (texture))
+ {
+ drawable->other->backend->push_current (drawable->other, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+ glitz_texture_allocate (gl, texture);
+ drawable->other->backend->pop_current (drawable->other);
+
+ if (!TEXTURE_ALLOCATED (texture))
+ return;
+ }
+
+ REGION_EMPTY (&surface->drawable_damage);
}
-void
-glitz_framebuffer_unbind (glitz_gl_proc_address_list_t *gl)
+static void
+_glitz_fbo_detach_notify (void *abstract_drawable,
+ glitz_surface_t *surface)
{
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+
+ if (surface->texture.name == drawable->front_texture ||
+ surface->texture.name == drawable->back_texture)
+ {
+ GLITZ_GL_DRAWABLE (drawable->other);
+
+ drawable->other->backend->push_current (drawable->other, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+
+ gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, drawable->fb);
+
+ if (surface->texture.name == drawable->front_texture)
+ {
+ gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_COLOR_ATTACHMENT0,
+ surface->texture.target,
+ 0, 0);
+ drawable->front_texture = 0;
+ }
+
+ if (surface->texture.name == drawable->back_texture)
+ {
+ gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
+ GLITZ_GL_COLOR_ATTACHMENT1,
+ surface->texture.target,
+ 0, 0);
+ drawable->back_texture = 0;
+ }
+
+ gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, 0);
+
+ surface->fb = 0;
+
+ drawable->other->backend->pop_current (drawable->other);
+ }
+}
+
+static glitz_bool_t
+_glitz_fbo_push_current (void *abstract_drawable,
+ glitz_surface_t *surface,
+ glitz_constraint_t constraint)
+{
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+
+ drawable->other->backend->push_current (drawable->other, surface,
+ constraint);
+
+ if (constraint == GLITZ_DRAWABLE_CURRENT)
+ {
+ if (_glitz_fbo_bind (drawable))
+ {
+ drawable->base.update_all = drawable->other->update_all = 1;
+ surface->fb = drawable->fb;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static glitz_surface_t *
+_glitz_fbo_pop_current (void *abstract_drawable)
+{
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+
+ GLITZ_GL_DRAWABLE (drawable->other);
+
gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, 0);
+
+ return drawable->other->backend->pop_current (drawable->other);
}
-glitz_bool_t
-glitz_framebuffer_complete (glitz_gl_proc_address_list_t *gl,
- glitz_framebuffer_t *framebuffer,
- glitz_texture_t *texture)
-{
- if (!framebuffer->name)
+static void
+_glitz_fbo_make_current (void *abstract_drawable,
+ void *abstract_context)
+{
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+
+ drawable->other->backend->make_current (drawable->other, abstract_context);
+
+ _glitz_fbo_bind (drawable);
+}
+
+static glitz_bool_t
+_glitz_fbo_swap_buffers (void *abstract_drawable)
+{
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+
+ if (!drawable->fb)
+ return 1;
+
+ return 0;
+}
+
+static void
+_glitz_fbo_destroy (void *abstract_drawable)
+{
+ glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
+ abstract_drawable;
+
+ if (drawable->fb)
{
- if (!TEXTURE_ALLOCATED (texture))
- glitz_texture_allocate (gl, texture);
-
- gl->gen_framebuffers (1, &framebuffer->name);
+ GLITZ_GL_DRAWABLE (drawable->other);
- gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, framebuffer->name);
-
- gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT0,
- GLITZ_GL_TEXTURE_2D, texture->name,
- 0);
+ drawable->other->backend->push_current (drawable->other, NULL,
+ GLITZ_ANY_CONTEXT_CURRENT);
+
+ gl->delete_framebuffers (1, &drawable->fb);
+
+ if (drawable->front)
+ gl->delete_renderbuffers (1, &drawable->front);
+
+ if (drawable->back)
+ gl->delete_renderbuffers (1, &drawable->back);
+
+ if (drawable->depth)
+ gl->delete_renderbuffers (1, &drawable->depth);
+
+ if (drawable->stencil)
+ gl->delete_renderbuffers (1, &drawable->stencil);
+
+ drawable->other->backend->pop_current (drawable->other);
}
+
+ glitz_drawable_destroy (drawable->other);
+
+ free (drawable);
+}
+
+glitz_drawable_t *
+_glitz_fbo_drawable_create (glitz_drawable_t *other,
+ glitz_int_drawable_format_t *format,
+ int width,
+ int height)
+{
+ glitz_fbo_drawable_t *drawable;
+ glitz_backend_t *backend;
+
+ drawable = malloc (sizeof (glitz_fbo_drawable_t) +
+ sizeof (glitz_backend_t));
+ if (!drawable)
+ return NULL;
+
+ glitz_drawable_reference (other);
+ drawable->other = other;
+ backend = (glitz_backend_t *) (drawable + 1);
+ *backend = *other->backend;
+
+ backend->destroy = _glitz_fbo_destroy;
+ backend->push_current = _glitz_fbo_push_current;
+ backend->pop_current = _glitz_fbo_pop_current;
+ backend->attach_notify = _glitz_fbo_attach_notify;
+ backend->detach_notify = _glitz_fbo_detach_notify;
+ backend->swap_buffers = _glitz_fbo_swap_buffers;
+ backend->make_current = _glitz_fbo_make_current;
+
+ drawable->fb = 0;
+
+ drawable->width = 0;
+ drawable->height = 0;
+
+ drawable->front = 0;
+ drawable->back = 0;
+ drawable->depth = 0;
+ drawable->stencil = 0;
+
+ drawable->front_texture = 0;
+ drawable->back_texture = 0;
+
+ /* XXX: temporary solution until we have proper format validation */
+ if (format->d.color.alpha_size)
+ drawable->internal_format = GLITZ_GL_RGBA;
else
- gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, framebuffer->name);
+ drawable->internal_format = GLITZ_GL_RGB;
- return (gl->check_framebuffer_status (GLITZ_GL_FRAMEBUFFER) ==
- GLITZ_GL_FRAMEBUFFER_COMPLETE);
+ _glitz_drawable_init (&drawable->base, format, backend, width, height);
+
+ return &drawable->base;
}
Index: glitz_geometry.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_geometry.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- glitz_geometry.c 4 Jul 2005 10:33:01 -0000 1.6
+++ glitz_geometry.c 14 Sep 2005 15:57:16 -0000 1.7
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...1052 lines suppressed...]
+ int damage)
{
switch (type) {
case GLITZ_GEOMETRY_TYPE_VERTEX:
- _glitz_draw_vertex_arrays (gl, dst, bounds, damage);
- break;
+ _glitz_draw_vertex_arrays (gl, dst, bounds, damage);
+ break;
case GLITZ_GEOMETRY_TYPE_BITMAP:
- _glitz_draw_bitmap_arrays (gl, dst, bounds, damage);
- break;
+ _glitz_draw_bitmap_arrays (gl, dst, bounds, damage);
+ break;
case GLITZ_GEOMETRY_TYPE_NONE:
- _glitz_draw_rectangle (gl, dst, bounds, damage);
- break;
+ _glitz_draw_rectangle (gl, dst, bounds, damage);
+ break;
}
}
Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- glitz_gl.h 10 Feb 2005 01:03:00 -0000 1.15
+++ glitz_gl.h 14 Sep 2005 15:57:16 -0000 1.16
@@ -106,8 +106,9 @@
#define GLITZ_GL_MAX_TEXTURE_SIZE 0x0D33
#define GLITZ_GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GLITZ_GL_TEXTURE_WIDTH 0x1000
-#define GLITZ_GL_TEXTURE_HEIGHT 0x1001
+#define GLITZ_GL_TEXTURE_WIDTH 0x1000
+#define GLITZ_GL_TEXTURE_HEIGHT 0x1001
+#define GLITZ_GL_TEXTURE_BORDER_COLOR 0x1004
#define GLITZ_GL_TEXTURE_ENV 0x2300
#define GLITZ_GL_TEXTURE_ENV_MODE 0x2200
@@ -129,6 +130,7 @@
#define GLITZ_GL_MODULATE 0x2100
#define GLITZ_GL_NEAREST 0x2600
#define GLITZ_GL_LINEAR 0x2601
+#define GLITZ_GL_CLAMP 0x2900
#define GLITZ_GL_REPEAT 0x2901
#define GLITZ_GL_CLAMP_TO_EDGE 0x812F
#define GLITZ_GL_CLAMP_TO_BORDER 0x812D
@@ -182,6 +184,9 @@
#define GLITZ_GL_TRANSFORM_BIT 0x00001000
#define GLITZ_GL_COLOR_BUFFER_BIT 0x00004000
+#define GLITZ_GL_STENCIL_INDEX 0x1901
+#define GLITZ_GL_DEPTH_COMPONENT 0x1902
+
#define GLITZ_GL_ALPHA 0x1906
#define GLITZ_GL_RGB 0x1907
#define GLITZ_GL_LUMINANCE 0x1909
@@ -303,8 +308,14 @@
#define GLITZ_GL_WRITE_ONLY 0x88B9
#define GLITZ_GL_READ_WRITE 0x88BA
-#define GLITZ_GL_FRAMEBUFFER 0x8D40
-#define GLITZ_GL_COLOR_ATTACHMENT0 0x8CE0
+#define GLITZ_GL_FRAMEBUFFER 0x8D40
+#define GLITZ_GL_RENDERBUFFER 0x8D41
+
+#define GLITZ_GL_COLOR_ATTACHMENT0 0x8CE0
+#define GLITZ_GL_COLOR_ATTACHMENT1 0x8CE1
+#define GLITZ_GL_DEPTH_ATTACHMENT 0x8D00
+#define GLITZ_GL_STENCIL_ATTACHMENT 0x8D20
+
#define GLITZ_GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
@@ -316,6 +327,13 @@
#define GLITZ_GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
#define GLITZ_GL_FRAMEBUFFER_STATUS_ERROR 0x8CDE
+#define GLITZ_GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GLITZ_GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GLITZ_GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GLITZ_GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GLITZ_GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GLITZ_GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
typedef glitz_gl_void_t (* glitz_gl_enable_t)
(glitz_gl_enum_t cap);
typedef glitz_gl_void_t (* glitz_gl_disable_t)
@@ -464,6 +482,9 @@
const glitz_gl_void_t *pixels);
typedef glitz_gl_void_t (* glitz_gl_tex_parameter_i_t)
(glitz_gl_enum_t target, glitz_gl_enum_t pname, glitz_gl_int_t param);
+typedef glitz_gl_void_t (* glitz_gl_tex_parameter_fv_t)
+ (glitz_gl_enum_t target, glitz_gl_enum_t pname,
+ const glitz_gl_float_t *parama);
typedef glitz_gl_void_t (* glitz_gl_get_tex_level_parameter_iv_t)
(glitz_gl_enum_t target, glitz_gl_int_t level,
glitz_gl_enum_t pname, glitz_gl_int_t *param);
@@ -518,10 +539,23 @@
(glitz_gl_sizei_t, const glitz_gl_uint_t *);
typedef glitz_gl_void_t (* glitz_gl_bind_framebuffer_t)
(glitz_gl_enum_t, glitz_gl_uint_t);
-typedef glitz_gl_enum_t (* glitz_gl_check_framebuffer_status_t)
- (glitz_gl_enum_t);
+typedef void (* glitz_gl_framebuffer_renderbuffer_t)
+ (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_enum_t,
+ glitz_gl_uint_t);
typedef void (* glitz_gl_framebuffer_texture_2d_t)
(glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_enum_t,
glitz_gl_uint_t, glitz_gl_int_t);
+typedef glitz_gl_enum_t (* glitz_gl_check_framebuffer_status_t)
+ (glitz_gl_enum_t);
+typedef void (* glitz_gl_gen_renderbuffers_t)
+ (glitz_gl_sizei_t, glitz_gl_uint_t *);
+typedef void (* glitz_gl_delete_renderbuffers_t)
+ (glitz_gl_sizei_t, const glitz_gl_uint_t *);
+typedef glitz_gl_void_t (* glitz_gl_bind_renderbuffer_t)
+ (glitz_gl_enum_t, glitz_gl_uint_t);
+typedef glitz_gl_void_t (* glitz_gl_renderbuffer_storage_t)
+ (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_sizei_t, glitz_gl_sizei_t);
+typedef glitz_gl_void_t (* glitz_gl_get_renderbuffer_parameter_iv_t)
+ (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_int_t *);
#endif /* GLITZ_GL_H_INCLUDED */
Index: glitz_operator.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_operator.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- glitz_operator.c 25 Jan 2005 19:50:26 -0000 1.7
+++ glitz_operator.c 14 Sep 2005 15:57:16 -0000 1.8
@@ -32,59 +32,61 @@
#include "glitzint.h"
void
-glitz_set_operator (glitz_gl_proc_address_list_t *gl, glitz_operator_t op) {
- switch (op) {
- case GLITZ_OPERATOR_CLEAR:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_ZERO);
- break;
- case GLITZ_OPERATOR_SRC:
- gl->disable (GLITZ_GL_BLEND);
- break;
- case GLITZ_OPERATOR_DST:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_ONE);
- break;
- case GLITZ_OPERATOR_OVER:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ONE, GLITZ_GL_ONE_MINUS_SRC_ALPHA);
- break;
- case GLITZ_OPERATOR_OVER_REVERSE:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA, GLITZ_GL_ONE);
- break;
- case GLITZ_OPERATOR_IN:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_DST_ALPHA, GLITZ_GL_ZERO);
- break;
- case GLITZ_OPERATOR_IN_REVERSE:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_SRC_ALPHA);
- break;
- case GLITZ_OPERATOR_OUT:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA, GLITZ_GL_ZERO);
- break;
- case GLITZ_OPERATOR_OUT_REVERSE:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_ONE_MINUS_SRC_ALPHA);
- break;
- case GLITZ_OPERATOR_ATOP:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_DST_ALPHA, GLITZ_GL_ONE_MINUS_SRC_ALPHA);
- break;
- case GLITZ_OPERATOR_ATOP_REVERSE:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA, GLITZ_GL_SRC_ALPHA);
- break;
- case GLITZ_OPERATOR_XOR:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA,
- GLITZ_GL_ONE_MINUS_SRC_ALPHA);
- break;
- case GLITZ_OPERATOR_ADD:
- gl->enable (GLITZ_GL_BLEND);
- gl->blend_func (GLITZ_GL_ONE, GLITZ_GL_ONE);
- break;
- }
+glitz_set_operator (glitz_gl_proc_address_list_t *gl,
+ glitz_operator_t op)
+{
+ switch (op) {
+ case GLITZ_OPERATOR_CLEAR:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_ZERO);
+ break;
+ case GLITZ_OPERATOR_SRC:
+ gl->disable (GLITZ_GL_BLEND);
+ break;
+ case GLITZ_OPERATOR_DST:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_ONE);
+ break;
+ case GLITZ_OPERATOR_OVER:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ONE, GLITZ_GL_ONE_MINUS_SRC_ALPHA);
+ break;
+ case GLITZ_OPERATOR_OVER_REVERSE:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA, GLITZ_GL_ONE);
+ break;
+ case GLITZ_OPERATOR_IN:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_DST_ALPHA, GLITZ_GL_ZERO);
+ break;
+ case GLITZ_OPERATOR_IN_REVERSE:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_SRC_ALPHA);
+ break;
+ case GLITZ_OPERATOR_OUT:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA, GLITZ_GL_ZERO);
+ break;
+ case GLITZ_OPERATOR_OUT_REVERSE:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ZERO, GLITZ_GL_ONE_MINUS_SRC_ALPHA);
+ break;
+ case GLITZ_OPERATOR_ATOP:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_DST_ALPHA, GLITZ_GL_ONE_MINUS_SRC_ALPHA);
+ break;
+ case GLITZ_OPERATOR_ATOP_REVERSE:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA, GLITZ_GL_SRC_ALPHA);
+ break;
+ case GLITZ_OPERATOR_XOR:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ONE_MINUS_DST_ALPHA,
+ GLITZ_GL_ONE_MINUS_SRC_ALPHA);
+ break;
+ case GLITZ_OPERATOR_ADD:
+ gl->enable (GLITZ_GL_BLEND);
+ gl->blend_func (GLITZ_GL_ONE, GLITZ_GL_ONE);
+ break;
+ }
}
Index: glitz_pixel.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_pixel.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- glitz_pixel.c 4 Jul 2005 10:33:01 -0000 1.20
+++ glitz_pixel.c 14 Sep 2005 15:57:16 -0000 1.21
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...2009 lines suppressed...]
+ _glitz_pixel_transform (transform,
+ &src_image,
+ &dst_image,
+ box.x1 - x_src, box.y1 - y_src,
+ format->xoffset + box.x1 - x_src,
+ format->skip_lines + box.y1 - y_src,
+ box.x2 - box.x1, box.y2 - box.y1);
+ }
+ clip++;
+ }
+
+ glitz_buffer_unmap (buffer);
+ } else
+ glitz_buffer_unbind (buffer);
+
+ glitz_surface_pop_current (src);
+
+ if (data)
+ free (data);
}
Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- glitz_program.c 25 Jan 2005 19:50:26 -0000 1.17
+++ glitz_program.c 14 Sep 2005 15:57:16 -0000 1.18
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...984 lines suppressed...]
- if (program->name[id - 1] > 0)
- return program->name[id - 1];
- else
- return 0;
+ if (program->name[id - 1] == 0) {
+ glitz_surface_push_current (op->dst, GLITZ_CONTEXT_CURRENT);
+
+ program->name[id - 1] =
+ _glitz_create_fragment_program (op, fp_type, id,
+ _program_expand_map[t0][t1]);
+
+ glitz_surface_pop_current (op->dst);
+ }
+
+ if (program->name[id - 1] > 0)
+ return program->name[id - 1];
+ else
+ return 0;
}
Index: glitz_rect.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_rect.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- glitz_rect.c 4 Jul 2005 10:33:01 -0000 1.17
+++ glitz_rect.c 14 Sep 2005 15:57:16 -0000 1.18
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -29,260 +29,259 @@
#include "glitzint.h"
-#define STORE_16(dst, size, src) \
- dst = ((size) ? \
- ((((((1L << (size)) - 1L) * (src)) / 0xffff) * 0xffff) / \
- ((1L << (size)) - 1L)) : \
- dst)
+#define STORE_16(dst, size, src) \
+ dst = ((size) ? \
+ ((((((1L << (size)) - 1L) * (src)) / 0xffff) * 0xffff) / \
+ ((1L << (size)) - 1L)) : \
+ dst)
static glitz_buffer_t *
_glitz_minimum_buffer (glitz_surface_t *surface,
- const glitz_rectangle_t *rects,
- int n_rects,
- unsigned int *pixel)
+ const glitz_rectangle_t *rects,
+ int n_rects,
+ unsigned int *pixel)
{
glitz_buffer_t *buffer;
int i, size = 0;
unsigned int *data;
-
+
while (n_rects--)
{
- i = rects->width * rects->height;
- if (i > size)
- size = i;
-
- rects++;
+ i = rects->width * rects->height;
+ if (i > size)
+ size = i;
+
+ rects++;
}
if (size <= 1)
- return glitz_buffer_create_for_data (pixel);
-
+ return glitz_buffer_create_for_data (pixel);
+
buffer = glitz_pixel_buffer_create (surface->drawable, NULL,
- size * sizeof (unsigned int),
- GLITZ_BUFFER_HINT_STATIC_DRAW);
+ size * sizeof (unsigned int),
+ GLITZ_BUFFER_HINT_STATIC_DRAW);
if (!buffer)
- return NULL;
-
+ return NULL;
+
data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
+
while (size--)
- *data++ = *pixel;
+ *data++ = *pixel;
glitz_buffer_unmap (buffer);
-
+
return buffer;
}
void
glitz_set_rectangles (glitz_surface_t *dst,
- const glitz_color_t *color,
- const glitz_rectangle_t *rects,
- int n_rects)
+ const glitz_color_t *color,
+ const glitz_rectangle_t *rects,
+ int n_rects)
{
GLITZ_GL_SURFACE (dst);
if (n_rects < 1)
- return;
+ return;
if (SURFACE_SOLID (dst))
{
- glitz_color_t old = dst->solid;
- glitz_box_t *clip = dst->clip;
- int n_clip = dst->n_clip;
+ glitz_color_t old = dst->solid;
+ glitz_box_t *clip = dst->clip;
+ int n_clip = dst->n_clip;
- for (; n_clip; clip++, n_clip--)
- {
- if (clip->x1 > 0 ||
- clip->y1 > 0 ||
- clip->x2 < 1 ||
- clip->y2 < 1)
- continue;
-
- for (; n_rects; rects++, n_rects--)
- {
- if (rects->x > 0 ||
- rects->y > 0 ||
- (rects->x + rects->width) < 1 ||
- (rects->y + rects->height) < 1)
- continue;
-
- STORE_16 (dst->solid.red,
- dst->format->color.red_size,
- color->red);
- STORE_16 (dst->solid.green,
- dst->format->color.green_size,
- color->green);
- STORE_16 (dst->solid.blue,
- dst->format->color.blue_size,
- color->blue);
- STORE_16 (dst->solid.alpha,
- dst->format->color.alpha_size,
- color->alpha);
-
- if (dst->flags & GLITZ_SURFACE_FLAG_SOLID_DAMAGE_MASK)
- {
- dst->flags &= ~GLITZ_SURFACE_FLAG_SOLID_DAMAGE_MASK;
- glitz_surface_damage (dst, &dst->box,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_DRAWABLE_MASK);
- }
- else
- {
- if (dst->solid.red != old.red ||
- dst->solid.green != old.green ||
- dst->solid.blue != old.blue ||
- dst->solid.alpha != old.alpha)
- glitz_surface_damage (dst, &dst->box,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_DRAWABLE_MASK);
- }
- break;
- }
- break;
- }
+ for (; n_clip; clip++, n_clip--)
+ {
+ if (clip->x1 > 0 ||
+ clip->y1 > 0 ||
+ clip->x2 < 1 ||
+ clip->y2 < 1)
+ continue;
+
+ for (; n_rects; rects++, n_rects--)
+ {
+ if (rects->x > 0 ||
+ rects->y > 0 ||
+ (rects->x + rects->width) < 1 ||
+ (rects->y + rects->height) < 1)
+ continue;
+
+ STORE_16 (dst->solid.red,
+ dst->format->color.red_size,
+ color->red);
+ STORE_16 (dst->solid.green,
+ dst->format->color.green_size,
+ color->green);
+ STORE_16 (dst->solid.blue,
+ dst->format->color.blue_size,
+ color->blue);
+ STORE_16 (dst->solid.alpha,
+ dst->format->color.alpha_size,
+ color->alpha);
+
+ if (dst->flags & GLITZ_SURFACE_FLAG_SOLID_DAMAGE_MASK)
+ {
+ dst->flags &= ~GLITZ_SURFACE_FLAG_SOLID_DAMAGE_MASK;
+ glitz_surface_damage (dst, &dst->box,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_DRAWABLE_MASK);
+ }
+ else
+ {
+ if (dst->solid.red != old.red ||
+ dst->solid.green != old.green ||
+ dst->solid.blue != old.blue ||
+ dst->solid.alpha != old.alpha)
+ glitz_surface_damage (dst, &dst->box,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_DRAWABLE_MASK);
+ }
+ break;
+ }
+ break;
+ }
}
else
{
- static glitz_pixel_format_t pf = {
- {
- 32,
- 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff
- },
- 0, 0, 0,
- GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
- };
- glitz_buffer_t *buffer = NULL;
- glitz_box_t box;
- glitz_bool_t drawable = 0;
+ static glitz_pixel_format_t pf = {
+ {
+ 32,
+ 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff
+ },
+ 0, 0, 0,
+ GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
+ };
+ glitz_buffer_t *buffer = NULL;
+ glitz_box_t box;
+ glitz_bool_t drawable = 0;
- if (n_rects == 1 && rects->width <= 1 && rects->height <= 1)
- {
- glitz_surface_push_current (dst, GLITZ_ANY_CONTEXT_CURRENT);
- }
- else
- {
- drawable = glitz_surface_push_current (dst,
- GLITZ_DRAWABLE_CURRENT);
- }
+ if (n_rects == 1 && rects->width <= 1 && rects->height <= 1)
+ {
+ glitz_surface_push_current (dst, GLITZ_ANY_CONTEXT_CURRENT);
+ }
+ else
+ {
+ drawable = glitz_surface_push_current (dst,
+ GLITZ_DRAWABLE_CURRENT);
+ }
- if (drawable)
- {
- glitz_box_t *clip;
- int n_clip;
- int target_height = SURFACE_DRAWABLE_HEIGHT (dst);
-
- gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
- color->green / (glitz_gl_clampf_t) 0xffff,
- color->blue / (glitz_gl_clampf_t) 0xffff,
- color->alpha / (glitz_gl_clampf_t) 0xffff);
+ if (drawable)
+ {
+ glitz_box_t *clip;
+ int n_clip;
- while (n_rects--)
- {
- clip = dst->clip;
- n_clip = dst->n_clip;
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
-
- if (dst->box.x1 > box.x1)
- box.x1 = dst->box.x1;
- if (dst->box.y1 > box.y1)
- box.y1 = dst->box.y1;
- if (dst->box.x2 < box.x2)
- box.x2 = dst->box.x2;
- if (dst->box.y2 < box.y2)
- box.y2 = dst->box.y2;
-
- if (rects->x > box.x1)
- box.x1 = rects->x;
- if (rects->y > box.y1)
- box.y1 = rects->y;
- if (rects->x + rects->width < box.x2)
- box.x2 = rects->x + rects->width;
- if (rects->y + rects->height < box.y2)
- box.y2 = rects->y + rects->height;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- gl->scissor (box.x1,
- target_height - dst->y - box.y2,
- box.x2 - box.x1,
- box.y2 - box.y1);
-
- gl->clear (GLITZ_GL_COLOR_BUFFER_BIT);
-
- glitz_surface_damage (dst, &box,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- clip++;
- }
- rects++;
- }
- }
- else
- {
- unsigned int pixel =
- ((((unsigned int) color->alpha * 0xff) / 0xffff) << 24) |
- ((((unsigned int) color->red * 0xff) / 0xffff) << 16) |
- ((((unsigned int) color->green * 0xff) / 0xffff) << 8) |
- ((((unsigned int) color->blue * 0xff) / 0xffff));
- int x1, y1, x2, y2;
+ gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
+ color->green / (glitz_gl_clampf_t) 0xffff,
+ color->blue / (glitz_gl_clampf_t) 0xffff,
+ color->alpha / (glitz_gl_clampf_t) 0xffff);
- buffer = _glitz_minimum_buffer (dst, rects, n_rects, &pixel);
- if (!buffer)
- {
- glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
- return;
- }
+ while (n_rects--)
+ {
+ clip = dst->clip;
+ n_clip = dst->n_clip;
+ while (n_clip--)
+ {
+ box.x1 = clip->x1 + dst->x_clip;
+ box.y1 = clip->y1 + dst->y_clip;
+ box.x2 = clip->x2 + dst->x_clip;
+ box.y2 = clip->y2 + dst->y_clip;
- while (n_rects--)
- {
- x1 = rects->x;
- y1 = rects->y;
- x2 = x1 + rects->width;
- y2 = y1 + rects->height;
-
- if (x1 < 0)
- x1 = 0;
- if (y1 < 0)
- y1 = 0;
- if (x2 > dst->box.x2)
- x2 = dst->box.x2;
- if (y2 > dst->box.y2)
- y2 = dst->box.y2;
+ if (dst->box.x1 > box.x1)
+ box.x1 = dst->box.x1;
+ if (dst->box.y1 > box.y1)
+ box.y1 = dst->box.y1;
+ if (dst->box.x2 < box.x2)
+ box.x2 = dst->box.x2;
+ if (dst->box.y2 < box.y2)
+ box.y2 = dst->box.y2;
- if (x1 < x2 && y1 < y2)
- glitz_set_pixels (dst,
- x1, y1,
- x2 - x1, y2 - y1,
- &pf, buffer);
+ if (rects->x > box.x1)
+ box.x1 = rects->x;
+ if (rects->y > box.y1)
+ box.y1 = rects->y;
+ if (rects->x + rects->width < box.x2)
+ box.x2 = rects->x + rects->width;
+ if (rects->y + rects->height < box.y2)
+ box.y2 = rects->y + rects->height;
- rects++;
- }
-
- if (buffer)
- glitz_buffer_destroy (buffer);
- }
- glitz_surface_pop_current (dst);
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ gl->scissor (box.x1,
+ dst->attached->height - dst->y - box.y2,
+ box.x2 - box.x1,
+ box.y2 - box.y1);
+
+ gl->clear (GLITZ_GL_COLOR_BUFFER_BIT);
+
+ glitz_surface_damage (dst, &box,
+ GLITZ_DAMAGE_TEXTURE_MASK |
+ GLITZ_DAMAGE_SOLID_MASK);
+ }
+
+ clip++;
+ }
+ rects++;
+ }
+ }
+ else
+ {
+ unsigned int pixel =
+ ((((unsigned int) color->alpha * 0xff) / 0xffff) << 24) |
+ ((((unsigned int) color->red * 0xff) / 0xffff) << 16) |
+ ((((unsigned int) color->green * 0xff) / 0xffff) << 8) |
+ ((((unsigned int) color->blue * 0xff) / 0xffff));
+ int x1, y1, x2, y2;
+
+ buffer = _glitz_minimum_buffer (dst, rects, n_rects, &pixel);
+ if (!buffer)
+ {
+ glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
+ return;
+ }
+
+ while (n_rects--)
+ {
+ x1 = rects->x;
+ y1 = rects->y;
+ x2 = x1 + rects->width;
+ y2 = y1 + rects->height;
+
+ if (x1 < 0)
+ x1 = 0;
+ if (y1 < 0)
+ y1 = 0;
+ if (x2 > dst->box.x2)
+ x2 = dst->box.x2;
+ if (y2 > dst->box.y2)
+ y2 = dst->box.y2;
+
+ if (x1 < x2 && y1 < y2)
+ glitz_set_pixels (dst,
+ x1, y1,
+ x2 - x1, y2 - y1,
+ &pf, buffer);
+
+ rects++;
+ }
+
+ if (buffer)
+ glitz_buffer_destroy (buffer);
+ }
+ glitz_surface_pop_current (dst);
}
}
slim_hidden_def(glitz_set_rectangles);
void
glitz_set_rectangle (glitz_surface_t *dst,
- const glitz_color_t *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height)
+ const glitz_color_t *color,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
{
glitz_rectangle_t rect;
Index: glitz_region.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_region.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_region.c 25 Jan 2005 19:50:26 -0000 1.2
+++ glitz_region.c 14 Sep 2005 15:57:16 -0000 1.3
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -31,41 +31,41 @@
#define REGION_ALLOC_CHUNK 16
-#define BOX_SUBSUMS_BOX(b1, b2) \
- ((b2)->x1 >= (b1)->x1 && \
- (b2)->x2 <= (b1)->x2 && \
- (b2)->y1 >= (b1)->y1 && \
- (b2)->y2 <= (b1)->y2)
+#define BOX_SUBSUMS_BOX(b1, b2) \
+ ((b2)->x1 >= (b1)->x1 && \
+ (b2)->x2 <= (b1)->x2 && \
+ (b2)->y1 >= (b1)->y1 && \
+ (b2)->y2 <= (b1)->y2)
-#define BOX_INTERSECTS_BOX(b1, b2) \
- ((b1)->x1 < (b2)->x2 && \
- (b1)->x2 > (b2)->x1 && \
- (b1)->y1 < (b2)->y2 && \
- (b1)->y2 > (b2)->y1)
+#define BOX_INTERSECTS_BOX(b1, b2) \
+ ((b1)->x1 < (b2)->x2 && \
+ (b1)->x2 > (b2)->x1 && \
+ (b1)->y1 < (b2)->y2 && \
+ (b1)->y2 > (b2)->y1)
-#define BOX_CLOSE_TO_BOX(b1, b2) \
- ((b1)->x1 < ((b2)->x2 + 1) && \
- (b1)->x2 > ((b2)->x1 - 1) && \
- (b1)->y1 < ((b2)->y2 + 1) && \
- (b1)->y2 > ((b2)->y1 - 1))
+#define BOX_CLOSE_TO_BOX(b1, b2) \
+ ((b1)->x1 < ((b2)->x2 + 1) && \
+ (b1)->x2 > ((b2)->x1 - 1) && \
+ (b1)->y1 < ((b2)->y2 + 1) && \
+ (b1)->y2 > ((b2)->y1 - 1))
-#define BOX_NEXT_TO_BOX(b1, b2) \
- ((((b1)->x1 == (b2)->x2 || \
- (b1)->x2 == (b2)->x1) && \
- (b1)->y1 == (b2)->y1 && \
- (b1)->y2 == (b2)->y2) || \
- (((b1)->y1 == (b2)->y2 || \
- (b1)->y2 == (b2)->y1) && \
- (b1)->x1 == (b2)->x1 && \
- (b1)->x2 == (b2)->x2))
+#define BOX_NEXT_TO_BOX(b1, b2) \
+ ((((b1)->x1 == (b2)->x2 || \
+ (b1)->x2 == (b2)->x1) && \
+ (b1)->y1 == (b2)->y1 && \
+ (b1)->y2 == (b2)->y2) || \
+ (((b1)->y1 == (b2)->y2 || \
+ (b1)->y2 == (b2)->y1) && \
+ (b1)->x1 == (b2)->x1 && \
+ (b1)->x2 == (b2)->x2))
-#define MERGE_BOXES(d, b1, b2) \
- { \
- (d)->x1 = MIN ((b1)->x1, (b2)->x1); \
- (d)->y1 = MIN ((b1)->y1, (b2)->y1); \
- (d)->x2 = MAX ((b1)->x2, (b2)->x2); \
- (d)->y2 = MAX ((b1)->y2, (b2)->y2); \
- }
+#define MERGE_BOXES(d, b1, b2) \
+ { \
+ (d)->x1 = MIN ((b1)->x1, (b2)->x1); \
+ (d)->y1 = MIN ((b1)->y1, (b2)->y1); \
+ (d)->x2 = MAX ((b1)->x2, (b2)->x2); \
+ (d)->y2 = MAX ((b1)->y2, (b2)->y2); \
+ }
/*
* No real union, boxes that intersect are just joined into bigger boxes.
@@ -74,93 +74,94 @@
*/
glitz_status_t
glitz_region_union (glitz_region_t *region,
- glitz_box_t *ubox)
-{
- if (region->n_box == 0) {
- region->extents = *ubox;
- region->box = ®ion->extents;
- region->n_box = 1;
+ glitz_box_t *ubox)
+{
+ if (region->n_box == 0) {
+ region->extents = *ubox;
+ region->box = ®ion->extents;
+ region->n_box = 1;
- return GLITZ_STATUS_SUCCESS;
- }
+ return GLITZ_STATUS_SUCCESS;
+ }
- if (BOX_CLOSE_TO_BOX (ubox, ®ion->extents)) {
- glitz_box_t *box, *new_box, *dst_box;
- int n_box;
+ if (BOX_CLOSE_TO_BOX (ubox, ®ion->extents)) {
+ glitz_box_t *box, *new_box, *dst_box;
+ int n_box;
- box = region->box;
- n_box = region->n_box;
+ box = region->box;
+ n_box = region->n_box;
- while (n_box--) {
- if (BOX_SUBSUMS_BOX (box, ubox))
- return GLITZ_STATUS_SUCCESS;
-
- box++;
- }
-
- box = region->box;
- n_box = region->n_box;
+ while (n_box--) {
+ if (BOX_SUBSUMS_BOX (box, ubox))
+ return GLITZ_STATUS_SUCCESS;
- new_box = ubox;
- dst_box = NULL;
- while (n_box--) {
+ box++;
+ }
- if (BOX_INTERSECTS_BOX (box, new_box) ||
- BOX_NEXT_TO_BOX (box, new_box)) {
-
- if (dst_box) {
- /*
- * Remove box from region
- */
- region->n_box--;
- if (region->n_box == 1) {
- MERGE_BOXES (®ion->extents, box, new_box);
- region->box = ®ion->extents;
-
- return GLITZ_STATUS_SUCCESS;
- } else {
- MERGE_BOXES (dst_box, box, new_box);
- if (n_box)
- memmove (box, box + 1, n_box * sizeof (glitz_box_t));
- }
- continue;
- } else {
- dst_box = box;
- MERGE_BOXES (dst_box, box, new_box);
- new_box = dst_box;
- }
- }
- box++;
+ box = region->box;
+ n_box = region->n_box;
+
+ new_box = ubox;
+ dst_box = NULL;
+ while (n_box--) {
+
+ if (BOX_INTERSECTS_BOX (box, new_box) ||
+ BOX_NEXT_TO_BOX (box, new_box)) {
+
+ if (dst_box) {
+ /*
+ * Remove box from region
+ */
+ region->n_box--;
+ if (region->n_box == 1) {
+ MERGE_BOXES (®ion->extents, box, new_box);
+ region->box = ®ion->extents;
+
+ return GLITZ_STATUS_SUCCESS;
+ } else {
+ MERGE_BOXES (dst_box, box, new_box);
+ if (n_box)
+ memmove (box, box + 1,
+ n_box * sizeof (glitz_box_t));
+ }
+ continue;
+ } else {
+ dst_box = box;
+ MERGE_BOXES (dst_box, box, new_box);
+ new_box = dst_box;
+ }
+ }
+ box++;
+ }
+
+ if (dst_box) {
+ if (region->n_box > 1)
+ MERGE_BOXES (®ion->extents, ®ion->extents, ubox);
+
+ return GLITZ_STATUS_SUCCESS;
+ }
}
-
- if (dst_box) {
- if (region->n_box > 1)
- MERGE_BOXES (®ion->extents, ®ion->extents, ubox);
-
- return GLITZ_STATUS_SUCCESS;
+
+ /*
+ * Add box to region
+ */
+ if (region->size < (region->n_box + 1)) {
+ region->size += REGION_ALLOC_CHUNK;
+ region->data = (void *) realloc (region->data,
+ sizeof (glitz_box_t) * region->size);
+ if (!region->data)
+ return GLITZ_STATUS_NO_MEMORY;
}
- }
- /*
- * Add box to region
- */
- if (region->size < (region->n_box + 1)) {
- region->size += REGION_ALLOC_CHUNK;
- region->data = (void *) realloc (region->data,
- sizeof (glitz_box_t) * region->size);
- if (!region->data)
- return GLITZ_STATUS_NO_MEMORY;
- }
+ region->box = (glitz_box_t *) region->data;
- region->box = (glitz_box_t *) region->data;
-
- region->box[region->n_box] = *ubox;
- if (region->n_box == 1)
- region->box[0] = region->extents;
+ region->box[region->n_box] = *ubox;
+ if (region->n_box == 1)
+ region->box[0] = region->extents;
- region->n_box++;
+ region->n_box++;
- MERGE_BOXES (®ion->extents, ®ion->extents, ubox);
-
- return GLITZ_STATUS_SUCCESS;
+ MERGE_BOXES (®ion->extents, ®ion->extents, ubox);
+
+ return GLITZ_STATUS_SUCCESS;
}
Index: glitz_status.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_status.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- glitz_status.c 25 Jan 2005 19:50:26 -0000 1.4
+++ glitz_status.c 14 Sep 2005 15:57:16 -0000 1.5
@@ -34,57 +34,57 @@
unsigned long
glitz_status_to_status_mask (glitz_status_t status)
{
- switch (status) {
- case GLITZ_STATUS_NO_MEMORY:
- return GLITZ_STATUS_NO_MEMORY_MASK;
- case GLITZ_STATUS_BAD_COORDINATE:
- return GLITZ_STATUS_BAD_COORDINATE_MASK;
- case GLITZ_STATUS_NOT_SUPPORTED:
- return GLITZ_STATUS_NOT_SUPPORTED_MASK;
- case GLITZ_STATUS_CONTENT_DESTROYED:
- return GLITZ_STATUS_CONTENT_DESTROYED_MASK;
- case GLITZ_STATUS_SUCCESS:
- break;
- }
-
- return 0;
+ switch (status) {
+ case GLITZ_STATUS_NO_MEMORY:
+ return GLITZ_STATUS_NO_MEMORY_MASK;
+ case GLITZ_STATUS_BAD_COORDINATE:
+ return GLITZ_STATUS_BAD_COORDINATE_MASK;
+ case GLITZ_STATUS_NOT_SUPPORTED:
+ return GLITZ_STATUS_NOT_SUPPORTED_MASK;
+ case GLITZ_STATUS_CONTENT_DESTROYED:
+ return GLITZ_STATUS_CONTENT_DESTROYED_MASK;
+ case GLITZ_STATUS_SUCCESS:
+ break;
+ }
+
+ return 0;
}
glitz_status_t
glitz_status_pop_from_mask (unsigned long *mask)
{
- if (*mask & GLITZ_STATUS_NO_MEMORY_MASK) {
- *mask &= ~GLITZ_STATUS_NO_MEMORY_MASK;
- return GLITZ_STATUS_NO_MEMORY;
- } else if (*mask & GLITZ_STATUS_BAD_COORDINATE_MASK) {
- *mask &= ~GLITZ_STATUS_BAD_COORDINATE_MASK;
- return GLITZ_STATUS_BAD_COORDINATE;
- } else if (*mask & GLITZ_STATUS_NOT_SUPPORTED_MASK) {
- *mask &= ~GLITZ_STATUS_NOT_SUPPORTED_MASK;
- return GLITZ_STATUS_NOT_SUPPORTED;
- } else if (*mask & GLITZ_STATUS_CONTENT_DESTROYED_MASK) {
- *mask &= ~GLITZ_STATUS_CONTENT_DESTROYED_MASK;
- return GLITZ_STATUS_CONTENT_DESTROYED;
- }
-
- return GLITZ_STATUS_SUCCESS;
+ if (*mask & GLITZ_STATUS_NO_MEMORY_MASK) {
+ *mask &= ~GLITZ_STATUS_NO_MEMORY_MASK;
+ return GLITZ_STATUS_NO_MEMORY;
+ } else if (*mask & GLITZ_STATUS_BAD_COORDINATE_MASK) {
+ *mask &= ~GLITZ_STATUS_BAD_COORDINATE_MASK;
+ return GLITZ_STATUS_BAD_COORDINATE;
+ } else if (*mask & GLITZ_STATUS_NOT_SUPPORTED_MASK) {
+ *mask &= ~GLITZ_STATUS_NOT_SUPPORTED_MASK;
+ return GLITZ_STATUS_NOT_SUPPORTED;
+ } else if (*mask & GLITZ_STATUS_CONTENT_DESTROYED_MASK) {
+ *mask &= ~GLITZ_STATUS_CONTENT_DESTROYED_MASK;
+ return GLITZ_STATUS_CONTENT_DESTROYED;
+ }
+
+ return GLITZ_STATUS_SUCCESS;
}
const char *
glitz_status_string (glitz_status_t status)
{
- switch (status) {
- case GLITZ_STATUS_SUCCESS:
- return "success";
- case GLITZ_STATUS_NO_MEMORY:
- return "out of memory";
- case GLITZ_STATUS_BAD_COORDINATE:
- return "bad coordinate";
- case GLITZ_STATUS_NOT_SUPPORTED:
- return "not supported";
- case GLITZ_STATUS_CONTENT_DESTROYED:
- return "content destroyed";
- }
+ switch (status) {
+ case GLITZ_STATUS_SUCCESS:
+ return "success";
+ case GLITZ_STATUS_NO_MEMORY:
+ return "out of memory";
+ case GLITZ_STATUS_BAD_COORDINATE:
+ return "bad coordinate";
+ case GLITZ_STATUS_NOT_SUPPORTED:
+ return "not supported";
+ case GLITZ_STATUS_CONTENT_DESTROYED:
+ return "content destroyed";
+ }
- return "<unknown error status>";
+ return "<unknown error status>";
}
Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- glitz_surface.c 4 Jul 2005 10:33:01 -0000 1.30
+++ glitz_surface.c 14 Sep 2005 15:57:16 -0000 1.31
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...1531 lines suppressed...]
- surface->clip = &surface->box;
- surface->n_clip = 1;
- surface->x_clip = surface->y_clip = 0;
+ surface->clip = &surface->box;
+ surface->n_clip = 1;
+ surface->x_clip = surface->y_clip = 0;
}
}
slim_hidden_def(glitz_surface_set_clip_region);
-
-glitz_bool_t
-glitz_surface_valid_target (glitz_surface_t *surface)
-{
- glitz_bool_t valid;
-
- valid = glitz_surface_push_current (surface, GLITZ_DRAWABLE_CURRENT);
- glitz_surface_pop_current (surface);
-
- return valid;
-}
Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- glitz_texture.c 4 Jul 2005 10:33:01 -0000 1.19
+++ glitz_texture.c 14 Sep 2005 15:57:16 -0000 1.20
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -31,317 +31,444 @@
void
glitz_texture_init (glitz_texture_t *texture,
- int width,
- int height,
- glitz_gl_int_t texture_format,
- unsigned long feature_mask,
- glitz_bool_t unnormalized)
+ int width,
+ int height,
+ glitz_gl_int_t texture_format,
+ unsigned long feature_mask,
+ glitz_bool_t unnormalized)
{
- texture->filter = 0;
- texture->wrap = 0;
+ texture->param.filter[0] = texture->param.filter[1] = GLITZ_GL_NEAREST;
+ texture->param.wrap[0] = texture->param.wrap[1] = GLITZ_GL_CLAMP;
+ texture->param.border_color.red = texture->param.border_color.green =
+ texture->param.border_color.blue =
+ texture->param.border_color.alpha = 0;
+
texture->format = texture_format;
texture->name = 0;
if (feature_mask & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)
{
- texture->box.x1 = texture->box.y1 = 0;
- texture->box.x2 = texture->width = width;
- texture->box.y2 = texture->height = height;
- texture->flags = GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
- GLITZ_TEXTURE_FLAG_PADABLE_MASK;
+ texture->box.x1 = texture->box.y1 = 0;
+ texture->box.x2 = texture->width = width;
+ texture->box.y2 = texture->height = height;
+ texture->flags = GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
+ GLITZ_TEXTURE_FLAG_PADABLE_MASK;
}
else
{
- texture->box.x1 = texture->box.y1 = 1;
- texture->box.x2 = width + 1;
- texture->box.y2 = height + 1;
- texture->width = width + 2;
- texture->height = height + 2;
- texture->flags = 0;
+ texture->box.x1 = texture->box.y1 = 1;
+ texture->box.x2 = width + 1;
+ texture->box.y2 = height + 1;
+ texture->width = width + 2;
+ texture->height = height + 2;
+ texture->flags = 0;
}
-
+
if (!unnormalized &&
- ((feature_mask & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
- (POWER_OF_TWO (texture->width) && POWER_OF_TWO (texture->height))))
+ ((feature_mask & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
+ (POWER_OF_TWO (texture->width) && POWER_OF_TWO (texture->height))))
{
- texture->target = GLITZ_GL_TEXTURE_2D;
+ texture->target = GLITZ_GL_TEXTURE_2D;
}
else
{
- texture->flags &= ~GLITZ_TEXTURE_FLAG_REPEATABLE_MASK;
-
- if (feature_mask & GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK)
- {
- texture->target = GLITZ_GL_TEXTURE_RECTANGLE;
- }
- else
- {
- texture->target = GLITZ_GL_TEXTURE_2D;
- texture->flags &= ~GLITZ_TEXTURE_FLAG_PADABLE_MASK;
-
- if (!POWER_OF_TWO (texture->width))
- texture->width = glitz_uint_to_power_of_two (texture->width);
-
- if (!POWER_OF_TWO (texture->height))
- texture->height = glitz_uint_to_power_of_two (texture->height);
- }
+ texture->flags &= ~GLITZ_TEXTURE_FLAG_REPEATABLE_MASK;
+
+ if (feature_mask & GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK)
+ {
+ texture->target = GLITZ_GL_TEXTURE_RECTANGLE;
+ }
+ else
+ {
+ texture->target = GLITZ_GL_TEXTURE_2D;
+ texture->flags &= ~GLITZ_TEXTURE_FLAG_PADABLE_MASK;
+
+ if (!POWER_OF_TWO (texture->width))
+ texture->width = glitz_uint_to_power_of_two (texture->width);
+
+ if (!POWER_OF_TWO (texture->height))
+ texture->height = glitz_uint_to_power_of_two (texture->height);
+ }
}
if (texture->target == GLITZ_GL_TEXTURE_2D)
{
- texture->texcoord_width_unit = 1.0f / texture->width;
- texture->texcoord_height_unit = 1.0f / texture->height;
+ texture->texcoord_width_unit = 1.0f / texture->width;
+ texture->texcoord_height_unit = 1.0f / texture->height;
}
else
{
- texture->texcoord_width_unit = 1.0f;
- texture->texcoord_height_unit = 1.0f;
+ texture->texcoord_width_unit = 1.0f;
+ texture->texcoord_height_unit = 1.0f;
}
}
void
glitz_texture_size_check (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_gl_int_t max_2d,
- glitz_gl_int_t max_rect) {
- glitz_gl_enum_t proxy_target;
- glitz_gl_int_t value, max;
+ glitz_texture_t *texture,
+ glitz_gl_int_t max_2d,
+ glitz_gl_int_t max_rect)
+{
+ glitz_gl_enum_t proxy_target;
+ glitz_gl_int_t value, max;
- if (texture->target == GLITZ_GL_TEXTURE_2D) {
- max = max_2d;
- proxy_target = GLITZ_GL_PROXY_TEXTURE_2D;
- } else {
- max = max_rect;
- proxy_target = GLITZ_GL_PROXY_TEXTURE_RECTANGLE;
- }
-
- if (texture->width > max || texture->height > max) {
- texture->flags |= GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK;
- return;
- }
-
- gl->tex_image_2d (proxy_target, 0,
- texture->format, texture->width, texture->height,
- 0, GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, NULL);
- gl->get_tex_level_parameter_iv (proxy_target, 0,
- GLITZ_GL_TEXTURE_WIDTH, &value);
- if (value != texture->width) {
- texture->flags |= GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK;
- return;
- }
-
- gl->get_tex_level_parameter_iv (proxy_target, 0,
- GLITZ_GL_TEXTURE_HEIGHT, &value);
- if (value != texture->height)
- texture->flags |= GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK;
+ if (texture->target == GLITZ_GL_TEXTURE_2D) {
+ max = max_2d;
+ proxy_target = GLITZ_GL_PROXY_TEXTURE_2D;
+ } else {
+ max = max_rect;
+ proxy_target = GLITZ_GL_PROXY_TEXTURE_RECTANGLE;
+ }
+
+ if (texture->width > max || texture->height > max) {
+ texture->flags |= GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK;
+ return;
+ }
+
+ gl->tex_image_2d (proxy_target, 0,
+ texture->format, texture->width, texture->height,
+ 0, GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, NULL);
+ gl->get_tex_level_parameter_iv (proxy_target, 0,
+ GLITZ_GL_TEXTURE_WIDTH, &value);
+ if (value != texture->width) {
+ texture->flags |= GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK;
+ return;
+ }
+
+ gl->get_tex_level_parameter_iv (proxy_target, 0,
+ GLITZ_GL_TEXTURE_HEIGHT, &value);
+ if (value != texture->height)
+ texture->flags |= GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK;
}
void
glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture)
+ glitz_texture_t *texture)
{
- char *data = NULL;
-
- if (!texture->name)
- gl->gen_textures (1, &texture->name);
-
- texture->flags |= GLITZ_TEXTURE_FLAG_ALLOCATED_MASK;
-
- glitz_texture_bind (gl, texture);
+ char *data = NULL;
- if (texture->box.x2 != texture->width ||
- texture->box.y2 != texture->height) {
- data = malloc (texture->width * texture->height);
- if (data)
- memset (data, 0, texture->width * texture->height);
+ if (!texture->name)
+ gl->gen_textures (1, &texture->name);
- gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
- gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
- gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_ROWS, 0);
- gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_PIXELS, 0);
- gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);
- }
+ texture->flags |= GLITZ_TEXTURE_FLAG_ALLOCATED_MASK;
- gl->tex_image_2d (texture->target, 0, texture->format,
- texture->width, texture->height, 0,
- GLITZ_GL_ALPHA, GLITZ_GL_UNSIGNED_BYTE, data);
+ glitz_texture_bind (gl, texture);
- gl->tex_parameter_i (texture->target,
- GLITZ_GL_TEXTURE_MAG_FILTER,
- GLITZ_GL_NEAREST);
- gl->tex_parameter_i (texture->target,
- GLITZ_GL_TEXTURE_MIN_FILTER,
- GLITZ_GL_NEAREST);
-
- texture->filter = GLITZ_GL_NEAREST;
+ if (texture->box.x2 != texture->width ||
+ texture->box.y2 != texture->height) {
+ data = malloc (texture->width * texture->height);
+ if (data)
+ memset (data, 0, texture->width * texture->height);
- glitz_texture_unbind (gl, texture);
+ gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
+ gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
+ gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_ROWS, 0);
+ gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_PIXELS, 0);
+ gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);
+ }
- if (data)
- free (data);
-}
+ gl->tex_image_2d (texture->target, 0, texture->format,
+ texture->width, texture->height, 0,
+ GLITZ_GL_ALPHA, GLITZ_GL_UNSIGNED_BYTE, data);
-void
-glitz_texture_fini (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture)
-{
- if (texture->name)
- gl->delete_textures (1, &texture->name);
-}
+ gl->tex_parameter_i (texture->target,
+ GLITZ_GL_TEXTURE_MAG_FILTER,
+ texture->param.filter[0]);
+ gl->tex_parameter_i (texture->target,
+ GLITZ_GL_TEXTURE_MIN_FILTER,
+ texture->param.filter[1]);
-void
-glitz_texture_ensure_filter (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_gl_enum_t filter)
-{
- if (!texture->name)
- return;
-
- if (texture->filter != filter) {
- gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_MAG_FILTER, filter);
- gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_MIN_FILTER, filter);
- texture->filter = filter;
- }
+ glitz_texture_unbind (gl, texture);
+
+ if (data)
+ free (data);
}
void
-glitz_texture_ensure_wrap (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_gl_enum_t wrap)
+glitz_texture_fini (glitz_gl_proc_address_list_t *gl,
+ glitz_texture_t *texture)
{
- if (!texture->name)
- return;
-
- if (texture->wrap != wrap) {
- gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_WRAP_S, wrap);
- gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_WRAP_T, wrap);
- texture->wrap = wrap;
- }
+ if (texture->name)
+ gl->delete_textures (1, &texture->name);
}
void
glitz_texture_bind (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture)
-{
- gl->disable (GLITZ_GL_TEXTURE_RECTANGLE);
- gl->disable (GLITZ_GL_TEXTURE_2D);
+ glitz_texture_t *texture)
+{
+ gl->disable (GLITZ_GL_TEXTURE_RECTANGLE);
+ gl->disable (GLITZ_GL_TEXTURE_2D);
- if (!texture->name)
- return;
+ if (!texture->name)
+ return;
- gl->enable (texture->target);
- gl->bind_texture (texture->target, texture->name);
+ gl->enable (texture->target);
+ gl->bind_texture (texture->target, texture->name);
}
void
glitz_texture_unbind (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture)
+ glitz_texture_t *texture)
{
- gl->bind_texture (texture->target, 0);
- gl->disable (texture->target);
+ gl->bind_texture (texture->target, 0);
+ gl->disable (texture->target);
}
void
glitz_texture_copy_drawable (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_drawable_t *drawable,
- int x_drawable,
- int y_drawable,
- int width,
- int height,
- int x_texture,
- int y_texture)
+ glitz_texture_t *texture,
+ glitz_drawable_t *drawable,
+ int x_drawable,
+ int y_drawable,
+ int width,
+ int height,
+ int x_texture,
+ int y_texture)
{
- gl->copy_tex_sub_image_2d (texture->target, 0,
- texture->box.x1 + x_texture,
- texture->box.y2 - y_texture - height,
- x_drawable,
- drawable->height - y_drawable - height,
- width, height);
+ gl->copy_tex_sub_image_2d (texture->target, 0,
+ texture->box.x1 + x_texture,
+ texture->box.y2 - y_texture - height,
+ x_drawable,
+ drawable->height - y_drawable - height,
+ width, height);
}
void
glitz_texture_set_tex_gen (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_geometry_t *geometry,
- int x_src,
- int y_src,
- unsigned long flags,
- glitz_int_coordinate_t *coord)
+ glitz_texture_t *texture,
+ glitz_geometry_t *geometry,
+ int x_src,
+ int y_src,
+ unsigned long flags,
+ glitz_int_coordinate_t *coord)
{
glitz_vec4_t plane;
if (flags & GLITZ_SURFACE_FLAG_GEN_S_COORDS_MASK)
{
- plane.v[1] = plane.v[2] = 0.0f;
-
- if (flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK)
- {
- plane.v[0] = 1.0f;
- plane.v[3] = -x_src;
- }
- else
- {
- plane.v[0] = texture->texcoord_width_unit;
-
- if (flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
- plane.v[3] = -(x_src) * texture->texcoord_width_unit;
- else
- plane.v[3] = -(x_src - texture->box.x1) *
- texture->texcoord_width_unit;
- }
-
- gl->tex_gen_i (GLITZ_GL_S, GLITZ_GL_TEXTURE_GEN_MODE,
- GLITZ_GL_EYE_LINEAR);
- gl->tex_gen_fv (GLITZ_GL_S, GLITZ_GL_EYE_PLANE, plane.v);
+ plane.v[1] = plane.v[2] = 0.0f;
- gl->enable (GLITZ_GL_TEXTURE_GEN_S);
+ if (flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK)
+ {
+ plane.v[0] = 1.0f;
+ plane.v[3] = -x_src;
+ }
+ else
+ {
+ plane.v[0] = texture->texcoord_width_unit;
+
+ if (flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
+ plane.v[3] = -(x_src) * texture->texcoord_width_unit;
+ else
+ plane.v[3] = -(x_src - texture->box.x1) *
+ texture->texcoord_width_unit;
+ }
+
+ gl->tex_gen_i (GLITZ_GL_S, GLITZ_GL_TEXTURE_GEN_MODE,
+ GLITZ_GL_EYE_LINEAR);
+ gl->tex_gen_fv (GLITZ_GL_S, GLITZ_GL_EYE_PLANE, plane.v);
+
+ gl->enable (GLITZ_GL_TEXTURE_GEN_S);
}
else
- gl->disable (GLITZ_GL_TEXTURE_GEN_S);
+ gl->disable (GLITZ_GL_TEXTURE_GEN_S);
if (flags & GLITZ_SURFACE_FLAG_GEN_T_COORDS_MASK)
{
- plane.v[0] = plane.v[2] = 0.0f;
- if (flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK)
- {
- plane.v[1] = 1.0f;
- plane.v[3] = -y_src;
- }
- else
- {
- plane.v[1] = -texture->texcoord_height_unit;
-
- if (flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
- plane.v[3] = (y_src + texture->box.y2 - texture->box.y1) *
- texture->texcoord_height_unit;
- else
- plane.v[3] = (y_src + texture->box.y2) *
- texture->texcoord_height_unit;
- }
-
- gl->tex_gen_i (GLITZ_GL_T, GLITZ_GL_TEXTURE_GEN_MODE,
- GLITZ_GL_EYE_LINEAR);
- gl->tex_gen_fv (GLITZ_GL_T, GLITZ_GL_EYE_PLANE, plane.v);
-
- gl->enable (GLITZ_GL_TEXTURE_GEN_T);
+ plane.v[0] = plane.v[2] = 0.0f;
+ if (flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK)
+ {
+ plane.v[1] = 1.0f;
+ plane.v[3] = -y_src;
+ }
+ else
+ {
+ plane.v[1] = -texture->texcoord_height_unit;
+
+ if (flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
+ plane.v[3] = (y_src + texture->box.y2 - texture->box.y1) *
+ texture->texcoord_height_unit;
+ else
+ plane.v[3] = (y_src + texture->box.y2) *
+ texture->texcoord_height_unit;
+ }
+
+ gl->tex_gen_i (GLITZ_GL_T, GLITZ_GL_TEXTURE_GEN_MODE,
+ GLITZ_GL_EYE_LINEAR);
+ gl->tex_gen_fv (GLITZ_GL_T, GLITZ_GL_EYE_PLANE, plane.v);
+
+ gl->enable (GLITZ_GL_TEXTURE_GEN_T);
}
else
- gl->disable (GLITZ_GL_TEXTURE_GEN_T);
+ gl->disable (GLITZ_GL_TEXTURE_GEN_T);
if (!(flags & GLITZ_SURFACE_FLAG_GEN_S_COORDS_MASK))
{
- unsigned char *ptr;
+ unsigned char *ptr;
- gl->enable_client_state (GLITZ_GL_TEXTURE_COORD_ARRAY);
-
- ptr = glitz_buffer_bind (geometry->buffer, GLITZ_GL_ARRAY_BUFFER);
- ptr += coord->offset;
+ gl->enable_client_state (GLITZ_GL_TEXTURE_COORD_ARRAY);
- gl->tex_coord_pointer (coord->size,
- coord->type,
- geometry->stride,
- (void *) ptr);
+ ptr = glitz_buffer_bind (geometry->buffer, GLITZ_GL_ARRAY_BUFFER);
+ ptr += coord->offset;
+
+ gl->tex_coord_pointer (coord->size,
+ coord->type,
+ geometry->stride,
+ (void *) ptr);
} else
- gl->disable_client_state (GLITZ_GL_TEXTURE_COORD_ARRAY);
+ gl->disable_client_state (GLITZ_GL_TEXTURE_COORD_ARRAY);
+}
+
+glitz_texture_object_t *
+glitz_texture_object_create (glitz_surface_t *surface)
+{
+ glitz_texture_object_t *texture;
+
+ GLITZ_GL_SURFACE (surface);
+
+ /* GL_ARB_texture_rectangle is required for sane texture coordinates.
+ GL_ARB_texture_border_clamp is required right now as glitz will
+ emulate it when missing, which means a 1 pixel translucent black
+ border inside textures and that cannot be exposed to clients. */
+ if ((!(surface->drawable->backend->feature_mask &
+ GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)) ||
+ (!(surface->drawable->backend->feature_mask &
+ GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)))
+ return 0;
+
+ texture = malloc (sizeof (glitz_texture_object_t));
+ if (!texture)
+ return 0;
+
+ texture->ref_count = 1;
+
+ glitz_surface_reference (surface);
+ texture->surface = surface;
+
+ if (!(TEXTURE_ALLOCATED (&surface->texture)))
+ glitz_texture_allocate (gl, &surface->texture);
+
+ texture->param = surface->texture.param;
+
+ return texture;
+}
+
+void
+glitz_texture_object_destroy (glitz_texture_object_t *texture)
+{
+ texture->ref_count--;
+ if (texture->ref_count)
+ return;
+
+ glitz_surface_destroy (texture->surface);
+ free (texture);
+}
+
+void
+glitz_texture_object_reference (glitz_texture_object_t *texture)
+{
+ texture->ref_count++;
+}
+
+void
+glitz_texture_object_set_filter (glitz_texture_object_t *texture,
+ glitz_texture_filter_type_t type,
+ glitz_texture_filter_t filter)
+{
+ static glitz_gl_enum_t filters[] = {
+ GLITZ_GL_NEAREST,
+ GLITZ_GL_LINEAR
+ };
+
+ texture->param.filter[type] = filters[filter];
+}
+
+void
+glitz_texture_object_set_wrap (glitz_texture_object_t *texture,
+ glitz_texture_wrap_type_t type,
+ glitz_texture_wrap_t wrap)
+{
+ static glitz_gl_enum_t wraps[] = {
+ GLITZ_GL_CLAMP,
+ GLITZ_GL_CLAMP_TO_EDGE,
+ GLITZ_GL_CLAMP_TO_BORDER,
+ GLITZ_GL_REPEAT,
+ GLITZ_GL_MIRRORED_REPEAT
+ };
+
+ texture->param.wrap[type] = wraps[wrap];
+}
+
+void
+glitz_texture_object_set_border_color (glitz_texture_object_t *texture,
+ glitz_color_t *color)
+{
+ texture->param.border_color = *color;
+}
+
+void
+glitz_texture_ensure_parameters (glitz_gl_proc_address_list_t *gl,
+ glitz_texture_t *texture,
+ glitz_texture_parameters_t *param)
+{
+ static const glitz_gl_enum_t filters[] = {
+ GLITZ_GL_TEXTURE_MAG_FILTER,
+ GLITZ_GL_TEXTURE_MIN_FILTER
+ };
+ static const glitz_gl_enum_t wraps[] = {
+ GLITZ_GL_TEXTURE_WRAP_S,
+ GLITZ_GL_TEXTURE_WRAP_T
+ };
+ int i;
+
+ if (!texture->name)
+ return;
+
+ for (i = 0; i < 2; i++)
+ {
+ if (texture->param.filter[i] != param->filter[i])
+ {
+ texture->param.filter[i] = param->filter[i];
+ gl->tex_parameter_i (texture->target, filters[i],
+ param->filter[i]);
+ }
+
+ if (texture->param.wrap[i] != param->wrap[i])
+ {
+ texture->param.wrap[i] = param->wrap[i];
+ gl->tex_parameter_i (texture->target, wraps[i], param->wrap[i]);
+ }
+ }
+
+ if (texture->param.wrap[0] == GLITZ_GL_CLAMP_TO_BORDER ||
+ texture->param.wrap[1] == GLITZ_GL_CLAMP_TO_BORDER ||
+ texture->param.wrap[0] == GLITZ_GL_CLAMP ||
+ texture->param.wrap[1] == GLITZ_GL_CLAMP)
+ {
+ if (memcmp (&texture->param.border_color, ¶m->border_color,
+ sizeof (glitz_color_t)))
+ {
+ glitz_vec4_t vec;
+
+ vec.v[0] = (glitz_float_t) param->border_color.red / 0xffff;
+ vec.v[1] = (glitz_float_t) param->border_color.green / 0xffff;
+ vec.v[2] = (glitz_float_t) param->border_color.blue / 0xffff;
+ vec.v[3] = (glitz_float_t) param->border_color.alpha / 0xffff;
+
+ gl->tex_parameter_fv (texture->target,
+ GLITZ_GL_TEXTURE_BORDER_COLOR,
+ vec.v);
+
+ texture->param.border_color = param->border_color;
+ }
+ }
+}
+
+glitz_texture_target_t
+glitz_texture_object_get_target (glitz_texture_object_t *texture)
+{
+ if (texture->surface->texture.target == GLITZ_GL_TEXTURE_2D)
+ return GLITZ_TEXTURE_TARGET_2D;
+
+ return GLITZ_TEXTURE_TARGET_RECT;
}
Index: glitz_trap.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_trap.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- glitz_trap.c 25 Jan 2005 19:50:26 -0000 1.10
+++ glitz_trap.c 14 Sep 2005 15:57:16 -0000 1.11
@@ -1,6 +1,6 @@
/*
* Copyright © 2005 Novell, Inc.
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -30,9 +30,9 @@
#include "glitzint.h"
/* whether 't' is a well defined not obviously empty trapezoid */
-#define TRAPEZOID_VALID(t) ((t)->left.p1.y != (t)->left.p2.y && \
- (t)->right.p1.y != (t)->right.p2.y && \
- (int) ((t)->bottom - (t)->top) > 0)
+#define TRAPEZOID_VALID(t) ((t)->left.p1.y != (t)->left.p2.y && \
+ (t)->right.p1.y != (t)->right.p2.y && \
+ (int) ((t)->bottom - (t)->top) > 0)
/* whether 't' is a well defined not obviously empty trap */
#define TRAP_VALID(t) ((int) ((t)->bottom.y - (t)->top.y) > 0)
@@ -46,57 +46,57 @@
int hyp;
} glitz_edge_t;
-#define EDGE_INIT(e, p1x, p1y, p2x, p2y) \
- (e)->hyp = 1; \
- (e)->dx = (p2x) - (p1x); \
- (e)->dy = (p2y) - (p1y); \
- if ((e)->dy) \
- (e)->kx = (e)->dx / (e)->dy; \
- else \
- (e)->kx = 0; \
- (e)->x0 = (p1x) - (e)->kx * (p1y); \
- if ((e)->dx) \
- (e)->ky = (e)->dy / (e)->dx; \
- else \
- (e)->ky = 0; \
+#define EDGE_INIT(e, p1x, p1y, p2x, p2y) \
+ (e)->hyp = 1; \
+ (e)->dx = (p2x) - (p1x); \
+ (e)->dy = (p2y) - (p1y); \
+ if ((e)->dy) \
+ (e)->kx = (e)->dx / (e)->dy; \
+ else \
+ (e)->kx = 0; \
+ (e)->x0 = (p1x) - (e)->kx * (p1y); \
+ if ((e)->dx) \
+ (e)->ky = (e)->dy / (e)->dx; \
+ else \
+ (e)->ky = 0; \
(e)->y0 = (p1y) - (e)->ky * (p1x)
#define EDGE_X(e, _y) (((e)->kx * (_y)) + (e)->x0)
#define EDGE_Y(e, _x) (((e)->ky * (_x)) + (e)->y0)
-#define EDGE_INTERSECT_BOX(upper_x, lower_y, left_y, right_y, \
- box_x1, box_x2, box_y1, box_y2, \
- max_x, max_y, \
- _x1, _y1, _x2, _y2) \
- if (upper_x < (box_x1)) \
- { \
- (_x1) = 0.0f; \
- (_y1) = (left_y) - (box_y1); \
- } \
- else if ((upper_x) > (box_x2)) \
- { \
- (_x1) = (max_x); \
- (_y1) = (right_y) - (box_y1); \
- } \
- else \
- { \
- (_x1) = (upper_x) - (box_x1); \
- (_y1) = 0.0f; \
- } \
- if ((lower_x) < (box_x1)) \
- { \
- (_x2) = 0.0f; \
- (_y2) = (left_y) - (box_y1); \
- } \
- else if ((lower_x) > (box_x2)) \
- { \
- (_x2) = (max_x); \
- (_y2) = (right_y) - (box_y1); \
- } \
- else \
- { \
- (_x2) = (lower_x) - (box_x1); \
- (_y2) = (max_y); \
+#define EDGE_INTERSECT_BOX(upper_x, lower_y, left_y, right_y, \
+ box_x1, box_x2, box_y1, box_y2, \
+ max_x, max_y, \
+ _x1, _y1, _x2, _y2) \
+ if (upper_x < (box_x1)) \
+ { \
+ (_x1) = 0.0f; \
+ (_y1) = (left_y) - (box_y1); \
+ } \
+ else if ((upper_x) > (box_x2)) \
+ { \
+ (_x1) = (max_x); \
+ (_y1) = (right_y) - (box_y1); \
+ } \
+ else \
+ { \
+ (_x1) = (upper_x) - (box_x1); \
+ (_y1) = 0.0f; \
+ } \
+ if ((lower_x) < (box_x1)) \
+ { \
+ (_x2) = 0.0f; \
+ (_y2) = (left_y) - (box_y1); \
+ } \
+ else if ((lower_x) > (box_x2)) \
+ { \
+ (_x2) = (max_x); \
+ (_y2) = (right_y) - (box_y1); \
+ } \
+ else \
+ { \
+ (_x2) = (lower_x) - (box_x1); \
+ (_y2) = (max_y); \
}
#define AREA_ABOVE_LEFT(x1, y1, x2, y2, bottom) \
@@ -110,11 +110,11 @@
*/
static glitz_float_t
_glitz_pixel_area (glitz_float_t pixel_x,
- glitz_float_t pixel_y,
- glitz_float_t top,
- glitz_float_t bottom,
- glitz_edge_t *left,
- glitz_edge_t *right)
+ glitz_float_t pixel_y,
+ glitz_float_t top,
+ glitz_float_t bottom,
+ glitz_edge_t *left,
+ glitz_edge_t *right)
{
glitz_float_t area;
glitz_float_t upper_x, lower_x;
@@ -124,158 +124,158 @@
glitz_float_t x1, x2, y1, y2;
if (bottom >= pixel_y_1)
- bottom = 1.0f;
+ bottom = 1.0f;
else
- bottom = bottom - pixel_y;
+ bottom = bottom - pixel_y;
if (top <= pixel_y)
- top = 0.0f;
+ top = 0.0f;
else
- top = top - pixel_y;
-
+ top = top - pixel_y;
+
if (right->ky)
{
- upper_x = EDGE_X (right, pixel_y);
- lower_x = EDGE_X (right, pixel_y_1);
+ upper_x = EDGE_X (right, pixel_y);
+ lower_x = EDGE_X (right, pixel_y_1);
- left_y = EDGE_Y (right, pixel_x);
- right_y = EDGE_Y (right, pixel_x_1);
+ left_y = EDGE_Y (right, pixel_x);
+ right_y = EDGE_Y (right, pixel_x_1);
- EDGE_INTERSECT_BOX (upper_x, lower_y, left_y, right_y,
- pixel_x, pixel_x_1, pixel_y, pixel_y_1,
- 1.0f, 1.0f, x1, y1, x2, y2);
-
- if (bottom <= y1)
- {
- if (left_y > right_y)
- area = bottom;
- else
- area = 0.0f;
- }
- else
- {
- if (bottom < y2)
- {
- x2 -= right->kx * (y2 - bottom);
- y2 = bottom;
- }
- area = AREA_ABOVE_LEFT (x1, y1, x2, y2, bottom);
- }
+ EDGE_INTERSECT_BOX (upper_x, lower_y, left_y, right_y,
+ pixel_x, pixel_x_1, pixel_y, pixel_y_1,
+ 1.0f, 1.0f, x1, y1, x2, y2);
- if (top <= y1)
- {
- if (left_y > right_y)
- area -= top;
- }
- else
- {
- if (top < y2)
- {
- x2 -= right->kx * (y2 - top);
- y2 = top;
- }
+ if (bottom <= y1)
+ {
+ if (left_y > right_y)
+ area = bottom;
+ else
+ area = 0.0f;
+ }
+ else
+ {
+ if (bottom < y2)
+ {
+ x2 -= right->kx * (y2 - bottom);
+ y2 = bottom;
+ }
+ area = AREA_ABOVE_LEFT (x1, y1, x2, y2, bottom);
+ }
- area -= AREA_ABOVE_LEFT (x1, y1, x2, y2, top);
- }
+ if (top <= y1)
+ {
+ if (left_y > right_y)
+ area -= top;
+ }
+ else
+ {
+ if (top < y2)
+ {
+ x2 -= right->kx * (y2 - top);
+ y2 = top;
+ }
+
+ area -= AREA_ABOVE_LEFT (x1, y1, x2, y2, top);
+ }
}
else
{
- /* Vertical Edge */
- if (right->x0 < pixel_x_1)
- area = (right->x0 - pixel_x) * (bottom - top);
- else
- area = bottom - top;
+ /* Vertical Edge */
+ if (right->x0 < pixel_x_1)
+ area = (right->x0 - pixel_x) * (bottom - top);
+ else
+ area = bottom - top;
}
if (left->kx)
{
- upper_x = EDGE_X (left, pixel_y);
- lower_x = EDGE_X (left, pixel_y_1);
+ upper_x = EDGE_X (left, pixel_y);
+ lower_x = EDGE_X (left, pixel_y_1);
- left_y = EDGE_Y (left, pixel_x);
- right_y = EDGE_Y (left, pixel_x_1);
+ left_y = EDGE_Y (left, pixel_x);
+ right_y = EDGE_Y (left, pixel_x_1);
- EDGE_INTERSECT_BOX (upper_x, lower_y, left_y, right_y,
- pixel_x, pixel_x_1, pixel_y, pixel_y_1,
- 1.0f, 1.0f, x1, y1, x2, y2);
-
- if (bottom <= y1)
- {
- if (left_y > right_y)
- area -= bottom;
- }
- else
- {
- if (bottom < y2)
- {
- x2 -= left->kx * (y2 - bottom);
- y2 = bottom;
- }
- area -= AREA_ABOVE_LEFT (x1, y1, x2, y2, bottom);
- }
+ EDGE_INTERSECT_BOX (upper_x, lower_y, left_y, right_y,
+ pixel_x, pixel_x_1, pixel_y, pixel_y_1,
+ 1.0f, 1.0f, x1, y1, x2, y2);
- if (top <= y1)
- {
- if (left_y > right_y)
- area += top;
- }
- else
- {
- if (top < y2)
- {
- x2 -= left->kx * (y2 - top);
- y2 = top;
- }
-
- area += AREA_ABOVE_LEFT (x1, y1, x2, y2, top);
- }
+ if (bottom <= y1)
+ {
+ if (left_y > right_y)
+ area -= bottom;
+ }
+ else
+ {
+ if (bottom < y2)
+ {
+ x2 -= left->kx * (y2 - bottom);
+ y2 = bottom;
+ }
+ area -= AREA_ABOVE_LEFT (x1, y1, x2, y2, bottom);
+ }
+
+ if (top <= y1)
+ {
+ if (left_y > right_y)
+ area += top;
+ }
+ else
+ {
+ if (top < y2)
+ {
+ x2 -= left->kx * (y2 - top);
+ y2 = top;
+ }
+
+ area += AREA_ABOVE_LEFT (x1, y1, x2, y2, top);
+ }
}
else
{
- /* Vertical Edge */
- if (left->x0 > pixel_x)
- area -= (left->x0 - pixel_x) * (bottom - top);
+ /* Vertical Edge */
+ if (left->x0 > pixel_x)
+ area -= (left->x0 - pixel_x) * (bottom - top);
}
-
+
return area;
}
#define TRAPINIT(trap, _top, _bottom, _left, _right) \
if (!TRAPEZOID_VALID (trap)) \
- continue; \
- \
+ continue; \
+ \
(_top) = FIXED_TO_FLOAT ((trap)->top); \
(_bottom) = FIXED_TO_FLOAT ((trap)->bottom); \
- \
+ \
(_left)->tx = FIXED_TO_FLOAT ((trap)->left.p1.x); \
(_left)->bx = FIXED_TO_FLOAT ((trap)->left.p1.y); \
- \
+ \
(_right)->tx = FIXED_TO_FLOAT ((trap)->right.p1.x); \
(_right)->bx = FIXED_TO_FLOAT ((trap)->right.p1.y); \
- \
+ \
EDGE_INIT (_left, \
- (_left)->tx, (_left)->bx, \
- FIXED_TO_FLOAT ((trap)->left.p2.x), \
- FIXED_TO_FLOAT ((trap)->left.p2.y)); \
- \
+ (_left)->tx, (_left)->bx, \
+ FIXED_TO_FLOAT ((trap)->left.p2.x), \
+ FIXED_TO_FLOAT ((trap)->left.p2.y)); \
+ \
EDGE_INIT (_right, \
- (_right)->tx, (_right)->bx, \
- FIXED_TO_FLOAT ((trap)->right.p2.x), \
- FIXED_TO_FLOAT ((trap)->right.p2.y)); \
- \
+ (_right)->tx, (_right)->bx, \
+ FIXED_TO_FLOAT ((trap)->right.p2.x), \
+ FIXED_TO_FLOAT ((trap)->right.p2.y)); \
+ \
if ((_left)->dx) \
{ \
- (_left)->tx = EDGE_X (_left, _top); \
- (_left)->bx = EDGE_X (_left, _bottom); \
+ (_left)->tx = EDGE_X (_left, _top); \
+ (_left)->bx = EDGE_X (_left, _bottom); \
} else \
- (_left)->tx = (_left)->bx = (_left)->x0; \
- \
+ (_left)->tx = (_left)->bx = (_left)->x0; \
+ \
if ((_right)->dx) \
{ \
- (_right)->tx = EDGE_X (_right, _top); \
- (_right)->bx = EDGE_X (_right, _bottom); \
+ (_right)->tx = EDGE_X (_right, _top); \
+ (_right)->bx = EDGE_X (_right, _bottom); \
} else \
- (_right)->tx = (_right)->bx = (_right)->x0
+ (_right)->tx = (_right)->bx = (_right)->x0
#define TRAP glitz_trapezoid_t
@@ -306,26 +306,26 @@
#undef TRAP
#undef TRAPINIT
-#define TRAPINIT(trap, _top, _bottom, _left, _right) \
- if (!TRAP_VALID (trap)) \
- continue; \
- \
- (_top) = FIXED_TO_FLOAT ((trap)->top.y); \
- (_bottom) = FIXED_TO_FLOAT ((trap)->bottom.y); \
- \
- (_left)->tx = FIXED_TO_FLOAT ((trap)->top.left); \
- (_left)->bx = FIXED_TO_FLOAT ((trap)->bottom.left); \
- \
- (_right)->tx = FIXED_TO_FLOAT ((trap)->top.right); \
- (_right)->bx = FIXED_TO_FLOAT ((trap)->bottom.right); \
- \
- EDGE_INIT (_left, \
- (_left)->tx, _top, \
- (_left)->bx, _bottom); \
- \
- EDGE_INIT (_right, \
- (_right)->tx, _top, \
- (_right)->bx, _bottom)
+#define TRAPINIT(trap, _top, _bottom, _left, _right) \
+ if (!TRAP_VALID (trap)) \
+ continue; \
+ \
+ (_top) = FIXED_TO_FLOAT ((trap)->top.y); \
+ (_bottom) = FIXED_TO_FLOAT ((trap)->bottom.y); \
+ \
+ (_left)->tx = FIXED_TO_FLOAT ((trap)->top.left); \
+ (_left)->bx = FIXED_TO_FLOAT ((trap)->bottom.left); \
+ \
+ (_right)->tx = FIXED_TO_FLOAT ((trap)->top.right); \
+ (_right)->bx = FIXED_TO_FLOAT ((trap)->bottom.right); \
+ \
+ EDGE_INIT (_left, \
+ (_left)->tx, _top, \
+ (_left)->bx, _bottom); \
+ \
+ EDGE_INIT (_right, \
+ (_right)->tx, _top, \
+ (_right)->bx, _bottom)
#define TRAP glitz_trap_t
@@ -358,44 +358,44 @@
int
glitz_add_trapezoids (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- glitz_data_type_t type,
- glitz_surface_t *mask,
- glitz_trapezoid_t *traps,
- int n_traps,
- int *n_added)
+ int offset,
+ unsigned int size,
+ glitz_data_type_t type,
+ glitz_surface_t *mask,
+ glitz_trapezoid_t *traps,
+ int n_traps,
+ int *n_added)
{
int count, n = n_traps;
uint8_t *ptr;
-
+
*n_added = 0;
-
+
ptr = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
if (!ptr)
- return 0;
+ return 0;
ptr += offset;
-
+
switch (type) {
case GLITZ_DATA_TYPE_SHORT:
- count = _glitz_add_trapezoids_short (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_trapezoids_short (ptr, size, mask, traps, &n_traps);
+ break;
case GLITZ_DATA_TYPE_INT:
- count = _glitz_add_trapezoids_int (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_trapezoids_int (ptr, size, mask, traps, &n_traps);
+ break;
case GLITZ_DATA_TYPE_DOUBLE:
- count = _glitz_add_trapezoids_double (ptr, size, mask,
- traps, &n_traps);
- break;
+ count = _glitz_add_trapezoids_double (ptr, size, mask,
+ traps, &n_traps);
+ break;
default:
- count = _glitz_add_trapezoids_float (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_trapezoids_float (ptr, size, mask, traps, &n_traps);
+ break;
}
if (glitz_buffer_unmap (buffer))
- return 0;
-
+ return 0;
+
*n_added = n - n_traps;
return count;
@@ -403,42 +403,42 @@
int
glitz_add_traps (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- glitz_data_type_t type,
- glitz_surface_t *mask,
- glitz_trap_t *traps,
- int n_traps,
- int *n_added)
+ int offset,
+ unsigned int size,
+ glitz_data_type_t type,
+ glitz_surface_t *mask,
+ glitz_trap_t *traps,
+ int n_traps,
+ int *n_added)
{
int count, n = n_traps;
uint8_t *ptr;
-
+
*n_added = 0;
-
+
ptr = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
if (!ptr)
return 0;
ptr += offset;
-
+
switch (type) {
case GLITZ_DATA_TYPE_SHORT:
- count = _glitz_add_traps_short (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_traps_short (ptr, size, mask, traps, &n_traps);
+ break;
case GLITZ_DATA_TYPE_INT:
- count = _glitz_add_traps_int (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_traps_int (ptr, size, mask, traps, &n_traps);
+ break;
case GLITZ_DATA_TYPE_DOUBLE:
- count = _glitz_add_traps_double (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_traps_double (ptr, size, mask, traps, &n_traps);
+ break;
default:
- count = _glitz_add_traps_float (ptr, size, mask, traps, &n_traps);
- break;
+ count = _glitz_add_traps_float (ptr, size, mask, traps, &n_traps);
+ break;
}
if (glitz_buffer_unmap (buffer))
- return 0;
+ return 0;
*n_added = n - n_traps;
Index: glitz_trapimp.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_trapimp.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- glitz_trapimp.h 27 Jan 2005 12:01:04 -0000 1.3
+++ glitz_trapimp.h 14 Sep 2005 15:57:16 -0000 1.4
@@ -1,6 +1,6 @@
/*
* Copyright © 2005 Novell, Inc.
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
[...1143 lines suppressed...]
+ {
+ area = right.x0 - rx;
+ ADD_RIGHT_SPAN (vptr, tptr, offset, size,
+ tmp0, tmp1,
+ tbase, tsize,
+ rx, y1, x2, y,
+ area);
+ }
+ }
+
+ left.tx = left.bx;
+ right.tx = right.bx;
+ y1 = y;
+ } while (y < y2);
+ }
+
+ toff = offset;
}
return toff;
Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- glitz_util.c 12 Apr 2005 14:54:56 -0000 1.14
+++ glitz_util.c 14 Sep 2005 15:57:16 -0000 1.15
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -33,335 +33,369 @@
#include <string.h>
static glitz_extension_map gl_extensions[] = {
- { 0.0, "GL_ARB_texture_rectangle", GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK },
- { 0.0, "GL_EXT_texture_rectangle", GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK },
- { 0.0, "GL_NV_texture_rectangle", GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK },
- { 0.0, "GL_ARB_texture_non_power_of_two",
- GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
- { 0.0, "GL_ARB_texture_mirrored_repeat",
- GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK },
- { 0.0, "GL_ARB_texture_border_clamp",
- GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK },
- { 0.0, "GL_ARB_texture_env_combine",
- GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK },
- { 0.0, "GL_EXT_texture_env_combine",
- GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK },
- { 0.0, "GL_ARB_texture_env_dot3", GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK },
- { 0.0, "GL_ARB_multisample", GLITZ_FEATURE_MULTISAMPLE_MASK },
- { 0.0, "GL_NV_multisample_filter_hint",
- GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK },
- { 0.0, "GL_ARB_multitexture", GLITZ_FEATURE_MULTITEXTURE_MASK },
- { 0.0, "GL_EXT_multi_draw_arrays", GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK },
- { 0.0, "GL_ARB_fragment_program", GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK },
- { 0.0, "GL_ARB_vertex_buffer_object",
- GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK },
- { 0.0, "GL_ARB_pixel_buffer_object",
- GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
- { 0.0, "GL_EXT_pixel_buffer_object",
- GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
- { 0.0, "GL_EXT_blend_color", GLITZ_FEATURE_BLEND_COLOR_MASK },
- { 0.0, "GL_ARB_imaging", GLITZ_FEATURE_BLEND_COLOR_MASK },
- { 0.0, "GL_APPLE_packed_pixels", GLITZ_FEATURE_PACKED_PIXELS_MASK },
- { 0.0, "GL_EXT_framebuffer_object", GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK },
- { 0.0, NULL, 0 }
+ { 0.0, "GL_ARB_texture_rectangle", GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK },
+ { 0.0, "GL_EXT_texture_rectangle", GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK },
+ { 0.0, "GL_NV_texture_rectangle", GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK },
+ { 0.0, "GL_ARB_texture_non_power_of_two",
+ GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
+ { 0.0, "GL_ARB_texture_mirrored_repeat",
+ GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK },
+ { 0.0, "GL_ARB_texture_border_clamp",
+ GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK },
+ { 0.0, "GL_ARB_texture_env_combine",
+ GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK },
+ { 0.0, "GL_EXT_texture_env_combine",
+ GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK },
+ { 0.0, "GL_ARB_texture_env_dot3", GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK },
+ { 0.0, "GL_ARB_multisample", GLITZ_FEATURE_MULTISAMPLE_MASK },
+ { 0.0, "GL_NV_multisample_filter_hint",
+ GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK },
+ { 0.0, "GL_ARB_multitexture", GLITZ_FEATURE_MULTITEXTURE_MASK },
+ { 0.0, "GL_EXT_multi_draw_arrays", GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK },
+ { 0.0, "GL_ARB_fragment_program", GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK },
+ { 0.0, "GL_ARB_vertex_buffer_object",
+ GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK },
+ { 0.0, "GL_ARB_pixel_buffer_object",
+ GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
+ { 0.0, "GL_EXT_pixel_buffer_object",
+ GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
+ { 0.0, "GL_EXT_blend_color", GLITZ_FEATURE_BLEND_COLOR_MASK },
+ { 0.0, "GL_ARB_imaging", GLITZ_FEATURE_BLEND_COLOR_MASK },
+ { 0.0, "GL_APPLE_packed_pixels", GLITZ_FEATURE_PACKED_PIXELS_MASK },
+ { 0.0, "GL_EXT_framebuffer_object",
+ GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK },
+ { 0.0, NULL, 0 }
};
static glitz_bool_t
_glitz_extension_check (const char *extensions,
- const char *ext_name)
+ const char *ext_name)
{
- char *end;
- char *p = (char *) extensions;
- int ext_name_len = strlen (ext_name);
+ char *end;
+ char *p = (char *) extensions;
+ int ext_name_len = strlen (ext_name);
- if (! p)
- return 0;
+ if (! p)
+ return 0;
- end = p + strlen (p);
+ end = p + strlen (p);
- while (p < end) {
- int n = strcspn (p, " ");
+ while (p < end) {
+ int n = strcspn (p, " ");
- if ((ext_name_len == n) && (strncmp (ext_name, p, n) == 0)) {
- return 1;
+ if ((ext_name_len == n) && (strncmp (ext_name, p, n) == 0)) {
+ return 1;
+ }
+ p += (n + 1);
}
- p += (n + 1);
- }
- return 0;
+ return 0;
}
unsigned long
glitz_extensions_query (glitz_gl_float_t version,
- const char *extensions_string,
- glitz_extension_map *extensions_map)
+ const char *extensions_string,
+ glitz_extension_map *extensions_map)
{
- unsigned long mask = 0;
- int i;
+ unsigned long mask = 0;
+ int i;
- for (i = 0; extensions_map[i].name; i++)
- if (((extensions_map[i].version > 1.0) &&
- (version >= extensions_map[i].version)) ||
- _glitz_extension_check (extensions_string, extensions_map[i].name))
- mask |= extensions_map[i].mask;
+ for (i = 0; extensions_map[i].name; i++)
+ if (((extensions_map[i].version > 1.0) &&
+ (version >= extensions_map[i].version)) ||
+ _glitz_extension_check (extensions_string, extensions_map[i].name))
+ mask |= extensions_map[i].mask;
- return mask;
+ return mask;
}
static glitz_status_t
_glitz_query_gl_extensions (glitz_gl_proc_address_list_t *gl,
- glitz_gl_float_t *gl_version,
- unsigned long *feature_mask)
+ glitz_gl_float_t *gl_version,
+ unsigned long *feature_mask)
{
- const char *gl_extensions_string;
+ const char *gl_extensions_string;
- *gl_version = atof ((const char *) gl->get_string (GLITZ_GL_VERSION));
- if (*gl_version < 1.2f)
- return GLITZ_STATUS_NOT_SUPPORTED;
-
- gl_extensions_string = (const char *) gl->get_string (GLITZ_GL_EXTENSIONS);
-
- *feature_mask = glitz_extensions_query (*gl_version,
- gl_extensions_string,
- gl_extensions);
-
- if ((*feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) &&
- (*feature_mask & GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK)) {
- glitz_gl_int_t max_texture_units;
-
- gl->get_integer_v (GLITZ_GL_MAX_TEXTURE_UNITS, &max_texture_units);
- if (max_texture_units >= 3)
- *feature_mask |= GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
- }
+ *gl_version = atof ((const char *) gl->get_string (GLITZ_GL_VERSION));
+ if (*gl_version < 1.2f)
+ return GLITZ_STATUS_NOT_SUPPORTED;
- return GLITZ_STATUS_SUCCESS;
+ gl_extensions_string = (const char *) gl->get_string (GLITZ_GL_EXTENSIONS);
+
+ *feature_mask = glitz_extensions_query (*gl_version,
+ gl_extensions_string,
+ gl_extensions);
+
+ if ((*feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) &&
+ (*feature_mask & GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK)) {
+ glitz_gl_int_t max_texture_units;
+
+ gl->get_integer_v (GLITZ_GL_MAX_TEXTURE_UNITS, &max_texture_units);
+ if (max_texture_units >= 3)
+ *feature_mask |= GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
+ }
+
+ return GLITZ_STATUS_SUCCESS;
}
static void
_glitz_gl_proc_address_lookup (glitz_backend_t *backend,
- glitz_get_proc_address_proc_t get_proc_address,
- void *closure)
+ glitz_get_proc_address_proc_t get_proc_address,
+ void *closure)
{
- if (backend->feature_mask & GLITZ_FEATURE_BLEND_COLOR_MASK) {
- if (backend->gl_version >= 1.4f) {
- backend->gl.blend_color = (glitz_gl_blend_color_t)
- get_proc_address ("glBlendColor", closure);
- } else {
- backend->gl.blend_color = (glitz_gl_blend_color_t)
- get_proc_address ("glBlendColorEXT", closure);
+ if (backend->feature_mask & GLITZ_FEATURE_BLEND_COLOR_MASK) {
+ if (backend->gl_version >= 1.4f) {
+ backend->gl->blend_color = (glitz_gl_blend_color_t)
+ get_proc_address ("glBlendColor", closure);
+ } else {
+ backend->gl->blend_color = (glitz_gl_blend_color_t)
+ get_proc_address ("glBlendColorEXT", closure);
+ }
+
+ if (!backend->gl->blend_color)
+ backend->feature_mask &= ~GLITZ_FEATURE_BLEND_COLOR_MASK;
}
- if (!backend->gl.blend_color)
- backend->feature_mask &= ~GLITZ_FEATURE_BLEND_COLOR_MASK;
- }
+ if (backend->feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK) {
+ if (backend->gl_version >= 1.3f) {
+ backend->gl->active_texture = (glitz_gl_active_texture_t)
+ get_proc_address ("glActiveTexture", closure);
+ backend->gl->client_active_texture =
+ (glitz_gl_client_active_texture_t)
+ get_proc_address ("glClientActiveTexture", closure);
+ } else {
+ backend->gl->active_texture = (glitz_gl_active_texture_t)
+ get_proc_address ("glActiveTextureARB", closure);
+ backend->gl->client_active_texture =
+ (glitz_gl_client_active_texture_t)
+ get_proc_address ("glClientActiveTextureARB", closure);
+ }
- if (backend->feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK) {
- if (backend->gl_version >= 1.3f) {
- backend->gl.active_texture = (glitz_gl_active_texture_t)
- get_proc_address ("glActiveTexture", closure);
- backend->gl.client_active_texture = (glitz_gl_client_active_texture_t)
- get_proc_address ("glClientActiveTexture", closure);
- } else {
- backend->gl.active_texture = (glitz_gl_active_texture_t)
- get_proc_address ("glActiveTextureARB", closure);
- backend->gl.client_active_texture = (glitz_gl_client_active_texture_t)
- get_proc_address ("glClientActiveTextureARB", closure);
+ if ((!backend->gl->active_texture) ||
+ (!backend->gl->client_active_texture)) {
+ backend->feature_mask &= ~GLITZ_FEATURE_MULTITEXTURE_MASK;
+ backend->feature_mask &=
+ ~GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
+ }
}
- if ((!backend->gl.active_texture) ||
- (!backend->gl.client_active_texture)) {
- backend->feature_mask &= ~GLITZ_FEATURE_MULTITEXTURE_MASK;
- backend->feature_mask &= ~GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
- }
- }
+ if (backend->feature_mask & GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK) {
+ backend->gl->multi_draw_arrays = (glitz_gl_multi_draw_arrays_t)
+ get_proc_address ("glMultiDrawArraysEXT", closure);
- if (backend->feature_mask & GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK) {
- backend->gl.multi_draw_arrays = (glitz_gl_multi_draw_arrays_t)
- get_proc_address ("glMultiDrawArraysEXT", closure);
+ if (!backend->gl->multi_draw_arrays)
+ backend->feature_mask &= ~GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK;
+ }
- if (!backend->gl.multi_draw_arrays)
- backend->feature_mask &= ~GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK;
- }
+ if (backend->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK) {
+ backend->gl->gen_programs = (glitz_gl_gen_programs_t)
+ get_proc_address ("glGenProgramsARB", closure);
+ backend->gl->delete_programs = (glitz_gl_delete_programs_t)
+ get_proc_address ("glDeleteProgramsARB", closure);
+ backend->gl->program_string = (glitz_gl_program_string_t)
+ get_proc_address ("glProgramStringARB", closure);
+ backend->gl->bind_program = (glitz_gl_bind_program_t)
+ get_proc_address ("glBindProgramARB", closure);
+ backend->gl->program_local_param_4fv =
+ (glitz_gl_program_local_param_4fv_t)
+ get_proc_address ("glProgramLocalParameter4fvARB", closure);
+ backend->gl->get_program_iv = (glitz_gl_get_program_iv_t)
+ get_proc_address ("glGetProgramivARB", closure);
- if (backend->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK) {
- backend->gl.gen_programs = (glitz_gl_gen_programs_t)
- get_proc_address ("glGenProgramsARB", closure);
- backend->gl.delete_programs = (glitz_gl_delete_programs_t)
- get_proc_address ("glDeleteProgramsARB", closure);
- backend->gl.program_string = (glitz_gl_program_string_t)
- get_proc_address ("glProgramStringARB", closure);
- backend->gl.bind_program = (glitz_gl_bind_program_t)
- get_proc_address ("glBindProgramARB", closure);
- backend->gl.program_local_param_4fv = (glitz_gl_program_local_param_4fv_t)
- get_proc_address ("glProgramLocalParameter4fvARB", closure);
- backend->gl.get_program_iv = (glitz_gl_get_program_iv_t)
- get_proc_address ("glGetProgramivARB", closure);
+ if ((!backend->gl->gen_programs) ||
+ (!backend->gl->delete_programs) ||
+ (!backend->gl->program_string) ||
+ (!backend->gl->bind_program) ||
+ (!backend->gl->program_local_param_4fv))
+ backend->feature_mask &= ~GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
+ }
- if ((!backend->gl.gen_programs) ||
- (!backend->gl.delete_programs) ||
- (!backend->gl.program_string) ||
- (!backend->gl.bind_program) ||
- (!backend->gl.program_local_param_4fv))
- backend->feature_mask &= ~GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
- }
+ if ((backend->feature_mask & GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK) ||
+ (backend->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)) {
+ if (backend->gl_version >= 1.5f) {
+ backend->gl->gen_buffers = (glitz_gl_gen_buffers_t)
+ get_proc_address ("glGenBuffers", closure);
+ backend->gl->delete_buffers = (glitz_gl_delete_buffers_t)
+ get_proc_address ("glDeleteBuffers", closure);
+ backend->gl->bind_buffer = (glitz_gl_bind_buffer_t)
+ get_proc_address ("glBindBuffer", closure);
+ backend->gl->buffer_data = (glitz_gl_buffer_data_t)
+ get_proc_address ("glBufferData", closure);
+ backend->gl->buffer_sub_data = (glitz_gl_buffer_sub_data_t)
+ get_proc_address ("glBufferSubData", closure);
+ backend->gl->get_buffer_sub_data = (glitz_gl_get_buffer_sub_data_t)
+ get_proc_address ("glGetBufferSubData", closure);
+ backend->gl->map_buffer = (glitz_gl_map_buffer_t)
+ get_proc_address ("glMapBuffer", closure);
+ backend->gl->unmap_buffer = (glitz_gl_unmap_buffer_t)
+ get_proc_address ("glUnmapBuffer", closure);
+ } else {
+ backend->gl->gen_buffers = (glitz_gl_gen_buffers_t)
+ get_proc_address ("glGenBuffersARB", closure);
+ backend->gl->delete_buffers = (glitz_gl_delete_buffers_t)
+ get_proc_address ("glDeleteBuffersARB", closure);
+ backend->gl->bind_buffer = (glitz_gl_bind_buffer_t)
+ get_proc_address ("glBindBufferARB", closure);
+ backend->gl->buffer_data = (glitz_gl_buffer_data_t)
+ get_proc_address ("glBufferDataARB", closure);
+ backend->gl->buffer_sub_data = (glitz_gl_buffer_sub_data_t)
+ get_proc_address ("glBufferSubDataARB", closure);
+ backend->gl->get_buffer_sub_data = (glitz_gl_get_buffer_sub_data_t)
+ get_proc_address ("glGetBufferSubDataARB", closure);
+ backend->gl->map_buffer = (glitz_gl_map_buffer_t)
+ get_proc_address ("glMapBufferARB", closure);
+ backend->gl->unmap_buffer = (glitz_gl_unmap_buffer_t)
+ get_proc_address ("glUnmapBufferARB", closure);
+ }
- if ((backend->feature_mask & GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK) ||
- (backend->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)) {
- if (backend->gl_version >= 1.5f) {
- backend->gl.gen_buffers = (glitz_gl_gen_buffers_t)
- get_proc_address ("glGenBuffers", closure);
- backend->gl.delete_buffers = (glitz_gl_delete_buffers_t)
- get_proc_address ("glDeleteBuffers", closure);
- backend->gl.bind_buffer = (glitz_gl_bind_buffer_t)
- get_proc_address ("glBindBuffer", closure);
- backend->gl.buffer_data = (glitz_gl_buffer_data_t)
- get_proc_address ("glBufferData", closure);
- backend->gl.buffer_sub_data = (glitz_gl_buffer_sub_data_t)
- get_proc_address ("glBufferSubData", closure);
- backend->gl.get_buffer_sub_data = (glitz_gl_get_buffer_sub_data_t)
- get_proc_address ("glGetBufferSubData", closure);
- backend->gl.map_buffer = (glitz_gl_map_buffer_t)
- get_proc_address ("glMapBuffer", closure);
- backend->gl.unmap_buffer = (glitz_gl_unmap_buffer_t)
- get_proc_address ("glUnmapBuffer", closure);
- } else {
- backend->gl.gen_buffers = (glitz_gl_gen_buffers_t)
- get_proc_address ("glGenBuffersARB", closure);
- backend->gl.delete_buffers = (glitz_gl_delete_buffers_t)
- get_proc_address ("glDeleteBuffersARB", closure);
- backend->gl.bind_buffer = (glitz_gl_bind_buffer_t)
- get_proc_address ("glBindBufferARB", closure);
- backend->gl.buffer_data = (glitz_gl_buffer_data_t)
- get_proc_address ("glBufferDataARB", closure);
- backend->gl.buffer_sub_data = (glitz_gl_buffer_sub_data_t)
- get_proc_address ("glBufferSubDataARB", closure);
- backend->gl.get_buffer_sub_data = (glitz_gl_get_buffer_sub_data_t)
- get_proc_address ("glGetBufferSubDataARB", closure);
- backend->gl.map_buffer = (glitz_gl_map_buffer_t)
- get_proc_address ("glMapBufferARB", closure);
- backend->gl.unmap_buffer = (glitz_gl_unmap_buffer_t)
- get_proc_address ("glUnmapBufferARB", closure);
+ if ((!backend->gl->gen_buffers) ||
+ (!backend->gl->delete_buffers) ||
+ (!backend->gl->bind_buffer) ||
+ (!backend->gl->buffer_data) ||
+ (!backend->gl->buffer_sub_data) ||
+ (!backend->gl->get_buffer_sub_data) ||
+ (!backend->gl->map_buffer) ||
+ (!backend->gl->unmap_buffer)) {
+ backend->feature_mask &= ~GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
+ backend->feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
+ }
}
- if ((!backend->gl.gen_buffers) ||
- (!backend->gl.delete_buffers) ||
- (!backend->gl.bind_buffer) ||
- (!backend->gl.buffer_data) ||
- (!backend->gl.buffer_sub_data) ||
- (!backend->gl.get_buffer_sub_data) ||
- (!backend->gl.map_buffer) ||
- (!backend->gl.unmap_buffer)) {
- backend->feature_mask &= ~GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
- backend->feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
- }
- }
+ if (backend->feature_mask & GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK) {
+ backend->gl->gen_framebuffers = (glitz_gl_gen_framebuffers_t)
+ get_proc_address ("glGenFramebuffersEXT", closure);
+ backend->gl->delete_framebuffers = (glitz_gl_delete_framebuffers_t)
+ get_proc_address ("glDeleteFramebuffersEXT", closure);
+ backend->gl->bind_framebuffer = (glitz_gl_bind_framebuffer_t)
+ get_proc_address ("glBindFramebufferEXT", closure);
+ backend->gl->framebuffer_renderbuffer =
+ (glitz_gl_framebuffer_renderbuffer_t)
+ get_proc_address ("glFramebufferRenderbufferEXT", closure);
+ backend->gl->framebuffer_texture_2d =
+ (glitz_gl_framebuffer_texture_2d_t)
+ get_proc_address ("glFramebufferTexture2DEXT", closure);
+ backend->gl->check_framebuffer_status =
+ (glitz_gl_check_framebuffer_status_t)
+ get_proc_address ("glCheckFramebufferStatusEXT", closure);
+ backend->gl->gen_renderbuffers = (glitz_gl_gen_renderbuffers_t)
+ get_proc_address ("glGenRenderbuffersEXT", closure);
+ backend->gl->delete_renderbuffers = (glitz_gl_delete_renderbuffers_t)
+ get_proc_address ("glDeleteRenderbuffersEXT", closure);
+ backend->gl->bind_renderbuffer = (glitz_gl_bind_renderbuffer_t)
+ get_proc_address ("glBindRenderbufferEXT", closure);
+ backend->gl->renderbuffer_storage = (glitz_gl_renderbuffer_storage_t)
+ get_proc_address ("glRenderbufferStorageEXT", closure);
+ backend->gl->get_renderbuffer_parameter_iv =
+ (glitz_gl_get_renderbuffer_parameter_iv_t)
+ get_proc_address ("glGetRenderbufferParameterivEXT", closure);
- if (backend->feature_mask & GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK) {
- backend->gl.gen_framebuffers = (glitz_gl_gen_framebuffers_t)
- get_proc_address ("glGenFramebuffersEXT", closure);
- backend->gl.delete_framebuffers = (glitz_gl_delete_framebuffers_t)
- get_proc_address ("glDeleteFramebuffersEXT", closure);
- backend->gl.bind_framebuffer = (glitz_gl_bind_framebuffer_t)
- get_proc_address ("glBindFramebufferEXT", closure);
- backend->gl.check_framebuffer_status =
- (glitz_gl_check_framebuffer_status_t)
- get_proc_address ("glCheckFramebufferStatusEXT", closure);
- backend->gl.framebuffer_texture_2d = (glitz_gl_framebuffer_texture_2d_t)
- get_proc_address ("glFramebufferTexture2DEXT", closure);
-
- if ((!backend->gl.gen_framebuffers) ||
- (!backend->gl.delete_framebuffers) ||
- (!backend->gl.bind_framebuffer) ||
- (!backend->gl.check_framebuffer_status) ||
- (!backend->gl.framebuffer_texture_2d))
- backend->feature_mask &= ~GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK;
- }
+ if ((!backend->gl->gen_framebuffers) ||
+ (!backend->gl->delete_framebuffers) ||
+ (!backend->gl->bind_framebuffer) ||
+ (!backend->gl->framebuffer_renderbuffer) ||
+ (!backend->gl->framebuffer_texture_2d) ||
+ (!backend->gl->check_framebuffer_status) ||
+ (!backend->gl->gen_renderbuffers) ||
+ (!backend->gl->delete_renderbuffers) ||
+ (!backend->gl->bind_renderbuffer) ||
+ (!backend->gl->renderbuffer_storage) ||
+ (!backend->gl->get_renderbuffer_parameter_iv))
+ backend->feature_mask &= ~GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK;
+ }
}
void
glitz_backend_init (glitz_backend_t *backend,
- glitz_get_proc_address_proc_t get_proc_address,
- void *closure)
+ glitz_get_proc_address_proc_t get_proc_address,
+ void *closure)
{
- if (!_glitz_query_gl_extensions (&backend->gl,
- &backend->gl_version,
- &backend->feature_mask)) {
- _glitz_gl_proc_address_lookup (backend, get_proc_address, closure);
- glitz_create_surface_formats (&backend->gl,
- &backend->formats,
- &backend->texture_formats,
- &backend->n_formats);
- }
-
- backend->gl.get_integer_v (GLITZ_GL_MAX_TEXTURE_SIZE,
- &backend->max_texture_2d_size);
-
- if (backend->feature_mask & GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK)
- backend->gl.get_integer_v (GLITZ_GL_MAX_RECTANGLE_TEXTURE_SIZE,
- &backend->max_texture_rect_size);
- else
- backend->max_texture_rect_size = 0;
+ if (!_glitz_query_gl_extensions (backend->gl,
+ &backend->gl_version,
+ &backend->feature_mask)) {
+ _glitz_gl_proc_address_lookup (backend, get_proc_address, closure);
+ glitz_create_surface_formats (backend->gl,
+ &backend->formats,
+ &backend->texture_formats,
+ &backend->n_formats);
+ _glitz_add_drawable_formats (backend->gl,
+ backend->feature_mask,
+ &backend->drawable_formats,
+ &backend->n_drawable_formats);
+ }
+
+ backend->gl->get_integer_v (GLITZ_GL_MAX_VIEWPORT_DIMS,
+ backend->max_viewport_dims);
+
+ backend->gl->get_integer_v (GLITZ_GL_MAX_TEXTURE_SIZE,
+ &backend->max_texture_2d_size);
+
+ if (backend->feature_mask & GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK)
+ backend->gl->get_integer_v (GLITZ_GL_MAX_RECTANGLE_TEXTURE_SIZE,
+ &backend->max_texture_rect_size);
+ else
+ backend->max_texture_rect_size = 0;
}
unsigned int
glitz_uint_to_power_of_two (unsigned int x)
{
- x |= (x >> 1);
- x |= (x >> 2);
- x |= (x >> 4);
- x |= (x >> 8);
- x |= (x >> 16);
-
- return (x + 1);
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
+
+ return (x + 1);
}
void
glitz_set_raster_pos (glitz_gl_proc_address_list_t *gl,
- glitz_float_t x,
- glitz_float_t y)
+ glitz_float_t x,
+ glitz_float_t y)
{
- gl->push_attrib (GLITZ_GL_TRANSFORM_BIT | GLITZ_GL_VIEWPORT_BIT);
- gl->matrix_mode (GLITZ_GL_PROJECTION);
- gl->push_matrix ();
- gl->load_identity ();
- gl->matrix_mode (GLITZ_GL_MODELVIEW);
- gl->push_matrix ();
- gl->load_identity ();
- gl->depth_range (0, 1);
- gl->viewport (-1, -1, 2, 2);
-
- gl->raster_pos_2f (0, 0);
- gl->bitmap (0, 0, 1, 1, x, y, NULL);
-
- gl->pop_matrix ();
- gl->matrix_mode (GLITZ_GL_PROJECTION);
- gl->pop_matrix ();
- gl->pop_attrib ();
+ gl->push_attrib (GLITZ_GL_TRANSFORM_BIT | GLITZ_GL_VIEWPORT_BIT);
+ gl->matrix_mode (GLITZ_GL_PROJECTION);
+ gl->push_matrix ();
+ gl->load_identity ();
+ gl->matrix_mode (GLITZ_GL_MODELVIEW);
+ gl->push_matrix ();
+ gl->load_identity ();
+ gl->depth_range (0, 1);
+ gl->viewport (-1, -1, 2, 2);
+
+ gl->raster_pos_2f (0, 0);
+ gl->bitmap (0, 0, 1, 1, x, y, NULL);
+
+ gl->pop_matrix ();
+ gl->matrix_mode (GLITZ_GL_PROJECTION);
+ gl->pop_matrix ();
+ gl->pop_attrib ();
}
void
glitz_clamp_value (glitz_float_t *value,
- glitz_float_t min, glitz_float_t max)
+ glitz_float_t min, glitz_float_t max)
{
- if (*value < min)
- *value = min;
- else if (*value > max)
- *value = max;
+ if (*value < min)
+ *value = min;
+ else if (*value > max)
+ *value = max;
}
void
glitz_initiate_state (glitz_gl_proc_address_list_t *gl)
{
- gl->hint (GLITZ_GL_PERSPECTIVE_CORRECTION_HINT, GLITZ_GL_FASTEST);
- gl->disable (GLITZ_GL_CULL_FACE);
- gl->depth_mask (GLITZ_GL_FALSE);
- gl->polygon_mode (GLITZ_GL_FRONT_AND_BACK, GLITZ_GL_FILL);
- gl->disable (GLITZ_GL_POLYGON_SMOOTH);
- gl->disable (GLITZ_GL_LINE_SMOOTH);
- gl->disable (GLITZ_GL_POINT_SMOOTH);
- gl->shade_model (GLITZ_GL_FLAT);
- gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE, GLITZ_GL_TRUE, GLITZ_GL_TRUE);
- gl->enable (GLITZ_GL_SCISSOR_TEST);
- gl->disable (GLITZ_GL_STENCIL_TEST);
- gl->enable_client_state (GLITZ_GL_VERTEX_ARRAY);
- gl->disable (GLITZ_GL_DEPTH_TEST);
+ gl->hint (GLITZ_GL_PERSPECTIVE_CORRECTION_HINT, GLITZ_GL_FASTEST);
+ gl->disable (GLITZ_GL_CULL_FACE);
+ gl->depth_mask (GLITZ_GL_FALSE);
+ gl->polygon_mode (GLITZ_GL_FRONT_AND_BACK, GLITZ_GL_FILL);
+ gl->disable (GLITZ_GL_POLYGON_SMOOTH);
+ gl->disable (GLITZ_GL_LINE_SMOOTH);
+ gl->disable (GLITZ_GL_POINT_SMOOTH);
+ gl->shade_model (GLITZ_GL_FLAT);
+ gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE,
+ GLITZ_GL_TRUE, GLITZ_GL_TRUE);
+ gl->enable (GLITZ_GL_SCISSOR_TEST);
+ gl->disable (GLITZ_GL_STENCIL_TEST);
+ gl->enable_client_state (GLITZ_GL_VERTEX_ARRAY);
+ gl->disable (GLITZ_GL_DEPTH_TEST);
}
Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- glitzint.h 4 Jul 2005 10:33:01 -0000 1.35
+++ glitzint.h 14 Sep 2005 15:57:16 -0000 1.36
@@ -1,6 +1,6 @@
/*
* Copyright © 2004 David Reveman
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
@@ -88,7 +88,7 @@
#define GLITZ_CONTEXT_STACK_SIZE 16
typedef struct _glitz_gl_proc_address_list_t {
-
+
/* core */
glitz_gl_enable_t enable;
glitz_gl_disable_t disable;
@@ -145,6 +145,7 @@
glitz_gl_bind_texture_t bind_texture;
glitz_gl_tex_image_2d_t tex_image_2d;
glitz_gl_tex_parameter_i_t tex_parameter_i;
+ glitz_gl_tex_parameter_fv_t tex_parameter_fv;
glitz_gl_get_tex_level_parameter_iv_t get_tex_level_parameter_iv;
glitz_gl_copy_tex_sub_image_2d_t copy_tex_sub_image_2d;
glitz_gl_get_integer_v_t get_integer_v;
@@ -171,8 +172,14 @@
glitz_gl_gen_framebuffers_t gen_framebuffers;
glitz_gl_delete_framebuffers_t delete_framebuffers;
glitz_gl_bind_framebuffer_t bind_framebuffer;
- glitz_gl_check_framebuffer_status_t check_framebuffer_status;
+ glitz_gl_framebuffer_renderbuffer_t framebuffer_renderbuffer;
glitz_gl_framebuffer_texture_2d_t framebuffer_texture_2d;
+ glitz_gl_check_framebuffer_status_t check_framebuffer_status;
+ glitz_gl_gen_renderbuffers_t gen_renderbuffers;
+ glitz_gl_delete_renderbuffers_t delete_renderbuffers;
+ glitz_gl_bind_renderbuffer_t bind_renderbuffer;
+ glitz_gl_renderbuffer_storage_t renderbuffer_storage;
+ glitz_gl_get_renderbuffer_parameter_iv_t get_renderbuffer_parameter_iv;
} glitz_gl_proc_address_list_t;
typedef int glitz_surface_type_t;
@@ -307,52 +314,81 @@
extern glitz_status_t __internal_linkage
glitz_region_union (glitz_region_t *region,
- glitz_box_t *box);
+ glitz_box_t *box);
+
+#define GLITZ_DRAWABLE_TYPE_WINDOW_MASK (1L << 0)
+#define GLITZ_DRAWABLE_TYPE_PBUFFER_MASK (1L << 1)
+#define GLITZ_DRAWABLE_TYPE_FBO_MASK (1L << 2)
+
+#define GLITZ_INT_FORMAT_WINDOW_MASK (1L << 17)
+#define GLITZ_INT_FORMAT_PBUFFER_MASK (1L << 18)
+#define GLITZ_INT_FORMAT_FBO_MASK (1L << 19)
+
+typedef struct _glitz_int_drawable_format_t {
+ glitz_drawable_format_t d;
+ unsigned int types;
+ int caveat;
+ union {
+ void *ptr;
+ long val;
+ unsigned long uval;
+ void *(*fptr) (void);
+ } u;
+} glitz_int_drawable_format_t;
typedef struct glitz_backend {
glitz_drawable_t *
(*create_pbuffer) (void *drawable,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
+ glitz_drawable_format_t *format,
+ unsigned int width,
+ unsigned int height);
+
void
(*destroy) (void *drawable);
- void
+ glitz_bool_t
(*push_current) (void *drawable,
- glitz_surface_t *surface,
- glitz_constraint_t constraint);
+ glitz_surface_t *surface,
+ glitz_constraint_t constraint);
glitz_surface_t *
(*pop_current) (void *drawable);
void
+ (*attach_notify) (void *drawable,
+ glitz_surface_t *surface);
+
+ void
+ (*detach_notify) (void *drawable,
+ glitz_surface_t *surface);
+
+ glitz_bool_t
(*swap_buffers) (void *drawable);
+
glitz_context_t *
(*create_context) (void *drawable,
- glitz_drawable_format_t *format);
+ glitz_drawable_format_t *format);
void
(*destroy_context) (void *context);
void
(*copy_context) (void *src,
- void *dst,
- unsigned long mask);
+ void *dst,
+ unsigned long mask);
void
- (*make_current) (void *context,
- void *drawable);
+ (*make_current) (void *drawable,
+ void *context);
glitz_function_pointer_t
(*get_proc_address) (void *context,
- const char *name);
+ const char *name);
- glitz_gl_proc_address_list_t gl;
-
- glitz_drawable_format_t *drawable_formats;
+ glitz_gl_proc_address_list_t *gl;
+
+ glitz_int_drawable_format_t *drawable_formats;
int n_drawable_formats;
glitz_gl_int_t *texture_formats;
@@ -360,25 +396,30 @@
int n_formats;
glitz_gl_float_t gl_version;
+ glitz_gl_int_t max_viewport_dims[2];
glitz_gl_int_t max_texture_2d_size;
glitz_gl_int_t max_texture_rect_size;
unsigned long feature_mask;
-
+
glitz_program_map_t *program_map;
} glitz_backend_t;
struct _glitz_drawable {
- glitz_backend_t *backend;
-
- int ref_count;
- glitz_drawable_format_t *format;
- int width, height;
- glitz_rectangle_t viewport;
- glitz_bool_t update_all;
+ glitz_backend_t *backend;
+ int ref_count;
+ glitz_int_drawable_format_t *format;
+ int width, height;
+ glitz_rectangle_t viewport;
+ glitz_bool_t update_all;
+ glitz_surface_t *front;
+ glitz_surface_t *back;
};
#define GLITZ_GL_DRAWABLE(drawable) \
- glitz_gl_proc_address_list_t *gl = &(drawable)->backend->gl;
+ glitz_gl_proc_address_list_t *gl = (drawable)->backend->gl;
+
+#define DRAWABLE_IS_FBO(drawable) \
+ ((drawable)->format->types == GLITZ_DRAWABLE_TYPE_FBO_MASK)
typedef struct _glitz_vec2_t {
glitz_float_t v[2];
@@ -405,30 +446,43 @@
#define TEXTURE_INVALID_SIZE(texture) \
((texture)->flags & GLITZ_TEXTURE_FLAG_INVALID_SIZE_MASK)
+typedef struct _glitz_texture_parameters {
+ glitz_gl_enum_t filter[2];
+ glitz_gl_enum_t wrap[2];
+ glitz_color_t border_color;
+} glitz_texture_parameters_t;
+
typedef struct _glitz_texture {
glitz_gl_uint_t name;
glitz_gl_enum_t target;
glitz_gl_int_t format;
unsigned long flags;
-
- glitz_gl_enum_t filter;
- glitz_gl_enum_t wrap;
-
- int width;
- int height;
- glitz_box_t box;
-
- glitz_float_t texcoord_width_unit;
- glitz_float_t texcoord_height_unit;
+ glitz_texture_parameters_t param;
+
+ int width;
+ int height;
+
+ glitz_box_t box;
+
+ glitz_float_t texcoord_width_unit;
+ glitz_float_t texcoord_height_unit;
} glitz_texture_t;
+struct _glitz_texture_object {
+ glitz_surface_t *surface;
+ int ref_count;
+ glitz_texture_parameters_t param;
+};
+
struct _glitz_buffer {
glitz_gl_uint_t name;
glitz_gl_enum_t target;
void *data;
int owns_data;
int ref_count;
+ glitz_surface_t *front_surface;
+ glitz_surface_t *back_surface;
glitz_drawable_t *drawable;
};
@@ -538,10 +592,6 @@
#define SURFACE_PROJECTIVE_TRANSFORM(surface) \
((surface)->flags & GLITZ_SURFACE_FLAG_PROJECTIVE_TRANSFORM_MASK)
-#define SURFACE_DRAWABLE_HEIGHT(surface) \
- (((surface)->attached) ? \
- (surface)->attached->height: surface->texture.height)
-
typedef struct _glitz_filter_params_t glitz_filter_params_t;
typedef struct _glitz_matrix {
@@ -549,10 +599,6 @@
glitz_float_t m[16];
} glitz_matrix_t;
-typedef struct _glitz_framebuffer {
- glitz_gl_uint_t name;
-} glitz_framebuffer_t;
-
#define GLITZ_DAMAGE_TEXTURE_MASK (1 << 0)
#define GLITZ_DAMAGE_DRAWABLE_MASK (1 << 1)
#define GLITZ_DAMAGE_SOLID_MASK (1 << 2)
@@ -587,11 +633,12 @@
int *primcount;
glitz_region_t texture_damage;
glitz_region_t drawable_damage;
- glitz_framebuffer_t framebuffer;
+ unsigned int flip_count;
+ glitz_gl_int_t fb;
};
#define GLITZ_GL_SURFACE(surface) \
- glitz_gl_proc_address_list_t *gl = &(surface)->drawable->backend->gl;
+ glitz_gl_proc_address_list_t *gl = (surface)->drawable->backend->gl;
struct _glitz_context {
int ref_count;
@@ -634,160 +681,169 @@
extern void __internal_linkage
glitz_set_operator (glitz_gl_proc_address_list_t *gl,
- glitz_operator_t op);
+ glitz_operator_t op);
unsigned long
glitz_extensions_query (glitz_gl_float_t version,
- const char *extensions_string,
- glitz_extension_map *extensions_map);
+ const char *extensions_string,
+ glitz_extension_map *extensions_map);
typedef glitz_function_pointer_t (* glitz_get_proc_address_proc_t)
(const char *name, void *closure);
void
glitz_backend_init (glitz_backend_t *backend,
- glitz_get_proc_address_proc_t get_proc_address,
- void *closure);
+ glitz_get_proc_address_proc_t get_proc_address,
+ void *closure);
extern unsigned int __internal_linkage
glitz_uint_to_power_of_two (unsigned int x);
extern void __internal_linkage
glitz_set_raster_pos (glitz_gl_proc_address_list_t *gl,
- glitz_float_t x,
- glitz_float_t y);
+ glitz_float_t x,
+ glitz_float_t y);
extern void __internal_linkage
glitz_clamp_value (glitz_float_t *value,
- glitz_float_t min,
- glitz_float_t max);
+ glitz_float_t min,
+ glitz_float_t max);
void
glitz_initiate_state (glitz_gl_proc_address_list_t *gl);
void
glitz_create_surface_formats (glitz_gl_proc_address_list_t *gl,
- glitz_format_t **formats,
- glitz_gl_int_t **texture_formats,
- int *n_formats);
+ glitz_format_t **formats,
+ glitz_gl_int_t **texture_formats,
+ int *n_formats);
+
+extern void __internal_linkage
+_glitz_add_drawable_formats (glitz_gl_proc_address_list_t *gl,
+ unsigned long feature_mask,
+ glitz_int_drawable_format_t **formats,
+ int *n_formats);
+
+void
+glitz_drawable_format_copy (const glitz_drawable_format_t *src,
+ glitz_drawable_format_t *dst,
+ unsigned long mask);
glitz_drawable_format_t *
-glitz_drawable_format_find (glitz_drawable_format_t *formats,
- int n_formats,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
+glitz_drawable_format_find (glitz_int_drawable_format_t *formats,
+ int n_formats,
+ unsigned long mask,
+ const glitz_int_drawable_format_t *templ,
+ int count);
void
glitz_texture_init (glitz_texture_t *texture,
- int width,
- int height,
- glitz_gl_int_t texture_format,
- unsigned long feature_mask,
- glitz_bool_t unnormalized);
+ int width,
+ int height,
+ glitz_gl_int_t texture_format,
+ unsigned long feature_mask,
+ glitz_bool_t unnormalized);
void
glitz_texture_fini (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture);
+ glitz_texture_t *texture);
void
glitz_texture_size_check (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_gl_int_t max_2d,
- glitz_gl_int_t max_rect);
+ glitz_texture_t *texture,
+ glitz_gl_int_t max_2d,
+ glitz_gl_int_t max_rect);
void
glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture);
-
-extern void __internal_linkage
-glitz_texture_ensure_filter (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_gl_enum_t filter);
+ glitz_texture_t *texture);
extern void __internal_linkage
-glitz_texture_ensure_wrap (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_gl_enum_t wrap);
+glitz_texture_ensure_parameters (glitz_gl_proc_address_list_t *gl,
+ glitz_texture_t *texture,
+ glitz_texture_parameters_t *param);
void
glitz_texture_bind (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture);
+ glitz_texture_t *texture);
void
glitz_texture_unbind (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture);
+ glitz_texture_t *texture);
void
glitz_texture_copy_drawable (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_drawable_t *drawable,
- int x_drawable,
- int y_drawable,
- int width,
- int height,
- int x_texture,
- int y_texture);
+ glitz_texture_t *texture,
+ glitz_drawable_t *drawable,
+ int x_drawable,
+ int y_drawable,
+ int width,
+ int height,
+ int x_texture,
+ int y_texture);
void
glitz_texture_set_tex_gen (glitz_gl_proc_address_list_t *gl,
- glitz_texture_t *texture,
- glitz_geometry_t *geometry,
- int x_src,
- int y_src,
- unsigned long flags,
- glitz_int_coordinate_t *coord);
+ glitz_texture_t *texture,
+ glitz_geometry_t *geometry,
+ int x_src,
+ int y_src,
+ unsigned long flags,
+ glitz_int_coordinate_t *coord);
+
+extern void __internal_linkage
+_glitz_surface_sync_texture (glitz_surface_t *surface);
extern glitz_texture_t __internal_linkage *
glitz_surface_get_texture (glitz_surface_t *surface,
- glitz_bool_t allocate);
+ glitz_bool_t allocate);
extern void __internal_linkage
glitz_surface_sync_solid (glitz_surface_t *surface);
extern glitz_bool_t __internal_linkage
glitz_surface_push_current (glitz_surface_t *surface,
- glitz_constraint_t constraint);
+ glitz_constraint_t constraint);
extern void __internal_linkage
glitz_surface_pop_current (glitz_surface_t *surface);
extern void __internal_linkage
glitz_surface_damage (glitz_surface_t *surface,
- glitz_box_t *box,
- int what);
+ glitz_box_t *box,
+ int what);
extern void __internal_linkage
glitz_surface_sync_drawable (glitz_surface_t *surface);
extern void __internal_linkage
glitz_surface_status_add (glitz_surface_t *surface,
- int flags);
+ int flags);
extern unsigned long __internal_linkage
glitz_status_to_status_mask (glitz_status_t status);
-
+
extern glitz_status_t __internal_linkage
glitz_status_pop_from_mask (unsigned long *mask);
void
glitz_program_map_init (glitz_program_map_t *map);
-
+
void
glitz_program_map_fini (glitz_gl_proc_address_list_t *gl,
- glitz_program_map_t *map);
+ glitz_program_map_t *map);
extern glitz_gl_uint_t __internal_linkage
glitz_get_fragment_program (glitz_composite_op_t *op,
- int fp_type,
- int id);
+ int fp_type,
+ int id);
extern void __internal_linkage
glitz_composite_op_init (glitz_composite_op_t *op,
- glitz_operator_t render_op,
- glitz_surface_t *src,
- glitz_surface_t *mask,
- glitz_surface_t *dst);
+ glitz_operator_t render_op,
+ glitz_surface_t *src,
+ glitz_surface_t *mask,
+ glitz_surface_t *dst);
extern void __internal_linkage
glitz_composite_enable (glitz_composite_op_t *op);
@@ -797,71 +853,69 @@
extern void __internal_linkage *
glitz_buffer_bind (glitz_buffer_t *buffer,
- glitz_gl_enum_t target);
+ glitz_gl_enum_t target);
extern void __internal_linkage
glitz_buffer_unbind (glitz_buffer_t *buffer);
extern glitz_status_t __internal_linkage
glitz_filter_set_params (glitz_surface_t *surface,
- glitz_filter_t filter,
- glitz_fixed16_16_t *params,
- int n_params);
+ glitz_filter_t filter,
+ glitz_fixed16_16_t *params,
+ int n_params);
extern void __internal_linkage
glitz_filter_set_type (glitz_surface_t *surface,
- glitz_filter_t filter);
+ glitz_filter_t filter);
extern glitz_gl_uint_t __internal_linkage
glitz_filter_get_vertex_program (glitz_surface_t *surface,
- glitz_composite_op_t *op);
+ glitz_composite_op_t *op);
extern glitz_gl_uint_t __internal_linkage
glitz_filter_get_fragment_program (glitz_surface_t *surface,
- glitz_composite_op_t *op);
+ glitz_composite_op_t *op);
extern void __internal_linkage
glitz_filter_enable (glitz_surface_t *surface,
- glitz_composite_op_t *op);
+ glitz_composite_op_t *op);
extern void __internal_linkage
glitz_geometry_enable_none (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *box);
+ glitz_surface_t *dst,
+ glitz_box_t *box);
extern void __internal_linkage
glitz_geometry_enable (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *box);
+ glitz_surface_t *dst,
+ glitz_box_t *box);
extern void __internal_linkage
glitz_geometry_disable (glitz_surface_t *dst);
extern void __internal_linkage
glitz_geometry_draw_arrays (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_geometry_type_t type,
- glitz_box_t *bounds,
- int damage);
-
-extern void __internal_linkage
-glitz_framebuffer_init (glitz_framebuffer_t *framebuffer);
-
-extern void __internal_linkage
-glitz_framebuffer_fini (glitz_gl_proc_address_list_t *gl,
- glitz_framebuffer_t *framebuffer);
+ glitz_surface_t *dst,
+ glitz_geometry_type_t type,
+ glitz_box_t *bounds,
+ int damage);
-extern void __internal_linkage
-glitz_framebuffer_unbind (glitz_gl_proc_address_list_t *gl);
+void
+_glitz_drawable_init (glitz_drawable_t *drawable,
+ glitz_int_drawable_format_t *format,
+ glitz_backend_t *backend,
+ int width,
+ int height);
-extern glitz_bool_t __internal_linkage
-glitz_framebuffer_complete (glitz_gl_proc_address_list_t *gl,
- glitz_framebuffer_t *framebuffer,
- glitz_texture_t *texture);
+extern glitz_drawable_t __internal_linkage *
+_glitz_fbo_drawable_create (glitz_drawable_t *other,
+ glitz_int_drawable_format_t *format,
+ int width,
+ int height);
void
_glitz_context_init (glitz_context_t *context,
- glitz_drawable_t *drawable);
+ glitz_drawable_t *drawable);
void
_glitz_context_fini (glitz_context_t *context);
@@ -912,8 +966,8 @@
typedef int32_t glitz_fixed_16_16;
/*
- * An unadorned "glitz_fixed" is the same as glitz_fixed_16_16,
- * (since it's quite common in the code)
+ * An unadorned "glitz_fixed" is the same as glitz_fixed_16_16,
+ * (since it's quite common in the code)
*/
typedef glitz_fixed_16_16 glitz_fixed;
@@ -941,14 +995,15 @@
#define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
-/* Avoid unnecessary PLT entries. */
+/* Avoid unnecessary PLT entries. */
-slim_hidden_proto(glitz_find_similar_drawable_format)
+slim_hidden_proto(glitz_find_drawable_format)
+slim_hidden_proto(glitz_find_pbuffer_format)
+slim_hidden_proto(glitz_create_drawable)
slim_hidden_proto(glitz_create_pbuffer_drawable)
slim_hidden_proto(glitz_drawable_get_width)
slim_hidden_proto(glitz_drawable_get_height)
slim_hidden_proto(glitz_drawable_swap_buffers)
-slim_hidden_proto(glitz_drawable_swap_buffers)
slim_hidden_proto(glitz_drawable_flush)
slim_hidden_proto(glitz_drawable_finish)
slim_hidden_proto(glitz_drawable_get_features)
- Previous message: [cairo-commit] glitz/src/glx glitz-glx.h, 1.3,
1.4 glitz_glx_context.c, 1.6, 1.7 glitz_glx_drawable.c, 1.3,
1.4 glitz_glx_extension.c, 1.2, 1.3 glitz_glx_format.c, 1.3,
1.4 glitz_glx_info.c, 1.4, 1.5 glitz_glx_pbuffer.c, 1.2,
1.3 glitz_glxext.h, 1.2, 1.3 glitz_glxint.h, 1.4, 1.5
- Next message: [cairo-commit] glitzinfo glitzinfo.c,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list