summaryrefslogtreecommitdiff
path: root/src/glitz.h
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2005-09-14 15:57:16 +0000
committerDavid Reveman <davidr@novell.com>2005-09-14 15:57:16 +0000
commit5c13cb3ce423a6085da906e6356e312eeebb47a1 (patch)
treeffbd70eda23e7bb6dd8143c6f17f6b3dd0a4c6e6 /src/glitz.h
parente5a75e4b8433403e6ad5aab5c3a67df2f2b8cc98 (diff)
Merge new code
Diffstat (limited to 'src/glitz.h')
-rw-r--r--src/glitz.h459
1 files changed, 264 insertions, 195 deletions
diff --git a/src/glitz.h b/src/glitz.h
index 53dbcec..f07d5d1 100644
--- a/src/glitz.h
+++ b/src/glitz.h
@@ -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 float glitz_float_t;
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_trapezoid_t {
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 @@ typedef struct {
unsigned short blue;
unsigned short alpha;
} glitz_color_t;
-
+
typedef enum {
GLITZ_FILTER_NEAREST,
GLITZ_FILTER_BILINEAR,
@@ -137,13 +140,16 @@ typedef enum {
#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 @@ typedef struct _glitz_color_format_t {
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_status_string (glitz_status_t status);
/* 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 @@ glitz_drawable_reference (glitz_drawable_t *drawable);
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 @@ unsigned int
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_get_features (glitz_drawable_t *drawable);
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 @@ glitz_surface_reference (glitz_surface_t *surface);
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 @@ glitz_surface_get_attached_drawable (glitz_surface_t *surface);
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 @@ typedef enum {
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 @@ glitz_surface_get_format (glitz_surface_t *surface);
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 @@ glitz_context_reference (glitz_context_t *context);
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 @@ typedef enum {
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 @@ glitz_buffer_reference (glitz_buffer_t *buffer);
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 @@ typedef struct _glitz_pixel_format {
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 @@ typedef enum {
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 @@ typedef union _glitz_geometry_format {
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 @@ glitz_multi_array_reference (glitz_multi_array_t *array);
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