mirror of
https://github.com/brl/mutter.git
synced 2025-03-03 19:58:10 +00:00
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so this is a first pass at tidying things up by giving them some consistency. These changes are all consistent with how new code in Cogl is being written, but the style isn't consistently applied across all code yet. There are two parts to this patch; but since each one required a large amount of effort to maintain tidy indenting it made sense to combine the changes to reduce the time spent re indenting the same lines. The first change is to use a consistent style for declaring function prototypes in headers. Cogl headers now consistently use this style for prototypes: return_type cogl_function_name (CoglType arg0, CoglType arg1); Not everyone likes this style, but it seems that most of the currently active Cogl developers agree on it. The second change is to constrain the use of redundant glib data types in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all been replaced with int, unsigned int, float, long, unsigned long and char respectively. When talking about pixel data; use of guchar has been replaced with guint8, otherwise unsigned char can be used. The glib types that we continue to use for portability are gboolean, gint{8,16,32,64}, guint{8,16,32,64} and gsize. The general intention is that Cogl should look palatable to the widest range of C programmers including those outside the Gnome community so - especially for the public API - we want to minimize the number of foreign looking typedefs.
This commit is contained in:
parent
10fa7c7ce9
commit
0f5f4e8645
@ -92,8 +92,8 @@ typedef struct _CoglAtlasTextureBlitData
|
|||||||
complete texture data in */
|
complete texture data in */
|
||||||
unsigned char *image_data;
|
unsigned char *image_data;
|
||||||
CoglPixelFormat format;
|
CoglPixelFormat format;
|
||||||
gint bpp;
|
int bpp;
|
||||||
guint src_height, src_width;
|
unsigned int src_height, src_width;
|
||||||
|
|
||||||
GLenum dst_gl_target;
|
GLenum dst_gl_target;
|
||||||
} CoglAtlasTextureBlitData;
|
} CoglAtlasTextureBlitData;
|
||||||
@ -169,12 +169,12 @@ _cogl_atlas_texture_blit_begin (CoglAtlasTextureBlitData *data,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_blit (CoglAtlasTextureBlitData *data,
|
_cogl_atlas_texture_blit (CoglAtlasTextureBlitData *data,
|
||||||
guint src_x,
|
unsigned int src_x,
|
||||||
guint src_y,
|
unsigned int src_y,
|
||||||
guint dst_x,
|
unsigned int dst_x,
|
||||||
guint dst_y,
|
unsigned int dst_y,
|
||||||
guint width,
|
unsigned int width,
|
||||||
guint height)
|
unsigned int height)
|
||||||
{
|
{
|
||||||
/* If we have an FBO then we can do a fast blit */
|
/* If we have an FBO then we can do a fast blit */
|
||||||
if (data->fbo)
|
if (data->fbo)
|
||||||
@ -269,7 +269,7 @@ _cogl_atlas_texture_free (CoglAtlasTexture *atlas_tex)
|
|||||||
cogl_handle_unref (atlas_tex->sub_texture);
|
cogl_handle_unref (atlas_tex->sub_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_atlas_texture_get_max_waste (CoglTexture *tex)
|
_cogl_atlas_texture_get_max_waste (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
||||||
@ -506,7 +506,7 @@ _cogl_atlas_texture_set_region (CoglTexture *tex,
|
|||||||
pixels to the border */
|
pixels to the border */
|
||||||
if (atlas_tex->in_atlas)
|
if (atlas_tex->in_atlas)
|
||||||
{
|
{
|
||||||
gint bpp;
|
int bpp;
|
||||||
CoglBitmap source_bmp;
|
CoglBitmap source_bmp;
|
||||||
CoglBitmap tmp_bmp;
|
CoglBitmap tmp_bmp;
|
||||||
gboolean tmp_bmp_owner = FALSE;
|
gboolean tmp_bmp_owner = FALSE;
|
||||||
@ -524,7 +524,7 @@ _cogl_atlas_texture_set_region (CoglTexture *tex,
|
|||||||
source_bmp.width = width;
|
source_bmp.width = width;
|
||||||
source_bmp.height = height;
|
source_bmp.height = height;
|
||||||
source_bmp.format = format;
|
source_bmp.format = format;
|
||||||
source_bmp.data = (guchar*) data;
|
source_bmp.data = (guint8 *)data;
|
||||||
|
|
||||||
/* Rowstride from width if none specified */
|
/* Rowstride from width if none specified */
|
||||||
bpp = _cogl_get_format_bpp (format);
|
bpp = _cogl_get_format_bpp (format);
|
||||||
@ -604,7 +604,7 @@ _cogl_atlas_texture_get_gl_format (CoglTexture *tex)
|
|||||||
return _cogl_texture_get_gl_format (atlas_tex->sub_texture);
|
return _cogl_texture_get_gl_format (atlas_tex->sub_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_atlas_texture_get_width (CoglTexture *tex)
|
_cogl_atlas_texture_get_width (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
||||||
@ -613,7 +613,7 @@ _cogl_atlas_texture_get_width (CoglTexture *tex)
|
|||||||
return cogl_texture_get_width (atlas_tex->sub_texture);
|
return cogl_texture_get_width (atlas_tex->sub_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_atlas_texture_get_height (CoglTexture *tex)
|
_cogl_atlas_texture_get_height (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
||||||
@ -644,13 +644,13 @@ typedef struct _CoglAtlasTextureRepositionData
|
|||||||
} CoglAtlasTextureRepositionData;
|
} CoglAtlasTextureRepositionData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_migrate (guint n_textures,
|
_cogl_atlas_texture_migrate (unsigned int n_textures,
|
||||||
CoglAtlasTextureRepositionData *textures,
|
CoglAtlasTextureRepositionData *textures,
|
||||||
CoglHandle old_texture,
|
CoglHandle old_texture,
|
||||||
CoglHandle new_texture,
|
CoglHandle new_texture,
|
||||||
CoglAtlasTexture *skip_texture)
|
CoglAtlasTexture *skip_texture)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
CoglAtlasTextureBlitData blit_data;
|
CoglAtlasTextureBlitData blit_data;
|
||||||
|
|
||||||
_cogl_atlas_texture_blit_begin (&blit_data, new_texture, old_texture);
|
_cogl_atlas_texture_blit_begin (&blit_data, new_texture, old_texture);
|
||||||
@ -686,7 +686,7 @@ typedef struct _CoglAtlasTextureGetRectanglesData
|
|||||||
{
|
{
|
||||||
CoglAtlasTextureRepositionData *textures;
|
CoglAtlasTextureRepositionData *textures;
|
||||||
/* Number of textures found so far */
|
/* Number of textures found so far */
|
||||||
guint n_textures;
|
unsigned int n_textures;
|
||||||
} CoglAtlasTextureGetRectanglesData;
|
} CoglAtlasTextureGetRectanglesData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -700,8 +700,8 @@ _cogl_atlas_texture_get_rectangles_cb (const CoglAtlasRectangle *rectangle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_get_next_size (guint *atlas_width,
|
_cogl_atlas_texture_get_next_size (unsigned int *atlas_width,
|
||||||
guint *atlas_height)
|
unsigned int *atlas_height)
|
||||||
{
|
{
|
||||||
/* Double the size of the texture by increasing whichever dimension
|
/* Double the size of the texture by increasing whichever dimension
|
||||||
is smaller */
|
is smaller */
|
||||||
@ -712,9 +712,9 @@ _cogl_atlas_texture_get_next_size (guint *atlas_width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglAtlas *
|
static CoglAtlas *
|
||||||
_cogl_atlas_texture_create_atlas (guint atlas_width,
|
_cogl_atlas_texture_create_atlas (unsigned int atlas_width,
|
||||||
guint atlas_height,
|
unsigned int atlas_height,
|
||||||
guint n_textures,
|
unsigned int n_textures,
|
||||||
CoglAtlasTextureRepositionData *textures)
|
CoglAtlasTextureRepositionData *textures)
|
||||||
{
|
{
|
||||||
GLint max_texture_size = 1024;
|
GLint max_texture_size = 1024;
|
||||||
@ -731,7 +731,7 @@ _cogl_atlas_texture_create_atlas (guint atlas_width,
|
|||||||
while (atlas_width < max_texture_size && atlas_height < max_texture_size)
|
while (atlas_width < max_texture_size && atlas_height < max_texture_size)
|
||||||
{
|
{
|
||||||
CoglAtlas *new_atlas = _cogl_atlas_new (atlas_width, atlas_height, NULL);
|
CoglAtlas *new_atlas = _cogl_atlas_new (atlas_width, atlas_height, NULL);
|
||||||
guint i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Add all of the textures and keep track of the new position */
|
/* Add all of the textures and keep track of the new position */
|
||||||
for (i = 0; i < n_textures; i++)
|
for (i = 0; i < n_textures; i++)
|
||||||
@ -763,7 +763,7 @@ _cogl_atlas_texture_compare_size_cb (const void *a,
|
|||||||
{
|
{
|
||||||
const CoglAtlasTextureRepositionData *ta = a;
|
const CoglAtlasTextureRepositionData *ta = a;
|
||||||
const CoglAtlasTextureRepositionData *tb = b;
|
const CoglAtlasTextureRepositionData *tb = b;
|
||||||
guint a_size, b_size;
|
unsigned int a_size, b_size;
|
||||||
|
|
||||||
a_size = ta->texture->rectangle.width * ta->texture->rectangle.height;
|
a_size = ta->texture->rectangle.width * ta->texture->rectangle.height;
|
||||||
b_size = tb->texture->rectangle.width * tb->texture->rectangle.height;
|
b_size = tb->texture->rectangle.width * tb->texture->rectangle.height;
|
||||||
@ -773,13 +773,13 @@ _cogl_atlas_texture_compare_size_cb (const void *a,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_atlas_texture_reserve_space (CoglAtlasTexture *new_sub_tex,
|
_cogl_atlas_texture_reserve_space (CoglAtlasTexture *new_sub_tex,
|
||||||
guint width,
|
unsigned int width,
|
||||||
guint height)
|
unsigned int height)
|
||||||
{
|
{
|
||||||
CoglAtlasTextureGetRectanglesData data;
|
CoglAtlasTextureGetRectanglesData data;
|
||||||
CoglAtlas *new_atlas;
|
CoglAtlas *new_atlas;
|
||||||
CoglHandle new_tex;
|
CoglHandle new_tex;
|
||||||
guint atlas_width, atlas_height;
|
unsigned int atlas_width, atlas_height;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
@ -67,8 +67,8 @@ struct _CoglAtlas
|
|||||||
{
|
{
|
||||||
CoglAtlasNode *root;
|
CoglAtlasNode *root;
|
||||||
|
|
||||||
guint space_remaining;
|
unsigned int space_remaining;
|
||||||
guint n_rectangles;
|
unsigned int n_rectangles;
|
||||||
|
|
||||||
GDestroyNotify value_destroy_func;
|
GDestroyNotify value_destroy_func;
|
||||||
};
|
};
|
||||||
@ -119,7 +119,8 @@ _cogl_atlas_node_free (CoglAtlasNode *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglAtlas *
|
CoglAtlas *
|
||||||
_cogl_atlas_new (guint width, guint height,
|
_cogl_atlas_new (unsigned int width,
|
||||||
|
unsigned int height,
|
||||||
GDestroyNotify value_destroy_func)
|
GDestroyNotify value_destroy_func)
|
||||||
{
|
{
|
||||||
CoglAtlas *atlas = g_new (CoglAtlas, 1);
|
CoglAtlas *atlas = g_new (CoglAtlas, 1);
|
||||||
@ -166,7 +167,7 @@ _cogl_atlas_stack_pop (CoglAtlasStackEntry *stack)
|
|||||||
|
|
||||||
static CoglAtlasNode *
|
static CoglAtlasNode *
|
||||||
_cogl_atlas_node_split_horizontally (CoglAtlasNode *node,
|
_cogl_atlas_node_split_horizontally (CoglAtlasNode *node,
|
||||||
guint left_width)
|
unsigned int left_width)
|
||||||
{
|
{
|
||||||
/* Splits the node horizontally (according to emacs' definition, not
|
/* Splits the node horizontally (according to emacs' definition, not
|
||||||
vim) by converting it to a branch and adding two new leaf
|
vim) by converting it to a branch and adding two new leaf
|
||||||
@ -204,7 +205,7 @@ _cogl_atlas_node_split_horizontally (CoglAtlasNode *node,
|
|||||||
|
|
||||||
static CoglAtlasNode *
|
static CoglAtlasNode *
|
||||||
_cogl_atlas_node_split_vertically (CoglAtlasNode *node,
|
_cogl_atlas_node_split_vertically (CoglAtlasNode *node,
|
||||||
guint top_height)
|
unsigned int top_height)
|
||||||
{
|
{
|
||||||
/* Splits the node vertically (according to emacs' definition, not
|
/* Splits the node vertically (according to emacs' definition, not
|
||||||
vim) by converting it to a branch and adding two new leaf
|
vim) by converting it to a branch and adding two new leaf
|
||||||
@ -242,7 +243,8 @@ _cogl_atlas_node_split_vertically (CoglAtlasNode *node,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_atlas_add_rectangle (CoglAtlas *atlas,
|
_cogl_atlas_add_rectangle (CoglAtlas *atlas,
|
||||||
guint width, guint height,
|
unsigned int width,
|
||||||
|
unsigned int height,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
CoglAtlasRectangle *rectangle)
|
CoglAtlasRectangle *rectangle)
|
||||||
{
|
{
|
||||||
@ -411,25 +413,25 @@ _cogl_atlas_remove_rectangle (CoglAtlas *atlas,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_width (CoglAtlas *atlas)
|
_cogl_atlas_get_width (CoglAtlas *atlas)
|
||||||
{
|
{
|
||||||
return atlas->root->rectangle.width;
|
return atlas->root->rectangle.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_height (CoglAtlas *atlas)
|
_cogl_atlas_get_height (CoglAtlas *atlas)
|
||||||
{
|
{
|
||||||
return atlas->root->rectangle.height;
|
return atlas->root->rectangle.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_remaining_space (CoglAtlas *atlas)
|
_cogl_atlas_get_remaining_space (CoglAtlas *atlas)
|
||||||
{
|
{
|
||||||
return atlas->space_remaining;
|
return atlas->space_remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_n_rectangles (CoglAtlas *atlas)
|
_cogl_atlas_get_n_rectangles (CoglAtlas *atlas)
|
||||||
{
|
{
|
||||||
return atlas->n_rectangles;
|
return atlas->n_rectangles;
|
||||||
|
@ -35,17 +35,19 @@ typedef void (* CoglAtlasCallback) (const CoglAtlasRectangle *rectangle,
|
|||||||
|
|
||||||
struct _CoglAtlasRectangle
|
struct _CoglAtlasRectangle
|
||||||
{
|
{
|
||||||
guint x, y;
|
unsigned int x, y;
|
||||||
guint width, height;
|
unsigned int width, height;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglAtlas *
|
CoglAtlas *
|
||||||
_cogl_atlas_new (guint width, guint height,
|
_cogl_atlas_new (unsigned int width,
|
||||||
|
unsigned int height,
|
||||||
GDestroyNotify value_destroy_func);
|
GDestroyNotify value_destroy_func);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_atlas_add_rectangle (CoglAtlas *atlas,
|
_cogl_atlas_add_rectangle (CoglAtlas *atlas,
|
||||||
guint width, guint height,
|
unsigned int width,
|
||||||
|
unsigned int height,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
CoglAtlasRectangle *rectangle);
|
CoglAtlasRectangle *rectangle);
|
||||||
|
|
||||||
@ -53,16 +55,16 @@ void
|
|||||||
_cogl_atlas_remove_rectangle (CoglAtlas *atlas,
|
_cogl_atlas_remove_rectangle (CoglAtlas *atlas,
|
||||||
const CoglAtlasRectangle *rectangle);
|
const CoglAtlasRectangle *rectangle);
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_width (CoglAtlas *atlas);
|
_cogl_atlas_get_width (CoglAtlas *atlas);
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_height (CoglAtlas *atlas);
|
_cogl_atlas_get_height (CoglAtlas *atlas);
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_remaining_space (CoglAtlas *atlas);
|
_cogl_atlas_get_remaining_space (CoglAtlas *atlas);
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
_cogl_atlas_get_n_rectangles (CoglAtlas *atlas);
|
_cogl_atlas_get_n_rectangles (CoglAtlas *atlas);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
/* TO rgba */
|
/* TO rgba */
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_g_to_rgba (const guchar *src, guchar *dst)
|
_cogl_g_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[0];
|
dst[0] = src[0];
|
||||||
dst[1] = src[0];
|
dst[1] = src[0];
|
||||||
@ -43,7 +43,7 @@ _cogl_g_to_rgba (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgb_to_rgba (const guchar *src, guchar *dst)
|
_cogl_rgb_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[0];
|
dst[0] = src[0];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -52,7 +52,7 @@ _cogl_rgb_to_rgba (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_bgr_to_rgba (const guchar *src, guchar *dst)
|
_cogl_bgr_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[2];
|
dst[0] = src[2];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -61,7 +61,7 @@ _cogl_bgr_to_rgba (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_bgra_to_rgba (const guchar *src, guchar *dst)
|
_cogl_bgra_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[2];
|
dst[0] = src[2];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -70,7 +70,7 @@ _cogl_bgra_to_rgba (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_argb_to_rgba (const guchar *src, guchar *dst)
|
_cogl_argb_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[1];
|
dst[0] = src[1];
|
||||||
dst[1] = src[2];
|
dst[1] = src[2];
|
||||||
@ -79,7 +79,7 @@ _cogl_argb_to_rgba (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_abgr_to_rgba (const guchar *src, guchar *dst)
|
_cogl_abgr_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[3];
|
dst[0] = src[3];
|
||||||
dst[1] = src[2];
|
dst[1] = src[2];
|
||||||
@ -88,7 +88,7 @@ _cogl_abgr_to_rgba (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_rgba (const guchar *src, guchar *dst)
|
_cogl_rgba_to_rgba (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[0];
|
dst[0] = src[0];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -99,13 +99,13 @@ _cogl_rgba_to_rgba (const guchar *src, guchar *dst)
|
|||||||
/* FROM rgba */
|
/* FROM rgba */
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_g (const guchar *src, guchar *dst)
|
_cogl_rgba_to_g (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = (src[0] + src[1] + src[2]) / 3;
|
dst[0] = (src[0] + src[1] + src[2]) / 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_rgb (const guchar *src, guchar *dst)
|
_cogl_rgba_to_rgb (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[0];
|
dst[0] = src[0];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -113,7 +113,7 @@ _cogl_rgba_to_rgb (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_bgr (const guchar *src, guchar *dst)
|
_cogl_rgba_to_bgr (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[2];
|
dst[0] = src[2];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -121,7 +121,7 @@ _cogl_rgba_to_bgr (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_bgra (const guchar *src, guchar *dst)
|
_cogl_rgba_to_bgra (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[2];
|
dst[0] = src[2];
|
||||||
dst[1] = src[1];
|
dst[1] = src[1];
|
||||||
@ -130,7 +130,7 @@ _cogl_rgba_to_bgra (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_argb (const guchar *src, guchar *dst)
|
_cogl_rgba_to_argb (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[3];
|
dst[0] = src[3];
|
||||||
dst[1] = src[0];
|
dst[1] = src[0];
|
||||||
@ -139,7 +139,7 @@ _cogl_rgba_to_argb (const guchar *src, guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_rgba_to_abgr (const guchar *src, guchar *dst)
|
_cogl_rgba_to_abgr (const guint8 *src, guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = src[3];
|
dst[0] = src[3];
|
||||||
dst[1] = src[2];
|
dst[1] = src[2];
|
||||||
@ -150,7 +150,7 @@ _cogl_rgba_to_abgr (const guchar *src, guchar *dst)
|
|||||||
/* (Un)Premultiplication */
|
/* (Un)Premultiplication */
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_unpremult_alpha_0 (guchar *dst)
|
_cogl_unpremult_alpha_0 (guint8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = 0;
|
dst[0] = 0;
|
||||||
dst[1] = 0;
|
dst[1] = 0;
|
||||||
@ -159,9 +159,9 @@ _cogl_unpremult_alpha_0 (guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_unpremult_alpha_last (guchar *dst)
|
_cogl_unpremult_alpha_last (guint8 *dst)
|
||||||
{
|
{
|
||||||
guchar alpha = dst[3];
|
guint8 alpha = dst[3];
|
||||||
|
|
||||||
dst[0] = (dst[0] * 255) / alpha;
|
dst[0] = (dst[0] * 255) / alpha;
|
||||||
dst[1] = (dst[1] * 255) / alpha;
|
dst[1] = (dst[1] * 255) / alpha;
|
||||||
@ -169,9 +169,9 @@ _cogl_unpremult_alpha_last (guchar *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_unpremult_alpha_first (guchar *dst)
|
_cogl_unpremult_alpha_first (guint8 *dst)
|
||||||
{
|
{
|
||||||
guchar alpha = dst[0];
|
guint8 alpha = dst[0];
|
||||||
|
|
||||||
dst[1] = (dst[1] * 255) / alpha;
|
dst[1] = (dst[1] * 255) / alpha;
|
||||||
dst[2] = (dst[2] * 255) / alpha;
|
dst[2] = (dst[2] * 255) / alpha;
|
||||||
@ -189,24 +189,24 @@ _cogl_unpremult_alpha_first (guchar *dst)
|
|||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_premult_alpha_last (guchar *dst)
|
_cogl_premult_alpha_last (guint8 *dst)
|
||||||
{
|
{
|
||||||
guchar alpha = dst[3];
|
guint8 alpha = dst[3];
|
||||||
/* Using a separate temporary per component has given slightly better
|
/* Using a separate temporary per component has given slightly better
|
||||||
* code generation with GCC in the past; it shouldn't do any worse in
|
* code generation with GCC in the past; it shouldn't do any worse in
|
||||||
* any case.
|
* any case.
|
||||||
*/
|
*/
|
||||||
guint t1, t2, t3;
|
unsigned int t1, t2, t3;
|
||||||
MULT(dst[0], alpha, t1);
|
MULT(dst[0], alpha, t1);
|
||||||
MULT(dst[1], alpha, t2);
|
MULT(dst[1], alpha, t2);
|
||||||
MULT(dst[2], alpha, t3);
|
MULT(dst[2], alpha, t3);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void
|
inline static void
|
||||||
_cogl_premult_alpha_first (guchar *dst)
|
_cogl_premult_alpha_first (guint8 *dst)
|
||||||
{
|
{
|
||||||
guchar alpha = dst[0];
|
guint8 alpha = dst[0];
|
||||||
guint t1, t2, t3;
|
unsigned int t1, t2, t3;
|
||||||
|
|
||||||
MULT(dst[1], alpha, t1);
|
MULT(dst[1], alpha, t1);
|
||||||
MULT(dst[2], alpha, t2);
|
MULT(dst[2], alpha, t2);
|
||||||
@ -342,12 +342,12 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
|
|||||||
CoglBitmap *dst_bmp,
|
CoglBitmap *dst_bmp,
|
||||||
CoglPixelFormat dst_format)
|
CoglPixelFormat dst_format)
|
||||||
{
|
{
|
||||||
guchar *src;
|
guint8 *src;
|
||||||
guchar *dst;
|
guint8 *dst;
|
||||||
gint src_bpp;
|
int src_bpp;
|
||||||
gint dst_bpp;
|
int dst_bpp;
|
||||||
gint x,y;
|
int x,y;
|
||||||
guchar temp_rgba[4] = {0,0,0,0};
|
guint8 temp_rgba[4] = {0,0,0,0};
|
||||||
|
|
||||||
/* Make sure conversion supported */
|
/* Make sure conversion supported */
|
||||||
if (!_cogl_bitmap_fallback_can_convert (bmp->format, dst_format))
|
if (!_cogl_bitmap_fallback_can_convert (bmp->format, dst_format))
|
||||||
@ -358,20 +358,20 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
|
|||||||
|
|
||||||
/* Initialize destination bitmap */
|
/* Initialize destination bitmap */
|
||||||
*dst_bmp = *bmp;
|
*dst_bmp = *bmp;
|
||||||
dst_bmp->rowstride = sizeof(guchar) * dst_bpp * dst_bmp->width;
|
dst_bmp->rowstride = sizeof(guint8) * dst_bpp * dst_bmp->width;
|
||||||
dst_bmp->format = ((bmp->format & COGL_PREMULT_BIT) |
|
dst_bmp->format = ((bmp->format & COGL_PREMULT_BIT) |
|
||||||
(dst_format & COGL_UNPREMULT_MASK));
|
(dst_format & COGL_UNPREMULT_MASK));
|
||||||
|
|
||||||
/* Allocate a new buffer to hold converted data */
|
/* Allocate a new buffer to hold converted data */
|
||||||
dst_bmp->data = g_malloc (sizeof(guchar)
|
dst_bmp->data = g_malloc (sizeof(guint8)
|
||||||
* dst_bmp->height
|
* dst_bmp->height
|
||||||
* dst_bmp->rowstride);
|
* dst_bmp->rowstride);
|
||||||
|
|
||||||
/* FIXME: Optimize */
|
/* FIXME: Optimize */
|
||||||
for (y = 0; y < bmp->height; y++)
|
for (y = 0; y < bmp->height; y++)
|
||||||
{
|
{
|
||||||
src = (guchar*)bmp->data + y * bmp->rowstride;
|
src = (guint8*)bmp->data + y * bmp->rowstride;
|
||||||
dst = (guchar*)dst_bmp->data + y * dst_bmp->rowstride;
|
dst = (guint8*)dst_bmp->data + y * dst_bmp->rowstride;
|
||||||
|
|
||||||
for (x = 0; x < bmp->width; x++)
|
for (x = 0; x < bmp->width; x++)
|
||||||
{
|
{
|
||||||
@ -429,8 +429,8 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
|
|||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_fallback_unpremult (CoglBitmap *bmp)
|
_cogl_bitmap_fallback_unpremult (CoglBitmap *bmp)
|
||||||
{
|
{
|
||||||
guchar *p;
|
guint8 *p;
|
||||||
gint x,y;
|
int x,y;
|
||||||
|
|
||||||
/* Make sure format supported for un-premultiplication */
|
/* Make sure format supported for un-premultiplication */
|
||||||
if (!_cogl_bitmap_fallback_can_unpremult (bmp->format))
|
if (!_cogl_bitmap_fallback_can_unpremult (bmp->format))
|
||||||
@ -438,7 +438,7 @@ _cogl_bitmap_fallback_unpremult (CoglBitmap *bmp)
|
|||||||
|
|
||||||
for (y = 0; y < bmp->height; y++)
|
for (y = 0; y < bmp->height; y++)
|
||||||
{
|
{
|
||||||
p = (guchar*) bmp->data + y * bmp->rowstride;
|
p = (guint8*) bmp->data + y * bmp->rowstride;
|
||||||
|
|
||||||
if (bmp->format & COGL_AFIRST_BIT)
|
if (bmp->format & COGL_AFIRST_BIT)
|
||||||
{
|
{
|
||||||
@ -472,8 +472,8 @@ _cogl_bitmap_fallback_unpremult (CoglBitmap *bmp)
|
|||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_fallback_premult (CoglBitmap *bmp)
|
_cogl_bitmap_fallback_premult (CoglBitmap *bmp)
|
||||||
{
|
{
|
||||||
guchar *p;
|
guint8 *p;
|
||||||
gint x,y;
|
int x,y;
|
||||||
|
|
||||||
/* Make sure format supported for un-premultiplication */
|
/* Make sure format supported for un-premultiplication */
|
||||||
if (!_cogl_bitmap_fallback_can_premult (bmp->format))
|
if (!_cogl_bitmap_fallback_can_premult (bmp->format))
|
||||||
@ -481,7 +481,7 @@ _cogl_bitmap_fallback_premult (CoglBitmap *bmp)
|
|||||||
|
|
||||||
for (y = 0; y < bmp->height; y++)
|
for (y = 0; y < bmp->height; y++)
|
||||||
{
|
{
|
||||||
p = (guchar*) bmp->data + y * bmp->rowstride;
|
p = (guint8*) bmp->data + y * bmp->rowstride;
|
||||||
|
|
||||||
if (bmp->format & COGL_AFIRST_BIT)
|
if (bmp->format & COGL_AFIRST_BIT)
|
||||||
{
|
{
|
||||||
@ -525,7 +525,7 @@ _cogl_bitmap_fallback_premult (CoglBitmap *bmp)
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_fallback_from_file (CoglBitmap *bmp,
|
_cogl_bitmap_fallback_from_file (CoglBitmap *bmp,
|
||||||
const gchar *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
/* FIXME: use jpeglib, libpng, etc. manually maybe */
|
/* FIXME: use jpeglib, libpng, etc. manually maybe */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -94,9 +94,9 @@ cogl_bitmap_error_quark (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_get_size_from_file (const gchar *filename,
|
_cogl_bitmap_get_size_from_file (const char *filename,
|
||||||
gint *width,
|
int *width,
|
||||||
gint *height)
|
int *height)
|
||||||
{
|
{
|
||||||
if (width)
|
if (width)
|
||||||
*width = 0;
|
*width = 0;
|
||||||
@ -110,7 +110,7 @@ _cogl_bitmap_get_size_from_file (const gchar *filename,
|
|||||||
/* the error does not contain the filename as the caller already has it */
|
/* the error does not contain the filename as the caller already has it */
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_assert (bmp != NULL);
|
g_assert (bmp != NULL);
|
||||||
@ -145,8 +145,8 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
|
|||||||
CGImageRef image = CGImageSourceCreateImageAtIndex (image_source, 0, NULL);
|
CGImageRef image = CGImageSourceCreateImageAtIndex (image_source, 0, NULL);
|
||||||
CFRelease (image_source);
|
CFRelease (image_source);
|
||||||
|
|
||||||
size_t width = CGImageGetWidth (image);
|
gsize width = CGImageGetWidth (image);
|
||||||
size_t height = CGImageGetHeight (image);
|
gsize height = CGImageGetHeight (image);
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
{
|
{
|
||||||
/* incomplete or corrupt */
|
/* incomplete or corrupt */
|
||||||
@ -157,7 +157,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate buffer big enough to hold pixel data */
|
/* allocate buffer big enough to hold pixel data */
|
||||||
size_t rowstride;
|
gsize rowstride;
|
||||||
rowstride = 4 * width;
|
rowstride = 4 * width;
|
||||||
guint8 *out_data = g_malloc0 (height * rowstride);
|
guint8 *out_data = g_malloc0 (height * rowstride);
|
||||||
|
|
||||||
@ -188,9 +188,9 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
|
|||||||
#elif defined(USE_GDKPIXBUF)
|
#elif defined(USE_GDKPIXBUF)
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_get_size_from_file (const gchar *filename,
|
_cogl_bitmap_get_size_from_file (const char *filename,
|
||||||
gint *width,
|
int *width,
|
||||||
gint *height)
|
int *height)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (filename != NULL, FALSE);
|
g_return_val_if_fail (filename != NULL, FALSE);
|
||||||
|
|
||||||
@ -202,23 +202,23 @@ _cogl_bitmap_get_size_from_file (const gchar *filename,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gboolean has_alpha;
|
gboolean has_alpha;
|
||||||
GdkColorspace color_space;
|
GdkColorspace color_space;
|
||||||
CoglPixelFormat pixel_format;
|
CoglPixelFormat pixel_format;
|
||||||
gint width;
|
int width;
|
||||||
gint height;
|
int height;
|
||||||
gint rowstride;
|
int rowstride;
|
||||||
gint bits_per_sample;
|
int bits_per_sample;
|
||||||
gint n_channels;
|
int n_channels;
|
||||||
gint last_row_size;
|
int last_row_size;
|
||||||
guchar *pixels;
|
guint8 *pixels;
|
||||||
guchar *out_data;
|
guint8 *out_data;
|
||||||
guchar *out;
|
guint8 *out;
|
||||||
gint r;
|
int r;
|
||||||
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
|
|||||||
/* FIXME: Any way to destroy pixbuf but retain pixel data? */
|
/* FIXME: Any way to destroy pixbuf but retain pixel data? */
|
||||||
|
|
||||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||||
out_data = (guchar*) g_malloc (height * rowstride);
|
out_data = g_malloc (height * rowstride);
|
||||||
out = out_data;
|
out = out_data;
|
||||||
|
|
||||||
/* Copy up to last row */
|
/* Copy up to last row */
|
||||||
@ -305,9 +305,9 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
|
|||||||
#include "stb_image.c"
|
#include "stb_image.c"
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_get_size_from_file (const gchar *filename,
|
_cogl_bitmap_get_size_from_file (const char *filename,
|
||||||
gint *width,
|
int *width,
|
||||||
gint *height)
|
int *height)
|
||||||
{
|
{
|
||||||
if (width)
|
if (width)
|
||||||
*width = 0;
|
*width = 0;
|
||||||
@ -320,13 +320,13 @@ _cogl_bitmap_get_size_from_file (const gchar *filename,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gint stb_pixel_format;
|
int stb_pixel_format;
|
||||||
gint width;
|
int width;
|
||||||
gint height;
|
int height;
|
||||||
guchar *pixels;
|
guint8 *pixels;
|
||||||
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@
|
|||||||
typedef struct _CoglBitmap
|
typedef struct _CoglBitmap
|
||||||
{
|
{
|
||||||
CoglHandleObject _parent;
|
CoglHandleObject _parent;
|
||||||
guchar *data;
|
guint8 *data;
|
||||||
CoglPixelFormat format;
|
CoglPixelFormat format;
|
||||||
gint width;
|
int width;
|
||||||
gint height;
|
int height;
|
||||||
gint rowstride;
|
int rowstride;
|
||||||
} CoglBitmap;
|
} CoglBitmap;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -81,12 +81,12 @@ _cogl_bitmap_fallback_premult (CoglBitmap *dst_bmp);
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
_cogl_bitmap_from_file (CoglBitmap *bmp,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_fallback_from_file (CoglBitmap *bmp,
|
_cogl_bitmap_fallback_from_file (CoglBitmap *bmp,
|
||||||
const gchar *filename);
|
const char *filename);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
|
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
|
||||||
@ -100,16 +100,16 @@ _cogl_bitmap_convert_format_and_premult (const CoglBitmap *bmp,
|
|||||||
void
|
void
|
||||||
_cogl_bitmap_copy_subregion (CoglBitmap *src,
|
_cogl_bitmap_copy_subregion (CoglBitmap *src,
|
||||||
CoglBitmap *dst,
|
CoglBitmap *dst,
|
||||||
gint src_x,
|
int src_x,
|
||||||
gint src_y,
|
int src_y,
|
||||||
gint dst_x,
|
int dst_x,
|
||||||
gint dst_y,
|
int dst_y,
|
||||||
gint width,
|
int width,
|
||||||
gint height);
|
int height);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_bitmap_get_size_from_file (const gchar *filename,
|
_cogl_bitmap_get_size_from_file (const char *filename,
|
||||||
gint *width,
|
int *width,
|
||||||
gint *height);
|
int *height);
|
||||||
|
|
||||||
#endif /* __COGL_BITMAP_H */
|
#endif /* __COGL_BITMAP_H */
|
||||||
|
@ -42,10 +42,10 @@ _cogl_bitmap_free (CoglBitmap *bmp)
|
|||||||
g_free (bmp);
|
g_free (bmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
int
|
||||||
_cogl_get_format_bpp (CoglPixelFormat format)
|
_cogl_get_format_bpp (CoglPixelFormat format)
|
||||||
{
|
{
|
||||||
gint bpp_lut[] = {
|
int bpp_lut[] = {
|
||||||
0, /* invalid */
|
0, /* invalid */
|
||||||
1, /* A_8 */
|
1, /* A_8 */
|
||||||
3, /* 888 */
|
3, /* 888 */
|
||||||
@ -119,17 +119,17 @@ _cogl_bitmap_convert_format_and_premult (const CoglBitmap *bmp,
|
|||||||
void
|
void
|
||||||
_cogl_bitmap_copy_subregion (CoglBitmap *src,
|
_cogl_bitmap_copy_subregion (CoglBitmap *src,
|
||||||
CoglBitmap *dst,
|
CoglBitmap *dst,
|
||||||
gint src_x,
|
int src_x,
|
||||||
gint src_y,
|
int src_y,
|
||||||
gint dst_x,
|
int dst_x,
|
||||||
gint dst_y,
|
int dst_y,
|
||||||
gint width,
|
int width,
|
||||||
gint height)
|
int height)
|
||||||
{
|
{
|
||||||
guchar *srcdata;
|
guint8 *srcdata;
|
||||||
guchar *dstdata;
|
guint8 *dstdata;
|
||||||
gint bpp;
|
int bpp;
|
||||||
gint line;
|
int line;
|
||||||
|
|
||||||
/* Intended only for fast copies when format is equal! */
|
/* Intended only for fast copies when format is equal! */
|
||||||
g_assert (src->format == dst->format);
|
g_assert (src->format == dst->format);
|
||||||
@ -147,16 +147,16 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cogl_bitmap_get_size_from_file (const gchar *filename,
|
cogl_bitmap_get_size_from_file (const char *filename,
|
||||||
gint *width,
|
int *width,
|
||||||
gint *height)
|
int *height)
|
||||||
{
|
{
|
||||||
return _cogl_bitmap_get_size_from_file (filename, width, height);
|
return _cogl_bitmap_get_size_from_file (filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_bitmap_new_from_file (const gchar *filename,
|
cogl_bitmap_new_from_file (const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
CoglBitmap bmp;
|
CoglBitmap bmp;
|
||||||
CoglBitmap *ret;
|
CoglBitmap *ret;
|
||||||
|
@ -56,8 +56,9 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_bitmap_new_from_file (const gchar *filename,
|
CoglHandle
|
||||||
GError **error);
|
cogl_bitmap_new_from_file (const char *filename,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_bitmap_get_size_from_file:
|
* cogl_bitmap_get_size_from_file:
|
||||||
@ -72,9 +73,10 @@ CoglHandle cogl_bitmap_new_from_file (const gchar *filename,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
gboolean cogl_bitmap_get_size_from_file (const gchar *filename,
|
gboolean
|
||||||
gint *width,
|
cogl_bitmap_get_size_from_file (const char *filename,
|
||||||
gint *height);
|
int *width,
|
||||||
|
int *height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_bitmap:
|
* cogl_is_bitmap:
|
||||||
@ -87,7 +89,8 @@ gboolean cogl_bitmap_get_size_from_file (const gchar *filename,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
gboolean cogl_is_bitmap (CoglHandle handle);
|
gboolean
|
||||||
|
cogl_is_bitmap (CoglHandle handle);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -413,9 +413,9 @@ get_function_info (const char *mark,
|
|||||||
const char *p,
|
const char *p,
|
||||||
CoglBlendStringContext context)
|
CoglBlendStringContext context)
|
||||||
{
|
{
|
||||||
size_t len = p - mark;
|
gsize len = p - mark;
|
||||||
CoglBlendStringFunctionInfo *functions;
|
CoglBlendStringFunctionInfo *functions;
|
||||||
size_t array_len;
|
gsize array_len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (context == COGL_BLEND_STRING_CONTEXT_BLENDING)
|
if (context == COGL_BLEND_STRING_CONTEXT_BLENDING)
|
||||||
@ -443,9 +443,9 @@ get_color_src_info (const char *mark,
|
|||||||
const char *p,
|
const char *p,
|
||||||
CoglBlendStringContext context)
|
CoglBlendStringContext context)
|
||||||
{
|
{
|
||||||
size_t len = p - mark;
|
gsize len = p - mark;
|
||||||
CoglBlendStringColorSourceInfo *sources;
|
CoglBlendStringColorSourceInfo *sources;
|
||||||
size_t array_len;
|
gsize array_len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (context == COGL_BLEND_STRING_CONTEXT_BLENDING)
|
if (context == COGL_BLEND_STRING_CONTEXT_BLENDING)
|
||||||
@ -617,7 +617,7 @@ parse_argument (const char *string, /* original user string */
|
|||||||
case PARSER_ARG_STATE_SCRAPING_MASK:
|
case PARSER_ARG_STATE_SCRAPING_MASK:
|
||||||
if (*p == ']')
|
if (*p == ']')
|
||||||
{
|
{
|
||||||
size_t len = p - mark;
|
gsize len = p - mark;
|
||||||
CoglBlendStringColorSource *source =
|
CoglBlendStringColorSource *source =
|
||||||
parsing_factor ? &arg->factor.source : &arg->source;
|
parsing_factor ? &arg->factor.source : &arg->source;
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ parse_argument (const char *string, /* original user string */
|
|||||||
case PARSER_ARG_STATE_MAYBE_SRC_ALPHA_SATURATE:
|
case PARSER_ARG_STATE_MAYBE_SRC_ALPHA_SATURATE:
|
||||||
if (!is_symbol_char (*p))
|
if (!is_symbol_char (*p))
|
||||||
{
|
{
|
||||||
size_t len = p - mark;
|
gsize len = p - mark;
|
||||||
if (len >= strlen ("SRC_ALPHA_SATURATE") &&
|
if (len >= strlen ("SRC_ALPHA_SATURATE") &&
|
||||||
strncmp (mark, "SRC_ALPHA_SATURATE", len) == 0)
|
strncmp (mark, "SRC_ALPHA_SATURATE", len) == 0)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ typedef struct _CoglBlendStringColorSourceInfo
|
|||||||
{
|
{
|
||||||
CoglBlendStringColorSourceType type;
|
CoglBlendStringColorSourceType type;
|
||||||
const char *name;
|
const char *name;
|
||||||
size_t name_len;
|
gsize name_len;
|
||||||
} CoglBlendStringColorSourceInfo;
|
} CoglBlendStringColorSourceInfo;
|
||||||
|
|
||||||
typedef struct _CoglBlendStringColorSource
|
typedef struct _CoglBlendStringColorSource
|
||||||
@ -111,7 +111,7 @@ typedef struct _CoglBlendStringFunctionInfo
|
|||||||
{
|
{
|
||||||
enum _CoglBlendStringFunctionType type;
|
enum _CoglBlendStringFunctionType type;
|
||||||
const char *name;
|
const char *name;
|
||||||
size_t name_len;
|
gsize name_len;
|
||||||
int argc;
|
int argc;
|
||||||
} CoglBlendStringFunctionInfo;
|
} CoglBlendStringFunctionInfo;
|
||||||
|
|
||||||
|
@ -50,15 +50,15 @@ typedef struct _CoglBufferVtable CoglBufferVtable;
|
|||||||
|
|
||||||
struct _CoglBufferVtable
|
struct _CoglBufferVtable
|
||||||
{
|
{
|
||||||
guchar * (* map) (CoglBuffer *buffer,
|
guint8 * (* map) (CoglBuffer *buffer,
|
||||||
CoglBufferAccess access);
|
CoglBufferAccess access);
|
||||||
|
|
||||||
void (* unmap) (CoglBuffer *buffer);
|
void (* unmap) (CoglBuffer *buffer);
|
||||||
|
|
||||||
gboolean (* set_data) (CoglBuffer *buffer,
|
gboolean (* set_data) (CoglBuffer *buffer,
|
||||||
guint offset,
|
unsigned int offset,
|
||||||
const guchar *data,
|
const guint8 *data,
|
||||||
guint size);
|
unsigned int size);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum _CoglBufferFlags
|
typedef enum _CoglBufferFlags
|
||||||
@ -76,18 +76,18 @@ struct _CoglBuffer
|
|||||||
CoglBufferFlags flags;
|
CoglBufferFlags flags;
|
||||||
|
|
||||||
GLuint gl_handle; /* OpenGL handle */
|
GLuint gl_handle; /* OpenGL handle */
|
||||||
guint size; /* size of the buffer, in bytes */
|
unsigned int size; /* size of the buffer, in bytes */
|
||||||
CoglBufferUsageHint usage_hint;
|
CoglBufferUsageHint usage_hint;
|
||||||
CoglBufferUpdateHint update_hint;
|
CoglBufferUpdateHint update_hint;
|
||||||
|
|
||||||
guchar *data; /* points to the mapped memory when
|
guint8 *data; /* points to the mapped memory when
|
||||||
* the CoglBuffer is a VBO, PBO, ... or
|
* the CoglBuffer is a VBO, PBO, ... or
|
||||||
* points to allocated memory in the
|
* points to allocated memory in the
|
||||||
* fallback paths */
|
* fallback paths */
|
||||||
};
|
};
|
||||||
|
|
||||||
void _cogl_buffer_initialize (CoglBuffer *buffer,
|
void _cogl_buffer_initialize (CoglBuffer *buffer,
|
||||||
guint size,
|
unsigned int size,
|
||||||
CoglBufferUsageHint usage_hint,
|
CoglBufferUsageHint usage_hint,
|
||||||
CoglBufferUpdateHint update_hint);
|
CoglBufferUpdateHint update_hint);
|
||||||
void _cogl_buffer_fini (CoglBuffer *buffer);
|
void _cogl_buffer_fini (CoglBuffer *buffer);
|
||||||
|
@ -85,7 +85,7 @@ cogl_is_buffer_EXP (CoglHandle handle)
|
|||||||
|
|
||||||
void
|
void
|
||||||
_cogl_buffer_initialize (CoglBuffer *buffer,
|
_cogl_buffer_initialize (CoglBuffer *buffer,
|
||||||
guint size,
|
unsigned int size,
|
||||||
CoglBufferUsageHint usage_hint,
|
CoglBufferUsageHint usage_hint,
|
||||||
CoglBufferUpdateHint update_hint)
|
CoglBufferUpdateHint update_hint)
|
||||||
{
|
{
|
||||||
@ -183,7 +183,7 @@ _cogl_buffer_bind (CoglBuffer *buffer,
|
|||||||
ctx->current_pbo = buffer;
|
ctx->current_pbo = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_buffer_get_size_EXP (CoglHandle handle)
|
cogl_buffer_get_size_EXP (CoglHandle handle)
|
||||||
{
|
{
|
||||||
if (!cogl_is_buffer (handle))
|
if (!cogl_is_buffer (handle))
|
||||||
@ -236,7 +236,7 @@ cogl_buffer_get_update_hint_EXP (CoglHandle handle)
|
|||||||
return COGL_BUFFER (handle)->update_hint;
|
return COGL_BUFFER (handle)->update_hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
guchar *
|
guint8 *
|
||||||
cogl_buffer_map_EXP (CoglHandle handle,
|
cogl_buffer_map_EXP (CoglHandle handle,
|
||||||
CoglBufferAccess access)
|
CoglBufferAccess access)
|
||||||
{
|
{
|
||||||
@ -273,7 +273,7 @@ cogl_buffer_unmap_EXP (CoglHandle handle)
|
|||||||
gboolean
|
gboolean
|
||||||
cogl_buffer_set_data_EXP (CoglHandle handle,
|
cogl_buffer_set_data_EXP (CoglHandle handle,
|
||||||
gsize offset,
|
gsize offset,
|
||||||
const guchar *data,
|
const guint8 *data,
|
||||||
gsize size)
|
gsize size)
|
||||||
{
|
{
|
||||||
CoglBuffer *buffer;
|
CoglBuffer *buffer;
|
||||||
|
@ -70,7 +70,7 @@ cogl_is_buffer (CoglHandle handle);
|
|||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
cogl_buffer_get_size (CoglHandle handle);
|
cogl_buffer_get_size (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +85,7 @@ cogl_buffer_get_size (CoglHandle handle);
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
typedef enum { /*< prefix=COGL_BUFFER_USAGE_HINT >*/
|
typedef enum { /*< prefix=COGL_BUFFER_USAGE_HINT >*/
|
||||||
COGL_BUFFER_USAGE_HINT_TEXTURE,
|
COGL_BUFFER_USAGE_HINT_TEXTURE,
|
||||||
} CoglBufferUsageHint;
|
} CoglBufferUsageHint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,7 +148,7 @@ typedef enum { /*< prefix=COGL_BUFFER_UPDATE_HINT >*/
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cogl_buffer_set_update_hint (CoglHandle handle,
|
cogl_buffer_set_update_hint (CoglHandle handle,
|
||||||
CoglBufferUpdateHint hint);
|
CoglBufferUpdateHint hint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,7 +196,7 @@ typedef enum { /*< prefix=COGL_BUFFER_ACCESS >*/
|
|||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
guchar *
|
guint8 *
|
||||||
cogl_buffer_map (CoglHandle handle,
|
cogl_buffer_map (CoglHandle handle,
|
||||||
CoglBufferAccess access);
|
CoglBufferAccess access);
|
||||||
|
|
||||||
@ -230,9 +230,9 @@ cogl_buffer_unmap (CoglHandle handle);
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_buffer_set_data (CoglHandle handle,
|
cogl_buffer_set_data (CoglHandle handle,
|
||||||
gsize offset,
|
gsize offset,
|
||||||
const guchar *data,
|
const guint8 *data,
|
||||||
gsize size);
|
gsize size);
|
||||||
|
|
||||||
/* the functions above are experimental, the actual symbols are suffixed by
|
/* the functions above are experimental, the actual symbols are suffixed by
|
||||||
* _EXP so we can ensure ABI compatibility and leave the cogl_buffer namespace
|
* _EXP so we can ensure ABI compatibility and leave the cogl_buffer namespace
|
||||||
@ -242,7 +242,7 @@ cogl_buffer_set_data (CoglHandle handle,
|
|||||||
gboolean
|
gboolean
|
||||||
cogl_is_buffer_EXP (CoglHandle handle);
|
cogl_is_buffer_EXP (CoglHandle handle);
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_buffer_get_size_EXP (CoglHandle handle);
|
cogl_buffer_get_size_EXP (CoglHandle handle);
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -253,13 +253,13 @@ CoglBufferUsageHint
|
|||||||
cogl_buffer_get_usage_hint_EXP (CoglHandle handle);
|
cogl_buffer_get_usage_hint_EXP (CoglHandle handle);
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_buffer_set_update_hint_EXP (CoglHandle handle,
|
cogl_buffer_set_update_hint_EXP (CoglHandle handle,
|
||||||
CoglBufferUpdateHint hint);
|
CoglBufferUpdateHint hint);
|
||||||
|
|
||||||
CoglBufferUpdateHint
|
CoglBufferUpdateHint
|
||||||
cogl_buffer_get_update_hint_EXP (CoglHandle handle);
|
cogl_buffer_get_update_hint_EXP (CoglHandle handle);
|
||||||
|
|
||||||
guchar *
|
guint8 *
|
||||||
cogl_buffer_map_EXP (CoglHandle handle,
|
cogl_buffer_map_EXP (CoglHandle handle,
|
||||||
CoglBufferAccess access);
|
CoglBufferAccess access);
|
||||||
|
|
||||||
@ -268,9 +268,9 @@ cogl_buffer_unmap_EXP (CoglHandle handle);
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cogl_buffer_set_data_EXP (CoglHandle handle,
|
cogl_buffer_set_data_EXP (CoglHandle handle,
|
||||||
gsize offset,
|
gsize offset,
|
||||||
const guchar *data,
|
const guint8 *data,
|
||||||
gsize size);
|
gsize size);
|
||||||
|
|
||||||
#define cogl_is_buffer cogl_is_buffer_EXP
|
#define cogl_is_buffer cogl_is_buffer_EXP
|
||||||
#define cogl_buffer_get_size cogl_buffer_get_size_EXP
|
#define cogl_buffer_get_size cogl_buffer_get_size_EXP
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
|
|
||||||
void _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
void _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
||||||
floatVec2 nodes_max,
|
floatVec2 nodes_max,
|
||||||
guint path_size,
|
unsigned int path_size,
|
||||||
CoglPathNode *path,
|
CoglPathNode *path,
|
||||||
gboolean merge,
|
gboolean merge,
|
||||||
gboolean need_clear);
|
gboolean need_clear);
|
||||||
@ -97,7 +97,7 @@ struct _CoglClipStackEntryPath
|
|||||||
floatVec2 path_nodes_min;
|
floatVec2 path_nodes_min;
|
||||||
floatVec2 path_nodes_max;
|
floatVec2 path_nodes_max;
|
||||||
|
|
||||||
guint path_size;
|
unsigned int path_size;
|
||||||
CoglPathNode path[1];
|
CoglPathNode path[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -642,10 +642,10 @@ _cogl_flush_clip_state (CoglClipStackState *clip_state)
|
|||||||
gboolean using_clip_planes = FALSE;
|
gboolean using_clip_planes = FALSE;
|
||||||
gboolean using_stencil_buffer = FALSE;
|
gboolean using_stencil_buffer = FALSE;
|
||||||
GList *node;
|
GList *node;
|
||||||
gint scissor_x0 = 0;
|
int scissor_x0 = 0;
|
||||||
gint scissor_y0 = 0;
|
int scissor_y0 = 0;
|
||||||
gint scissor_x1 = G_MAXINT;
|
int scissor_x1 = G_MAXINT;
|
||||||
gint scissor_y1 = G_MAXINT;
|
int scissor_y1 = G_MAXINT;
|
||||||
CoglMatrixStack *modelview_stack =
|
CoglMatrixStack *modelview_stack =
|
||||||
_cogl_framebuffer_get_modelview_stack (_cogl_get_framebuffer ());
|
_cogl_framebuffer_get_modelview_stack (_cogl_get_framebuffer ());
|
||||||
|
|
||||||
|
@ -35,10 +35,16 @@ struct _CoglClipStackState
|
|||||||
gboolean stencil_used;
|
gboolean stencil_used;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _cogl_clip_stack_state_init (CoglClipStackState *state);
|
void
|
||||||
void _cogl_clip_stack_state_destroy (CoglClipStackState *state);
|
_cogl_clip_stack_state_init (CoglClipStackState *state);
|
||||||
void _cogl_clip_stack_state_dirty (CoglClipStackState *state);
|
|
||||||
|
|
||||||
void _cogl_flush_clip_state (CoglClipStackState *clip_state);
|
void
|
||||||
|
_cogl_clip_stack_state_destroy (CoglClipStackState *state);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_clip_stack_state_dirty (CoglClipStackState *state);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_flush_clip_state (CoglClipStackState *clip_state);
|
||||||
|
|
||||||
#endif /* __COGL_CLIP_STACK_H */
|
#endif /* __COGL_CLIP_STACK_H */
|
||||||
|
@ -52,7 +52,8 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglColor *cogl_color_new (void);
|
CoglColor *
|
||||||
|
cogl_color_new (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_copy:
|
* cogl_color_copy:
|
||||||
@ -65,7 +66,8 @@ CoglColor *cogl_color_new (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglColor *cogl_color_copy (const CoglColor *color);
|
CoglColor *
|
||||||
|
cogl_color_copy (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_free:
|
* cogl_color_free:
|
||||||
@ -75,7 +77,8 @@ CoglColor *cogl_color_copy (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_color_free (CoglColor *color);
|
void
|
||||||
|
cogl_color_free (CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_set_from_4ub:
|
* cogl_color_set_from_4ub:
|
||||||
@ -89,11 +92,12 @@ void cogl_color_free (CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_color_set_from_4ub (CoglColor *dest,
|
void
|
||||||
guint8 red,
|
cogl_color_set_from_4ub (CoglColor *dest,
|
||||||
guint8 green,
|
guint8 red,
|
||||||
guint8 blue,
|
guint8 green,
|
||||||
guint8 alpha);
|
guint8 blue,
|
||||||
|
guint8 alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_set_from_4f:
|
* cogl_color_set_from_4f:
|
||||||
@ -107,11 +111,12 @@ void cogl_color_set_from_4ub (CoglColor *dest,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_color_set_from_4f (CoglColor *dest,
|
void
|
||||||
float red,
|
cogl_color_set_from_4f (CoglColor *dest,
|
||||||
float green,
|
float red,
|
||||||
float blue,
|
float green,
|
||||||
float alpha);
|
float blue,
|
||||||
|
float alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_red_byte:
|
* cogl_color_get_red_byte:
|
||||||
@ -124,7 +129,8 @@ void cogl_color_set_from_4f (CoglColor *dest,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
unsigned char cogl_color_get_red_byte (const CoglColor *color);
|
unsigned char
|
||||||
|
cogl_color_get_red_byte (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_green_byte:
|
* cogl_color_get_green_byte:
|
||||||
@ -137,7 +143,8 @@ unsigned char cogl_color_get_red_byte (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
unsigned char cogl_color_get_green_byte (const CoglColor *color);
|
unsigned char
|
||||||
|
cogl_color_get_green_byte (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_blue_byte:
|
* cogl_color_get_blue_byte:
|
||||||
@ -150,7 +157,8 @@ unsigned char cogl_color_get_green_byte (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
unsigned char cogl_color_get_blue_byte (const CoglColor *color);
|
unsigned char
|
||||||
|
cogl_color_get_blue_byte (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_alpha_byte:
|
* cogl_color_get_alpha_byte:
|
||||||
@ -163,7 +171,8 @@ unsigned char cogl_color_get_blue_byte (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
unsigned char cogl_color_get_alpha_byte (const CoglColor *color);
|
unsigned char
|
||||||
|
cogl_color_get_alpha_byte (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_red_float:
|
* cogl_color_get_red_float:
|
||||||
@ -176,7 +185,8 @@ unsigned char cogl_color_get_alpha_byte (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_red_float (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_red_float (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_green_float:
|
* cogl_color_get_green_float:
|
||||||
@ -189,7 +199,8 @@ float cogl_color_get_red_float (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_green_float (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_green_float (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_blue_float:
|
* cogl_color_get_blue_float:
|
||||||
@ -202,7 +213,8 @@ float cogl_color_get_green_float (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_blue_float (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_blue_float (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_alpha_float:
|
* cogl_color_get_alpha_float:
|
||||||
@ -215,7 +227,8 @@ float cogl_color_get_blue_float (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_alpha_float (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_alpha_float (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_red:
|
* cogl_color_get_red:
|
||||||
@ -228,7 +241,8 @@ float cogl_color_get_alpha_float (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_red (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_red (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_green:
|
* cogl_color_get_green:
|
||||||
@ -241,7 +255,8 @@ float cogl_color_get_red (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_green (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_green (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_blue:
|
* cogl_color_get_blue:
|
||||||
@ -254,7 +269,8 @@ float cogl_color_get_green (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_blue (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_blue (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_get_alpha:
|
* cogl_color_get_alpha:
|
||||||
@ -267,7 +283,8 @@ float cogl_color_get_blue (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_color_get_alpha (const CoglColor *color);
|
float
|
||||||
|
cogl_color_get_alpha (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_premultiply:
|
* cogl_color_premultiply:
|
||||||
@ -279,7 +296,8 @@ float cogl_color_get_alpha (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_color_premultiply (CoglColor *color);
|
void
|
||||||
|
cogl_color_premultiply (CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color_equal:
|
* cogl_color_equal:
|
||||||
@ -295,8 +313,9 @@ void cogl_color_premultiply (CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
gboolean cogl_color_equal (gconstpointer v1,
|
gboolean
|
||||||
gconstpointer v2);
|
cogl_color_equal (gconstpointer v1,
|
||||||
|
gconstpointer v2);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ static gboolean
|
|||||||
cogl_create_context (void)
|
cogl_create_context (void)
|
||||||
{
|
{
|
||||||
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
||||||
gulong enable_flags = 0;
|
unsigned long enable_flags = 0;
|
||||||
CoglHandle window_buffer;
|
CoglHandle window_buffer;
|
||||||
|
|
||||||
if (_context != NULL)
|
if (_context != NULL)
|
||||||
|
@ -49,7 +49,7 @@ typedef struct
|
|||||||
CoglHandle default_material;
|
CoglHandle default_material;
|
||||||
|
|
||||||
/* Enable cache */
|
/* Enable cache */
|
||||||
gulong enable_flags;
|
unsigned long enable_flags;
|
||||||
guint8 color_alpha;
|
guint8 color_alpha;
|
||||||
|
|
||||||
gboolean enable_backface_culling;
|
gboolean enable_backface_culling;
|
||||||
@ -83,10 +83,10 @@ typedef struct
|
|||||||
|
|
||||||
/* Some simple caching, to minimize state changes... */
|
/* Some simple caching, to minimize state changes... */
|
||||||
CoglHandle current_material;
|
CoglHandle current_material;
|
||||||
gulong current_material_flags;
|
unsigned long current_material_flags;
|
||||||
CoglMaterialFlushOptions current_material_flush_options;
|
CoglMaterialFlushOptions current_material_flush_options;
|
||||||
GArray *current_layers;
|
GArray *current_layers;
|
||||||
guint n_texcoord_arrays_enabled;
|
unsigned int n_texcoord_arrays_enabled;
|
||||||
|
|
||||||
/* PBOs */
|
/* PBOs */
|
||||||
/* This can be used to check if a pbo is bound */
|
/* This can be used to check if a pbo is bound */
|
||||||
@ -102,7 +102,7 @@ typedef struct
|
|||||||
floatVec2 path_start;
|
floatVec2 path_start;
|
||||||
floatVec2 path_pen;
|
floatVec2 path_pen;
|
||||||
GArray *path_nodes;
|
GArray *path_nodes;
|
||||||
guint last_path;
|
unsigned int last_path;
|
||||||
floatVec2 path_nodes_min;
|
floatVec2 path_nodes_min;
|
||||||
floatVec2 path_nodes_max;
|
floatVec2 path_nodes_max;
|
||||||
CoglHandle stencil_material;
|
CoglHandle stencil_material;
|
||||||
@ -110,7 +110,7 @@ typedef struct
|
|||||||
/* Pre-generated VBOs containing indices to generate GL_TRIANGLES
|
/* Pre-generated VBOs containing indices to generate GL_TRIANGLES
|
||||||
out of a vertex array of quads */
|
out of a vertex array of quads */
|
||||||
CoglHandle quad_indices_byte;
|
CoglHandle quad_indices_byte;
|
||||||
guint quad_indices_short_len;
|
unsigned int quad_indices_short_len;
|
||||||
CoglHandle quad_indices_short;
|
CoglHandle quad_indices_short;
|
||||||
|
|
||||||
gboolean in_begin_gl_block;
|
gboolean in_begin_gl_block;
|
||||||
|
@ -53,10 +53,10 @@ static const GDebugKey cogl_debug_keys[] = {
|
|||||||
{ "disable-atlas", COGL_DEBUG_DISABLE_ATLAS }
|
{ "disable-atlas", COGL_DEBUG_DISABLE_ATLAS }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);
|
static const int n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);
|
||||||
#endif /* COGL_ENABLE_DEBUG */
|
#endif /* COGL_ENABLE_DEBUG */
|
||||||
|
|
||||||
guint cogl_debug_flags = 0;
|
unsigned int cogl_debug_flags = 0;
|
||||||
|
|
||||||
#ifdef COGL_ENABLE_DEBUG
|
#ifdef COGL_ENABLE_DEBUG
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -73,8 +73,8 @@ cogl_arg_debug_cb (const char *key,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
cogl_arg_no_debug_cb (const char *key,
|
cogl_arg_no_debug_cb (const char *key,
|
||||||
const char *value,
|
const char *value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
cogl_debug_flags &=
|
cogl_debug_flags &=
|
||||||
~g_parse_debug_string (value,
|
~g_parse_debug_string (value,
|
||||||
|
@ -62,7 +62,7 @@ typedef enum {
|
|||||||
#else
|
#else
|
||||||
#define COGL_NOTE(type,...) G_STMT_START { \
|
#define COGL_NOTE(type,...) G_STMT_START { \
|
||||||
if (cogl_debug_flags & COGL_DEBUG_##type) { \
|
if (cogl_debug_flags & COGL_DEBUG_##type) { \
|
||||||
gchar *_fmt = g_strdup_printf (__VA_ARGS__); \
|
char *_fmt = g_strdup_printf (__VA_ARGS__); \
|
||||||
g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \
|
g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \
|
||||||
g_free (_fmt); \
|
g_free (_fmt); \
|
||||||
} } G_STMT_END
|
} } G_STMT_END
|
||||||
@ -75,7 +75,7 @@ typedef enum {
|
|||||||
|
|
||||||
#endif /* COGL_ENABLE_DEBUG */
|
#endif /* COGL_ENABLE_DEBUG */
|
||||||
|
|
||||||
extern guint cogl_debug_flags;
|
extern unsigned int cogl_debug_flags;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -34,11 +34,12 @@
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_feature_check (const CoglFeatureData *data,
|
_cogl_feature_check (const CoglFeatureData *data,
|
||||||
guint gl_major, guint gl_minor,
|
unsigned int gl_major,
|
||||||
const gchar *extensions_string)
|
unsigned int gl_minor,
|
||||||
|
const char *extensions_string)
|
||||||
|
|
||||||
{
|
{
|
||||||
const gchar *suffix = NULL;
|
const char *suffix = NULL;
|
||||||
int func_num;
|
int func_num;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
@ -51,14 +52,14 @@ _cogl_feature_check (const CoglFeatureData *data,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Otherwise try all of the extensions */
|
/* Otherwise try all of the extensions */
|
||||||
const gchar *namespace, *namespace_suffix;
|
const char *namespace, *namespace_suffix;
|
||||||
guint namespace_len;
|
unsigned int namespace_len;
|
||||||
|
|
||||||
for (namespace = data->namespaces;
|
for (namespace = data->namespaces;
|
||||||
*namespace;
|
*namespace;
|
||||||
namespace += strlen (namespace) + 1)
|
namespace += strlen (namespace) + 1)
|
||||||
{
|
{
|
||||||
const gchar *extension;
|
const char *extension;
|
||||||
GString *full_extension_name = g_string_new ("");
|
GString *full_extension_name = g_string_new ("");
|
||||||
|
|
||||||
/* If the namespace part contains a ':' then the suffix for
|
/* If the namespace part contains a ':' then the suffix for
|
||||||
@ -110,7 +111,7 @@ _cogl_feature_check (const CoglFeatureData *data,
|
|||||||
for (func_num = 0; data->functions[func_num].name; func_num++)
|
for (func_num = 0; data->functions[func_num].name; func_num++)
|
||||||
{
|
{
|
||||||
void *func;
|
void *func;
|
||||||
gchar *full_function_name;
|
char *full_function_name;
|
||||||
|
|
||||||
full_function_name = g_strconcat (data->functions[func_num].name,
|
full_function_name = g_strconcat (data->functions[func_num].name,
|
||||||
suffix, NULL);
|
suffix, NULL);
|
||||||
@ -121,7 +122,7 @@ _cogl_feature_check (const CoglFeatureData *data,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* Set the function pointer in the context */
|
/* Set the function pointer in the context */
|
||||||
*(void **) ((guchar *) ctx +
|
*(void **) ((guint8 *) ctx +
|
||||||
data->functions[func_num].pointer_offset) = func;
|
data->functions[func_num].pointer_offset) = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ _cogl_feature_check (const CoglFeatureData *data,
|
|||||||
if (data->functions[func_num].name)
|
if (data->functions[func_num].name)
|
||||||
{
|
{
|
||||||
while (func_num-- > 0)
|
while (func_num-- > 0)
|
||||||
*(void **) ((guchar *) ctx +
|
*(void **) ((guint8 *) ctx +
|
||||||
data->functions[func_num].pointer_offset) = NULL;
|
data->functions[func_num].pointer_offset) = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ typedef struct _CoglFeatureFunction CoglFeatureFunction;
|
|||||||
struct _CoglFeatureFunction
|
struct _CoglFeatureFunction
|
||||||
{
|
{
|
||||||
/* The name of the function without the "EXT" or "ARB" suffix */
|
/* The name of the function without the "EXT" or "ARB" suffix */
|
||||||
const gchar *name;
|
const char *name;
|
||||||
/* The offset in the context of where to store the function pointer */
|
/* The offset in the context of where to store the function pointer */
|
||||||
guint pointer_offset;
|
unsigned int pointer_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _CoglFeatureData CoglFeatureData;
|
typedef struct _CoglFeatureData CoglFeatureData;
|
||||||
@ -48,15 +48,15 @@ struct _CoglFeatureData
|
|||||||
/* A minimum GL version which the functions should be defined in
|
/* A minimum GL version which the functions should be defined in
|
||||||
without needing an extension. Set to 255,255 if it's only
|
without needing an extension. Set to 255,255 if it's only
|
||||||
provided in an extension */
|
provided in an extension */
|
||||||
guchar min_gl_major, min_gl_minor;
|
guint8 min_gl_major, min_gl_minor;
|
||||||
/* \0 separated list of namespaces to try. Eg "EXT\0ARB\0" */
|
/* \0 separated list of namespaces to try. Eg "EXT\0ARB\0" */
|
||||||
const gchar *namespaces;
|
const char *namespaces;
|
||||||
/* \0 separated list of required extension names without the GL_EXT
|
/* \0 separated list of required extension names without the GL_EXT
|
||||||
or GL_ARB prefix. All of the extensions must be available for the
|
or GL_ARB prefix. All of the extensions must be available for the
|
||||||
feature to be considered available. If the suffix for an
|
feature to be considered available. If the suffix for an
|
||||||
extension is different from the namespace, you can specify it
|
extension is different from the namespace, you can specify it
|
||||||
with a ':' after the namespace */
|
with a ':' after the namespace */
|
||||||
const gchar *extension_names;
|
const char *extension_names;
|
||||||
/* A set of feature flags to enable if the extension is available */
|
/* A set of feature flags to enable if the extension is available */
|
||||||
CoglFeatureFlags feature_flags;
|
CoglFeatureFlags feature_flags;
|
||||||
/* A list of functions required for this feature. Terminated with a
|
/* A list of functions required for this feature. Terminated with a
|
||||||
@ -65,7 +65,7 @@ struct _CoglFeatureData
|
|||||||
};
|
};
|
||||||
|
|
||||||
gboolean _cogl_feature_check (const CoglFeatureData *data,
|
gboolean _cogl_feature_check (const CoglFeatureData *data,
|
||||||
guint gl_major, guint gl_minor,
|
unsigned int gl_major, unsigned int gl_minor,
|
||||||
const gchar *extensions_string);
|
const char *extensions_string);
|
||||||
|
|
||||||
#endif /* __COGL_FEATURE_PRIVATE_H */
|
#endif /* __COGL_FEATURE_PRIVATE_H */
|
||||||
|
@ -295,7 +295,7 @@ static const CoglFixed sqrt_tbl[] =
|
|||||||
/* the difference of the angle for two adjacent values in the
|
/* the difference of the angle for two adjacent values in the
|
||||||
* sin_tbl table, expressed as CoglFixed number
|
* sin_tbl table, expressed as CoglFixed number
|
||||||
*/
|
*/
|
||||||
static const gint sin_tbl_size = G_N_ELEMENTS (sin_tbl) - 1;
|
static const int sin_tbl_size = G_N_ELEMENTS (sin_tbl) - 1;
|
||||||
|
|
||||||
static const double _magic = 68719476736.0 * 1.5;
|
static const double _magic = 68719476736.0 * 1.5;
|
||||||
|
|
||||||
@ -346,11 +346,11 @@ cogl_double_to_fixed (double val)
|
|||||||
*
|
*
|
||||||
* Return value: Integer part of the double
|
* Return value: Integer part of the double
|
||||||
*/
|
*/
|
||||||
gint
|
int
|
||||||
cogl_double_to_int (double val)
|
cogl_double_to_int (double val)
|
||||||
{
|
{
|
||||||
#ifdef COGL_NO_FAST_CONVERSIONS
|
#ifdef COGL_NO_FAST_CONVERSIONS
|
||||||
return (gint) (val);
|
return (int) (val);
|
||||||
#else
|
#else
|
||||||
union {
|
union {
|
||||||
double d;
|
double d;
|
||||||
@ -364,11 +364,11 @@ cogl_double_to_int (double val)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_double_to_uint (double val)
|
cogl_double_to_uint (double val)
|
||||||
{
|
{
|
||||||
#ifdef COGL_NO_FAST_CONVERSIONS
|
#ifdef COGL_NO_FAST_CONVERSIONS
|
||||||
return (guint)(val);
|
return (unsigned int)(val);
|
||||||
#else
|
#else
|
||||||
union {
|
union {
|
||||||
double d;
|
double d;
|
||||||
@ -716,8 +716,8 @@ cogl_fixed_sqrt (CoglFixed x)
|
|||||||
*
|
*
|
||||||
* Since: 0.2
|
* Since: 0.2
|
||||||
*/
|
*/
|
||||||
gint
|
int
|
||||||
cogl_sqrti (gint number)
|
cogl_sqrti (int number)
|
||||||
{
|
{
|
||||||
#if defined __SSE2__
|
#if defined __SSE2__
|
||||||
/* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as
|
/* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as
|
||||||
@ -859,7 +859,7 @@ cogl_fixed_mul_div (CoglFixed a,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CoglFixed
|
CoglFixed
|
||||||
cogl_fixed_log2 (guint x)
|
cogl_fixed_log2 (unsigned int x)
|
||||||
{
|
{
|
||||||
/* Note: we could easily have a version for CoglFixed x, but the int
|
/* Note: we could easily have a version for CoglFixed x, but the int
|
||||||
* precision is enough for the current purposes.
|
* precision is enough for the current purposes.
|
||||||
@ -889,7 +889,7 @@ cogl_fixed_log2 (guint x)
|
|||||||
return flt.i + y;
|
return flt.i + y;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_fixed_pow2 (CoglFixed x)
|
cogl_fixed_pow2 (CoglFixed x)
|
||||||
{
|
{
|
||||||
/* Note: we could easily have a version that produces CoglFixed result,
|
/* Note: we could easily have a version that produces CoglFixed result,
|
||||||
@ -926,9 +926,9 @@ cogl_fixed_pow2 (CoglFixed x)
|
|||||||
return COGL_FLOAT_TO_UINT (flt.f);
|
return COGL_FLOAT_TO_UINT (flt.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_fixed_pow (guint x,
|
cogl_fixed_pow (unsigned int x,
|
||||||
CoglFixed y)
|
CoglFixed y)
|
||||||
{
|
{
|
||||||
return cogl_fixed_pow2 (COGL_FIXED_MUL (y, cogl_fixed_log2 (x)));
|
return cogl_fixed_pow2 (COGL_FIXED_MUL (y, cogl_fixed_log2 (x)));
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,8 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_sin (CoglFixed angle);
|
CoglFixed
|
||||||
|
cogl_fixed_sin (CoglFixed angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_tan:
|
* cogl_fixed_tan:
|
||||||
@ -480,7 +481,8 @@ CoglFixed cogl_fixed_sin (CoglFixed angle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_tan (CoglFixed angle);
|
CoglFixed
|
||||||
|
cogl_fixed_tan (CoglFixed angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_cos:
|
* cogl_fixed_cos:
|
||||||
@ -492,7 +494,7 @@ CoglFixed cogl_fixed_tan (CoglFixed angle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_cos (CoglFixed angle);
|
CoglFixed cogl_fixed_cos (CoglFixed angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_atani:
|
* cogl_fixed_atani:
|
||||||
@ -504,7 +506,8 @@ CoglFixed cogl_fixed_cos (CoglFixed angle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_atani (CoglFixed a);
|
CoglFixed
|
||||||
|
cogl_fixed_atani (CoglFixed a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_atan2:
|
* cogl_fixed_atan2:
|
||||||
@ -519,19 +522,25 @@ CoglFixed cogl_fixed_atani (CoglFixed a);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_atan2 (CoglFixed a,
|
CoglFixed
|
||||||
CoglFixed b);
|
cogl_fixed_atan2 (CoglFixed a,
|
||||||
|
CoglFixed b);
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
|
|
||||||
/* Fixed point math routines */
|
/* Fixed point math routines */
|
||||||
G_INLINE_FUNC CoglFixed cogl_fixed_mul (CoglFixed a,
|
G_INLINE_FUNC CoglFixed
|
||||||
CoglFixed b);
|
cogl_fixed_mul (CoglFixed a,
|
||||||
G_INLINE_FUNC CoglFixed cogl_fixed_div (CoglFixed a,
|
CoglFixed b);
|
||||||
CoglFixed b);
|
|
||||||
G_INLINE_FUNC CoglFixed cogl_fixed_mul_div (CoglFixed a,
|
G_INLINE_FUNC CoglFixed
|
||||||
CoglFixed b,
|
cogl_fixed_div (CoglFixed a,
|
||||||
CoglFixed c);
|
CoglFixed b);
|
||||||
|
|
||||||
|
G_INLINE_FUNC CoglFixed
|
||||||
|
cogl_fixed_mul_div (CoglFixed a,
|
||||||
|
CoglFixed b,
|
||||||
|
CoglFixed c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* COGL_SQRTI_ARG_MAX:
|
* COGL_SQRTI_ARG_MAX:
|
||||||
@ -585,7 +594,8 @@ G_INLINE_FUNC CoglFixed cogl_fixed_mul_div (CoglFixed a,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_sqrt (CoglFixed x);
|
CoglFixed
|
||||||
|
cogl_fixed_sqrt (CoglFixed x);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_log2:
|
* cogl_fixed_log2:
|
||||||
@ -600,7 +610,8 @@ CoglFixed cogl_fixed_sqrt (CoglFixed x);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_fixed_log2 (guint x);
|
CoglFixed
|
||||||
|
cogl_fixed_log2 (unsigned int x);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_pow2:
|
* cogl_fixed_pow2:
|
||||||
@ -615,7 +626,8 @@ CoglFixed cogl_fixed_log2 (guint x);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
guint cogl_fixed_pow2 (CoglFixed x);
|
unsigned int
|
||||||
|
cogl_fixed_pow2 (CoglFixed x);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_fixed_pow:
|
* cogl_fixed_pow:
|
||||||
@ -628,8 +640,9 @@ guint cogl_fixed_pow2 (CoglFixed x);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
guint cogl_fixed_pow (guint x,
|
unsigned int
|
||||||
CoglFixed y);
|
cogl_fixed_pow (unsigned int x,
|
||||||
|
CoglFixed y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_sqrti:
|
* cogl_sqrti:
|
||||||
@ -647,7 +660,8 @@ guint cogl_fixed_pow (guint x,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
gint cogl_sqrti (gint x);
|
int
|
||||||
|
cogl_sqrti (int x);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* COGL_ANGLE_FROM_DEG:
|
* COGL_ANGLE_FROM_DEG:
|
||||||
@ -700,7 +714,8 @@ gint cogl_sqrti (gint x);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_angle_sin (CoglAngle angle);
|
CoglFixed
|
||||||
|
cogl_angle_sin (CoglAngle angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_angle_tan:
|
* cogl_angle_tan:
|
||||||
@ -712,7 +727,8 @@ CoglFixed cogl_angle_sin (CoglAngle angle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_angle_tan (CoglAngle angle);
|
CoglFixed
|
||||||
|
cogl_angle_tan (CoglAngle angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_angle_cos:
|
* cogl_angle_cos:
|
||||||
@ -724,7 +740,8 @@ CoglFixed cogl_angle_tan (CoglAngle angle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglFixed cogl_angle_cos (CoglAngle angle);
|
CoglFixed
|
||||||
|
cogl_angle_cos (CoglAngle angle);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
||||||
@ -773,9 +790,14 @@ cogl_fixed_mul_div (CoglFixed a,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern CoglFixed cogl_double_to_fixed (double value);
|
CoglFixed
|
||||||
extern gint cogl_double_to_int (double value);
|
cogl_double_to_fixed (double value);
|
||||||
extern guint cogl_double_to_unit (double value);
|
|
||||||
|
int
|
||||||
|
cogl_double_to_int (double value);
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
cogl_double_to_unit (double value);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ typedef struct _CoglHandleClass
|
|||||||
*/
|
*/
|
||||||
typedef struct _CoglHandleObject
|
typedef struct _CoglHandleObject
|
||||||
{
|
{
|
||||||
guint ref_count;
|
unsigned int ref_count;
|
||||||
CoglHandleClass *klass;
|
CoglHandleClass *klass;
|
||||||
} CoglHandleObject;
|
} CoglHandleObject;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -48,11 +48,11 @@ typedef struct _CoglBoxedValue
|
|||||||
gboolean transpose;
|
gboolean transpose;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
gfloat float_value[4];
|
float float_value[4];
|
||||||
gint int_value[4];
|
int int_value[4];
|
||||||
gfloat matrix[16];
|
float matrix[16];
|
||||||
gfloat *float_array;
|
float *float_array;
|
||||||
gint *int_array;
|
int *int_array;
|
||||||
gpointer array;
|
gpointer array;
|
||||||
} v;
|
} v;
|
||||||
} CoglBoxedValue;
|
} CoglBoxedValue;
|
||||||
@ -60,7 +60,8 @@ typedef struct _CoglBoxedValue
|
|||||||
|
|
||||||
#ifdef COGL_GL_DEBUG
|
#ifdef COGL_GL_DEBUG
|
||||||
|
|
||||||
const gchar *cogl_gl_error_to_string (GLenum error_code);
|
const char *
|
||||||
|
cogl_gl_error_to_string (GLenum error_code);
|
||||||
|
|
||||||
#define GE(x) G_STMT_START { \
|
#define GE(x) G_STMT_START { \
|
||||||
GLenum __err; \
|
GLenum __err; \
|
||||||
@ -97,12 +98,17 @@ const gchar *cogl_gl_error_to_string (GLenum error_code);
|
|||||||
#define COGL_ENABLE_COLOR_ARRAY (1<<4)
|
#define COGL_ENABLE_COLOR_ARRAY (1<<4)
|
||||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
||||||
|
|
||||||
void _cogl_features_init (void);
|
void
|
||||||
|
_cogl_features_init (void);
|
||||||
|
|
||||||
gint _cogl_get_format_bpp (CoglPixelFormat format);
|
int
|
||||||
|
_cogl_get_format_bpp (CoglPixelFormat format);
|
||||||
|
|
||||||
void cogl_enable (gulong flags);
|
void
|
||||||
gulong cogl_get_enable (void);
|
cogl_enable (gulong flags);
|
||||||
|
|
||||||
|
unsigned long
|
||||||
|
cogl_get_enable (void);
|
||||||
|
|
||||||
typedef struct _CoglTextureUnit
|
typedef struct _CoglTextureUnit
|
||||||
{
|
{
|
||||||
@ -112,9 +118,11 @@ typedef struct _CoglTextureUnit
|
|||||||
|
|
||||||
CoglTextureUnit *
|
CoglTextureUnit *
|
||||||
_cogl_get_texture_unit (int index_);
|
_cogl_get_texture_unit (int index_);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_destroy_texture_units (void);
|
_cogl_destroy_texture_units (void);
|
||||||
guint
|
|
||||||
|
unsigned int
|
||||||
_cogl_get_max_texture_image_units (void);
|
_cogl_get_max_texture_image_units (void);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -88,7 +88,7 @@ typedef CoglVertexBufferIndices CoglJournalIndices;
|
|||||||
|
|
||||||
typedef struct _CoglJournalFlushState
|
typedef struct _CoglJournalFlushState
|
||||||
{
|
{
|
||||||
size_t stride;
|
gsize stride;
|
||||||
/* Note: this is a pointer to handle fallbacks. It normally holds a VBO
|
/* Note: this is a pointer to handle fallbacks. It normally holds a VBO
|
||||||
* offset, but when the driver doesn't support VBOs then this points into
|
* offset, but when the driver doesn't support VBOs then this points into
|
||||||
* our GArray of logged vertices. */
|
* our GArray of logged vertices. */
|
||||||
@ -96,7 +96,7 @@ typedef struct _CoglJournalFlushState
|
|||||||
GLuint vertex_offset;
|
GLuint vertex_offset;
|
||||||
#ifndef HAVE_COGL_GL
|
#ifndef HAVE_COGL_GL
|
||||||
CoglJournalIndices *indices;
|
CoglJournalIndices *indices;
|
||||||
size_t indices_type_size;
|
gsize indices_type_size;
|
||||||
#endif
|
#endif
|
||||||
CoglMatrixStack *modelview_stack;
|
CoglMatrixStack *modelview_stack;
|
||||||
} CoglJournalFlushState;
|
} CoglJournalFlushState;
|
||||||
@ -110,7 +110,7 @@ typedef gboolean (*CoglJournalBatchTest) (CoglJournalEntry *entry0,
|
|||||||
void
|
void
|
||||||
_cogl_journal_dump_quad_vertices (guint8 *data, int n_layers)
|
_cogl_journal_dump_quad_vertices (guint8 *data, int n_layers)
|
||||||
{
|
{
|
||||||
size_t stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers);
|
gsize stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -144,7 +144,7 @@ _cogl_journal_dump_quad_vertices (guint8 *data, int n_layers)
|
|||||||
void
|
void
|
||||||
_cogl_journal_dump_quad_batch (guint8 *data, int n_layers, int n_quads)
|
_cogl_journal_dump_quad_batch (guint8 *data, int n_layers, int n_quads)
|
||||||
{
|
{
|
||||||
size_t byte_stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers) * 4;
|
gsize byte_stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers) * 4;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_print ("_cogl_journal_dump_quad_batch: n_layers = %d, n_quads = %d\n",
|
g_print ("_cogl_journal_dump_quad_batch: n_layers = %d, n_quads = %d\n",
|
||||||
@ -304,10 +304,10 @@ compare_entry_modelviews (CoglJournalEntry *entry0,
|
|||||||
* materials, but they may not all have the same modelview matrix */
|
* materials, but they may not all have the same modelview matrix */
|
||||||
static void
|
static void
|
||||||
_cogl_journal_flush_material_and_entries (CoglJournalEntry *batch_start,
|
_cogl_journal_flush_material_and_entries (CoglJournalEntry *batch_start,
|
||||||
gint batch_len,
|
int batch_len,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
gulong enable_flags = 0;
|
unsigned long enable_flags = 0;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ compare_entry_materials (CoglJournalEntry *entry0, CoglJournalEntry *entry1)
|
|||||||
static void
|
static void
|
||||||
_cogl_journal_flush_texcoord_vbo_offsets_and_entries (
|
_cogl_journal_flush_texcoord_vbo_offsets_and_entries (
|
||||||
CoglJournalEntry *batch_start,
|
CoglJournalEntry *batch_start,
|
||||||
gint batch_len,
|
int batch_len,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
CoglJournalFlushState *state = data;
|
CoglJournalFlushState *state = data;
|
||||||
@ -423,11 +423,11 @@ compare_entry_n_layers (CoglJournalEntry *entry0, CoglJournalEntry *entry1)
|
|||||||
* of journal entries */
|
* of journal entries */
|
||||||
static void
|
static void
|
||||||
_cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
_cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
||||||
gint batch_len,
|
int batch_len,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
CoglJournalFlushState *state = data;
|
CoglJournalFlushState *state = data;
|
||||||
size_t stride;
|
gsize stride;
|
||||||
#ifndef HAVE_COGL_GL
|
#ifndef HAVE_COGL_GL
|
||||||
int needed_indices = batch_len * 6;
|
int needed_indices = batch_len * 6;
|
||||||
CoglHandle indices_handle;
|
CoglHandle indices_handle;
|
||||||
@ -502,7 +502,7 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
|||||||
/* progress forward through the VBO containing all our vertices */
|
/* progress forward through the VBO containing all our vertices */
|
||||||
state->vbo_offset += (stride * 4 * batch_len);
|
state->vbo_offset += (stride * 4 * batch_len);
|
||||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL))
|
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL))
|
||||||
g_print ("new vbo offset = %lu\n", (gulong)state->vbo_offset);
|
g_print ("new vbo offset = %lu\n", (unsigned long)state->vbo_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -524,7 +524,7 @@ compare_entry_strides (CoglJournalEntry *entry0, CoglJournalEntry *entry1)
|
|||||||
static GLuint
|
static GLuint
|
||||||
upload_vertices_to_vbo (GArray *vertices, CoglJournalFlushState *state)
|
upload_vertices_to_vbo (GArray *vertices, CoglJournalFlushState *state)
|
||||||
{
|
{
|
||||||
size_t needed_vbo_len;
|
gsize needed_vbo_len;
|
||||||
GLuint journal_vbo;
|
GLuint journal_vbo;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
@ -668,8 +668,8 @@ _cogl_journal_log_quad (float x_1,
|
|||||||
const float *tex_coords,
|
const float *tex_coords,
|
||||||
unsigned int tex_coords_len)
|
unsigned int tex_coords_len)
|
||||||
{
|
{
|
||||||
size_t stride;
|
gsize stride;
|
||||||
size_t byte_stride;
|
gsize byte_stride;
|
||||||
int next_vert;
|
int next_vert;
|
||||||
GLfloat *v;
|
GLfloat *v;
|
||||||
GLubyte *c;
|
GLubyte *c;
|
||||||
|
@ -60,23 +60,23 @@ typedef enum _CoglMaterialLayerPrivFlags
|
|||||||
/* For tracking the state of a layer that's been flushed to OpenGL */
|
/* For tracking the state of a layer that's been flushed to OpenGL */
|
||||||
typedef struct _CoglLayerInfo
|
typedef struct _CoglLayerInfo
|
||||||
{
|
{
|
||||||
CoglHandle handle;
|
CoglHandle handle;
|
||||||
gulong flags;
|
unsigned long flags;
|
||||||
GLenum gl_target;
|
GLenum gl_target;
|
||||||
GLuint gl_texture;
|
GLuint gl_texture;
|
||||||
gboolean fallback;
|
gboolean fallback;
|
||||||
gboolean disabled;
|
gboolean disabled;
|
||||||
gboolean layer0_overridden;
|
gboolean layer0_overridden;
|
||||||
} CoglLayerInfo;
|
} CoglLayerInfo;
|
||||||
|
|
||||||
struct _CoglMaterialLayer
|
struct _CoglMaterialLayer
|
||||||
{
|
{
|
||||||
CoglHandleObject _parent;
|
CoglHandleObject _parent;
|
||||||
guint index; /*!< lowest index is blended first then others
|
unsigned int index; /*!< lowest index is blended first then others on
|
||||||
on top */
|
top */
|
||||||
gulong flags;
|
unsigned long flags;
|
||||||
CoglHandle texture; /*!< The texture for this layer, or COGL_INVALID_HANDLE
|
CoglHandle texture; /*!< The texture for this layer, or
|
||||||
for an empty layer */
|
COGL_INVALID_HANDLE for an empty layer */
|
||||||
|
|
||||||
CoglMaterialFilter mag_filter;
|
CoglMaterialFilter mag_filter;
|
||||||
CoglMaterialFilter min_filter;
|
CoglMaterialFilter min_filter;
|
||||||
@ -112,9 +112,9 @@ typedef enum _CoglMaterialFlags
|
|||||||
struct _CoglMaterial
|
struct _CoglMaterial
|
||||||
{
|
{
|
||||||
CoglHandleObject _parent;
|
CoglHandleObject _parent;
|
||||||
gulong journal_ref_count;
|
unsigned long journal_ref_count;
|
||||||
|
|
||||||
gulong flags;
|
unsigned long flags;
|
||||||
|
|
||||||
/* If no lighting is enabled; this is the basic material color */
|
/* If no lighting is enabled; this is the basic material color */
|
||||||
GLubyte unlit[4];
|
GLubyte unlit[4];
|
||||||
@ -141,8 +141,8 @@ struct _CoglMaterial
|
|||||||
GLint blend_src_factor_rgb;
|
GLint blend_src_factor_rgb;
|
||||||
GLint blend_dst_factor_rgb;
|
GLint blend_dst_factor_rgb;
|
||||||
|
|
||||||
GList *layers;
|
GList *layers;
|
||||||
guint n_layers;
|
unsigned int n_layers;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -179,7 +179,8 @@ _cogl_material_init_default_material (void);
|
|||||||
* will be replaced.
|
* will be replaced.
|
||||||
*/
|
*/
|
||||||
/* TODO: find a nicer solution! */
|
/* TODO: find a nicer solution! */
|
||||||
gulong _cogl_material_get_cogl_enable_flags (CoglHandle handle);
|
unsigned long
|
||||||
|
_cogl_material_get_cogl_enable_flags (CoglHandle handle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CoglMaterialLayerFlags:
|
* CoglMaterialLayerFlags:
|
||||||
@ -202,13 +203,15 @@ typedef enum _CoglMaterialLayerFlags
|
|||||||
* internally, but if you are developing custom primitives directly with
|
* internally, but if you are developing custom primitives directly with
|
||||||
* OpenGL you may need this.
|
* OpenGL you may need this.
|
||||||
*/
|
*/
|
||||||
gulong _cogl_material_layer_get_flags (CoglHandle layer_handle);
|
unsigned long
|
||||||
|
_cogl_material_layer_get_flags (CoglHandle layer_handle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensures the mipmaps are available for the texture in the layer if
|
* Ensures the mipmaps are available for the texture in the layer if
|
||||||
* the filter settings would require it
|
* the filter settings would require it
|
||||||
*/
|
*/
|
||||||
void _cogl_material_layer_ensure_mipmaps (CoglHandle layer_handler);
|
void
|
||||||
|
_cogl_material_layer_ensure_mipmaps (CoglHandle layer_handler);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CoglMaterialFlushFlag:
|
* CoglMaterialFlushFlag:
|
||||||
@ -251,19 +254,25 @@ typedef struct _CoglMaterialFlushOptions
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _cogl_material_get_colorubv (CoglHandle handle,
|
void
|
||||||
guint8 *color);
|
_cogl_material_get_colorubv (CoglHandle handle,
|
||||||
|
guint8 *color);
|
||||||
|
|
||||||
void _cogl_material_flush_gl_state (CoglHandle material,
|
void
|
||||||
CoglMaterialFlushOptions *options);
|
_cogl_material_flush_gl_state (CoglHandle material,
|
||||||
|
CoglMaterialFlushOptions *options);
|
||||||
|
|
||||||
gboolean _cogl_material_equal (CoglHandle material0_handle,
|
gboolean
|
||||||
CoglMaterialFlushOptions *material0_flush_options,
|
_cogl_material_equal (CoglHandle material0_handle,
|
||||||
CoglHandle material1_handle,
|
CoglMaterialFlushOptions *material0_flush_options,
|
||||||
CoglMaterialFlushOptions *material1_flush_options);
|
CoglHandle material1_handle,
|
||||||
|
CoglMaterialFlushOptions *material1_flush_options);
|
||||||
|
|
||||||
CoglHandle _cogl_material_journal_ref (CoglHandle material_handle);
|
CoglHandle
|
||||||
void _cogl_material_journal_unref (CoglHandle material_handle);
|
_cogl_material_journal_ref (CoglHandle material_handle);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_material_journal_unref (CoglHandle material_handle);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __COGL_MATERIAL_PRIVATE_H */
|
#endif /* __COGL_MATERIAL_PRIVATE_H */
|
||||||
|
@ -740,7 +740,7 @@ cogl_material_set_blend_constant (CoglHandle handle,
|
|||||||
*/
|
*/
|
||||||
static CoglMaterialLayer *
|
static CoglMaterialLayer *
|
||||||
_cogl_material_get_layer (CoglMaterial *material,
|
_cogl_material_get_layer (CoglMaterial *material,
|
||||||
gint index_,
|
int index_,
|
||||||
gboolean create_if_not_found)
|
gboolean create_if_not_found)
|
||||||
{
|
{
|
||||||
CoglMaterialLayer *layer;
|
CoglMaterialLayer *layer;
|
||||||
@ -801,7 +801,7 @@ _cogl_material_get_layer (CoglMaterial *material,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_material_set_layer (CoglHandle material_handle,
|
cogl_material_set_layer (CoglHandle material_handle,
|
||||||
gint layer_index,
|
int layer_index,
|
||||||
CoglHandle texture_handle)
|
CoglHandle texture_handle)
|
||||||
{
|
{
|
||||||
CoglMaterial *material;
|
CoglMaterial *material;
|
||||||
@ -934,7 +934,7 @@ setup_texture_combine_state (CoglBlendStringStatement *statement,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cogl_material_set_layer_combine (CoglHandle handle,
|
cogl_material_set_layer_combine (CoglHandle handle,
|
||||||
gint layer_index,
|
int layer_index,
|
||||||
const char *combine_description,
|
const char *combine_description,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1004,7 +1004,7 @@ cogl_material_set_layer_combine (CoglHandle handle,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_material_set_layer_combine_constant (CoglHandle handle,
|
cogl_material_set_layer_combine_constant (CoglHandle handle,
|
||||||
gint layer_index,
|
int layer_index,
|
||||||
CoglColor *constant_color)
|
CoglColor *constant_color)
|
||||||
{
|
{
|
||||||
CoglMaterial *material;
|
CoglMaterial *material;
|
||||||
@ -1031,7 +1031,7 @@ cogl_material_set_layer_combine_constant (CoglHandle handle,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_material_set_layer_matrix (CoglHandle material_handle,
|
cogl_material_set_layer_matrix (CoglHandle material_handle,
|
||||||
gint layer_index,
|
int layer_index,
|
||||||
CoglMatrix *matrix)
|
CoglMatrix *matrix)
|
||||||
{
|
{
|
||||||
CoglMaterial *material;
|
CoglMaterial *material;
|
||||||
@ -1062,7 +1062,7 @@ _cogl_material_layer_free (CoglMaterialLayer *layer)
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_material_remove_layer (CoglHandle material_handle,
|
cogl_material_remove_layer (CoglHandle material_handle,
|
||||||
gint layer_index)
|
int layer_index)
|
||||||
{
|
{
|
||||||
CoglMaterial *material;
|
CoglMaterial *material;
|
||||||
CoglMaterialLayer *layer;
|
CoglMaterialLayer *layer;
|
||||||
@ -1099,11 +1099,11 @@ cogl_material_remove_layer (CoglHandle material_handle,
|
|||||||
|
|
||||||
/* XXX: This API is hopfully just a stop-gap solution. Ideally cogl_enable
|
/* XXX: This API is hopfully just a stop-gap solution. Ideally cogl_enable
|
||||||
* will be replaced. */
|
* will be replaced. */
|
||||||
gulong
|
unsigned long
|
||||||
_cogl_material_get_cogl_enable_flags (CoglHandle material_handle)
|
_cogl_material_get_cogl_enable_flags (CoglHandle material_handle)
|
||||||
{
|
{
|
||||||
CoglMaterial *material;
|
CoglMaterial *material;
|
||||||
gulong enable_flags = 0;
|
unsigned long enable_flags = 0;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
|
|
||||||
@ -1169,7 +1169,7 @@ cogl_material_layer_get_texture (CoglHandle layer_handle)
|
|||||||
return layer->texture;
|
return layer->texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
gulong
|
unsigned long
|
||||||
_cogl_material_layer_get_flags (CoglHandle layer_handle)
|
_cogl_material_layer_get_flags (CoglHandle layer_handle)
|
||||||
{
|
{
|
||||||
CoglMaterialLayer *layer;
|
CoglMaterialLayer *layer;
|
||||||
@ -1196,7 +1196,7 @@ _cogl_material_layer_copy (CoglHandle layer_handle)
|
|||||||
return _cogl_material_layer_handle_new (layer_copy);
|
return _cogl_material_layer_handle_new (layer_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static unsigned int
|
||||||
get_n_args_for_combine_func (GLint func)
|
get_n_args_for_combine_func (GLint func)
|
||||||
{
|
{
|
||||||
switch (func)
|
switch (func)
|
||||||
@ -2056,7 +2056,7 @@ cogl_material_layer_get_mag_filter (CoglHandle layer_handle)
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_material_set_layer_filters (CoglHandle handle,
|
cogl_material_set_layer_filters (CoglHandle handle,
|
||||||
gint layer_index,
|
int layer_index,
|
||||||
CoglMaterialFilter min_filter,
|
CoglMaterialFilter min_filter,
|
||||||
CoglMaterialFilter mag_filter)
|
CoglMaterialFilter mag_filter)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,8 @@ typedef enum {
|
|||||||
*
|
*
|
||||||
* Return value: a handle to the new material
|
* Return value: a handle to the new material
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_material_new (void);
|
CoglHandle
|
||||||
|
cogl_material_new (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_copy:
|
* cogl_material_copy:
|
||||||
@ -104,7 +105,8 @@ CoglHandle cogl_material_new (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_material_copy (CoglHandle source);
|
CoglHandle
|
||||||
|
cogl_material_copy (CoglHandle source);
|
||||||
|
|
||||||
#ifndef COGL_DISABLE_DEPRECATED
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
@ -120,7 +122,8 @@ CoglHandle cogl_material_copy (CoglHandle source);
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: Use cogl_handle_ref() instead
|
* Deprecated: 1.2: Use cogl_handle_ref() instead
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_material_ref (CoglHandle handle);
|
CoglHandle
|
||||||
|
cogl_material_ref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_unref:
|
* cogl_material_unref:
|
||||||
@ -132,7 +135,8 @@ CoglHandle cogl_material_ref (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: Use cogl_handle_unref() instead
|
* Deprecated: 1.2: Use cogl_handle_unref() instead
|
||||||
*/
|
*/
|
||||||
void cogl_material_unref (CoglHandle handle);
|
void
|
||||||
|
cogl_material_unref (CoglHandle handle);
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -145,7 +149,8 @@ void cogl_material_unref (CoglHandle handle);
|
|||||||
* Return value: %TRUE if the handle references a #CoglMaterial,
|
* Return value: %TRUE if the handle references a #CoglMaterial,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_is_material (CoglHandle handle);
|
gboolean
|
||||||
|
cogl_is_material (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_color:
|
* cogl_material_set_color:
|
||||||
@ -163,8 +168,9 @@ gboolean cogl_is_material (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_color (CoglHandle material,
|
void
|
||||||
const CoglColor *color);
|
cogl_material_set_color (CoglHandle material,
|
||||||
|
const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_color4ub:
|
* cogl_material_set_color4ub:
|
||||||
@ -180,11 +186,12 @@ void cogl_material_set_color (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_color4ub (CoglHandle material,
|
void
|
||||||
guint8 red,
|
cogl_material_set_color4ub (CoglHandle material,
|
||||||
guint8 green,
|
guint8 red,
|
||||||
guint8 blue,
|
guint8 green,
|
||||||
guint8 alpha);
|
guint8 blue,
|
||||||
|
guint8 alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_color4f:
|
* cogl_material_set_color4f:
|
||||||
@ -200,11 +207,12 @@ void cogl_material_set_color4ub (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_color4f (CoglHandle material,
|
void
|
||||||
float red,
|
cogl_material_set_color4f (CoglHandle material,
|
||||||
float green,
|
float red,
|
||||||
float blue,
|
float green,
|
||||||
float alpha);
|
float blue,
|
||||||
|
float alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_color:
|
* cogl_material_get_color:
|
||||||
@ -215,8 +223,9 @@ void cogl_material_set_color4f (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_get_color (CoglHandle material,
|
void
|
||||||
CoglColor *color);
|
cogl_material_get_color (CoglHandle material,
|
||||||
|
CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_ambient:
|
* cogl_material_set_ambient:
|
||||||
@ -234,8 +243,9 @@ void cogl_material_get_color (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_ambient (CoglHandle material,
|
void
|
||||||
const CoglColor *ambient);
|
cogl_material_set_ambient (CoglHandle material,
|
||||||
|
const CoglColor *ambient);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_ambient:
|
* cogl_material_get_ambient:
|
||||||
@ -246,8 +256,9 @@ void cogl_material_set_ambient (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_get_ambient (CoglHandle material,
|
void
|
||||||
CoglColor *ambient);
|
cogl_material_get_ambient (CoglHandle material,
|
||||||
|
CoglColor *ambient);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_diffuse:
|
* cogl_material_set_diffuse:
|
||||||
@ -262,8 +273,9 @@ void cogl_material_get_ambient (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_diffuse (CoglHandle material,
|
void
|
||||||
const CoglColor *diffuse);
|
cogl_material_set_diffuse (CoglHandle material,
|
||||||
|
const CoglColor *diffuse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_diffuse:
|
* cogl_material_get_diffuse:
|
||||||
@ -274,8 +286,9 @@ void cogl_material_set_diffuse (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_get_diffuse (CoglHandle material,
|
void
|
||||||
CoglColor *diffuse);
|
cogl_material_get_diffuse (CoglHandle material,
|
||||||
|
CoglColor *diffuse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_ambient_and_diffuse:
|
* cogl_material_set_ambient_and_diffuse:
|
||||||
@ -291,8 +304,9 @@ void cogl_material_get_diffuse (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_ambient_and_diffuse (CoglHandle material,
|
void
|
||||||
const CoglColor *color);
|
cogl_material_set_ambient_and_diffuse (CoglHandle material,
|
||||||
|
const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_specular:
|
* cogl_material_set_specular:
|
||||||
@ -307,8 +321,9 @@ void cogl_material_set_ambient_and_diffuse (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_specular (CoglHandle material,
|
void
|
||||||
const CoglColor *specular);
|
cogl_material_set_specular (CoglHandle material,
|
||||||
|
const CoglColor *specular);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_specular:
|
* cogl_material_get_specular:
|
||||||
@ -319,8 +334,9 @@ void cogl_material_set_specular (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_get_specular (CoglHandle material,
|
void
|
||||||
CoglColor *specular);
|
cogl_material_get_specular (CoglHandle material,
|
||||||
|
CoglColor *specular);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_shininess:
|
* cogl_material_set_shininess:
|
||||||
@ -335,8 +351,10 @@ void cogl_material_get_specular (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_shininess (CoglHandle material,
|
void
|
||||||
float shininess);
|
cogl_material_set_shininess (CoglHandle material,
|
||||||
|
float shininess);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_shininess:
|
* cogl_material_get_shininess:
|
||||||
* @material: A CoglMaterial object
|
* @material: A CoglMaterial object
|
||||||
@ -347,7 +365,8 @@ void cogl_material_set_shininess (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
float cogl_material_get_shininess (CoglHandle material);
|
float
|
||||||
|
cogl_material_get_shininess (CoglHandle material);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_emission:
|
* cogl_material_set_emission:
|
||||||
@ -362,8 +381,9 @@ float cogl_material_get_shininess (CoglHandle material);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_emission (CoglHandle material,
|
void
|
||||||
const CoglColor *emission);
|
cogl_material_set_emission (CoglHandle material,
|
||||||
|
const CoglColor *emission);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_emission:
|
* cogl_material_get_emission:
|
||||||
@ -374,8 +394,9 @@ void cogl_material_set_emission (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_get_emission (CoglHandle material,
|
void
|
||||||
CoglColor *emission);
|
cogl_material_get_emission (CoglHandle material,
|
||||||
|
CoglColor *emission);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglMaterialAlphaFunc:
|
* CoglMaterialAlphaFunc:
|
||||||
@ -427,9 +448,10 @@ typedef enum {
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_alpha_test_function (CoglHandle material,
|
void
|
||||||
CoglMaterialAlphaFunc alpha_func,
|
cogl_material_set_alpha_test_function (CoglHandle material,
|
||||||
float alpha_reference);
|
CoglMaterialAlphaFunc alpha_func,
|
||||||
|
float alpha_reference);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_blend:
|
* cogl_material_set_blend:
|
||||||
@ -515,9 +537,10 @@ void cogl_material_set_alpha_test_function (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
gboolean cogl_material_set_blend (CoglHandle material,
|
gboolean
|
||||||
const char *blend_string,
|
cogl_material_set_blend (CoglHandle material,
|
||||||
GError **error);
|
const char *blend_string,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_blend_constant:
|
* cogl_material_set_blend_constant:
|
||||||
@ -529,8 +552,9 @@ gboolean cogl_material_set_blend (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_blend_constant (CoglHandle material,
|
void
|
||||||
CoglColor *constant_color);
|
cogl_material_set_blend_constant (CoglHandle material,
|
||||||
|
CoglColor *constant_color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_layer:
|
* cogl_material_set_layer:
|
||||||
@ -551,9 +575,10 @@ void cogl_material_set_blend_constant (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_layer (CoglHandle material,
|
void
|
||||||
int layer_index,
|
cogl_material_set_layer (CoglHandle material,
|
||||||
CoglHandle texture);
|
int layer_index,
|
||||||
|
CoglHandle texture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_remove_layer:
|
* cogl_material_remove_layer:
|
||||||
@ -562,8 +587,9 @@ void cogl_material_set_layer (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* This function removes a layer from your material
|
* This function removes a layer from your material
|
||||||
*/
|
*/
|
||||||
void cogl_material_remove_layer (CoglHandle material,
|
void
|
||||||
gint layer_index);
|
cogl_material_remove_layer (CoglHandle material,
|
||||||
|
int layer_index);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -660,7 +686,7 @@ void cogl_material_remove_layer (CoglHandle material,
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_material_set_layer_combine (CoglHandle material,
|
cogl_material_set_layer_combine (CoglHandle material,
|
||||||
gint layer_index,
|
int layer_index,
|
||||||
const char *blend_string,
|
const char *blend_string,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
@ -676,9 +702,10 @@ cogl_material_set_layer_combine (CoglHandle material,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_layer_combine_constant (CoglHandle material,
|
void
|
||||||
int layer_index,
|
cogl_material_set_layer_combine_constant (CoglHandle material,
|
||||||
CoglColor *constant);
|
int layer_index,
|
||||||
|
CoglColor *constant);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_layer_matrix:
|
* cogl_material_set_layer_matrix:
|
||||||
@ -689,9 +716,10 @@ void cogl_material_set_layer_combine_constant (CoglHandle material,
|
|||||||
* This function lets you set a matrix that can be used to e.g. translate
|
* This function lets you set a matrix that can be used to e.g. translate
|
||||||
* and rotate a single layer of a material used to fill your geometry.
|
* and rotate a single layer of a material used to fill your geometry.
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_layer_matrix (CoglHandle material,
|
void
|
||||||
int layer_index,
|
cogl_material_set_layer_matrix (CoglHandle material,
|
||||||
CoglMatrix *matrix);
|
int layer_index,
|
||||||
|
CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_layers:
|
* cogl_material_get_layers:
|
||||||
@ -705,7 +733,8 @@ void cogl_material_set_layer_matrix (CoglHandle material,
|
|||||||
* functions. The list is owned by COGL and it should not be modified or
|
* functions. The list is owned by COGL and it should not be modified or
|
||||||
* freed
|
* freed
|
||||||
*/
|
*/
|
||||||
G_CONST_RETURN GList *cogl_material_get_layers (CoglHandle material);
|
G_CONST_RETURN GList *
|
||||||
|
cogl_material_get_layers (CoglHandle material);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_get_n_layers:
|
* cogl_material_get_n_layers:
|
||||||
@ -717,7 +746,8 @@ G_CONST_RETURN GList *cogl_material_get_layers (CoglHandle material);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
int cogl_material_get_n_layers (CoglHandle material);
|
int
|
||||||
|
cogl_material_get_n_layers (CoglHandle material);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglMaterialLayerType:
|
* CoglMaterialLayerType:
|
||||||
@ -747,7 +777,8 @@ typedef enum {
|
|||||||
*
|
*
|
||||||
* Return value: the type of the layer
|
* Return value: the type of the layer
|
||||||
*/
|
*/
|
||||||
CoglMaterialLayerType cogl_material_layer_get_type (CoglHandle layer);
|
CoglMaterialLayerType
|
||||||
|
cogl_material_layer_get_type (CoglHandle layer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_layer_get_texture:
|
* cogl_material_layer_get_texture:
|
||||||
@ -763,7 +794,8 @@ CoglMaterialLayerType cogl_material_layer_get_type (CoglHandle layer);
|
|||||||
*
|
*
|
||||||
* Return value: a #CoglHandle for the texture inside the layer
|
* Return value: a #CoglHandle for the texture inside the layer
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_material_layer_get_texture (CoglHandle layer);
|
CoglHandle
|
||||||
|
cogl_material_layer_get_texture (CoglHandle layer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_layer_get_min_filter:
|
* cogl_material_layer_get_min_filter:
|
||||||
@ -773,7 +805,8 @@ CoglHandle cogl_material_layer_get_texture (CoglHandle layer);
|
|||||||
*
|
*
|
||||||
* Return value: the current downscaling filter
|
* Return value: the current downscaling filter
|
||||||
*/
|
*/
|
||||||
CoglMaterialFilter cogl_material_layer_get_min_filter (CoglHandle layer);
|
CoglMaterialFilter
|
||||||
|
cogl_material_layer_get_min_filter (CoglHandle layer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_layer_get_mag_filter:
|
* cogl_material_layer_get_mag_filter:
|
||||||
@ -783,7 +816,8 @@ CoglMaterialFilter cogl_material_layer_get_min_filter (CoglHandle layer);
|
|||||||
*
|
*
|
||||||
* Return value: the current downscaling filter
|
* Return value: the current downscaling filter
|
||||||
*/
|
*/
|
||||||
CoglMaterialFilter cogl_material_layer_get_mag_filter (CoglHandle layer);
|
CoglMaterialFilter
|
||||||
|
cogl_material_layer_get_mag_filter (CoglHandle layer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_material_set_layer_filters:
|
* cogl_material_set_layer_filters:
|
||||||
@ -795,10 +829,11 @@ CoglMaterialFilter cogl_material_layer_get_mag_filter (CoglHandle layer);
|
|||||||
* Changes the decimation and interpolation filters used when a texture is
|
* Changes the decimation and interpolation filters used when a texture is
|
||||||
* drawn at other scales than 100%.
|
* drawn at other scales than 100%.
|
||||||
*/
|
*/
|
||||||
void cogl_material_set_layer_filters (CoglHandle material,
|
void
|
||||||
gint layer_index,
|
cogl_material_set_layer_filters (CoglHandle material,
|
||||||
CoglMaterialFilter min_filter,
|
int layer_index,
|
||||||
CoglMaterialFilter mag_filter);
|
CoglMaterialFilter min_filter,
|
||||||
|
CoglMaterialFilter mag_filter);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ struct _CoglMatrix
|
|||||||
/* Note: we may want to extend this later with private flags
|
/* Note: we may want to extend this later with private flags
|
||||||
* and a cache of the inverse transform matrix. */
|
* and a cache of the inverse transform matrix. */
|
||||||
float inv[16];
|
float inv[16];
|
||||||
gulong type;
|
unsigned long type;
|
||||||
gulong flags;
|
unsigned long flags;
|
||||||
gulong _padding3;
|
unsigned long _padding3;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +119,8 @@ struct _CoglMatrix
|
|||||||
* .wx=0; .wy=0; .wz=0; .ww=1;
|
* .wx=0; .wy=0; .wz=0; .ww=1;
|
||||||
* ]|
|
* ]|
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_init_identity (CoglMatrix *matrix);
|
void
|
||||||
|
cogl_matrix_init_identity (CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_multiply:
|
* cogl_matrix_multiply:
|
||||||
@ -130,9 +131,10 @@ void cogl_matrix_init_identity (CoglMatrix *matrix);
|
|||||||
* Multiplies the two supplied matrices together and stores
|
* Multiplies the two supplied matrices together and stores
|
||||||
* the resulting matrix inside @result
|
* the resulting matrix inside @result
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_multiply (CoglMatrix *result,
|
void
|
||||||
const CoglMatrix *a,
|
cogl_matrix_multiply (CoglMatrix *result,
|
||||||
const CoglMatrix *b);
|
const CoglMatrix *a,
|
||||||
|
const CoglMatrix *b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_rotate:
|
* cogl_matrix_rotate:
|
||||||
@ -145,11 +147,12 @@ void cogl_matrix_multiply (CoglMatrix *result,
|
|||||||
* Multiplies @matrix with a rotation matrix that applies a rotation
|
* Multiplies @matrix with a rotation matrix that applies a rotation
|
||||||
* of @angle degrees around the specified 3D vector.
|
* of @angle degrees around the specified 3D vector.
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_rotate (CoglMatrix *matrix,
|
void
|
||||||
float angle,
|
cogl_matrix_rotate (CoglMatrix *matrix,
|
||||||
float x,
|
float angle,
|
||||||
float y,
|
float x,
|
||||||
float z);
|
float y,
|
||||||
|
float z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_translate:
|
* cogl_matrix_translate:
|
||||||
@ -161,10 +164,11 @@ void cogl_matrix_rotate (CoglMatrix *matrix,
|
|||||||
* Multiplies @matrix with a transform matrix that translates along
|
* Multiplies @matrix with a transform matrix that translates along
|
||||||
* the X, Y and Z axis.
|
* the X, Y and Z axis.
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_translate (CoglMatrix *matrix,
|
void
|
||||||
float x,
|
cogl_matrix_translate (CoglMatrix *matrix,
|
||||||
float y,
|
float x,
|
||||||
float z);
|
float y,
|
||||||
|
float z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_scale:
|
* cogl_matrix_scale:
|
||||||
@ -176,10 +180,11 @@ void cogl_matrix_translate (CoglMatrix *matrix,
|
|||||||
* Multiplies @matrix with a transform matrix that scales along the X,
|
* Multiplies @matrix with a transform matrix that scales along the X,
|
||||||
* Y and Z axis.
|
* Y and Z axis.
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_scale (CoglMatrix *matrix,
|
void
|
||||||
float sx,
|
cogl_matrix_scale (CoglMatrix *matrix,
|
||||||
float sy,
|
float sx,
|
||||||
float sz);
|
float sy,
|
||||||
|
float sz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_frustum:
|
* cogl_matrix_frustum:
|
||||||
@ -193,13 +198,14 @@ void cogl_matrix_scale (CoglMatrix *matrix,
|
|||||||
*
|
*
|
||||||
* Multiplies @matrix by the given frustum perspective matrix.
|
* Multiplies @matrix by the given frustum perspective matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_frustum (CoglMatrix *matrix,
|
void
|
||||||
float left,
|
cogl_matrix_frustum (CoglMatrix *matrix,
|
||||||
float right,
|
float left,
|
||||||
float bottom,
|
float right,
|
||||||
float top,
|
float bottom,
|
||||||
float z_near,
|
float top,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_perspective:
|
* cogl_matrix_perspective:
|
||||||
@ -218,11 +224,12 @@ void cogl_matrix_frustum (CoglMatrix *matrix,
|
|||||||
* be enough precision to identify the depth of objects near to each
|
* be enough precision to identify the depth of objects near to each
|
||||||
* other.</note>
|
* other.</note>
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_perspective (CoglMatrix *matrix,
|
void
|
||||||
float fov_y,
|
cogl_matrix_perspective (CoglMatrix *matrix,
|
||||||
float aspect,
|
float fov_y,
|
||||||
float z_near,
|
float aspect,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_ortho:
|
* cogl_matrix_ortho:
|
||||||
@ -238,13 +245,14 @@ void cogl_matrix_perspective (CoglMatrix *matrix,
|
|||||||
*
|
*
|
||||||
* Multiplies @matrix by a parallel projection matrix.
|
* Multiplies @matrix by a parallel projection matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_ortho (CoglMatrix *matrix,
|
void
|
||||||
float left,
|
cogl_matrix_ortho (CoglMatrix *matrix,
|
||||||
float right,
|
float left,
|
||||||
float bottom,
|
float right,
|
||||||
float top,
|
float bottom,
|
||||||
float z_near,
|
float top,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_init_from_array:
|
* cogl_matrix_init_from_array:
|
||||||
@ -253,8 +261,9 @@ void cogl_matrix_ortho (CoglMatrix *matrix,
|
|||||||
*
|
*
|
||||||
* Initializes @matrix with the contents of @array
|
* Initializes @matrix with the contents of @array
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_init_from_array (CoglMatrix *matrix,
|
void
|
||||||
const float *array);
|
cogl_matrix_init_from_array (CoglMatrix *matrix,
|
||||||
|
const float *array);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_get_array:
|
* cogl_matrix_get_array:
|
||||||
@ -264,7 +273,8 @@ void cogl_matrix_init_from_array (CoglMatrix *matrix,
|
|||||||
*
|
*
|
||||||
* Return value: a pointer to the float array
|
* Return value: a pointer to the float array
|
||||||
*/
|
*/
|
||||||
G_CONST_RETURN float *cogl_matrix_get_array (const CoglMatrix *matrix);
|
G_CONST_RETURN float *
|
||||||
|
cogl_matrix_get_array (const CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_get_inverse:
|
* cogl_matrix_get_inverse:
|
||||||
@ -286,8 +296,9 @@ G_CONST_RETURN float *cogl_matrix_get_array (const CoglMatrix *matrix);
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
gboolean cogl_matrix_get_inverse (const CoglMatrix *matrix,
|
gboolean
|
||||||
CoglMatrix *inverse);
|
cogl_matrix_get_inverse (const CoglMatrix *matrix,
|
||||||
|
CoglMatrix *inverse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_matrix_transform_point:
|
* cogl_matrix_transform_point:
|
||||||
@ -300,11 +311,12 @@ gboolean cogl_matrix_get_inverse (const CoglMatrix *matrix,
|
|||||||
* Transforms a point whos position is given and returned as four float
|
* Transforms a point whos position is given and returned as four float
|
||||||
* components.
|
* components.
|
||||||
*/
|
*/
|
||||||
void cogl_matrix_transform_point (const CoglMatrix *matrix,
|
void
|
||||||
float *x,
|
cogl_matrix_transform_point (const CoglMatrix *matrix,
|
||||||
float *y,
|
float *x,
|
||||||
float *z,
|
float *y,
|
||||||
float *w);
|
float *z,
|
||||||
|
float *w);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
138
cogl/cogl-path.h
138
cogl/cogl-path.h
@ -63,10 +63,11 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Fills a rectangle at the given coordinates with the current source material
|
* Fills a rectangle at the given coordinates with the current source material
|
||||||
**/
|
**/
|
||||||
void cogl_rectangle (float x_1,
|
void
|
||||||
float y_1,
|
cogl_rectangle (float x_1,
|
||||||
float x_2,
|
float y_1,
|
||||||
float y_2);
|
float x_2,
|
||||||
|
float y_2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_fill:
|
* cogl_path_fill:
|
||||||
@ -75,7 +76,8 @@ void cogl_rectangle (float x_1,
|
|||||||
* current path is then cleared. To use the path again, call
|
* current path is then cleared. To use the path again, call
|
||||||
* cogl_path_fill_preserve() instead.
|
* cogl_path_fill_preserve() instead.
|
||||||
**/
|
**/
|
||||||
void cogl_path_fill (void);
|
void
|
||||||
|
cogl_path_fill (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_fill_preserve:
|
* cogl_path_fill_preserve:
|
||||||
@ -85,7 +87,8 @@ void cogl_path_fill (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
**/
|
**/
|
||||||
void cogl_path_fill_preserve (void);
|
void
|
||||||
|
cogl_path_fill_preserve (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_stroke:
|
* cogl_path_stroke:
|
||||||
@ -95,7 +98,8 @@ void cogl_path_fill_preserve (void);
|
|||||||
* matrix). To current path is then cleared. To use the path again,
|
* matrix). To current path is then cleared. To use the path again,
|
||||||
* call cogl_path_stroke_preserve() instead.
|
* call cogl_path_stroke_preserve() instead.
|
||||||
**/
|
**/
|
||||||
void cogl_path_stroke (void);
|
void
|
||||||
|
cogl_path_stroke (void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +110,8 @@ void cogl_path_stroke (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
**/
|
**/
|
||||||
void cogl_path_stroke_preserve (void);
|
void
|
||||||
|
cogl_path_stroke_preserve (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_new:
|
* cogl_path_new:
|
||||||
@ -115,7 +120,8 @@ void cogl_path_stroke_preserve (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_path_new (void);
|
void
|
||||||
|
cogl_path_new (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_move_to:
|
* cogl_path_move_to:
|
||||||
@ -125,8 +131,9 @@ void cogl_path_new (void);
|
|||||||
* Moves the pen to the given location. If there is an existing path
|
* Moves the pen to the given location. If there is an existing path
|
||||||
* this will start a new disjoint subpath.
|
* this will start a new disjoint subpath.
|
||||||
**/
|
**/
|
||||||
void cogl_path_move_to (float x,
|
void
|
||||||
float y);
|
cogl_path_move_to (float x,
|
||||||
|
float y);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,8 +145,9 @@ void cogl_path_move_to (float x,
|
|||||||
* location. If there is an existing path this will start a new
|
* location. If there is an existing path this will start a new
|
||||||
* disjoint subpath.
|
* disjoint subpath.
|
||||||
**/
|
**/
|
||||||
void cogl_path_rel_move_to (float x,
|
void
|
||||||
float y);
|
cogl_path_rel_move_to (float x,
|
||||||
|
float y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_line_to:
|
* cogl_path_line_to:
|
||||||
@ -149,8 +157,9 @@ void cogl_path_rel_move_to (float x,
|
|||||||
* Adds a straight line segment to the current path that ends at the
|
* Adds a straight line segment to the current path that ends at the
|
||||||
* given coordinates.
|
* given coordinates.
|
||||||
**/
|
**/
|
||||||
void cogl_path_line_to (float x,
|
void
|
||||||
float y);
|
cogl_path_line_to (float x,
|
||||||
|
float y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_rel_line_to:
|
* cogl_path_rel_line_to:
|
||||||
@ -160,8 +169,9 @@ void cogl_path_line_to (float x,
|
|||||||
* Adds a straight line segment to the current path that ends at the
|
* Adds a straight line segment to the current path that ends at the
|
||||||
* given coordinates relative to the current pen location.
|
* given coordinates relative to the current pen location.
|
||||||
**/
|
**/
|
||||||
void cogl_path_rel_line_to (float x,
|
void
|
||||||
float y);
|
cogl_path_rel_line_to (float x,
|
||||||
|
float y);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,14 +188,13 @@ void cogl_path_rel_line_to (float x,
|
|||||||
* of the arc. If you perform a move_to to the arcs start just before
|
* of the arc. If you perform a move_to to the arcs start just before
|
||||||
* drawing it you create a free standing arc.
|
* drawing it you create a free standing arc.
|
||||||
**/
|
**/
|
||||||
void cogl_path_arc (float center_x,
|
void
|
||||||
float center_y,
|
cogl_path_arc (float center_x,
|
||||||
float radius_x,
|
float center_y,
|
||||||
float radius_y,
|
float radius_x,
|
||||||
float angle_1,
|
float radius_y,
|
||||||
float angle_2);
|
float angle_1,
|
||||||
|
float angle_2);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_curve_to:
|
* cogl_path_curve_to:
|
||||||
@ -200,12 +209,13 @@ void cogl_path_arc (float center_x,
|
|||||||
* second, third and fourth control points and using current pen location
|
* second, third and fourth control points and using current pen location
|
||||||
* as the first control point.
|
* as the first control point.
|
||||||
**/
|
**/
|
||||||
void cogl_path_curve_to (float x_1,
|
void
|
||||||
float y_1,
|
cogl_path_curve_to (float x_1,
|
||||||
float x_2,
|
float y_1,
|
||||||
float y_2,
|
float x_2,
|
||||||
float x_3,
|
float y_2,
|
||||||
float y_3);
|
float x_3,
|
||||||
|
float y_3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_rel_curve_to:
|
* cogl_path_rel_curve_to:
|
||||||
@ -221,12 +231,13 @@ void cogl_path_curve_to (float x_1,
|
|||||||
* as the first control point. The given coordinates are relative to the
|
* as the first control point. The given coordinates are relative to the
|
||||||
* current pen location.
|
* current pen location.
|
||||||
*/
|
*/
|
||||||
void cogl_path_rel_curve_to (float x_1,
|
void
|
||||||
float y_1,
|
cogl_path_rel_curve_to (float x_1,
|
||||||
float x_2,
|
float y_1,
|
||||||
float y_2,
|
float x_2,
|
||||||
float x_3,
|
float y_2,
|
||||||
float y_3);
|
float x_3,
|
||||||
|
float y_3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_close:
|
* cogl_path_close:
|
||||||
@ -234,7 +245,8 @@ void cogl_path_rel_curve_to (float x_1,
|
|||||||
* Closes the path being constructed by adding a straight line segment
|
* Closes the path being constructed by adding a straight line segment
|
||||||
* to it that ends at the first vertex of the path.
|
* to it that ends at the first vertex of the path.
|
||||||
**/
|
**/
|
||||||
void cogl_path_close (void);
|
void
|
||||||
|
cogl_path_close (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_line:
|
* cogl_path_line:
|
||||||
@ -247,10 +259,11 @@ void cogl_path_close (void);
|
|||||||
* coordinates. If there is an existing path this will start a new
|
* coordinates. If there is an existing path this will start a new
|
||||||
* disjoint sub-path.
|
* disjoint sub-path.
|
||||||
**/
|
**/
|
||||||
void cogl_path_line (float x_1,
|
void
|
||||||
float y_1,
|
cogl_path_line (float x_1,
|
||||||
float x_2,
|
float y_1,
|
||||||
float y_2);
|
float x_2,
|
||||||
|
float y_2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_polyline:
|
* cogl_path_polyline:
|
||||||
@ -270,8 +283,9 @@ void cogl_path_line (float x_1,
|
|||||||
* fashion for the rest of the vertices. (num_points - 1) segments will
|
* fashion for the rest of the vertices. (num_points - 1) segments will
|
||||||
* be constructed.
|
* be constructed.
|
||||||
**/
|
**/
|
||||||
void cogl_path_polyline (float *coords,
|
void
|
||||||
gint num_points);
|
cogl_path_polyline (float *coords,
|
||||||
|
int num_points);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,8 +302,9 @@ void cogl_path_polyline (float *coords,
|
|||||||
* represents the Y coordinate of the first vertex, continuing in the same
|
* represents the Y coordinate of the first vertex, continuing in the same
|
||||||
* fashion for the rest of the vertices.
|
* fashion for the rest of the vertices.
|
||||||
**/
|
**/
|
||||||
void cogl_path_polygon (float *coords,
|
void
|
||||||
gint num_points);
|
cogl_path_polygon (float *coords,
|
||||||
|
int num_points);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -302,10 +317,11 @@ void cogl_path_polygon (float *coords,
|
|||||||
* Constructs a rectangular shape at the given coordinates. If there
|
* Constructs a rectangular shape at the given coordinates. If there
|
||||||
* is an existing path this will start a new disjoint sub-path.
|
* is an existing path this will start a new disjoint sub-path.
|
||||||
**/
|
**/
|
||||||
void cogl_path_rectangle (float x_1,
|
void
|
||||||
float y_1,
|
cogl_path_rectangle (float x_1,
|
||||||
float x_2,
|
float y_1,
|
||||||
float y_2);
|
float x_2,
|
||||||
|
float y_2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_ellipse:
|
* cogl_path_ellipse:
|
||||||
@ -317,10 +333,11 @@ void cogl_path_rectangle (float x_1,
|
|||||||
* Constructs an ellipse shape. If there is an existing path this will
|
* Constructs an ellipse shape. If there is an existing path this will
|
||||||
* start a new disjoint sub-path.
|
* start a new disjoint sub-path.
|
||||||
**/
|
**/
|
||||||
void cogl_path_ellipse (float center_x,
|
void
|
||||||
float center_y,
|
cogl_path_ellipse (float center_x,
|
||||||
float radius_x,
|
float center_y,
|
||||||
float radius_y);
|
float radius_x,
|
||||||
|
float radius_y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_path_round_rectangle:
|
* cogl_path_round_rectangle:
|
||||||
@ -335,12 +352,13 @@ void cogl_path_ellipse (float center_x,
|
|||||||
* Constructs a rectangular shape with rounded corners. If there is an
|
* Constructs a rectangular shape with rounded corners. If there is an
|
||||||
* existing path this will start a new disjoint sub-path.
|
* existing path this will start a new disjoint sub-path.
|
||||||
**/
|
**/
|
||||||
void cogl_path_round_rectangle (float x_1,
|
void
|
||||||
float y_1,
|
cogl_path_round_rectangle (float x_1,
|
||||||
float x_2,
|
float y_1,
|
||||||
float y_2,
|
float x_2,
|
||||||
float radius,
|
float y_2,
|
||||||
float arc_step);
|
float radius,
|
||||||
|
float arc_step);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -59,13 +59,14 @@ typedef struct _CoglPixelBuffer
|
|||||||
|
|
||||||
GLenum gl_target;
|
GLenum gl_target;
|
||||||
CoglPixelFormat format;
|
CoglPixelFormat format;
|
||||||
guint width;
|
unsigned int width;
|
||||||
guint height;
|
unsigned int height;
|
||||||
guint stride;
|
unsigned int stride;
|
||||||
|
|
||||||
} CoglPixelBuffer;
|
} CoglPixelBuffer;
|
||||||
|
|
||||||
GQuark _cogl_handle_pixel_buffer_get_type (void);
|
GQuark
|
||||||
|
_cogl_handle_pixel_buffer_get_type (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -76,12 +76,15 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void _cogl_pixel_buffer_free (CoglPixelBuffer *buffer);
|
static void
|
||||||
|
_cogl_pixel_buffer_free (CoglPixelBuffer *buffer);
|
||||||
|
|
||||||
#if !defined (COGL_HAS_GLES)
|
#if !defined (COGL_HAS_GLES)
|
||||||
static const CoglBufferVtable cogl_pixel_buffer_vtable;
|
static const CoglBufferVtable
|
||||||
|
cogl_pixel_buffer_vtable;
|
||||||
#endif
|
#endif
|
||||||
static const CoglBufferVtable cogl_malloc_pixel_buffer_vtable;
|
static const CoglBufferVtable
|
||||||
|
cogl_malloc_pixel_buffer_vtable;
|
||||||
|
|
||||||
/* we don't want to use the stock COGL_HANDLE_DEFINE * for 2 reasons:
|
/* we don't want to use the stock COGL_HANDLE_DEFINE * for 2 reasons:
|
||||||
* - it defines already deprecated symbols
|
* - it defines already deprecated symbols
|
||||||
@ -138,7 +141,7 @@ cogl_is_##type_name##_EXP (CoglHandle handle) \
|
|||||||
COGL_HANDLE_DEFINE_EXP(PixelBuffer, pixel_buffer)
|
COGL_HANDLE_DEFINE_EXP(PixelBuffer, pixel_buffer)
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_pixel_buffer_new_EXP (guint size)
|
cogl_pixel_buffer_new_EXP (unsigned int size)
|
||||||
{
|
{
|
||||||
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
|
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
|
||||||
CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
|
CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
|
||||||
@ -179,14 +182,14 @@ cogl_pixel_buffer_new_EXP (guint size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_pixel_buffer_new_for_size_EXP (guint width,
|
cogl_pixel_buffer_new_for_size_EXP (unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
guint *rowstride)
|
unsigned int *rowstride)
|
||||||
{
|
{
|
||||||
CoglHandle buffer;
|
CoglHandle buffer;
|
||||||
CoglPixelBuffer *pixel_buffer;
|
CoglPixelBuffer *pixel_buffer;
|
||||||
guint stride;
|
unsigned int stride;
|
||||||
|
|
||||||
/* creating a buffer to store "any" format does not make sense */
|
/* creating a buffer to store "any" format does not make sense */
|
||||||
if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY))
|
if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY))
|
||||||
@ -225,13 +228,13 @@ _cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined (COGL_HAS_GLES)
|
#if !defined (COGL_HAS_GLES)
|
||||||
static guchar *
|
static guint8 *
|
||||||
_cogl_pixel_buffer_map (CoglBuffer *buffer,
|
_cogl_pixel_buffer_map (CoglBuffer *buffer,
|
||||||
CoglBufferAccess access)
|
CoglBufferAccess access)
|
||||||
{
|
{
|
||||||
CoglPixelBuffer *pixel_buffer = COGL_PIXEL_BUFFER (buffer);
|
CoglPixelBuffer *pixel_buffer = COGL_PIXEL_BUFFER (buffer);
|
||||||
GLenum gl_target;
|
GLenum gl_target;
|
||||||
guchar *data;
|
guint8 *data;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NULL);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
@ -281,9 +284,9 @@ _cogl_pixel_buffer_unmap (CoglBuffer *buffer)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_pixel_buffer_set_data (CoglBuffer *buffer,
|
_cogl_pixel_buffer_set_data (CoglBuffer *buffer,
|
||||||
guint offset,
|
unsigned int offset,
|
||||||
const guchar *data,
|
const guint8 *data,
|
||||||
guint size)
|
unsigned int size)
|
||||||
{
|
{
|
||||||
CoglPixelBuffer *pixel_buffer = COGL_PIXEL_BUFFER (buffer);
|
CoglPixelBuffer *pixel_buffer = COGL_PIXEL_BUFFER (buffer);
|
||||||
|
|
||||||
@ -315,13 +318,13 @@ _cogl_pixel_buffer_set_data (CoglBuffer *buffer,
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
gboolean
|
gboolean
|
||||||
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
|
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
|
||||||
guchar *data,
|
guint8 *data,
|
||||||
guint src_width,
|
unsigned int src_width,
|
||||||
guint src_height,
|
unsigned int src_height,
|
||||||
guint src_rowstride,
|
unsigned int src_rowstride,
|
||||||
guint dst_x,
|
unsigned int dst_x,
|
||||||
guint dst_y)
|
unsigned int dst_y)
|
||||||
{
|
{
|
||||||
if (!cogl_is_pixel_buffer (buffer))
|
if (!cogl_is_pixel_buffer (buffer))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -342,7 +345,7 @@ static const CoglBufferVtable cogl_pixel_buffer_vtable =
|
|||||||
* Fallback path, buffer->data points to a malloc'ed buffer.
|
* Fallback path, buffer->data points to a malloc'ed buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static guchar *
|
static guint8 *
|
||||||
_cogl_malloc_pixel_buffer_map (CoglBuffer *buffer,
|
_cogl_malloc_pixel_buffer_map (CoglBuffer *buffer,
|
||||||
CoglBufferAccess access)
|
CoglBufferAccess access)
|
||||||
{
|
{
|
||||||
@ -358,9 +361,9 @@ _cogl_malloc_pixel_buffer_unmap (CoglBuffer *buffer)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_malloc_pixel_buffer_set_data (CoglBuffer *buffer,
|
_cogl_malloc_pixel_buffer_set_data (CoglBuffer *buffer,
|
||||||
guint offset,
|
unsigned int offset,
|
||||||
const guchar *data,
|
const guint8 *data,
|
||||||
guint size)
|
unsigned int size)
|
||||||
{
|
{
|
||||||
memcpy (buffer->data + offset, data, size);
|
memcpy (buffer->data + offset, data, size);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -50,7 +50,7 @@ G_BEGIN_DECLS
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_pixel_buffer_new (guint size);
|
cogl_pixel_buffer_new (unsigned int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pixel_buffer_new_for_size:
|
* cogl_pixel_buffer_new_for_size:
|
||||||
@ -75,10 +75,10 @@ cogl_pixel_buffer_new (guint size);
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_pixel_buffer_new_for_size (guint width,
|
cogl_pixel_buffer_new_for_size (unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
guint *stride);
|
unsigned int *stride);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_pixel_buffer:
|
* cogl_is_pixel_buffer:
|
||||||
@ -117,13 +117,13 @@ cogl_is_pixel_buffer (CoglHandle handle);
|
|||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
gboolean
|
gboolean
|
||||||
cogl_pixel_buffer_set_region (CoglHandle buffer,
|
cogl_pixel_buffer_set_region (CoglHandle buffer,
|
||||||
guchar *data,
|
guint8 *data,
|
||||||
guint src_width,
|
unsigned int src_width,
|
||||||
guint src_height,
|
unsigned int src_height,
|
||||||
guint src_rowstride,
|
unsigned int src_rowstride,
|
||||||
guint dst_x,
|
unsigned int dst_x,
|
||||||
guint dst_y);
|
unsigned int dst_y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* the functions above are experimental, the actual symbols are suffixed by
|
/* the functions above are experimental, the actual symbols are suffixed by
|
||||||
@ -132,25 +132,25 @@ cogl_pixel_buffer_set_region (CoglHandle buffer,
|
|||||||
* above into the real symbols */
|
* above into the real symbols */
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_pixel_buffer_new_EXP (guint size);
|
cogl_pixel_buffer_new_EXP (unsigned int size);
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_pixel_buffer_new_for_size_EXP (guint width,
|
cogl_pixel_buffer_new_for_size_EXP (unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
guint *stride);
|
unsigned int *stride);
|
||||||
gboolean
|
gboolean
|
||||||
cogl_is_pixel_buffer_EXP (CoglHandle handle);
|
cogl_is_pixel_buffer_EXP (CoglHandle handle);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
gboolean
|
gboolean
|
||||||
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
|
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
|
||||||
guchar *data,
|
guint8 *data,
|
||||||
guint src_width,
|
unsigned int src_width,
|
||||||
guint src_height,
|
unsigned int src_height,
|
||||||
guint src_rowstride,
|
unsigned int src_rowstride,
|
||||||
guint dst_x,
|
unsigned int dst_x,
|
||||||
guint dst_y);
|
unsigned int dst_y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
|
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -250,7 +250,7 @@ _cogl_multitexture_quad_single_primitive (float x_1,
|
|||||||
float *out_tex_coords;
|
float *out_tex_coords;
|
||||||
float default_tex_coords[4] = {0.0, 0.0, 1.0, 1.0};
|
float default_tex_coords[4] = {0.0, 0.0, 1.0, 1.0};
|
||||||
gboolean need_repeat = FALSE;
|
gboolean need_repeat = FALSE;
|
||||||
gint coord_num;
|
int coord_num;
|
||||||
GLenum wrap_mode;
|
GLenum wrap_mode;
|
||||||
|
|
||||||
tex_handle = cogl_material_layer_get_texture (layer);
|
tex_handle = cogl_material_layer_get_texture (layer);
|
||||||
@ -364,13 +364,13 @@ struct _CoglMutiTexturedRect
|
|||||||
float x_2;
|
float x_2;
|
||||||
float y_2;
|
float y_2;
|
||||||
const float *tex_coords;
|
const float *tex_coords;
|
||||||
gint tex_coords_len;
|
int tex_coords_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_rectangles_with_multitexture_coords (
|
_cogl_rectangles_with_multitexture_coords (
|
||||||
struct _CoglMutiTexturedRect *rects,
|
struct _CoglMutiTexturedRect *rects,
|
||||||
gint n_rects)
|
int n_rects)
|
||||||
{
|
{
|
||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
const GList *layers;
|
const GList *layers;
|
||||||
@ -395,7 +395,7 @@ _cogl_rectangles_with_multitexture_coords (
|
|||||||
{
|
{
|
||||||
CoglHandle layer = tmp->data;
|
CoglHandle layer = tmp->data;
|
||||||
CoglHandle tex_handle;
|
CoglHandle tex_handle;
|
||||||
gulong flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (cogl_material_layer_get_type (layer)
|
if (cogl_material_layer_get_type (layer)
|
||||||
!= COGL_MATERIAL_LAYER_TYPE_TEXTURE)
|
!= COGL_MATERIAL_LAYER_TYPE_TEXTURE)
|
||||||
@ -542,7 +542,7 @@ _cogl_rectangles_with_multitexture_coords (
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_rectangles (const float *verts,
|
cogl_rectangles (const float *verts,
|
||||||
guint n_rects)
|
unsigned int n_rects)
|
||||||
{
|
{
|
||||||
struct _CoglMutiTexturedRect *rects;
|
struct _CoglMutiTexturedRect *rects;
|
||||||
int i;
|
int i;
|
||||||
@ -564,7 +564,7 @@ cogl_rectangles (const float *verts,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_rectangles_with_texture_coords (const float *verts,
|
cogl_rectangles_with_texture_coords (const float *verts,
|
||||||
guint n_rects)
|
unsigned int n_rects)
|
||||||
{
|
{
|
||||||
struct _CoglMutiTexturedRect *rects;
|
struct _CoglMutiTexturedRect *rects;
|
||||||
int i;
|
int i;
|
||||||
@ -617,7 +617,7 @@ cogl_rectangle_with_multitexture_coords (float x_1,
|
|||||||
float x_2,
|
float x_2,
|
||||||
float y_2,
|
float y_2,
|
||||||
const float *user_tex_coords,
|
const float *user_tex_coords,
|
||||||
gint user_tex_coords_len)
|
int user_tex_coords_len)
|
||||||
{
|
{
|
||||||
struct _CoglMutiTexturedRect rect;
|
struct _CoglMutiTexturedRect rect;
|
||||||
|
|
||||||
@ -756,9 +756,9 @@ _cogl_texture_polygon_multiple_primitives (const CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_multitexture_polygon_single_primitive (const CoglTextureVertex *vertices,
|
_cogl_multitexture_polygon_single_primitive (const CoglTextureVertex *vertices,
|
||||||
guint n_vertices,
|
unsigned int n_vertices,
|
||||||
guint n_layers,
|
unsigned int n_layers,
|
||||||
guint stride,
|
unsigned int stride,
|
||||||
gboolean use_color,
|
gboolean use_color,
|
||||||
guint32 fallback_layers)
|
guint32 fallback_layers)
|
||||||
{
|
{
|
||||||
@ -835,7 +835,7 @@ _cogl_multitexture_polygon_single_primitive (const CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_polygon (const CoglTextureVertex *vertices,
|
cogl_polygon (const CoglTextureVertex *vertices,
|
||||||
guint n_vertices,
|
unsigned int n_vertices,
|
||||||
gboolean use_color)
|
gboolean use_color)
|
||||||
{
|
{
|
||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
@ -844,8 +844,8 @@ cogl_polygon (const CoglTextureVertex *vertices,
|
|||||||
gboolean use_sliced_polygon_fallback = FALSE;
|
gboolean use_sliced_polygon_fallback = FALSE;
|
||||||
guint32 fallback_layers = 0;
|
guint32 fallback_layers = 0;
|
||||||
int i;
|
int i;
|
||||||
gulong enable_flags;
|
unsigned long enable_flags;
|
||||||
guint stride;
|
unsigned int stride;
|
||||||
gsize stride_bytes;
|
gsize stride_bytes;
|
||||||
GLfloat *v;
|
GLfloat *v;
|
||||||
int prev_n_texcoord_arrays_enabled;
|
int prev_n_texcoord_arrays_enabled;
|
||||||
@ -1081,7 +1081,7 @@ _cogl_path_stroke_nodes (void)
|
|||||||
path_start);
|
path_start);
|
||||||
|
|
||||||
GE( glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
|
GE( glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
|
||||||
(guchar *) path
|
(guint8 *) path
|
||||||
+ G_STRUCT_OFFSET (CoglPathNode, x)) );
|
+ G_STRUCT_OFFSET (CoglPathNode, x)) );
|
||||||
GE( glDrawArrays (GL_LINE_STRIP, 0, path->path_size) );
|
GE( glDrawArrays (GL_LINE_STRIP, 0, path->path_size) );
|
||||||
|
|
||||||
@ -1200,7 +1200,7 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
|||||||
while (path_start < path_size)
|
while (path_start < path_size)
|
||||||
{
|
{
|
||||||
GE (glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
|
GE (glVertexPointer (2, GL_FLOAT, sizeof (CoglPathNode),
|
||||||
(guchar *) path
|
(guint8 *) path
|
||||||
+ G_STRUCT_OFFSET (CoglPathNode, x)));
|
+ G_STRUCT_OFFSET (CoglPathNode, x)));
|
||||||
GE (glDrawArrays (GL_TRIANGLE_FAN, 0, path->path_size));
|
GE (glDrawArrays (GL_TRIANGLE_FAN, 0, path->path_size));
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
|
|||||||
cogl_handle_unref (prev_source);
|
cogl_handle_unref (prev_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
compare_ints (gconstpointer a,
|
compare_ints (gconstpointer a,
|
||||||
gconstpointer b)
|
gconstpointer b)
|
||||||
{
|
{
|
||||||
@ -1359,7 +1359,7 @@ _cogl_path_fill_nodes_scanlines (CoglPathNode *path,
|
|||||||
y - bounds_y < bounds_h &&
|
y - bounds_y < bounds_h &&
|
||||||
lastline != y)
|
lastline != y)
|
||||||
{
|
{
|
||||||
gint x = prev_x + (dx * (y-prev_y)) / dy;
|
int x = prev_x + (dx * (y-prev_y)) / dy;
|
||||||
|
|
||||||
scanlines[ y - bounds_y ]=
|
scanlines[ y - bounds_y ]=
|
||||||
g_slist_insert_sorted (scanlines[ y - bounds_y],
|
g_slist_insert_sorted (scanlines[ y - bounds_y],
|
||||||
@ -1640,9 +1640,9 @@ cogl_path_line (float x_1,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_path_polyline (float *coords,
|
cogl_path_polyline (float *coords,
|
||||||
gint num_points)
|
int num_points)
|
||||||
{
|
{
|
||||||
gint c = 0;
|
int c = 0;
|
||||||
|
|
||||||
cogl_path_move_to (coords[0], coords[1]);
|
cogl_path_move_to (coords[0], coords[1]);
|
||||||
|
|
||||||
@ -1652,7 +1652,7 @@ cogl_path_polyline (float *coords,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_path_polygon (float *coords,
|
cogl_path_polygon (float *coords,
|
||||||
gint num_points)
|
int num_points)
|
||||||
{
|
{
|
||||||
cogl_path_polyline (coords, num_points);
|
cogl_path_polyline (coords, num_points);
|
||||||
cogl_path_close ();
|
cogl_path_close ();
|
||||||
@ -1679,7 +1679,7 @@ _cogl_path_arc (float center_x,
|
|||||||
float angle_1,
|
float angle_1,
|
||||||
float angle_2,
|
float angle_2,
|
||||||
float angle_step,
|
float angle_step,
|
||||||
guint move_first)
|
unsigned int move_first)
|
||||||
{
|
{
|
||||||
float a = 0x0;
|
float a = 0x0;
|
||||||
float cosa = 0x0;
|
float cosa = 0x0;
|
||||||
@ -1856,7 +1856,7 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic)
|
|||||||
floatVec2 c3;
|
floatVec2 c3;
|
||||||
floatVec2 c4;
|
floatVec2 c4;
|
||||||
floatVec2 c5;
|
floatVec2 c5;
|
||||||
gint cindex;
|
int cindex;
|
||||||
|
|
||||||
/* Put first curve on stack */
|
/* Put first curve on stack */
|
||||||
cubics[0] = *cubic;
|
cubics[0] = *cubic;
|
||||||
@ -2001,7 +2001,7 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad)
|
|||||||
floatVec2 c1;
|
floatVec2 c1;
|
||||||
floatVec2 c2;
|
floatVec2 c2;
|
||||||
floatVec2 c3;
|
floatVec2 c3;
|
||||||
gint qindex;
|
int qindex;
|
||||||
|
|
||||||
/* Put first curve on stack */
|
/* Put first curve on stack */
|
||||||
quads[0] = *quad;
|
quads[0] = *quad;
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
#ifndef __COGL_PRIMITIVES_H
|
#ifndef __COGL_PRIMITIVES_H
|
||||||
#define __COGL_PRIMITIVES_H
|
#define __COGL_PRIMITIVES_H
|
||||||
|
|
||||||
typedef struct _floatVec2 floatVec2;
|
typedef struct _floatVec2 floatVec2;
|
||||||
typedef struct _CoglBezQuad CoglBezQuad;
|
typedef struct _CoglBezQuad CoglBezQuad;
|
||||||
typedef struct _CoglBezCubic CoglBezCubic;
|
typedef struct _CoglBezCubic CoglBezCubic;
|
||||||
typedef struct _CoglPathNode CoglPathNode;
|
typedef struct _CoglPathNode CoglPathNode;
|
||||||
|
|
||||||
struct _floatVec2
|
struct _floatVec2
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ struct _CoglPathNode
|
|||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
guint path_size;
|
unsigned int path_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _CoglBezQuad
|
struct _CoglBezQuad
|
||||||
@ -57,6 +57,7 @@ struct _CoglBezCubic
|
|||||||
floatVec2 p4;
|
floatVec2 p4;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _cogl_journal_flush (void);
|
void
|
||||||
|
_cogl_journal_flush (void);
|
||||||
|
|
||||||
#endif /* __COGL_PRIMITIVES_H */
|
#endif /* __COGL_PRIMITIVES_H */
|
||||||
|
@ -66,7 +66,8 @@ typedef enum {
|
|||||||
*
|
*
|
||||||
* Returns: a new shader handle.
|
* Returns: a new shader handle.
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_create_shader (CoglShaderType shader_type);
|
CoglHandle
|
||||||
|
cogl_create_shader (CoglShaderType shader_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_ref:
|
* cogl_shader_ref:
|
||||||
@ -76,7 +77,8 @@ CoglHandle cogl_create_shader (CoglShaderType shader_type);
|
|||||||
*
|
*
|
||||||
* Returns: @handle
|
* Returns: @handle
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_shader_ref (CoglHandle handle);
|
CoglHandle
|
||||||
|
cogl_shader_ref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_unref:
|
* cogl_shader_unref:
|
||||||
@ -85,7 +87,8 @@ CoglHandle cogl_shader_ref (CoglHandle handle);
|
|||||||
* Removes a reference to a shader. If it was the last reference the
|
* Removes a reference to a shader. If it was the last reference the
|
||||||
* shader object will be destroyed.
|
* shader object will be destroyed.
|
||||||
*/
|
*/
|
||||||
void cogl_shader_unref (CoglHandle handle);
|
void
|
||||||
|
cogl_shader_unref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_shader:
|
* cogl_is_shader:
|
||||||
@ -96,7 +99,7 @@ void cogl_shader_unref (CoglHandle handle);
|
|||||||
* Returns: %TRUE if the handle references a shader,
|
* Returns: %TRUE if the handle references a shader,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_is_shader (CoglHandle handle);
|
gboolean cogl_is_shader (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_source:
|
* cogl_shader_source:
|
||||||
@ -106,8 +109,9 @@ gboolean cogl_is_shader (CoglHandle handle);
|
|||||||
* Replaces the current GLSL source associated with a shader with a new
|
* Replaces the current GLSL source associated with a shader with a new
|
||||||
* one.
|
* one.
|
||||||
*/
|
*/
|
||||||
void cogl_shader_source (CoglHandle shader,
|
void
|
||||||
const gchar *source);
|
cogl_shader_source (CoglHandle shader,
|
||||||
|
const char *source);
|
||||||
/**
|
/**
|
||||||
* cogl_shader_compile:
|
* cogl_shader_compile:
|
||||||
* @handle: #CoglHandle for a shader.
|
* @handle: #CoglHandle for a shader.
|
||||||
@ -115,7 +119,8 @@ void cogl_shader_source (CoglHandle shader,
|
|||||||
* Compiles the shader, no return value, but the shader is now ready for
|
* Compiles the shader, no return value, but the shader is now ready for
|
||||||
* linking into a program.
|
* linking into a program.
|
||||||
*/
|
*/
|
||||||
void cogl_shader_compile (CoglHandle handle);
|
void
|
||||||
|
cogl_shader_compile (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_get_info_log:
|
* cogl_shader_get_info_log:
|
||||||
@ -129,7 +134,8 @@ void cogl_shader_compile (CoglHandle handle);
|
|||||||
* Return value: a newly allocated string containing the info log. Use
|
* Return value: a newly allocated string containing the info log. Use
|
||||||
* g_free() to free it
|
* g_free() to free it
|
||||||
*/
|
*/
|
||||||
gchar * cogl_shader_get_info_log (CoglHandle handle);
|
char *
|
||||||
|
cogl_shader_get_info_log (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_get_type:
|
* cogl_shader_get_type:
|
||||||
@ -140,7 +146,8 @@ gchar * cogl_shader_get_info_log (CoglHandle handle);
|
|||||||
* Return value: %COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor
|
* Return value: %COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor
|
||||||
* or %COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
|
* or %COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
|
||||||
*/
|
*/
|
||||||
CoglShaderType cogl_shader_get_type (CoglHandle handle);
|
CoglShaderType
|
||||||
|
cogl_shader_get_type (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_is_compiled:
|
* cogl_shader_is_compiled:
|
||||||
@ -150,7 +157,8 @@ CoglShaderType cogl_shader_get_type (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Return value: %TRUE if the shader object has sucessfully be compiled
|
* Return value: %TRUE if the shader object has sucessfully be compiled
|
||||||
*/
|
*/
|
||||||
gboolean cogl_shader_is_compiled (CoglHandle handle);
|
gboolean
|
||||||
|
cogl_shader_is_compiled (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_create_program:
|
* cogl_create_program:
|
||||||
@ -160,7 +168,8 @@ gboolean cogl_shader_is_compiled (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Returns: a new cogl program.
|
* Returns: a new cogl program.
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_create_program (void);
|
CoglHandle
|
||||||
|
cogl_create_program (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_ref:
|
* cogl_program_ref:
|
||||||
@ -170,7 +179,8 @@ CoglHandle cogl_create_program (void);
|
|||||||
*
|
*
|
||||||
* Returns: @handle
|
* Returns: @handle
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_program_ref (CoglHandle handle);
|
CoglHandle
|
||||||
|
cogl_program_ref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_unref:
|
* cogl_program_unref:
|
||||||
@ -179,7 +189,8 @@ CoglHandle cogl_program_ref (CoglHandle handle);
|
|||||||
* Removes a reference to a program. If it was the last reference the
|
* Removes a reference to a program. If it was the last reference the
|
||||||
* program object will be destroyed.
|
* program object will be destroyed.
|
||||||
*/
|
*/
|
||||||
void cogl_program_unref (CoglHandle handle);
|
void
|
||||||
|
cogl_program_unref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_program:
|
* cogl_is_program:
|
||||||
@ -190,7 +201,8 @@ void cogl_program_unref (CoglHandle handle);
|
|||||||
* Returns: %TRUE if the handle references a program,
|
* Returns: %TRUE if the handle references a program,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_is_program (CoglHandle handle);
|
gboolean
|
||||||
|
cogl_is_program (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_attach_shader:
|
* cogl_program_attach_shader:
|
||||||
@ -200,8 +212,9 @@ gboolean cogl_is_program (CoglHandle handle);
|
|||||||
* Attaches a shader to a program object, a program can have one vertex shader
|
* Attaches a shader to a program object, a program can have one vertex shader
|
||||||
* and one fragment shader attached.
|
* and one fragment shader attached.
|
||||||
*/
|
*/
|
||||||
void cogl_program_attach_shader (CoglHandle program_handle,
|
void
|
||||||
CoglHandle shader_handle);
|
cogl_program_attach_shader (CoglHandle program_handle,
|
||||||
|
CoglHandle shader_handle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -210,7 +223,8 @@ void cogl_program_attach_shader (CoglHandle program_handle,
|
|||||||
*
|
*
|
||||||
* Links a program making it ready for use.
|
* Links a program making it ready for use.
|
||||||
*/
|
*/
|
||||||
void cogl_program_link (CoglHandle handle);
|
void
|
||||||
|
cogl_program_link (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_use:
|
* cogl_program_use:
|
||||||
@ -220,7 +234,8 @@ void cogl_program_link (CoglHandle handle);
|
|||||||
* rendering pipeline, if passed in %COGL_INVALID_HANDLE the default
|
* rendering pipeline, if passed in %COGL_INVALID_HANDLE the default
|
||||||
* behavior of GL is reinstated.
|
* behavior of GL is reinstated.
|
||||||
*/
|
*/
|
||||||
void cogl_program_use (CoglHandle handle);
|
void
|
||||||
|
cogl_program_use (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_get_uniform_location:
|
* cogl_program_get_uniform_location:
|
||||||
@ -235,9 +250,9 @@ void cogl_program_use (CoglHandle handle);
|
|||||||
* This uniform can be set using cogl_program_uniform_1f() when the
|
* This uniform can be set using cogl_program_uniform_1f() when the
|
||||||
* program is in use.
|
* program is in use.
|
||||||
*/
|
*/
|
||||||
int cogl_program_get_uniform_location
|
int
|
||||||
(CoglHandle handle,
|
cogl_program_get_uniform_location (CoglHandle handle,
|
||||||
const char *uniform_name);
|
const char *uniform_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_uniform_1f:
|
* cogl_program_uniform_1f:
|
||||||
@ -247,8 +262,9 @@ int cogl_program_get_uniform_location
|
|||||||
* Changes the value of a floating point uniform in the currently
|
* Changes the value of a floating point uniform in the currently
|
||||||
* used (see cogl_program_use()) shader program.
|
* used (see cogl_program_use()) shader program.
|
||||||
*/
|
*/
|
||||||
void cogl_program_uniform_1f (int uniform_no,
|
void
|
||||||
float value);
|
cogl_program_uniform_1f (int uniform_no,
|
||||||
|
float value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_uniform_1i:
|
* cogl_program_uniform_1i:
|
||||||
@ -258,8 +274,9 @@ void cogl_program_uniform_1f (int uniform_no,
|
|||||||
* Changes the value of an integer uniform in the currently
|
* Changes the value of an integer uniform in the currently
|
||||||
* used (see cogl_program_use()) shader program.
|
* used (see cogl_program_use()) shader program.
|
||||||
*/
|
*/
|
||||||
void cogl_program_uniform_1i (int uniform_no,
|
void
|
||||||
int value);
|
cogl_program_uniform_1i (int uniform_no,
|
||||||
|
int value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_uniform_float:
|
* cogl_program_uniform_float:
|
||||||
@ -271,10 +288,11 @@ void cogl_program_uniform_1i (int uniform_no,
|
|||||||
* Changes the value of a float vector uniform, or uniform array in the
|
* Changes the value of a float vector uniform, or uniform array in the
|
||||||
* currently used (see cogl_program_use()) shader program.
|
* currently used (see cogl_program_use()) shader program.
|
||||||
*/
|
*/
|
||||||
void cogl_program_uniform_float (int uniform_no,
|
void
|
||||||
int size,
|
cogl_program_uniform_float (int uniform_no,
|
||||||
int count,
|
int size,
|
||||||
const GLfloat *value);
|
int count,
|
||||||
|
const GLfloat *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_uniform_int:
|
* cogl_program_uniform_int:
|
||||||
@ -286,10 +304,11 @@ void cogl_program_uniform_float (int uniform_no,
|
|||||||
* Changes the value of a int vector uniform, or uniform array in the
|
* Changes the value of a int vector uniform, or uniform array in the
|
||||||
* currently used (see cogl_program_use()) shader program.
|
* currently used (see cogl_program_use()) shader program.
|
||||||
*/
|
*/
|
||||||
void cogl_program_uniform_int (int uniform_no,
|
void
|
||||||
int size,
|
cogl_program_uniform_int (int uniform_no,
|
||||||
int count,
|
int size,
|
||||||
const int *value);
|
int count,
|
||||||
|
const int *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_uniform_matrix:
|
* cogl_program_uniform_matrix:
|
||||||
@ -303,11 +322,12 @@ void cogl_program_uniform_int (int uniform_no,
|
|||||||
* currently used (see cogl_program_use()) shader program. The @size
|
* currently used (see cogl_program_use()) shader program. The @size
|
||||||
* parameter is used to determine the square size of the matrix.
|
* parameter is used to determine the square size of the matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_program_uniform_matrix (int uniform_no,
|
void
|
||||||
int size,
|
cogl_program_uniform_matrix (int uniform_no,
|
||||||
int count,
|
int size,
|
||||||
gboolean transpose,
|
int count,
|
||||||
const float *value);
|
gboolean transpose,
|
||||||
|
const float *value);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ struct _CoglSubTexture
|
|||||||
CoglHandle full_texture;
|
CoglHandle full_texture;
|
||||||
|
|
||||||
/* The region represented by this sub-texture */
|
/* The region represented by this sub-texture */
|
||||||
gint sub_x;
|
int sub_x;
|
||||||
gint sub_y;
|
int sub_y;
|
||||||
gint sub_width;
|
int sub_width;
|
||||||
gint sub_height;
|
int sub_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
@ -49,7 +49,9 @@ _cogl_handle_sub_texture_get_type (void);
|
|||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
_cogl_sub_texture_new (CoglHandle full_texture,
|
_cogl_sub_texture_new (CoglHandle full_texture,
|
||||||
gint sub_x, gint sub_y,
|
int sub_x,
|
||||||
gint sub_width, gint sub_height);
|
int sub_y,
|
||||||
|
int sub_width,
|
||||||
|
int sub_height);
|
||||||
|
|
||||||
#endif /* __COGL_SUB_TEXTURE_H */
|
#endif /* __COGL_SUB_TEXTURE_H */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Intel Corporation.
|
* Copyright (C) 2009,2010 Intel Corporation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -47,12 +47,12 @@ COGL_HANDLE_DEFINE (SubTexture, sub_texture);
|
|||||||
static const CoglTextureVtable cogl_sub_texture_vtable;
|
static const CoglTextureVtable cogl_sub_texture_vtable;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_sub_texture_map_range (gfloat *t1, gfloat *t2,
|
_cogl_sub_texture_map_range (float *t1, float *t2,
|
||||||
gint sub_offset,
|
int sub_offset,
|
||||||
gint sub_size,
|
int sub_size,
|
||||||
gint full_size)
|
int full_size)
|
||||||
{
|
{
|
||||||
gfloat t1_frac, t1_int, t2_frac, t2_int;
|
float t1_frac, t1_int, t2_frac, t2_int;
|
||||||
|
|
||||||
t1_frac = modff (*t1, &t1_int);
|
t1_frac = modff (*t1, &t1_int);
|
||||||
t2_frac = modff (*t2, &t2_int);
|
t2_frac = modff (*t2, &t2_int);
|
||||||
@ -98,10 +98,10 @@ _cogl_sub_texture_map_range (gfloat *t1, gfloat *t2,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,
|
_cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,
|
||||||
gfloat *coords)
|
float *coords)
|
||||||
{
|
{
|
||||||
guint full_width = cogl_texture_get_width (sub_tex->full_texture);
|
unsigned int full_width = cogl_texture_get_width (sub_tex->full_texture);
|
||||||
guint full_height = cogl_texture_get_height (sub_tex->full_texture);
|
unsigned int full_height = cogl_texture_get_height (sub_tex->full_texture);
|
||||||
|
|
||||||
_cogl_sub_texture_map_range (coords + 0, coords + 2,
|
_cogl_sub_texture_map_range (coords + 0, coords + 2,
|
||||||
sub_tex->sub_x, sub_tex->sub_width,
|
sub_tex->sub_x, sub_tex->sub_width,
|
||||||
@ -113,13 +113,13 @@ _cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,
|
|||||||
|
|
||||||
/* Maps from the texture coordinates of the full texture to the
|
/* Maps from the texture coordinates of the full texture to the
|
||||||
texture coordinates of the sub texture */
|
texture coordinates of the sub texture */
|
||||||
static gfloat
|
static float
|
||||||
_cogl_sub_texture_unmap_coord (gfloat t,
|
_cogl_sub_texture_unmap_coord (float t,
|
||||||
gint sub_offset,
|
int sub_offset,
|
||||||
gint sub_size,
|
int sub_size,
|
||||||
gint full_size)
|
int full_size)
|
||||||
{
|
{
|
||||||
gfloat frac_part, int_part;
|
float frac_part, int_part;
|
||||||
|
|
||||||
/* Convert the fractional part leaving the integer part in tact */
|
/* Convert the fractional part leaving the integer part in tact */
|
||||||
frac_part = modff (t, &int_part);
|
frac_part = modff (t, &int_part);
|
||||||
@ -135,11 +135,11 @@ _cogl_sub_texture_unmap_coord (gfloat t,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_sub_texture_unmap_coords (CoglSubTexture *sub_tex,
|
_cogl_sub_texture_unmap_coords (CoglSubTexture *sub_tex,
|
||||||
gfloat *s,
|
float *s,
|
||||||
gfloat *t)
|
float *t)
|
||||||
{
|
{
|
||||||
guint full_width = cogl_texture_get_width (sub_tex->full_texture);
|
unsigned int full_width = cogl_texture_get_width (sub_tex->full_texture);
|
||||||
guint full_height = cogl_texture_get_height (sub_tex->full_texture);
|
unsigned int full_height = cogl_texture_get_height (sub_tex->full_texture);
|
||||||
|
|
||||||
*s = _cogl_sub_texture_unmap_coord (*s, sub_tex->sub_x, sub_tex->sub_width,
|
*s = _cogl_sub_texture_unmap_coord (*s, sub_tex->sub_x, sub_tex->sub_width,
|
||||||
full_width);
|
full_width);
|
||||||
@ -242,12 +242,12 @@ _cogl_sub_texture_free (CoglSubTexture *sub_tex)
|
|||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
_cogl_sub_texture_new (CoglHandle full_texture,
|
_cogl_sub_texture_new (CoglHandle full_texture,
|
||||||
gint sub_x, gint sub_y,
|
int sub_x, int sub_y,
|
||||||
gint sub_width, gint sub_height)
|
int sub_width, int sub_height)
|
||||||
{
|
{
|
||||||
CoglSubTexture *sub_tex;
|
CoglSubTexture *sub_tex;
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
guint full_width, full_height;
|
unsigned int full_width, full_height;
|
||||||
|
|
||||||
full_width = cogl_texture_get_width (full_texture);
|
full_width = cogl_texture_get_width (full_texture);
|
||||||
full_height = cogl_texture_get_height (full_texture);
|
full_height = cogl_texture_get_height (full_texture);
|
||||||
@ -273,7 +273,7 @@ _cogl_sub_texture_new (CoglHandle full_texture,
|
|||||||
return _cogl_sub_texture_handle_new (sub_tex);
|
return _cogl_sub_texture_handle_new (sub_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_sub_texture_get_max_waste (CoglTexture *tex)
|
_cogl_sub_texture_get_max_waste (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
||||||
@ -403,14 +403,14 @@ _cogl_sub_texture_set_region (CoglTexture *tex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_sub_texture_copy_region (guchar *dst,
|
_cogl_sub_texture_copy_region (guint8 *dst,
|
||||||
const guchar *src,
|
const guint8 *src,
|
||||||
gint dst_x, gint dst_y,
|
int dst_x, int dst_y,
|
||||||
gint src_x, gint src_y,
|
int src_x, int src_y,
|
||||||
gint width, gint height,
|
int width, int height,
|
||||||
gint dst_rowstride,
|
int dst_rowstride,
|
||||||
gint src_rowstride,
|
int src_rowstride,
|
||||||
gint bpp)
|
int bpp)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
@ -435,8 +435,8 @@ _cogl_sub_texture_get_data (CoglTexture *tex,
|
|||||||
unsigned int full_rowstride;
|
unsigned int full_rowstride;
|
||||||
guint8 *full_data;
|
guint8 *full_data;
|
||||||
int byte_size, full_size;
|
int byte_size, full_size;
|
||||||
gint bpp;
|
int bpp;
|
||||||
gint full_tex_width, full_tex_height;
|
int full_tex_width, full_tex_height;
|
||||||
|
|
||||||
/* FIXME: This gets the full data from the full texture and then
|
/* FIXME: This gets the full data from the full texture and then
|
||||||
copies a subregion of that. It would be better if there was a
|
copies a subregion of that. It would be better if there was a
|
||||||
@ -500,7 +500,7 @@ _cogl_sub_texture_get_gl_format (CoglTexture *tex)
|
|||||||
return _cogl_texture_get_gl_format (sub_tex->full_texture);
|
return _cogl_texture_get_gl_format (sub_tex->full_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_sub_texture_get_width (CoglTexture *tex)
|
_cogl_sub_texture_get_width (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
||||||
@ -508,7 +508,7 @@ _cogl_sub_texture_get_width (CoglTexture *tex)
|
|||||||
return sub_tex->sub_width;
|
return sub_tex->sub_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_sub_texture_get_height (CoglTexture *tex)
|
_cogl_sub_texture_get_height (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
|
||||||
|
@ -43,8 +43,8 @@ struct _CoglTexture2D
|
|||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
/* The texture object number */
|
/* The texture object number */
|
||||||
GLuint gl_texture;
|
GLuint gl_texture;
|
||||||
gint width;
|
int width;
|
||||||
gint height;
|
int height;
|
||||||
GLenum min_filter;
|
GLenum min_filter;
|
||||||
GLenum mag_filter;
|
GLenum mag_filter;
|
||||||
GLint wrap_mode;
|
GLint wrap_mode;
|
||||||
|
@ -52,7 +52,7 @@ struct _CoglTexture2DSliced
|
|||||||
GArray *slice_x_spans;
|
GArray *slice_x_spans;
|
||||||
GArray *slice_y_spans;
|
GArray *slice_y_spans;
|
||||||
GArray *slice_gl_handles;
|
GArray *slice_gl_handles;
|
||||||
gint max_waste;
|
int max_waste;
|
||||||
|
|
||||||
/* The internal format of the GL texture represented as a
|
/* The internal format of the GL texture represented as a
|
||||||
CoglPixelFormat */
|
CoglPixelFormat */
|
||||||
@ -60,8 +60,8 @@ struct _CoglTexture2DSliced
|
|||||||
/* The internal format of the GL texture represented as a GL enum */
|
/* The internal format of the GL texture represented as a GL enum */
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_target;
|
GLenum gl_target;
|
||||||
gint width;
|
int width;
|
||||||
gint height;
|
int height;
|
||||||
GLenum min_filter;
|
GLenum min_filter;
|
||||||
GLenum mag_filter;
|
GLenum mag_filter;
|
||||||
gboolean is_foreign;
|
gboolean is_foreign;
|
||||||
|
@ -181,13 +181,13 @@ _cogl_texture_2d_sliced_foreach_sub_texture_in_region (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static guchar *
|
static guint8 *
|
||||||
_cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
|
_cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
|
||||||
CoglPixelFormat format)
|
CoglPixelFormat format)
|
||||||
{
|
{
|
||||||
CoglSpan *last_x_span;
|
CoglSpan *last_x_span;
|
||||||
CoglSpan *last_y_span;
|
CoglSpan *last_y_span;
|
||||||
guchar *waste_buf = NULL;
|
guint8 *waste_buf = NULL;
|
||||||
|
|
||||||
/* If the texture has any waste then allocate a buffer big enough to
|
/* If the texture has any waste then allocate a buffer big enough to
|
||||||
fill the gaps */
|
fill the gaps */
|
||||||
@ -197,13 +197,13 @@ _cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
|
|||||||
tex_2ds->slice_y_spans->len - 1);
|
tex_2ds->slice_y_spans->len - 1);
|
||||||
if (last_x_span->waste > 0 || last_y_span->waste > 0)
|
if (last_x_span->waste > 0 || last_y_span->waste > 0)
|
||||||
{
|
{
|
||||||
gint bpp = _cogl_get_format_bpp (format);
|
int bpp = _cogl_get_format_bpp (format);
|
||||||
CoglSpan *first_x_span
|
CoglSpan *first_x_span
|
||||||
= &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
|
= &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
|
||||||
CoglSpan *first_y_span
|
CoglSpan *first_y_span
|
||||||
= &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
|
= &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
|
||||||
guint right_size = first_y_span->size * last_x_span->waste;
|
unsigned int right_size = first_y_span->size * last_x_span->waste;
|
||||||
guint bottom_size = first_x_span->size * last_y_span->waste;
|
unsigned int bottom_size = first_x_span->size * last_y_span->waste;
|
||||||
|
|
||||||
waste_buf = g_malloc (MAX (right_size, bottom_size) * bpp);
|
waste_buf = g_malloc (MAX (right_size, bottom_size) * bpp);
|
||||||
}
|
}
|
||||||
@ -220,10 +220,10 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
{
|
{
|
||||||
CoglSpan *x_span;
|
CoglSpan *x_span;
|
||||||
CoglSpan *y_span;
|
CoglSpan *y_span;
|
||||||
GLuint gl_handle;
|
GLuint gl_handle;
|
||||||
gint bpp;
|
int bpp;
|
||||||
gint x,y;
|
int x, y;
|
||||||
guchar *waste_buf;
|
guint8 *waste_buf;
|
||||||
|
|
||||||
bpp = _cogl_get_format_bpp (bmp->format);
|
bpp = _cogl_get_format_bpp (bmp->format);
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
/* Iterate horizontal slices */
|
/* Iterate horizontal slices */
|
||||||
for (x = 0; x < tex_2ds->slice_x_spans->len; ++x)
|
for (x = 0; x < tex_2ds->slice_x_spans->len; ++x)
|
||||||
{
|
{
|
||||||
gint slice_num = y * tex_2ds->slice_x_spans->len + x;
|
int slice_num = y * tex_2ds->slice_x_spans->len + x;
|
||||||
|
|
||||||
x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
|
x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
|
||||||
|
|
||||||
@ -272,11 +272,11 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
/* Fill the waste with a copies of the rightmost pixels */
|
/* Fill the waste with a copies of the rightmost pixels */
|
||||||
if (x_span->waste > 0)
|
if (x_span->waste > 0)
|
||||||
{
|
{
|
||||||
const guchar *src = bmp->data
|
const guint8 *src = bmp->data
|
||||||
+ y_span->start * bmp->rowstride
|
+ y_span->start * bmp->rowstride
|
||||||
+ (x_span->start + x_span->size - x_span->waste - 1) * bpp;
|
+ (x_span->start + x_span->size - x_span->waste - 1) * bpp;
|
||||||
guchar *dst = waste_buf;
|
guint8 *dst = waste_buf;
|
||||||
guint wx, wy;
|
unsigned int wx, wy;
|
||||||
|
|
||||||
for (wy = 0; wy < y_span->size - y_span->waste; wy++)
|
for (wy = 0; wy < y_span->size - y_span->waste; wy++)
|
||||||
{
|
{
|
||||||
@ -303,12 +303,12 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
|
|
||||||
if (y_span->waste > 0)
|
if (y_span->waste > 0)
|
||||||
{
|
{
|
||||||
const guchar *src = bmp->data
|
const guint8 *src = bmp->data
|
||||||
+ ((y_span->start + y_span->size - y_span->waste - 1)
|
+ ((y_span->start + y_span->size - y_span->waste - 1)
|
||||||
* bmp->rowstride)
|
* bmp->rowstride)
|
||||||
+ x_span->start * bpp;
|
+ x_span->start * bpp;
|
||||||
guchar *dst = waste_buf;
|
guint8 *dst = waste_buf;
|
||||||
guint wy, wx;
|
unsigned int wy, wx;
|
||||||
|
|
||||||
for (wy = 0; wy < y_span->waste; wy++)
|
for (wy = 0; wy < y_span->waste; wy++)
|
||||||
{
|
{
|
||||||
@ -347,26 +347,26 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
_cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
||||||
gint src_x,
|
int src_x,
|
||||||
gint src_y,
|
int src_y,
|
||||||
gint dst_x,
|
int dst_x,
|
||||||
gint dst_y,
|
int dst_y,
|
||||||
gint width,
|
int width,
|
||||||
gint height,
|
int height,
|
||||||
CoglBitmap *source_bmp,
|
CoglBitmap *source_bmp,
|
||||||
GLuint source_gl_format,
|
GLuint source_gl_format,
|
||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
CoglSpan *x_span;
|
CoglSpan *x_span;
|
||||||
CoglSpan *y_span;
|
CoglSpan *y_span;
|
||||||
gint bpp;
|
int bpp;
|
||||||
CoglSpanIter x_iter;
|
CoglSpanIter x_iter;
|
||||||
CoglSpanIter y_iter;
|
CoglSpanIter y_iter;
|
||||||
GLuint gl_handle;
|
GLuint gl_handle;
|
||||||
gint source_x = 0, source_y = 0;
|
int source_x = 0, source_y = 0;
|
||||||
gint inter_w = 0, inter_h = 0;
|
int inter_w = 0, inter_h = 0;
|
||||||
gint local_x = 0, local_y = 0;
|
int local_x = 0, local_y = 0;
|
||||||
guchar *waste_buf;
|
guint8 *waste_buf;
|
||||||
|
|
||||||
bpp = _cogl_get_format_bpp (source_bmp->format);
|
bpp = _cogl_get_format_bpp (source_bmp->format);
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
_cogl_span_iter_next (&x_iter),
|
_cogl_span_iter_next (&x_iter),
|
||||||
source_x += inter_w )
|
source_x += inter_w )
|
||||||
{
|
{
|
||||||
gint slice_num;
|
int slice_num;
|
||||||
|
|
||||||
/* Discard slices out of the subregion early */
|
/* Discard slices out of the subregion early */
|
||||||
if (!x_iter.intersects)
|
if (!x_iter.intersects)
|
||||||
@ -464,9 +464,9 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
&& local_x < x_span->size - x_span->waste
|
&& local_x < x_span->size - x_span->waste
|
||||||
&& local_x + inter_w >= x_span->size - x_span->waste)
|
&& local_x + inter_w >= x_span->size - x_span->waste)
|
||||||
{
|
{
|
||||||
const guchar *src;
|
const guint8 *src;
|
||||||
guchar *dst;
|
guint8 *dst;
|
||||||
guint wx, wy;
|
unsigned int wx, wy;
|
||||||
|
|
||||||
src = source_bmp->data
|
src = source_bmp->data
|
||||||
+ (src_y + ((int)y_iter.intersect_start)
|
+ (src_y + ((int)y_iter.intersect_start)
|
||||||
@ -507,10 +507,10 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
&& local_y < y_span->size - y_span->waste
|
&& local_y < y_span->size - y_span->waste
|
||||||
&& local_y + inter_h >= y_span->size - y_span->waste)
|
&& local_y + inter_h >= y_span->size - y_span->waste)
|
||||||
{
|
{
|
||||||
const guchar *src;
|
const guint8 *src;
|
||||||
guchar *dst;
|
guint8 *dst;
|
||||||
guint wy, wx;
|
unsigned int wy, wx;
|
||||||
guint copy_width;
|
unsigned int copy_width;
|
||||||
|
|
||||||
src = source_bmp->data
|
src = source_bmp->data
|
||||||
+ (src_x + ((int)x_iter.intersect_start)
|
+ (src_x + ((int)x_iter.intersect_start)
|
||||||
@ -563,13 +563,13 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_rect_slices_for_size (int size_to_fill,
|
_cogl_rect_slices_for_size (int size_to_fill,
|
||||||
int max_span_size,
|
int max_span_size,
|
||||||
int max_waste,
|
int max_waste,
|
||||||
GArray *out_spans)
|
GArray *out_spans)
|
||||||
{
|
{
|
||||||
int n_spans = 0;
|
int n_spans = 0;
|
||||||
CoglSpan span;
|
CoglSpan span;
|
||||||
|
|
||||||
/* Init first slice span */
|
/* Init first slice span */
|
||||||
@ -600,13 +600,13 @@ _cogl_rect_slices_for_size (int size_to_fill,
|
|||||||
return n_spans;
|
return n_spans;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_pot_slices_for_size (gint size_to_fill,
|
_cogl_pot_slices_for_size (int size_to_fill,
|
||||||
gint max_span_size,
|
int max_span_size,
|
||||||
gint max_waste,
|
int max_waste,
|
||||||
GArray *out_spans)
|
GArray *out_spans)
|
||||||
{
|
{
|
||||||
gint n_spans = 0;
|
int n_spans = 0;
|
||||||
CoglSpan span;
|
CoglSpan span;
|
||||||
|
|
||||||
/* Init first slice span */
|
/* Init first slice span */
|
||||||
@ -686,23 +686,23 @@ _cogl_texture_2d_sliced_set_wrap_mode_parameter (CoglTexture *tex,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_texture_2d_sliced_slices_create (CoglTexture2DSliced *tex_2ds,
|
_cogl_texture_2d_sliced_slices_create (CoglTexture2DSliced *tex_2ds,
|
||||||
gint width, gint height,
|
int width, int height,
|
||||||
GLenum gl_intformat,
|
GLenum gl_intformat,
|
||||||
GLenum gl_format,
|
GLenum gl_format,
|
||||||
GLenum gl_type)
|
GLenum gl_type)
|
||||||
{
|
{
|
||||||
gint max_width;
|
int max_width;
|
||||||
gint max_height;
|
int max_height;
|
||||||
GLuint *gl_handles;
|
GLuint *gl_handles;
|
||||||
gint n_x_slices;
|
int n_x_slices;
|
||||||
gint n_y_slices;
|
int n_y_slices;
|
||||||
gint n_slices;
|
int n_slices;
|
||||||
gint x, y;
|
int x, y;
|
||||||
CoglSpan *x_span;
|
CoglSpan *x_span;
|
||||||
CoglSpan *y_span;
|
CoglSpan *y_span;
|
||||||
const GLfloat transparent_color[4] = { 0x00, 0x00, 0x00, 0x00 };
|
const GLfloat transparent_color[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
gint (*slices_for_size) (gint, gint, gint, GArray*);
|
int (*slices_for_size) (int, int, int, GArray*);
|
||||||
|
|
||||||
/* Initialize size of largest slice according to supported features */
|
/* Initialize size of largest slice according to supported features */
|
||||||
if (cogl_features_available (COGL_FEATURE_TEXTURE_NPOT))
|
if (cogl_features_available (COGL_FEATURE_TEXTURE_NPOT))
|
||||||
@ -1096,8 +1096,8 @@ _cogl_texture_2d_sliced_new_from_foreign (GLuint gl_handle,
|
|||||||
GLint gl_gen_mipmap;
|
GLint gl_gen_mipmap;
|
||||||
CoglTexture2DSliced *tex_2ds;
|
CoglTexture2DSliced *tex_2ds;
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglSpan x_span;
|
CoglSpan x_span;
|
||||||
CoglSpan y_span;
|
CoglSpan y_span;
|
||||||
|
|
||||||
if (!_cogl_texture_driver_allows_foreign_gl_target (gl_target))
|
if (!_cogl_texture_driver_allows_foreign_gl_target (gl_target))
|
||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
@ -1228,7 +1228,7 @@ _cogl_texture_2d_sliced_new_from_foreign (GLuint gl_handle,
|
|||||||
return _cogl_texture_2d_sliced_handle_new (tex_2ds);
|
return _cogl_texture_2d_sliced_handle_new (tex_2ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_texture_2d_sliced_get_max_waste (CoglTexture *tex)
|
_cogl_texture_2d_sliced_get_max_waste (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
||||||
@ -1427,7 +1427,7 @@ _cogl_texture_2d_sliced_set_region (CoglTexture *tex,
|
|||||||
const guint8 *data)
|
const guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
||||||
gint bpp;
|
int bpp;
|
||||||
CoglBitmap source_bmp;
|
CoglBitmap source_bmp;
|
||||||
CoglBitmap tmp_bmp;
|
CoglBitmap tmp_bmp;
|
||||||
gboolean tmp_bmp_owner = FALSE;
|
gboolean tmp_bmp_owner = FALSE;
|
||||||
@ -1446,7 +1446,7 @@ _cogl_texture_2d_sliced_set_region (CoglTexture *tex,
|
|||||||
source_bmp.width = width;
|
source_bmp.width = width;
|
||||||
source_bmp.height = height;
|
source_bmp.height = height;
|
||||||
source_bmp.format = format;
|
source_bmp.format = format;
|
||||||
source_bmp.data = (guchar*)data;
|
source_bmp.data = (guint8 *)data;
|
||||||
|
|
||||||
/* Rowstride from width if none specified */
|
/* Rowstride from width if none specified */
|
||||||
bpp = _cogl_get_format_bpp (format);
|
bpp = _cogl_get_format_bpp (format);
|
||||||
@ -1489,10 +1489,10 @@ _cogl_texture_2d_sliced_download_from_gl (
|
|||||||
{
|
{
|
||||||
CoglSpan *x_span;
|
CoglSpan *x_span;
|
||||||
CoglSpan *y_span;
|
CoglSpan *y_span;
|
||||||
GLuint gl_handle;
|
GLuint gl_handle;
|
||||||
gint bpp;
|
int bpp;
|
||||||
gint x,y;
|
int x, y;
|
||||||
CoglBitmap slice_bmp;
|
CoglBitmap slice_bmp;
|
||||||
|
|
||||||
bpp = _cogl_get_format_bpp (target_bmp->format);
|
bpp = _cogl_get_format_bpp (target_bmp->format);
|
||||||
|
|
||||||
@ -1521,8 +1521,8 @@ _cogl_texture_2d_sliced_download_from_gl (
|
|||||||
slice_bmp.width = x_span->size;
|
slice_bmp.width = x_span->size;
|
||||||
slice_bmp.height = y_span->size;
|
slice_bmp.height = y_span->size;
|
||||||
slice_bmp.rowstride = bpp * slice_bmp.width;
|
slice_bmp.rowstride = bpp * slice_bmp.width;
|
||||||
slice_bmp.data = (guchar*) g_malloc (slice_bmp.rowstride *
|
slice_bmp.data = g_malloc (slice_bmp.rowstride *
|
||||||
slice_bmp.height);
|
slice_bmp.height);
|
||||||
|
|
||||||
/* Setup gl alignment to 0,0 top-left corner */
|
/* Setup gl alignment to 0,0 top-left corner */
|
||||||
_cogl_texture_driver_prep_gl_for_pixels_download (
|
_cogl_texture_driver_prep_gl_for_pixels_download (
|
||||||
@ -1587,18 +1587,18 @@ _cogl_texture_2d_sliced_get_data (CoglTexture *tex,
|
|||||||
guint8 *data)
|
guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
|
||||||
gint bpp;
|
int bpp;
|
||||||
gint byte_size;
|
int byte_size;
|
||||||
CoglPixelFormat closest_format;
|
CoglPixelFormat closest_format;
|
||||||
gint closest_bpp;
|
int closest_bpp;
|
||||||
GLenum closest_gl_format;
|
GLenum closest_gl_format;
|
||||||
GLenum closest_gl_type;
|
GLenum closest_gl_type;
|
||||||
CoglBitmap target_bmp;
|
CoglBitmap target_bmp;
|
||||||
CoglBitmap new_bmp;
|
CoglBitmap new_bmp;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
guchar *src;
|
guint8 *src;
|
||||||
guchar *dst;
|
guint8 *dst;
|
||||||
gint y;
|
int y;
|
||||||
|
|
||||||
/* Default to internal format if none specified */
|
/* Default to internal format if none specified */
|
||||||
if (format == COGL_PIXEL_FORMAT_ANY)
|
if (format == COGL_PIXEL_FORMAT_ANY)
|
||||||
@ -1606,11 +1606,13 @@ _cogl_texture_2d_sliced_get_data (CoglTexture *tex,
|
|||||||
|
|
||||||
/* Rowstride from texture width if none specified */
|
/* Rowstride from texture width if none specified */
|
||||||
bpp = _cogl_get_format_bpp (format);
|
bpp = _cogl_get_format_bpp (format);
|
||||||
if (rowstride == 0) rowstride = tex_2ds->width * bpp;
|
if (rowstride == 0)
|
||||||
|
rowstride = tex_2ds->width * bpp;
|
||||||
|
|
||||||
/* Return byte size if only that requested */
|
/* Return byte size if only that requested */
|
||||||
byte_size = tex_2ds->height * rowstride;
|
byte_size = tex_2ds->height * rowstride;
|
||||||
if (data == NULL) return byte_size;
|
if (data == NULL)
|
||||||
|
return byte_size;
|
||||||
|
|
||||||
closest_format =
|
closest_format =
|
||||||
_cogl_texture_driver_find_best_gl_get_data_format (format,
|
_cogl_texture_driver_find_best_gl_get_data_format (format,
|
||||||
@ -1634,8 +1636,7 @@ _cogl_texture_2d_sliced_get_data (CoglTexture *tex,
|
|||||||
/* Target intermediate buffer */
|
/* Target intermediate buffer */
|
||||||
target_bmp.format = closest_format;
|
target_bmp.format = closest_format;
|
||||||
target_bmp.rowstride = target_bmp.width * closest_bpp;
|
target_bmp.rowstride = target_bmp.width * closest_bpp;
|
||||||
target_bmp.data = (guchar*) g_malloc (target_bmp.height
|
target_bmp.data = g_malloc (target_bmp.height * target_bmp.rowstride);
|
||||||
* target_bmp.rowstride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve data from slices */
|
/* Retrieve data from slices */
|
||||||
@ -1691,13 +1692,13 @@ _cogl_texture_2d_sliced_get_gl_format (CoglTexture *tex)
|
|||||||
return COGL_TEXTURE_2D_SLICED (tex)->gl_format;
|
return COGL_TEXTURE_2D_SLICED (tex)->gl_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_texture_2d_sliced_get_width (CoglTexture *tex)
|
_cogl_texture_2d_sliced_get_width (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
return COGL_TEXTURE_2D_SLICED (tex)->width;
|
return COGL_TEXTURE_2D_SLICED (tex)->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_texture_2d_sliced_get_height (CoglTexture *tex)
|
_cogl_texture_2d_sliced_get_height (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
return COGL_TEXTURE_2D_SLICED (tex)->height;
|
return COGL_TEXTURE_2D_SLICED (tex)->height;
|
||||||
|
@ -316,7 +316,7 @@ _cogl_texture_2d_new_from_bitmap (CoglHandle bmp_handle,
|
|||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_handle_new (tex_2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_texture_2d_get_max_waste (CoglTexture *tex)
|
_cogl_texture_2d_get_max_waste (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -430,7 +430,7 @@ _cogl_texture_2d_set_region (CoglTexture *tex,
|
|||||||
const guint8 *data)
|
const guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
||||||
gint bpp;
|
int bpp;
|
||||||
CoglBitmap source_bmp;
|
CoglBitmap source_bmp;
|
||||||
CoglBitmap tmp_bmp;
|
CoglBitmap tmp_bmp;
|
||||||
gboolean tmp_bmp_owner = FALSE;
|
gboolean tmp_bmp_owner = FALSE;
|
||||||
@ -449,7 +449,7 @@ _cogl_texture_2d_set_region (CoglTexture *tex,
|
|||||||
source_bmp.width = width;
|
source_bmp.width = width;
|
||||||
source_bmp.height = height;
|
source_bmp.height = height;
|
||||||
source_bmp.format = format;
|
source_bmp.format = format;
|
||||||
source_bmp.data = (guchar*) data;
|
source_bmp.data = (guint8 *)data;
|
||||||
|
|
||||||
/* Rowstride from width if none specified */
|
/* Rowstride from width if none specified */
|
||||||
bpp = _cogl_get_format_bpp (format);
|
bpp = _cogl_get_format_bpp (format);
|
||||||
@ -490,18 +490,18 @@ _cogl_texture_2d_get_data (CoglTexture *tex,
|
|||||||
guint8 *data)
|
guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
|
||||||
gint bpp;
|
int bpp;
|
||||||
gint byte_size;
|
int byte_size;
|
||||||
CoglPixelFormat closest_format;
|
CoglPixelFormat closest_format;
|
||||||
gint closest_bpp;
|
int closest_bpp;
|
||||||
GLenum closest_gl_format;
|
GLenum closest_gl_format;
|
||||||
GLenum closest_gl_type;
|
GLenum closest_gl_type;
|
||||||
CoglBitmap target_bmp;
|
CoglBitmap target_bmp;
|
||||||
CoglBitmap new_bmp;
|
CoglBitmap new_bmp;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
guchar *src;
|
guint8 *src;
|
||||||
guchar *dst;
|
guint8 *dst;
|
||||||
gint y;
|
int y;
|
||||||
|
|
||||||
/* Default to internal format if none specified */
|
/* Default to internal format if none specified */
|
||||||
if (format == COGL_PIXEL_FORMAT_ANY)
|
if (format == COGL_PIXEL_FORMAT_ANY)
|
||||||
@ -509,11 +509,13 @@ _cogl_texture_2d_get_data (CoglTexture *tex,
|
|||||||
|
|
||||||
/* Rowstride from texture width if none specified */
|
/* Rowstride from texture width if none specified */
|
||||||
bpp = _cogl_get_format_bpp (format);
|
bpp = _cogl_get_format_bpp (format);
|
||||||
if (rowstride == 0) rowstride = tex_2d->width * bpp;
|
if (rowstride == 0)
|
||||||
|
rowstride = tex_2d->width * bpp;
|
||||||
|
|
||||||
/* Return byte size if only that requested */
|
/* Return byte size if only that requested */
|
||||||
byte_size = tex_2d->height * rowstride;
|
byte_size = tex_2d->height * rowstride;
|
||||||
if (data == NULL) return byte_size;
|
if (data == NULL)
|
||||||
|
return byte_size;
|
||||||
|
|
||||||
closest_format =
|
closest_format =
|
||||||
_cogl_texture_driver_find_best_gl_get_data_format (format,
|
_cogl_texture_driver_find_best_gl_get_data_format (format,
|
||||||
@ -537,8 +539,7 @@ _cogl_texture_2d_get_data (CoglTexture *tex,
|
|||||||
/* Target intermediate buffer */
|
/* Target intermediate buffer */
|
||||||
target_bmp.format = closest_format;
|
target_bmp.format = closest_format;
|
||||||
target_bmp.rowstride = target_bmp.width * closest_bpp;
|
target_bmp.rowstride = target_bmp.width * closest_bpp;
|
||||||
target_bmp.data = (guchar*) g_malloc (target_bmp.height
|
target_bmp.data = g_malloc (target_bmp.height * target_bmp.rowstride);
|
||||||
* target_bmp.rowstride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GE( glBindTexture (GL_TEXTURE_2D, tex_2d->gl_texture) );
|
GE( glBindTexture (GL_TEXTURE_2D, tex_2d->gl_texture) );
|
||||||
@ -566,7 +567,8 @@ _cogl_texture_2d_get_data (CoglTexture *tex,
|
|||||||
|
|
||||||
/* Free intermediate data and return if failed */
|
/* Free intermediate data and return if failed */
|
||||||
g_free (target_bmp.data);
|
g_free (target_bmp.data);
|
||||||
if (!success) return 0;
|
if (!success)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Copy to user buffer */
|
/* Copy to user buffer */
|
||||||
for (y = 0; y < new_bmp.height; ++y)
|
for (y = 0; y < new_bmp.height; ++y)
|
||||||
@ -595,13 +597,13 @@ _cogl_texture_2d_get_gl_format (CoglTexture *tex)
|
|||||||
return COGL_TEXTURE_2D (tex)->gl_format;
|
return COGL_TEXTURE_2D (tex)->gl_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_texture_2d_get_width (CoglTexture *tex)
|
_cogl_texture_2d_get_width (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
return COGL_TEXTURE_2D (tex)->width;
|
return COGL_TEXTURE_2D (tex)->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
_cogl_texture_2d_get_height (CoglTexture *tex)
|
_cogl_texture_2d_get_height (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
return COGL_TEXTURE_2D (tex)->height;
|
return COGL_TEXTURE_2D (tex)->height;
|
||||||
|
@ -74,7 +74,7 @@ struct _CoglTextureVtable
|
|||||||
CoglTextureSliceCallback callback,
|
CoglTextureSliceCallback callback,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
gint (* get_max_waste) (CoglTexture *tex);
|
int (* get_max_waste) (CoglTexture *tex);
|
||||||
|
|
||||||
gboolean (* is_sliced) (CoglTexture *tex);
|
gboolean (* is_sliced) (CoglTexture *tex);
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ struct _CoglTextureVtable
|
|||||||
|
|
||||||
CoglPixelFormat (* get_format) (CoglTexture *tex);
|
CoglPixelFormat (* get_format) (CoglTexture *tex);
|
||||||
GLenum (* get_gl_format) (CoglTexture *tex);
|
GLenum (* get_gl_format) (CoglTexture *tex);
|
||||||
gint (* get_width) (CoglTexture *tex);
|
int (* get_width) (CoglTexture *tex);
|
||||||
gint (* get_height) (CoglTexture *tex);
|
int (* get_height) (CoglTexture *tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _CoglTexture
|
struct _CoglTexture
|
||||||
|
@ -224,15 +224,15 @@ _cogl_texture_set_wrap_mode_parameter (CoglHandle handle,
|
|||||||
effectively assumes there is only one span from 0.0 to 1.0 */
|
effectively assumes there is only one span from 0.0 to 1.0 */
|
||||||
typedef struct _CoglTextureIter
|
typedef struct _CoglTextureIter
|
||||||
{
|
{
|
||||||
gfloat pos, end, next_pos;
|
float pos, end, next_pos;
|
||||||
gboolean flipped;
|
gboolean flipped;
|
||||||
gfloat t_1, t_2;
|
float t_1, t_2;
|
||||||
} CoglTextureIter;
|
} CoglTextureIter;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_texture_iter_update (CoglTextureIter *iter)
|
_cogl_texture_iter_update (CoglTextureIter *iter)
|
||||||
{
|
{
|
||||||
gfloat t_2;
|
float t_2;
|
||||||
float frac_part;
|
float frac_part;
|
||||||
|
|
||||||
frac_part = modff (iter->pos, &iter->next_pos);
|
frac_part = modff (iter->pos, &iter->next_pos);
|
||||||
@ -261,7 +261,7 @@ _cogl_texture_iter_update (CoglTextureIter *iter)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_texture_iter_begin (CoglTextureIter *iter,
|
_cogl_texture_iter_begin (CoglTextureIter *iter,
|
||||||
gfloat t_1, gfloat t_2)
|
float t_1, float t_2)
|
||||||
{
|
{
|
||||||
if (t_1 <= t_2)
|
if (t_1 <= t_2)
|
||||||
{
|
{
|
||||||
@ -316,8 +316,8 @@ _cogl_texture_iterate_manual_repeats (CoglTextureManualRepeatCallback callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_texture_new_with_size (guint width,
|
cogl_texture_new_with_size (unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
{
|
{
|
||||||
@ -337,13 +337,13 @@ cogl_texture_new_with_size (guint width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_texture_new_from_data (guint width,
|
cogl_texture_new_from_data (unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
guint rowstride,
|
unsigned int rowstride,
|
||||||
const guchar *data)
|
const guint8 *data)
|
||||||
{
|
{
|
||||||
CoglBitmap bitmap;
|
CoglBitmap bitmap;
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ cogl_texture_new_from_data (guint width,
|
|||||||
/* Wrap the data into a bitmap */
|
/* Wrap the data into a bitmap */
|
||||||
bitmap.width = width;
|
bitmap.width = width;
|
||||||
bitmap.height = height;
|
bitmap.height = height;
|
||||||
bitmap.data = (guchar *) data;
|
bitmap.data = (guint8 *) data;
|
||||||
bitmap.format = format;
|
bitmap.format = format;
|
||||||
bitmap.rowstride = rowstride;
|
bitmap.rowstride = rowstride;
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_texture_new_from_file (const gchar *filename,
|
cogl_texture_new_from_file (const char *filename,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -445,24 +445,24 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_texture_new_from_sub_texture (CoglHandle full_texture,
|
cogl_texture_new_from_sub_texture (CoglHandle full_texture,
|
||||||
gint sub_x,
|
int sub_x,
|
||||||
gint sub_y,
|
int sub_y,
|
||||||
gint sub_width,
|
int sub_width,
|
||||||
gint sub_height)
|
int sub_height)
|
||||||
{
|
{
|
||||||
return _cogl_sub_texture_new (full_texture, sub_x, sub_y,
|
return _cogl_sub_texture_new (full_texture, sub_x, sub_y,
|
||||||
sub_width, sub_height);
|
sub_width, sub_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
|
cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
|
||||||
guint width,
|
unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
guint rowstride,
|
unsigned int rowstride,
|
||||||
const guint offset)
|
const unsigned int offset)
|
||||||
{
|
{
|
||||||
CoglHandle texture;
|
CoglHandle texture;
|
||||||
CoglBuffer *cogl_buffer;
|
CoglBuffer *cogl_buffer;
|
||||||
@ -526,7 +526,7 @@ cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_texture_get_width (CoglHandle handle)
|
cogl_texture_get_width (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
@ -539,7 +539,7 @@ cogl_texture_get_width (CoglHandle handle)
|
|||||||
return tex->vtable->get_width (tex);
|
return tex->vtable->get_width (tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_texture_get_height (CoglHandle handle)
|
cogl_texture_get_height (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
@ -565,7 +565,7 @@ cogl_texture_get_format (CoglHandle handle)
|
|||||||
return tex->vtable->get_format (tex);
|
return tex->vtable->get_format (tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_texture_get_rowstride (CoglHandle handle)
|
cogl_texture_get_rowstride (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
@ -584,7 +584,7 @@ cogl_texture_get_rowstride (CoglHandle handle)
|
|||||||
* cogl_texture_get_width (tex));
|
* cogl_texture_get_width (tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
int
|
||||||
cogl_texture_get_max_waste (CoglHandle handle)
|
cogl_texture_get_max_waste (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
@ -739,17 +739,17 @@ _cogl_texture_ensure_non_quad_rendering (CoglHandle handle)
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cogl_texture_set_region (CoglHandle handle,
|
cogl_texture_set_region (CoglHandle handle,
|
||||||
gint src_x,
|
int src_x,
|
||||||
gint src_y,
|
int src_y,
|
||||||
gint dst_x,
|
int dst_x,
|
||||||
gint dst_y,
|
int dst_y,
|
||||||
guint dst_width,
|
unsigned int dst_width,
|
||||||
guint dst_height,
|
unsigned int dst_height,
|
||||||
gint width,
|
int width,
|
||||||
gint height,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
guint rowstride,
|
unsigned int rowstride,
|
||||||
const guchar *data)
|
const guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
|
|
||||||
@ -786,14 +786,14 @@ do_texture_draw_and_read (CoglHandle handle,
|
|||||||
CoglBitmap *target_bmp,
|
CoglBitmap *target_bmp,
|
||||||
GLint *viewport)
|
GLint *viewport)
|
||||||
{
|
{
|
||||||
gint bpp;
|
int bpp;
|
||||||
float rx1, ry1;
|
float rx1, ry1;
|
||||||
float rx2, ry2;
|
float rx2, ry2;
|
||||||
float tx1, ty1;
|
float tx1, ty1;
|
||||||
float tx2, ty2;
|
float tx2, ty2;
|
||||||
int bw, bh;
|
int bw, bh;
|
||||||
CoglBitmap rect_bmp;
|
CoglBitmap rect_bmp;
|
||||||
guint tex_width, tex_height;
|
unsigned int tex_width, tex_height;
|
||||||
|
|
||||||
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
||||||
|
|
||||||
@ -840,8 +840,8 @@ do_texture_draw_and_read (CoglHandle handle,
|
|||||||
rect_bmp.width = rx2 - rx1;
|
rect_bmp.width = rx2 - rx1;
|
||||||
rect_bmp.height = ry2 - ry1;
|
rect_bmp.height = ry2 - ry1;
|
||||||
rect_bmp.rowstride = bpp * rect_bmp.width;
|
rect_bmp.rowstride = bpp * rect_bmp.width;
|
||||||
rect_bmp.data = (guchar*) g_malloc (rect_bmp.rowstride *
|
rect_bmp.data = g_malloc (rect_bmp.rowstride *
|
||||||
rect_bmp.height);
|
rect_bmp.height);
|
||||||
|
|
||||||
_cogl_texture_driver_prep_gl_for_pixels_download (rect_bmp.rowstride,
|
_cogl_texture_driver_prep_gl_for_pixels_download (rect_bmp.rowstride,
|
||||||
bpp);
|
bpp);
|
||||||
@ -877,7 +877,7 @@ _cogl_texture_draw_and_read (CoglHandle handle,
|
|||||||
GLuint target_gl_format,
|
GLuint target_gl_format,
|
||||||
GLuint target_gl_type)
|
GLuint target_gl_type)
|
||||||
{
|
{
|
||||||
gint bpp;
|
int bpp;
|
||||||
CoglHandle framebuffer;
|
CoglHandle framebuffer;
|
||||||
int viewport[4];
|
int viewport[4];
|
||||||
CoglBitmap alpha_bmp;
|
CoglBitmap alpha_bmp;
|
||||||
@ -951,19 +951,19 @@ _cogl_texture_draw_and_read (CoglHandle handle,
|
|||||||
printf ("A bits: %d\n", a_bits); */
|
printf ("A bits: %d\n", a_bits); */
|
||||||
if ((cogl_texture_get_format (handle) & COGL_A_BIT)/* && a_bits == 0*/)
|
if ((cogl_texture_get_format (handle) & COGL_A_BIT)/* && a_bits == 0*/)
|
||||||
{
|
{
|
||||||
guchar *srcdata;
|
guint8 *srcdata;
|
||||||
guchar *dstdata;
|
guint8 *dstdata;
|
||||||
guchar *srcpixel;
|
guint8 *srcpixel;
|
||||||
guchar *dstpixel;
|
guint8 *dstpixel;
|
||||||
gint x,y;
|
int x,y;
|
||||||
|
|
||||||
/* Create temp bitmap for alpha values */
|
/* Create temp bitmap for alpha values */
|
||||||
alpha_bmp.format = COGL_PIXEL_FORMAT_RGBA_8888;
|
alpha_bmp.format = COGL_PIXEL_FORMAT_RGBA_8888;
|
||||||
alpha_bmp.width = target_bmp->width;
|
alpha_bmp.width = target_bmp->width;
|
||||||
alpha_bmp.height = target_bmp->height;
|
alpha_bmp.height = target_bmp->height;
|
||||||
alpha_bmp.rowstride = bpp * alpha_bmp.width;
|
alpha_bmp.rowstride = bpp * alpha_bmp.width;
|
||||||
alpha_bmp.data = (guchar*) g_malloc (alpha_bmp.rowstride *
|
alpha_bmp.data = g_malloc (alpha_bmp.rowstride *
|
||||||
alpha_bmp.height);
|
alpha_bmp.height);
|
||||||
|
|
||||||
/* Draw alpha values into RGB channels */
|
/* Draw alpha values into RGB channels */
|
||||||
cogl_material_set_layer_combine (ctx->texture_download_material,
|
cogl_material_set_layer_combine (ctx->texture_download_material,
|
||||||
@ -1003,11 +1003,11 @@ _cogl_texture_draw_and_read (CoglHandle handle,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
int
|
||||||
cogl_texture_get_data (CoglHandle handle,
|
cogl_texture_get_data (CoglHandle handle,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
guint rowstride,
|
unsigned int rowstride,
|
||||||
guchar *data)
|
guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -59,10 +59,11 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_with_size (guint width,
|
CoglHandle
|
||||||
guint height,
|
cogl_texture_new_with_size (unsigned int width,
|
||||||
CoglTextureFlags flags,
|
unsigned int height,
|
||||||
CoglPixelFormat internal_format);
|
CoglTextureFlags flags,
|
||||||
|
CoglPixelFormat internal_format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_from_file:
|
* cogl_texture_new_from_file:
|
||||||
@ -85,10 +86,11 @@ CoglHandle cogl_texture_new_with_size (guint width,
|
|||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_from_file (const gchar *filename,
|
CoglHandle
|
||||||
CoglTextureFlags flags,
|
cogl_texture_new_from_file (const char *filename,
|
||||||
CoglPixelFormat internal_format,
|
CoglTextureFlags flags,
|
||||||
GError **error);
|
CoglPixelFormat internal_format,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_from_data:
|
* cogl_texture_new_from_data:
|
||||||
@ -115,13 +117,14 @@ CoglHandle cogl_texture_new_from_file (const gchar *filename,
|
|||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_from_data (guint width,
|
CoglHandle
|
||||||
guint height,
|
cogl_texture_new_from_data (unsigned int width,
|
||||||
CoglTextureFlags flags,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat format,
|
||||||
guint rowstride,
|
CoglPixelFormat internal_format,
|
||||||
const guchar *data);
|
unsigned int rowstride,
|
||||||
|
const guint8 *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_from_foreign:
|
* cogl_texture_new_from_foreign:
|
||||||
@ -142,13 +145,14 @@ CoglHandle cogl_texture_new_from_data (guint width,
|
|||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_from_foreign (GLuint gl_handle,
|
CoglHandle
|
||||||
GLenum gl_target,
|
cogl_texture_new_from_foreign (GLuint gl_handle,
|
||||||
GLuint width,
|
GLenum gl_target,
|
||||||
GLuint height,
|
GLuint width,
|
||||||
GLuint x_pot_waste,
|
GLuint height,
|
||||||
GLuint y_pot_waste,
|
GLuint x_pot_waste,
|
||||||
CoglPixelFormat format);
|
GLuint y_pot_waste,
|
||||||
|
CoglPixelFormat format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_from_bitmap:
|
* cogl_texture_new_from_bitmap:
|
||||||
@ -164,9 +168,10 @@ CoglHandle cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
CoglHandle
|
||||||
CoglTextureFlags flags,
|
cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
||||||
CoglPixelFormat internal_format);
|
CoglTextureFlags flags,
|
||||||
|
CoglPixelFormat internal_format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_texture:
|
* cogl_is_texture:
|
||||||
@ -177,7 +182,8 @@ CoglHandle cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
|||||||
* Return value: %TRUE if the handle references a texture, and
|
* Return value: %TRUE if the handle references a texture, and
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_is_texture (CoglHandle handle);
|
gboolean
|
||||||
|
cogl_is_texture (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_get_width:
|
* cogl_texture_get_width:
|
||||||
@ -187,7 +193,8 @@ gboolean cogl_is_texture (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Return value: the width of the GPU side texture in pixels
|
* Return value: the width of the GPU side texture in pixels
|
||||||
*/
|
*/
|
||||||
guint cogl_texture_get_width (CoglHandle handle);
|
unsigned int
|
||||||
|
cogl_texture_get_width (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_get_height:
|
* cogl_texture_get_height:
|
||||||
@ -197,7 +204,8 @@ guint cogl_texture_get_width (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Return value: the height of the GPU side texture in pixels
|
* Return value: the height of the GPU side texture in pixels
|
||||||
*/
|
*/
|
||||||
guint cogl_texture_get_height (CoglHandle handle);
|
unsigned int
|
||||||
|
cogl_texture_get_height (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_get_format:
|
* cogl_texture_get_format:
|
||||||
@ -207,7 +215,8 @@ guint cogl_texture_get_height (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Return value: the #CoglPixelFormat of the GPU side texture
|
* Return value: the #CoglPixelFormat of the GPU side texture
|
||||||
*/
|
*/
|
||||||
CoglPixelFormat cogl_texture_get_format (CoglHandle handle);
|
CoglPixelFormat
|
||||||
|
cogl_texture_get_format (CoglHandle handle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,7 +227,8 @@ CoglPixelFormat cogl_texture_get_format (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Return value: the offset in bytes between each consequetive row of pixels
|
* Return value: the offset in bytes between each consequetive row of pixels
|
||||||
*/
|
*/
|
||||||
guint cogl_texture_get_rowstride (CoglHandle handle);
|
unsigned int
|
||||||
|
cogl_texture_get_rowstride (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_get_max_waste:
|
* cogl_texture_get_max_waste:
|
||||||
@ -229,7 +239,8 @@ guint cogl_texture_get_rowstride (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Return value: the maximum waste
|
* Return value: the maximum waste
|
||||||
*/
|
*/
|
||||||
gint cogl_texture_get_max_waste (CoglHandle handle);
|
int
|
||||||
|
cogl_texture_get_max_waste (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_is_sliced:
|
* cogl_texture_is_sliced:
|
||||||
@ -241,7 +252,8 @@ gint cogl_texture_get_max_waste (CoglHandle handle);
|
|||||||
* Return value: %TRUE if the texture is sliced, %FALSE if the texture
|
* Return value: %TRUE if the texture is sliced, %FALSE if the texture
|
||||||
* is stored as a single GPU texture
|
* is stored as a single GPU texture
|
||||||
*/
|
*/
|
||||||
gboolean cogl_texture_is_sliced (CoglHandle handle);
|
gboolean
|
||||||
|
cogl_texture_is_sliced (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_get_gl_texture:
|
* cogl_texture_get_gl_texture:
|
||||||
@ -259,9 +271,10 @@ gboolean cogl_texture_is_sliced (CoglHandle handle);
|
|||||||
* Return value: %TRUE if the handle was successfully retrieved, %FALSE
|
* Return value: %TRUE if the handle was successfully retrieved, %FALSE
|
||||||
* if the handle was invalid
|
* if the handle was invalid
|
||||||
*/
|
*/
|
||||||
gboolean cogl_texture_get_gl_texture (CoglHandle handle,
|
gboolean
|
||||||
GLuint *out_gl_handle,
|
cogl_texture_get_gl_texture (CoglHandle handle,
|
||||||
GLenum *out_gl_target);
|
GLuint *out_gl_handle,
|
||||||
|
GLenum *out_gl_target);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_get_data:
|
* cogl_texture_get_data:
|
||||||
@ -277,10 +290,11 @@ gboolean cogl_texture_get_gl_texture (CoglHandle handle,
|
|||||||
* Return value: the size of the texture data in bytes, or 0 if the texture
|
* Return value: the size of the texture data in bytes, or 0 if the texture
|
||||||
* is not valid
|
* is not valid
|
||||||
*/
|
*/
|
||||||
gint cogl_texture_get_data (CoglHandle handle,
|
int
|
||||||
CoglPixelFormat format,
|
cogl_texture_get_data (CoglHandle handle,
|
||||||
guint rowstride,
|
CoglPixelFormat format,
|
||||||
guchar *data);
|
unsigned int rowstride,
|
||||||
|
guint8 *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_set_region:
|
* cogl_texture_set_region:
|
||||||
@ -304,18 +318,19 @@ gint cogl_texture_get_data (CoglHandle handle,
|
|||||||
* Return value: %TRUE if the subregion upload was successful, and
|
* Return value: %TRUE if the subregion upload was successful, and
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_texture_set_region (CoglHandle handle,
|
gboolean
|
||||||
gint src_x,
|
cogl_texture_set_region (CoglHandle handle,
|
||||||
gint src_y,
|
int src_x,
|
||||||
gint dst_x,
|
int src_y,
|
||||||
gint dst_y,
|
int dst_x,
|
||||||
guint dst_width,
|
int dst_y,
|
||||||
guint dst_height,
|
unsigned int dst_width,
|
||||||
gint width,
|
unsigned int dst_height,
|
||||||
gint height,
|
int width,
|
||||||
CoglPixelFormat format,
|
int height,
|
||||||
guint rowstride,
|
CoglPixelFormat format,
|
||||||
const guchar *data);
|
unsigned int rowstride,
|
||||||
|
const guint8 *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_new_from_sub_texture:
|
* cogl_texture_new_from_sub_texture:
|
||||||
@ -337,12 +352,12 @@ gboolean cogl_texture_set_region (CoglHandle handle,
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_from_sub_texture
|
CoglHandle
|
||||||
(CoglHandle full_texture,
|
cogl_texture_new_from_sub_texture (CoglHandle full_texture,
|
||||||
gint sub_x,
|
int sub_x,
|
||||||
gint sub_y,
|
int sub_y,
|
||||||
gint sub_width,
|
int sub_width,
|
||||||
gint sub_height);
|
int sub_height);
|
||||||
|
|
||||||
#if defined (COGL_ENABLE_EXPERIMENTAL_API)
|
#if defined (COGL_ENABLE_EXPERIMENTAL_API)
|
||||||
|
|
||||||
@ -376,29 +391,30 @@ CoglHandle cogl_texture_new_from_sub_texture
|
|||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_new_from_buffer (CoglHandle buffer,
|
CoglHandle
|
||||||
guint width,
|
cogl_texture_new_from_buffer (CoglHandle buffer,
|
||||||
guint height,
|
unsigned int width,
|
||||||
CoglTextureFlags flags,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat format,
|
||||||
guint rowstride,
|
CoglPixelFormat internal_format,
|
||||||
guint offset);
|
unsigned int rowstride,
|
||||||
|
unsigned int offset);
|
||||||
|
|
||||||
/* the function above is experimental, the actual symbol is suffixed by _EXP so
|
/* the function above is experimental, the actual symbol is suffixed by _EXP so
|
||||||
* we can ensure ABI compatibility and leave the cogl_buffer namespace free for
|
* we can ensure ABI compatibility and leave the cogl_buffer namespace free for
|
||||||
* future use. A bunch of defines translates the symbols documented above into
|
* future use. A bunch of defines translates the symbols documented above into
|
||||||
* the real symbols */
|
* the real symbols */
|
||||||
|
|
||||||
CoglHandle cogl_texture_new_from_buffer_EXP
|
CoglHandle
|
||||||
(CoglHandle buffer,
|
cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
|
||||||
guint width,
|
unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
guint rowstride,
|
unsigned int rowstride,
|
||||||
guint offset);
|
unsigned int offset);
|
||||||
|
|
||||||
#define cogl_texture_new_from_buffer cogl_texture_new_from_buffer_EXP
|
#define cogl_texture_new_from_buffer cogl_texture_new_from_buffer_EXP
|
||||||
|
|
||||||
@ -416,7 +432,8 @@ CoglHandle cogl_texture_new_from_buffer_EXP
|
|||||||
*
|
*
|
||||||
* Return value: the @handle.
|
* Return value: the @handle.
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_texture_ref (CoglHandle handle);
|
CoglHandle
|
||||||
|
cogl_texture_ref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_texture_unref:
|
* cogl_texture_unref:
|
||||||
@ -426,7 +443,8 @@ CoglHandle cogl_texture_ref (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: Use cogl_handle_unref() instead
|
* Deprecated: 1.2: Use cogl_handle_unref() instead
|
||||||
*/
|
*/
|
||||||
void cogl_texture_unref (CoglHandle handle);
|
void
|
||||||
|
cogl_texture_unref (CoglHandle handle);
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -447,14 +465,15 @@ void cogl_texture_unref (CoglHandle handle);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_rectangle_with_texture_coords (float x1,
|
void
|
||||||
float y1,
|
cogl_rectangle_with_texture_coords (float x1,
|
||||||
float x2,
|
float y1,
|
||||||
float y2,
|
float x2,
|
||||||
float tx1,
|
float y2,
|
||||||
float ty1,
|
float tx1,
|
||||||
float tx2,
|
float ty1,
|
||||||
float ty2);
|
float tx2,
|
||||||
|
float ty2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_rectangle_with_multitexture_coords:
|
* cogl_rectangle_with_multitexture_coords:
|
||||||
@ -483,12 +502,13 @@ void cogl_rectangle_with_texture_coords (float x1,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_rectangle_with_multitexture_coords (float x1,
|
void
|
||||||
float y1,
|
cogl_rectangle_with_multitexture_coords (float x1,
|
||||||
float x2,
|
float y1,
|
||||||
float y2,
|
float x2,
|
||||||
const float *tex_coords,
|
float y2,
|
||||||
gint tex_coords_len);
|
const float *tex_coords,
|
||||||
|
int tex_coords_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_rectangles_with_texture_coords:
|
* cogl_rectangles_with_texture_coords:
|
||||||
@ -507,8 +527,9 @@ void cogl_rectangle_with_multitexture_coords (float x1,
|
|||||||
*
|
*
|
||||||
* Since: 0.8.6
|
* Since: 0.8.6
|
||||||
*/
|
*/
|
||||||
void cogl_rectangles_with_texture_coords (const float *verts,
|
void
|
||||||
guint n_rects);
|
cogl_rectangles_with_texture_coords (const float *verts,
|
||||||
|
unsigned int n_rects);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_rectangles:
|
* cogl_rectangles:
|
||||||
@ -527,9 +548,9 @@ void cogl_rectangles_with_texture_coords (const float *verts,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_rectangles (const float *verts,
|
void
|
||||||
guint n_rects);
|
cogl_rectangles (const float *verts,
|
||||||
|
unsigned int n_rects);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_polygon:
|
* cogl_polygon:
|
||||||
@ -555,9 +576,10 @@ void cogl_rectangles (const float *verts,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_polygon (const CoglTextureVertex *vertices,
|
void
|
||||||
guint n_vertices,
|
cogl_polygon (const CoglTextureVertex *vertices,
|
||||||
gboolean use_color);
|
unsigned int n_vertices,
|
||||||
|
gboolean use_color);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ typedef gpointer CoglHandle;
|
|||||||
#define COGL_INVALID_HANDLE NULL
|
#define COGL_INVALID_HANDLE NULL
|
||||||
|
|
||||||
#define COGL_TYPE_HANDLE (cogl_handle_get_type ())
|
#define COGL_TYPE_HANDLE (cogl_handle_get_type ())
|
||||||
GType cogl_handle_get_type (void) G_GNUC_CONST;
|
GType
|
||||||
|
cogl_handle_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_handle_ref:
|
* cogl_handle_ref:
|
||||||
@ -59,7 +60,8 @@ GType cogl_handle_get_type (void) G_GNUC_CONST;
|
|||||||
*
|
*
|
||||||
* Returns: the handle, with its reference count increased
|
* Returns: the handle, with its reference count increased
|
||||||
*/
|
*/
|
||||||
CoglHandle cogl_handle_ref (CoglHandle handle);
|
CoglHandle
|
||||||
|
cogl_handle_ref (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_handle_unref:
|
* cogl_handle_unref:
|
||||||
@ -68,7 +70,8 @@ CoglHandle cogl_handle_ref (CoglHandle handle);
|
|||||||
* Drecreases the reference count of @handle by 1; if the reference
|
* Drecreases the reference count of @handle by 1; if the reference
|
||||||
* count reaches 0, the resources allocated by @handle will be freed
|
* count reaches 0, the resources allocated by @handle will be freed
|
||||||
*/
|
*/
|
||||||
void cogl_handle_unref (CoglHandle Handle);
|
void
|
||||||
|
cogl_handle_unref (CoglHandle Handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglFuncPtr:
|
* CoglFuncPtr:
|
||||||
@ -87,7 +90,8 @@ typedef void (* CoglFuncPtr) (void);
|
|||||||
typedef gint32 CoglFixed;
|
typedef gint32 CoglFixed;
|
||||||
|
|
||||||
#define COGL_TYPE_FIXED (cogl_fixed_get_type ())
|
#define COGL_TYPE_FIXED (cogl_fixed_get_type ())
|
||||||
GType cogl_fixed_get_type (void) G_GNUC_CONST;
|
GType
|
||||||
|
cogl_fixed_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglAngle:
|
* CoglAngle:
|
||||||
@ -361,7 +365,8 @@ typedef enum { /*< prefix=COGL_BLEND_STRING_ERROR >*/
|
|||||||
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
|
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
|
||||||
} CoglBlendStringError;
|
} CoglBlendStringError;
|
||||||
|
|
||||||
GQuark cogl_blend_string_error_quark (void);
|
GQuark
|
||||||
|
cogl_blend_string_error_quark (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -129,27 +129,27 @@ cogl_value_init_fixed (GValue *value)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_value_copy_fixed (const GValue *src,
|
cogl_value_copy_fixed (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
dest->data[0].v_int = src->data[0].v_int;
|
dest->data[0].v_int = src->data[0].v_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static char *
|
||||||
cogl_value_collect_fixed (GValue *value,
|
cogl_value_collect_fixed (GValue *value,
|
||||||
guint n_collect_values,
|
unsigned int n_collect_values,
|
||||||
GTypeCValue *collect_values,
|
GTypeCValue *collect_values,
|
||||||
guint collect_flags)
|
unsigned int collect_flags)
|
||||||
{
|
{
|
||||||
value->data[0].v_int = collect_values[0].v_int;
|
value->data[0].v_int = collect_values[0].v_int;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static char *
|
||||||
cogl_value_lcopy_fixed (const GValue *value,
|
cogl_value_lcopy_fixed (const GValue *value,
|
||||||
guint n_collect_values,
|
unsigned int n_collect_values,
|
||||||
GTypeCValue *collect_values,
|
GTypeCValue *collect_values,
|
||||||
guint collect_flags)
|
unsigned int collect_flags)
|
||||||
{
|
{
|
||||||
gint32 *fixed_p = collect_values[0].v_pointer;
|
gint32 *fixed_p = collect_values[0].v_pointer;
|
||||||
|
|
||||||
@ -178,28 +178,28 @@ cogl_value_transform_fixed_double (const GValue *src,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_value_transform_fixed_float (const GValue *src,
|
cogl_value_transform_fixed_float (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
dest->data[0].v_float = COGL_FIXED_TO_FLOAT (src->data[0].v_int);
|
dest->data[0].v_float = COGL_FIXED_TO_FLOAT (src->data[0].v_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_value_transform_int_fixed (const GValue *src,
|
cogl_value_transform_int_fixed (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
dest->data[0].v_int = COGL_FIXED_FROM_INT (src->data[0].v_int);
|
dest->data[0].v_int = COGL_FIXED_FROM_INT (src->data[0].v_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_value_transform_double_fixed (const GValue *src,
|
cogl_value_transform_double_fixed (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
dest->data[0].v_int = COGL_FIXED_FROM_DOUBLE (src->data[0].v_double);
|
dest->data[0].v_int = COGL_FIXED_FROM_DOUBLE (src->data[0].v_double);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_value_transform_float_fixed (const GValue *src,
|
cogl_value_transform_float_fixed (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
dest->data[0].v_int = COGL_FIXED_FROM_FLOAT (src->data[0].v_float);
|
dest->data[0].v_int = COGL_FIXED_FROM_FLOAT (src->data[0].v_float);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ typedef struct _CoglVertexBufferVBO
|
|||||||
* a GLuint VBO name, but when the driver doesn't support VBOs then
|
* a GLuint VBO name, but when the driver doesn't support VBOs then
|
||||||
* this simply points to an malloc'd buffer. */
|
* this simply points to an malloc'd buffer. */
|
||||||
void *vbo_name; /*!< The name of the corresponding buffer object */
|
void *vbo_name; /*!< The name of the corresponding buffer object */
|
||||||
size_t vbo_bytes; /*!< The lengh of the allocated buffer object in bytes */
|
gsize vbo_bytes; /*!< The lengh of the allocated buffer object in bytes */
|
||||||
GList *attributes;
|
GList *attributes;
|
||||||
} CoglVertexBufferVBO;
|
} CoglVertexBufferVBO;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ COGL_HANDLE_DEFINE (VertexBuffer, vertex_buffer);
|
|||||||
COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices);
|
COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices);
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_vertex_buffer_new (guint n_vertices)
|
cogl_vertex_buffer_new (unsigned int n_vertices)
|
||||||
{
|
{
|
||||||
CoglVertexBuffer *buffer = g_slice_alloc (sizeof (CoglVertexBuffer));
|
CoglVertexBuffer *buffer = g_slice_alloc (sizeof (CoglVertexBuffer));
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ cogl_vertex_buffer_new (guint n_vertices)
|
|||||||
return _cogl_vertex_buffer_handle_new (buffer);
|
return _cogl_vertex_buffer_handle_new (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
unsigned int
|
||||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle)
|
cogl_vertex_buffer_get_n_vertices (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglVertexBuffer *buffer;
|
CoglVertexBuffer *buffer;
|
||||||
@ -958,7 +958,7 @@ upload_multipack_vbo_via_map_buffer (CoglVertexBufferVBO *cogl_vbo)
|
|||||||
{
|
{
|
||||||
#if HAVE_COGL_GL
|
#if HAVE_COGL_GL
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
guint offset = 0;
|
unsigned int offset = 0;
|
||||||
char *buf;
|
char *buf;
|
||||||
gboolean fallback =
|
gboolean fallback =
|
||||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||||
@ -1004,7 +1004,7 @@ static void
|
|||||||
upload_multipack_vbo_via_buffer_sub_data (CoglVertexBufferVBO *cogl_vbo)
|
upload_multipack_vbo_via_buffer_sub_data (CoglVertexBufferVBO *cogl_vbo)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
guint offset = 0;
|
unsigned int offset = 0;
|
||||||
gboolean fallback =
|
gboolean fallback =
|
||||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||||
|
|
||||||
@ -1511,8 +1511,8 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
|
|||||||
#ifdef MAY_HAVE_PROGRAMABLE_GL
|
#ifdef MAY_HAVE_PROGRAMABLE_GL
|
||||||
GLuint generic_index = 0;
|
GLuint generic_index = 0;
|
||||||
#endif
|
#endif
|
||||||
gulong enable_flags = 0;
|
unsigned long enable_flags = 0;
|
||||||
gint max_texcoord_attrib_unit = -1;
|
int max_texcoord_attrib_unit = -1;
|
||||||
const GList *layers;
|
const GList *layers;
|
||||||
guint32 fallback_layers = 0;
|
guint32 fallback_layers = 0;
|
||||||
guint32 disable_layers = ~0;
|
guint32 disable_layers = ~0;
|
||||||
@ -1797,7 +1797,7 @@ cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
|
|||||||
{
|
{
|
||||||
gboolean fallback =
|
gboolean fallback =
|
||||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||||
size_t indices_bytes;
|
gsize indices_bytes;
|
||||||
CoglVertexBufferIndices *indices;
|
CoglVertexBufferIndices *indices;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
@ -1885,7 +1885,7 @@ cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
|||||||
CoglVertexBuffer *buffer;
|
CoglVertexBuffer *buffer;
|
||||||
gboolean fallback =
|
gboolean fallback =
|
||||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||||
size_t byte_offset;
|
gsize byte_offset;
|
||||||
CoglVertexBufferIndices *indices = NULL;
|
CoglVertexBufferIndices *indices = NULL;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -1936,7 +1936,7 @@ _cogl_vertex_buffer_free (CoglVertexBuffer *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_vertex_buffer_indices_get_for_quads (guint n_indices)
|
cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ G_BEGIN_DECLS
|
|||||||
* Return value: a new #CoglHandle
|
* Return value: a new #CoglHandle
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_vertex_buffer_new (guint n_vertices);
|
cogl_vertex_buffer_new (unsigned int n_vertices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_vertex_buffer_get_n_vertices:
|
* cogl_vertex_buffer_get_n_vertices:
|
||||||
@ -93,7 +93,7 @@ cogl_vertex_buffer_new (guint n_vertices);
|
|||||||
*
|
*
|
||||||
* Return value: the number of vertices
|
* Return value: the number of vertices
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
|
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -439,7 +439,7 @@ cogl_vertex_buffer_unref (CoglHandle handle);
|
|||||||
* owned by Cogl and should not be modified or unref'd.
|
* owned by Cogl and should not be modified or unref'd.
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglHandle
|
||||||
cogl_vertex_buffer_indices_get_for_quads (guint n_indices);
|
cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_vertex_buffer:
|
* cogl_is_vertex_buffer:
|
||||||
|
52
cogl/cogl.c
52
cogl/cogl.c
@ -54,7 +54,7 @@
|
|||||||
/* GL error to string conversion */
|
/* GL error to string conversion */
|
||||||
static const struct {
|
static const struct {
|
||||||
GLuint error_code;
|
GLuint error_code;
|
||||||
const gchar *error_string;
|
const char *error_string;
|
||||||
} gl_errors[] = {
|
} gl_errors[] = {
|
||||||
{ GL_NO_ERROR, "No error" },
|
{ GL_NO_ERROR, "No error" },
|
||||||
{ GL_INVALID_ENUM, "Invalid enumeration value" },
|
{ GL_INVALID_ENUM, "Invalid enumeration value" },
|
||||||
@ -69,12 +69,12 @@ static const struct {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const guint n_gl_errors = G_N_ELEMENTS (gl_errors);
|
static const unsigned int n_gl_errors = G_N_ELEMENTS (gl_errors);
|
||||||
|
|
||||||
const gchar *
|
const char *
|
||||||
cogl_gl_error_to_string (GLenum error_code)
|
cogl_gl_error_to_string (GLenum error_code)
|
||||||
{
|
{
|
||||||
gint i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < n_gl_errors; i++)
|
for (i = 0; i < n_gl_errors; i++)
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ cogl_gl_error_to_string (GLenum error_code)
|
|||||||
#endif /* COGL_GL_DEBUG */
|
#endif /* COGL_GL_DEBUG */
|
||||||
|
|
||||||
CoglFuncPtr
|
CoglFuncPtr
|
||||||
cogl_get_proc_address (const gchar* name)
|
cogl_get_proc_address (const char* name)
|
||||||
{
|
{
|
||||||
void *address;
|
void *address;
|
||||||
static GModule *module = NULL;
|
static GModule *module = NULL;
|
||||||
@ -113,15 +113,15 @@ cogl_get_proc_address (const gchar* name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_check_extension (const gchar *name, const gchar *ext)
|
_cogl_check_extension (const char *name, const gchar *ext)
|
||||||
{
|
{
|
||||||
gchar *end;
|
char *end;
|
||||||
gint name_len, n;
|
int name_len, n;
|
||||||
|
|
||||||
if (name == NULL || ext == NULL)
|
if (name == NULL || ext == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
end = (gchar*)(ext + strlen(ext));
|
end = (char*)(ext + strlen(ext));
|
||||||
|
|
||||||
name_len = strlen(name);
|
name_len = strlen(name);
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ cogl_check_extension (const char *name, const char *ext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_clear (const CoglColor *color, gulong buffers)
|
cogl_clear (const CoglColor *color, unsigned long buffers)
|
||||||
{
|
{
|
||||||
GLbitfield gl_buffers = 0;
|
GLbitfield gl_buffers = 0;
|
||||||
|
|
||||||
@ -203,8 +203,8 @@ cogl_clear (const CoglColor *color, gulong buffers)
|
|||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
cogl_toggle_flag (CoglContext *ctx,
|
cogl_toggle_flag (CoglContext *ctx,
|
||||||
gulong new_flags,
|
unsigned long new_flags,
|
||||||
gulong flag,
|
unsigned long flag,
|
||||||
GLenum gl_flag)
|
GLenum gl_flag)
|
||||||
{
|
{
|
||||||
/* Toggles and caches a single enable flag on or off
|
/* Toggles and caches a single enable flag on or off
|
||||||
@ -230,8 +230,8 @@ cogl_toggle_flag (CoglContext *ctx,
|
|||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
cogl_toggle_client_flag (CoglContext *ctx,
|
cogl_toggle_client_flag (CoglContext *ctx,
|
||||||
gulong new_flags,
|
unsigned long new_flags,
|
||||||
gulong flag,
|
unsigned long flag,
|
||||||
GLenum gl_flag)
|
GLenum gl_flag)
|
||||||
{
|
{
|
||||||
/* Toggles and caches a single client-side enable flag
|
/* Toggles and caches a single client-side enable flag
|
||||||
@ -256,7 +256,7 @@ cogl_toggle_client_flag (CoglContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_enable (gulong flags)
|
cogl_enable (unsigned long flags)
|
||||||
{
|
{
|
||||||
/* This function essentially caches glEnable state() in the
|
/* This function essentially caches glEnable state() in the
|
||||||
* hope of lessening number GL traffic.
|
* hope of lessening number GL traffic.
|
||||||
@ -280,7 +280,7 @@ cogl_enable (gulong flags)
|
|||||||
GL_COLOR_ARRAY);
|
GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
gulong
|
unsigned long
|
||||||
cogl_get_enable ()
|
cogl_get_enable ()
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
@ -402,15 +402,15 @@ cogl_set_viewport (int x,
|
|||||||
/* XXX: This should be deprecated, and we should expose a way to also
|
/* XXX: This should be deprecated, and we should expose a way to also
|
||||||
* specify an x and y viewport offset */
|
* specify an x and y viewport offset */
|
||||||
void
|
void
|
||||||
cogl_viewport (guint width,
|
cogl_viewport (unsigned int width,
|
||||||
guint height)
|
unsigned int height)
|
||||||
{
|
{
|
||||||
cogl_set_viewport (0, 0, width, height);
|
cogl_set_viewport (0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_setup_viewport (guint width,
|
_cogl_setup_viewport (unsigned int width,
|
||||||
guint height,
|
unsigned int height,
|
||||||
float fovy,
|
float fovy,
|
||||||
float aspect,
|
float aspect,
|
||||||
float z_near,
|
float z_near,
|
||||||
@ -525,10 +525,10 @@ cogl_get_viewport (float v[4])
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_get_bitmasks (gint *red,
|
cogl_get_bitmasks (int *red,
|
||||||
gint *green,
|
int *green,
|
||||||
gint *blue,
|
int *blue,
|
||||||
gint *alpha)
|
int *alpha)
|
||||||
{
|
{
|
||||||
GLint value;
|
GLint value;
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ void
|
|||||||
cogl_begin_gl (void)
|
cogl_begin_gl (void)
|
||||||
{
|
{
|
||||||
CoglMaterialFlushOptions options;
|
CoglMaterialFlushOptions options;
|
||||||
gulong enable_flags = 0;
|
unsigned long enable_flags = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -851,7 +851,7 @@ _cogl_destroy_texture_units (void)
|
|||||||
* Note that, for now, we use GL_MAX_TEXTURE_UNITS as we are exposing the
|
* Note that, for now, we use GL_MAX_TEXTURE_UNITS as we are exposing the
|
||||||
* fixed function pipeline.
|
* fixed function pipeline.
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
_cogl_get_max_texture_image_units (void)
|
_cogl_get_max_texture_image_units (void)
|
||||||
{
|
{
|
||||||
GLint nb_texture_image_units;
|
GLint nb_texture_image_units;
|
||||||
|
310
cogl/cogl.h
310
cogl/cogl.h
@ -73,7 +73,8 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
GOptionGroup * cogl_get_option_group (void);
|
GOptionGroup *
|
||||||
|
cogl_get_option_group (void);
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
/**
|
/**
|
||||||
@ -85,7 +86,8 @@ GOptionGroup * cogl_get_option_group (void);
|
|||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
CoglFeatureFlags cogl_get_features (void);
|
CoglFeatureFlags
|
||||||
|
cogl_get_features (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_features_available:
|
* cogl_features_available:
|
||||||
@ -98,7 +100,8 @@ CoglFeatureFlags cogl_get_features (void);
|
|||||||
*
|
*
|
||||||
* Return value: %TRUE if the features are available, %FALSE otherwise.
|
* Return value: %TRUE if the features are available, %FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
gboolean cogl_features_available (CoglFeatureFlags features);
|
gboolean
|
||||||
|
cogl_features_available (CoglFeatureFlags features);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_proc_address:
|
* cogl_get_proc_address:
|
||||||
@ -111,7 +114,8 @@ gboolean cogl_features_available (CoglFeatureFlags features);
|
|||||||
* Return value: a pointer to the requested function or %NULL if the
|
* Return value: a pointer to the requested function or %NULL if the
|
||||||
* function is not available.
|
* function is not available.
|
||||||
*/
|
*/
|
||||||
CoglFuncPtr cogl_get_proc_address (const gchar *name);
|
CoglFuncPtr
|
||||||
|
cogl_get_proc_address (const char *name);
|
||||||
|
|
||||||
#ifndef COGL_DISABLE_DEPRECATED
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
@ -128,8 +132,9 @@ CoglFuncPtr cogl_get_proc_address (const gchar *name);
|
|||||||
* appropriate to expose OpenGL extensions through the Cogl
|
* appropriate to expose OpenGL extensions through the Cogl
|
||||||
* API.
|
* API.
|
||||||
*/
|
*/
|
||||||
gboolean cogl_check_extension (const gchar *name,
|
gboolean
|
||||||
const gchar *ext) G_GNUC_DEPRECATED;
|
cogl_check_extension (const char *name,
|
||||||
|
const char *ext) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -144,10 +149,11 @@ gboolean cogl_check_extension (const gchar *name,
|
|||||||
* in the color buffer. Pass %NULL for any of the arguments if the
|
* in the color buffer. Pass %NULL for any of the arguments if the
|
||||||
* value is not required.
|
* value is not required.
|
||||||
*/
|
*/
|
||||||
void cogl_get_bitmasks (gint *red,
|
void
|
||||||
gint *green,
|
cogl_get_bitmasks (int *red,
|
||||||
gint *blue,
|
int *green,
|
||||||
gint *alpha);
|
int *blue,
|
||||||
|
int *alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_perspective:
|
* cogl_perspective:
|
||||||
@ -159,10 +165,11 @@ void cogl_get_bitmasks (gint *red,
|
|||||||
* Replaces the current projection matrix with a perspective matrix
|
* Replaces the current projection matrix with a perspective matrix
|
||||||
* based on the provided values.
|
* based on the provided values.
|
||||||
*/
|
*/
|
||||||
void cogl_perspective (float fovy,
|
void
|
||||||
float aspect,
|
cogl_perspective (float fovy,
|
||||||
float z_near,
|
float aspect,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_frustum:
|
* cogl_frustum:
|
||||||
@ -178,12 +185,13 @@ void cogl_perspective (float fovy,
|
|||||||
*
|
*
|
||||||
* Since: 0.8.2
|
* Since: 0.8.2
|
||||||
*/
|
*/
|
||||||
void cogl_frustum (float left,
|
void
|
||||||
float right,
|
cogl_frustum (float left,
|
||||||
float bottom,
|
float right,
|
||||||
float top,
|
float bottom,
|
||||||
float z_near,
|
float top,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_ortho:
|
* cogl_ortho:
|
||||||
@ -201,12 +209,13 @@ void cogl_frustum (float left,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_ortho (float left,
|
void
|
||||||
float right,
|
cogl_ortho (float left,
|
||||||
float bottom,
|
float right,
|
||||||
float top,
|
float bottom,
|
||||||
float near,
|
float top,
|
||||||
float far);
|
float near,
|
||||||
|
float far);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _cogl_setup_viewport:
|
* _cogl_setup_viewport:
|
||||||
@ -226,12 +235,13 @@ void cogl_ortho (float left,
|
|||||||
*
|
*
|
||||||
* This function is used only by Clutter.
|
* This function is used only by Clutter.
|
||||||
*/
|
*/
|
||||||
void _cogl_setup_viewport (guint width,
|
void
|
||||||
guint height,
|
_cogl_setup_viewport (unsigned int width,
|
||||||
float fovy,
|
unsigned int height,
|
||||||
float aspect,
|
float fovy,
|
||||||
float z_near,
|
float aspect,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
#ifndef COGL_DISABLE_DEPRECATED
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
@ -246,8 +256,9 @@ void _cogl_setup_viewport (guint width,
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: Use cogl_set_viewport() instead
|
* Deprecated: 1.2: Use cogl_set_viewport() instead
|
||||||
*/
|
*/
|
||||||
void cogl_viewport (guint width,
|
void
|
||||||
guint height) G_GNUC_DEPRECATED;
|
cogl_viewport (unsigned int width,
|
||||||
|
unsigned int height) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -262,10 +273,11 @@ void cogl_viewport (guint width,
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void cogl_set_viewport (int x,
|
void
|
||||||
int y,
|
cogl_set_viewport (int x,
|
||||||
int width,
|
int y,
|
||||||
int height);
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_push_matrix:
|
* cogl_push_matrix:
|
||||||
@ -273,14 +285,16 @@ void cogl_set_viewport (int x,
|
|||||||
* Stores the current model-view matrix on the matrix stack. The matrix
|
* Stores the current model-view matrix on the matrix stack. The matrix
|
||||||
* can later be restored with cogl_pop_matrix().
|
* can later be restored with cogl_pop_matrix().
|
||||||
*/
|
*/
|
||||||
void cogl_push_matrix (void);
|
void
|
||||||
|
cogl_push_matrix (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pop_matrix:
|
* cogl_pop_matrix:
|
||||||
*
|
*
|
||||||
* Restores the current model-view matrix from the matrix stack.
|
* Restores the current model-view matrix from the matrix stack.
|
||||||
*/
|
*/
|
||||||
void cogl_pop_matrix (void);
|
void
|
||||||
|
cogl_pop_matrix (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_scale:
|
* cogl_scale:
|
||||||
@ -291,9 +305,10 @@ void cogl_pop_matrix (void);
|
|||||||
* Multiplies the current model-view matrix by one that scales the x,
|
* Multiplies the current model-view matrix by one that scales the x,
|
||||||
* y and z axes by the given values.
|
* y and z axes by the given values.
|
||||||
*/
|
*/
|
||||||
void cogl_scale (float x,
|
void
|
||||||
float y,
|
cogl_scale (float x,
|
||||||
float z);
|
float y,
|
||||||
|
float z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_translate:
|
* cogl_translate:
|
||||||
@ -304,9 +319,10 @@ void cogl_scale (float x,
|
|||||||
* Multiplies the current model-view matrix by one that translates the
|
* Multiplies the current model-view matrix by one that translates the
|
||||||
* model along all three axes according to the given values.
|
* model along all three axes according to the given values.
|
||||||
*/
|
*/
|
||||||
void cogl_translate (float x,
|
void
|
||||||
float y,
|
cogl_translate (float x,
|
||||||
float z);
|
float y,
|
||||||
|
float z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_rotate:
|
* cogl_rotate:
|
||||||
@ -321,10 +337,11 @@ void cogl_translate (float x,
|
|||||||
* degrees about the vertex (0, 0, 1) causes a small counter-clockwise
|
* degrees about the vertex (0, 0, 1) causes a small counter-clockwise
|
||||||
* rotation.
|
* rotation.
|
||||||
*/
|
*/
|
||||||
void cogl_rotate (float angle,
|
void
|
||||||
float x,
|
cogl_rotate (float angle,
|
||||||
float y,
|
float x,
|
||||||
float z);
|
float y,
|
||||||
|
float z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_modelview_matrix:
|
* cogl_get_modelview_matrix:
|
||||||
@ -332,7 +349,8 @@ void cogl_rotate (float angle,
|
|||||||
*
|
*
|
||||||
* Stores the current model-view matrix in @matrix.
|
* Stores the current model-view matrix in @matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_get_modelview_matrix (CoglMatrix *matrix);
|
void
|
||||||
|
cogl_get_modelview_matrix (CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_modelview_matrix:
|
* cogl_set_modelview_matrix:
|
||||||
@ -340,7 +358,8 @@ void cogl_get_modelview_matrix (CoglMatrix *matrix);
|
|||||||
*
|
*
|
||||||
* Loads @matrix as the new model-view matrix.
|
* Loads @matrix as the new model-view matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_set_modelview_matrix (CoglMatrix *matrix);
|
void
|
||||||
|
cogl_set_modelview_matrix (CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_projection_matrix:
|
* cogl_get_projection_matrix:
|
||||||
@ -348,7 +367,8 @@ void cogl_set_modelview_matrix (CoglMatrix *matrix);
|
|||||||
*
|
*
|
||||||
* Stores the current projection matrix in @matrix.
|
* Stores the current projection matrix in @matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_get_projection_matrix (CoglMatrix *matrix);
|
void
|
||||||
|
cogl_get_projection_matrix (CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_projection_matrix:
|
* cogl_set_projection_matrix:
|
||||||
@ -356,7 +376,8 @@ void cogl_get_projection_matrix (CoglMatrix *matrix);
|
|||||||
*
|
*
|
||||||
* Loads matrix as the new projection matrix.
|
* Loads matrix as the new projection matrix.
|
||||||
*/
|
*/
|
||||||
void cogl_set_projection_matrix (CoglMatrix *matrix);
|
void
|
||||||
|
cogl_set_projection_matrix (CoglMatrix *matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_viewport:
|
* cogl_get_viewport:
|
||||||
@ -367,7 +388,8 @@ void cogl_set_projection_matrix (CoglMatrix *matrix);
|
|||||||
* position of the viewport and @v[2] and @v[3] get the width and
|
* position of the viewport and @v[2] and @v[3] get the width and
|
||||||
* height.
|
* height.
|
||||||
*/
|
*/
|
||||||
void cogl_get_viewport (float v[4]);
|
void
|
||||||
|
cogl_get_viewport (float v[4]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_depth_test_enabled:
|
* cogl_set_depth_test_enabled:
|
||||||
@ -379,7 +401,8 @@ void cogl_get_viewport (float v[4]);
|
|||||||
* clutter_actor_lower(), otherwise it will also take into account the
|
* clutter_actor_lower(), otherwise it will also take into account the
|
||||||
* actor's depth. Depth testing is disabled by default.
|
* actor's depth. Depth testing is disabled by default.
|
||||||
*/
|
*/
|
||||||
void cogl_set_depth_test_enabled (gboolean setting);
|
void
|
||||||
|
cogl_set_depth_test_enabled (gboolean setting);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_depth_test_enabled:
|
* cogl_get_depth_test_enabled:
|
||||||
@ -388,7 +411,8 @@ void cogl_set_depth_test_enabled (gboolean setting);
|
|||||||
*
|
*
|
||||||
* Return value: %TRUE if depth testing is enabled, and %FALSE otherwise
|
* Return value: %TRUE if depth testing is enabled, and %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_get_depth_test_enabled (void);
|
gboolean
|
||||||
|
cogl_get_depth_test_enabled (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_backface_culling_enabled:
|
* cogl_set_backface_culling_enabled:
|
||||||
@ -400,7 +424,8 @@ gboolean cogl_get_depth_test_enabled (void);
|
|||||||
* only affects calls to the cogl_rectangle* family of functions and
|
* only affects calls to the cogl_rectangle* family of functions and
|
||||||
* cogl_vertex_buffer_draw*. Backface culling is disabled by default.
|
* cogl_vertex_buffer_draw*. Backface culling is disabled by default.
|
||||||
*/
|
*/
|
||||||
void cogl_set_backface_culling_enabled (gboolean setting);
|
void
|
||||||
|
cogl_set_backface_culling_enabled (gboolean setting);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_backface_culling_enabled:
|
* cogl_get_backface_culling_enabled:
|
||||||
@ -410,7 +435,8 @@ void cogl_set_backface_culling_enabled (gboolean setting);
|
|||||||
*
|
*
|
||||||
* Return value: %TRUE if backface culling is enabled, and %FALSE otherwise
|
* Return value: %TRUE if backface culling is enabled, and %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean cogl_get_backface_culling_enabled (void);
|
gboolean
|
||||||
|
cogl_get_backface_culling_enabled (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_fog:
|
* cogl_set_fog:
|
||||||
@ -437,11 +463,12 @@ gboolean cogl_get_backface_culling_enabled (void);
|
|||||||
* opaque primitives. This might improve in the future when we can depend
|
* opaque primitives. This might improve in the future when we can depend
|
||||||
* on fragment shaders.</note>
|
* on fragment shaders.</note>
|
||||||
*/
|
*/
|
||||||
void cogl_set_fog (const CoglColor *fog_color,
|
void
|
||||||
CoglFogMode mode,
|
cogl_set_fog (const CoglColor *fog_color,
|
||||||
float density,
|
CoglFogMode mode,
|
||||||
float z_near,
|
float density,
|
||||||
float z_far);
|
float z_near,
|
||||||
|
float z_far);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_disable_fog:
|
* cogl_disable_fog:
|
||||||
@ -449,7 +476,8 @@ void cogl_set_fog (const CoglColor *fog_color,
|
|||||||
* This function disables fogging, so primitives drawn afterwards will not be
|
* This function disables fogging, so primitives drawn afterwards will not be
|
||||||
* blended with any previously set fog color.
|
* blended with any previously set fog color.
|
||||||
*/
|
*/
|
||||||
void cogl_disable_fog (void);
|
void
|
||||||
|
cogl_disable_fog (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglBufferBit:
|
* CoglBufferBit:
|
||||||
@ -476,8 +504,9 @@ typedef enum {
|
|||||||
* Clears all the auxiliary buffers identified in the @buffers mask, and if
|
* Clears all the auxiliary buffers identified in the @buffers mask, and if
|
||||||
* that includes the color buffer then the specified @color is used.
|
* that includes the color buffer then the specified @color is used.
|
||||||
*/
|
*/
|
||||||
void cogl_clear (const CoglColor *color,
|
void
|
||||||
gulong buffers);
|
cogl_clear (const CoglColor *color,
|
||||||
|
unsigned long buffers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_source:
|
* cogl_set_source:
|
||||||
@ -492,7 +521,8 @@ void cogl_clear (const CoglColor *color,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_set_source (CoglHandle material);
|
void
|
||||||
|
cogl_set_source (CoglHandle material);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_source_color:
|
* cogl_set_source_color:
|
||||||
@ -511,7 +541,8 @@ void cogl_set_source (CoglHandle material);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_set_source_color (const CoglColor *color);
|
void
|
||||||
|
cogl_set_source_color (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_source_color4ub:
|
* cogl_set_source_color4ub:
|
||||||
@ -529,10 +560,11 @@ void cogl_set_source_color (const CoglColor *color);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_set_source_color4ub (guint8 red,
|
void
|
||||||
guint8 green,
|
cogl_set_source_color4ub (guint8 red,
|
||||||
guint8 blue,
|
guint8 green,
|
||||||
guint8 alpha);
|
guint8 blue,
|
||||||
|
guint8 alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_source_color4f:
|
* cogl_set_source_color4f:
|
||||||
@ -551,10 +583,11 @@ void cogl_set_source_color4ub (guint8 red,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_set_source_color4f (float red,
|
void
|
||||||
float green,
|
cogl_set_source_color4f (float red,
|
||||||
float blue,
|
float green,
|
||||||
float alpha);
|
float blue,
|
||||||
|
float alpha);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_set_source_texture:
|
* cogl_set_source_texture:
|
||||||
@ -576,7 +609,8 @@ void cogl_set_source_color4f (float red,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_set_source_texture (CoglHandle texture_handle);
|
void
|
||||||
|
cogl_set_source_texture (CoglHandle texture_handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:cogl-clipping
|
* SECTION:cogl-clipping
|
||||||
@ -607,10 +641,11 @@ void cogl_set_source_texture (CoglHandle texture_handle);
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: Use cogl_clip_push_window_rectangle() instead
|
* Deprecated: 1.2: Use cogl_clip_push_window_rectangle() instead
|
||||||
*/
|
*/
|
||||||
void cogl_clip_push_window_rect (float x_offset,
|
void
|
||||||
float y_offset,
|
cogl_clip_push_window_rect (float x_offset,
|
||||||
float width,
|
float y_offset,
|
||||||
float height) G_GNUC_DEPRECATED;
|
float width,
|
||||||
|
float height) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -632,10 +667,11 @@ void cogl_clip_push_window_rect (float x_offset,
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void cogl_clip_push_window_rectangle (int x_offset,
|
void
|
||||||
int y_offset,
|
cogl_clip_push_window_rectangle (int x_offset,
|
||||||
int width,
|
int y_offset,
|
||||||
int height);
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
#ifndef COGL_DISABLE_DEPRECATED
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
@ -661,10 +697,11 @@ void cogl_clip_push_window_rectangle (int x_offset,
|
|||||||
* extending up, it's awkward to use. Please use cogl_clip_push_rectangle()
|
* extending up, it's awkward to use. Please use cogl_clip_push_rectangle()
|
||||||
* instead
|
* instead
|
||||||
*/
|
*/
|
||||||
void cogl_clip_push (float x_offset,
|
void
|
||||||
float y_offset,
|
cogl_clip_push (float x_offset,
|
||||||
float width,
|
float y_offset,
|
||||||
float height) G_GNUC_DEPRECATED;
|
float width,
|
||||||
|
float height) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -686,10 +723,11 @@ void cogl_clip_push (float x_offset,
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void cogl_clip_push_rectangle (float x0,
|
void
|
||||||
float y0,
|
cogl_clip_push_rectangle (float x0,
|
||||||
float x1,
|
float y0,
|
||||||
float y1);
|
float x1,
|
||||||
|
float y1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_clip_push_from_path:
|
* cogl_clip_push_from_path:
|
||||||
@ -701,7 +739,8 @@ void cogl_clip_push_rectangle (float x0,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_clip_push_from_path (void);
|
void
|
||||||
|
cogl_clip_push_from_path (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_clip_push_from_path_preserve:
|
* cogl_clip_push_from_path_preserve:
|
||||||
@ -713,7 +752,8 @@ void cogl_clip_push_from_path (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_clip_push_from_path_preserve (void);
|
void
|
||||||
|
cogl_clip_push_from_path_preserve (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_clip_pop:
|
* cogl_clip_pop:
|
||||||
@ -721,7 +761,8 @@ void cogl_clip_push_from_path_preserve (void);
|
|||||||
* Reverts the clipping region to the state before the last call to
|
* Reverts the clipping region to the state before the last call to
|
||||||
* cogl_clip_push().
|
* cogl_clip_push().
|
||||||
*/
|
*/
|
||||||
void cogl_clip_pop (void);
|
void
|
||||||
|
cogl_clip_pop (void);
|
||||||
|
|
||||||
#ifndef COGL_DISABLE_DEPRECATED
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
@ -737,7 +778,8 @@ void cogl_clip_pop (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_clip_ensure (void) G_GNUC_DEPRECATED;
|
void
|
||||||
|
cogl_clip_ensure (void) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_clip_stack_save:
|
* cogl_clip_stack_save:
|
||||||
@ -756,7 +798,8 @@ void cogl_clip_ensure (void) G_GNUC_DEPRECATED;
|
|||||||
*
|
*
|
||||||
* Since: 0.8.2
|
* Since: 0.8.2
|
||||||
*/
|
*/
|
||||||
void cogl_clip_stack_save (void) G_GNUC_DEPRECATED;
|
void
|
||||||
|
cogl_clip_stack_save (void) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_clip_stack_restore:
|
* cogl_clip_stack_restore:
|
||||||
@ -772,7 +815,8 @@ void cogl_clip_stack_save (void) G_GNUC_DEPRECATED;
|
|||||||
*
|
*
|
||||||
* Since: 0.8.2
|
* Since: 0.8.2
|
||||||
*/
|
*/
|
||||||
void cogl_clip_stack_restore (void) G_GNUC_DEPRECATED;
|
void
|
||||||
|
cogl_clip_stack_restore (void) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -788,7 +832,8 @@ void cogl_clip_stack_restore (void) G_GNUC_DEPRECATED;
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void cogl_set_framebuffer (CoglHandle buffer);
|
void
|
||||||
|
cogl_set_framebuffer (CoglHandle buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_push_framebuffer:
|
* cogl_push_framebuffer:
|
||||||
@ -804,7 +849,8 @@ void cogl_set_framebuffer (CoglHandle buffer);
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void cogl_push_framebuffer (CoglHandle buffer);
|
void
|
||||||
|
cogl_push_framebuffer (CoglHandle buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pop_framebuffer:
|
* cogl_pop_framebuffer:
|
||||||
@ -814,7 +860,8 @@ void cogl_push_framebuffer (CoglHandle buffer);
|
|||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void cogl_pop_framebuffer (void);
|
void
|
||||||
|
cogl_pop_framebuffer (void);
|
||||||
|
|
||||||
#ifndef COGL_DISABLE_DEPRECATED
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
@ -833,8 +880,9 @@ void cogl_pop_framebuffer (void);
|
|||||||
* Deprecated: 1.2: The target argument was redundant since we could look at
|
* Deprecated: 1.2: The target argument was redundant since we could look at
|
||||||
* the type of CoglHandle given instead.
|
* the type of CoglHandle given instead.
|
||||||
*/
|
*/
|
||||||
void cogl_set_draw_buffer (CoglBufferTarget target,
|
void
|
||||||
CoglHandle offscreen) G_GNUC_DEPRECATED;
|
cogl_set_draw_buffer (CoglBufferTarget target,
|
||||||
|
CoglHandle offscreen) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_push_draw_buffer:
|
* cogl_push_draw_buffer:
|
||||||
@ -843,7 +891,8 @@ void cogl_set_draw_buffer (CoglBufferTarget target,
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: The draw buffer API was replaced with a framebuffer API
|
* Deprecated: 1.2: The draw buffer API was replaced with a framebuffer API
|
||||||
*/
|
*/
|
||||||
void cogl_push_draw_buffer (void) G_GNUC_DEPRECATED;
|
void
|
||||||
|
cogl_push_draw_buffer (void) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pop_draw_buffer:
|
* cogl_pop_draw_buffer:
|
||||||
@ -852,7 +901,8 @@ void cogl_push_draw_buffer (void) G_GNUC_DEPRECATED;
|
|||||||
*
|
*
|
||||||
* Deprecated: 1.2: The draw buffer API was replaced with a framebuffer API
|
* Deprecated: 1.2: The draw buffer API was replaced with a framebuffer API
|
||||||
*/
|
*/
|
||||||
void cogl_pop_draw_buffer (void) G_GNUC_DEPRECATED;
|
void
|
||||||
|
cogl_pop_draw_buffer (void) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
#endif /* COGL_DISABLE_DEPRECATED */
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
@ -884,13 +934,14 @@ typedef enum { /*< prefix=COGL_READ_PIXELS >*/
|
|||||||
* position (0, 0) is the top left. The pixel at (x, y) is the first
|
* position (0, 0) is the top left. The pixel at (x, y) is the first
|
||||||
* read, and the data is returned with a rowstride of (width * 4)
|
* read, and the data is returned with a rowstride of (width * 4)
|
||||||
*/
|
*/
|
||||||
void cogl_read_pixels (int x,
|
void
|
||||||
int y,
|
cogl_read_pixels (int x,
|
||||||
int width,
|
int y,
|
||||||
int height,
|
int width,
|
||||||
CoglReadPixelsFlags source,
|
int height,
|
||||||
CoglPixelFormat format,
|
CoglReadPixelsFlags source,
|
||||||
guint8 *pixels);
|
CoglPixelFormat format,
|
||||||
|
guint8 *pixels);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_flush:
|
* cogl_flush:
|
||||||
@ -918,7 +969,8 @@ void cogl_read_pixels (int x,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_flush (void);
|
void
|
||||||
|
cogl_flush (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_begin_gl:
|
* cogl_begin_gl:
|
||||||
@ -993,7 +1045,8 @@ void cogl_flush (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_begin_gl (void);
|
void
|
||||||
|
cogl_begin_gl (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_end_gl:
|
* cogl_end_gl:
|
||||||
@ -1003,7 +1056,8 @@ void cogl_begin_gl (void);
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_end_gl (void);
|
void
|
||||||
|
cogl_end_gl (void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal API available only to Clutter.
|
* Internal API available only to Clutter.
|
||||||
@ -1014,7 +1068,8 @@ void cogl_end_gl (void);
|
|||||||
* move down into Cogl and these functions will be removed.
|
* move down into Cogl and these functions will be removed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _cogl_destroy_context (void);
|
void
|
||||||
|
_cogl_destroy_context (void);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
#define COGL_DRIVER_ERROR (_cogl_driver_error_quark ())
|
#define COGL_DRIVER_ERROR (_cogl_driver_error_quark ())
|
||||||
@ -1024,11 +1079,20 @@ typedef enum { /*< prefix=COGL_DRIVER_ERROR >*/
|
|||||||
COGL_DRIVER_ERROR_INVALID_VERSION
|
COGL_DRIVER_ERROR_INVALID_VERSION
|
||||||
} CoglDriverError;
|
} CoglDriverError;
|
||||||
|
|
||||||
gboolean _cogl_check_extension (const char *name, const char *ext);
|
gboolean
|
||||||
void _cogl_set_indirect_context (gboolean indirect);
|
_cogl_check_extension (const char *name, const char *ext);
|
||||||
void _cogl_set_viewport (int x, int y, int width, int height);
|
|
||||||
gboolean _cogl_check_driver_valid (GError **error);
|
void
|
||||||
GQuark _cogl_driver_error_quark (void);
|
_cogl_set_indirect_context (gboolean indirect);
|
||||||
|
|
||||||
|
void
|
||||||
|
_cogl_set_viewport (int x, int y, int width, int height);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_cogl_check_driver_valid (GError **error);
|
||||||
|
|
||||||
|
GQuark
|
||||||
|
_cogl_driver_error_quark (void);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_onscreen_clutter_backend_set_size (int width, int height);
|
_cogl_onscreen_clutter_backend_set_size (int width, int height);
|
||||||
|
@ -145,7 +145,7 @@ cogl_program_use (CoglHandle handle)
|
|||||||
|
|
||||||
int
|
int
|
||||||
cogl_program_get_uniform_location (CoglHandle handle,
|
cogl_program_get_uniform_location (CoglHandle handle,
|
||||||
const gchar *uniform_name)
|
const char *uniform_name)
|
||||||
{
|
{
|
||||||
CoglProgram *program;
|
CoglProgram *program;
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
_COGL_GET_CONTEXT (ctx, 0);
|
||||||
@ -160,7 +160,7 @@ cogl_program_get_uniform_location (CoglHandle handle,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_1f (int uniform_no,
|
cogl_program_uniform_1f (int uniform_no,
|
||||||
gfloat value)
|
float value)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
glUniform1f (uniform_no, value);
|
glUniform1f (uniform_no, value);
|
||||||
@ -168,7 +168,7 @@ cogl_program_uniform_1f (int uniform_no,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_1i (int uniform_no,
|
cogl_program_uniform_1i (int uniform_no,
|
||||||
gint value)
|
int value)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
glUniform1i (uniform_no, value);
|
glUniform1i (uniform_no, value);
|
||||||
@ -176,8 +176,8 @@ cogl_program_uniform_1i (int uniform_no,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_float (int uniform_no,
|
cogl_program_uniform_float (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
const GLfloat *value)
|
const GLfloat *value)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -203,8 +203,8 @@ cogl_program_uniform_float (int uniform_no,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_int (int uniform_no,
|
cogl_program_uniform_int (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
const int *value)
|
const int *value)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -230,8 +230,8 @@ cogl_program_uniform_int (int uniform_no,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_matrix (int uniform_no,
|
cogl_program_uniform_matrix (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
gboolean transpose,
|
gboolean transpose,
|
||||||
const GLfloat *value)
|
const GLfloat *value)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ cogl_shader_compile (CoglHandle handle)
|
|||||||
glCompileShader (shader->gl_handle);
|
glCompileShader (shader->gl_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
char *
|
||||||
cogl_shader_get_info_log (CoglHandle handle)
|
cogl_shader_get_info_log (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglShader *shader;
|
CoglShader *shader;
|
||||||
|
@ -52,7 +52,7 @@ _cogl_texture_driver_gen (GLenum gl_target,
|
|||||||
GLsizei n,
|
GLsizei n,
|
||||||
GLuint *textures)
|
GLuint *textures)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
|
|
||||||
GE (glGenTextures (n, textures));
|
GE (glGenTextures (n, textures));
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ gboolean
|
|||||||
_cogl_check_driver_valid (GError **error)
|
_cogl_check_driver_valid (GError **error)
|
||||||
{
|
{
|
||||||
int major, minor;
|
int major, minor;
|
||||||
const gchar *gl_extensions;
|
const char *gl_extensions;
|
||||||
|
|
||||||
if (!_cogl_get_gl_version (&major, &minor))
|
if (!_cogl_get_gl_version (&major, &minor))
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ _cogl_check_driver_valid (GError **error)
|
|||||||
if (COGL_CHECK_GL_VERSION (major, minor, 1, 3))
|
if (COGL_CHECK_GL_VERSION (major, minor, 1, 3))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
|
gl_extensions = (const char*) glGetString (GL_EXTENSIONS);
|
||||||
|
|
||||||
/* OpenGL 1.2 is only supported if we have the multitexturing
|
/* OpenGL 1.2 is only supported if we have the multitexturing
|
||||||
extension */
|
extension */
|
||||||
@ -175,7 +175,7 @@ void
|
|||||||
_cogl_features_init (void)
|
_cogl_features_init (void)
|
||||||
{
|
{
|
||||||
CoglFeatureFlags flags = 0;
|
CoglFeatureFlags flags = 0;
|
||||||
const gchar *gl_extensions;
|
const char *gl_extensions;
|
||||||
GLint max_clip_planes = 0;
|
GLint max_clip_planes = 0;
|
||||||
GLint num_stencil_bits = 0;
|
GLint num_stencil_bits = 0;
|
||||||
int gl_major = 0, gl_minor = 0;
|
int gl_major = 0, gl_minor = 0;
|
||||||
@ -187,7 +187,7 @@ _cogl_features_init (void)
|
|||||||
|
|
||||||
flags = COGL_FEATURE_TEXTURE_READ_PIXELS;
|
flags = COGL_FEATURE_TEXTURE_READ_PIXELS;
|
||||||
|
|
||||||
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
|
gl_extensions = (const char*) glGetString (GL_EXTENSIONS);
|
||||||
|
|
||||||
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) ||
|
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) ||
|
||||||
_cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions))
|
_cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions))
|
||||||
|
@ -788,7 +788,7 @@ cogl_gles2_do_set_uniform (GLint location, CoglBoxedValue *value)
|
|||||||
|
|
||||||
case COGL_BOXED_INT:
|
case COGL_BOXED_INT:
|
||||||
{
|
{
|
||||||
gint *ptr;
|
int *ptr;
|
||||||
|
|
||||||
if (value->count == 1)
|
if (value->count == 1)
|
||||||
ptr = value->v.int_value;
|
ptr = value->v.int_value;
|
||||||
@ -807,7 +807,7 @@ cogl_gles2_do_set_uniform (GLint location, CoglBoxedValue *value)
|
|||||||
|
|
||||||
case COGL_BOXED_FLOAT:
|
case COGL_BOXED_FLOAT:
|
||||||
{
|
{
|
||||||
gfloat *ptr;
|
float *ptr;
|
||||||
|
|
||||||
if (value->count == 1)
|
if (value->count == 1)
|
||||||
ptr = value->v.float_value;
|
ptr = value->v.float_value;
|
||||||
@ -826,7 +826,7 @@ cogl_gles2_do_set_uniform (GLint location, CoglBoxedValue *value)
|
|||||||
|
|
||||||
case COGL_BOXED_MATRIX:
|
case COGL_BOXED_MATRIX:
|
||||||
{
|
{
|
||||||
gfloat *ptr;
|
float *ptr;
|
||||||
|
|
||||||
if (value->count == 1)
|
if (value->count == 1)
|
||||||
ptr = value->v.matrix;
|
ptr = value->v.matrix;
|
||||||
|
@ -128,8 +128,8 @@ struct _CoglGles2WrapperSettings
|
|||||||
/* The current in-use user program */
|
/* The current in-use user program */
|
||||||
CoglHandle user_program;
|
CoglHandle user_program;
|
||||||
|
|
||||||
guint alpha_test_enabled:1;
|
unsigned int alpha_test_enabled:1;
|
||||||
guint fog_enabled:1;
|
unsigned int fog_enabled:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _CoglGles2WrapperTextureUnit
|
struct _CoglGles2WrapperTextureUnit
|
||||||
@ -141,8 +141,8 @@ struct _CoglGles2WrapperTextureUnit
|
|||||||
GLsizei texture_coords_stride;
|
GLsizei texture_coords_stride;
|
||||||
const void *texture_coords_pointer;
|
const void *texture_coords_pointer;
|
||||||
|
|
||||||
guint texture_coords_enabled:1;
|
unsigned int texture_coords_enabled:1;
|
||||||
guint dirty_matrix:1; /*!< shader uniform needs updating */
|
unsigned int dirty_matrix:1; /*!< shader uniform needs updating */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _CoglGles2Wrapper
|
struct _CoglGles2Wrapper
|
||||||
@ -150,8 +150,8 @@ struct _CoglGles2Wrapper
|
|||||||
GLuint matrix_mode;
|
GLuint matrix_mode;
|
||||||
CoglMatrix modelview_matrix;
|
CoglMatrix modelview_matrix;
|
||||||
CoglMatrix projection_matrix;
|
CoglMatrix projection_matrix;
|
||||||
guint active_texture_unit;
|
unsigned int active_texture_unit;
|
||||||
guint active_client_texture_unit;
|
unsigned int active_client_texture_unit;
|
||||||
|
|
||||||
CoglGles2WrapperTextureUnit texture_units[COGL_GLES2_MAX_TEXTURE_UNITS];
|
CoglGles2WrapperTextureUnit texture_units[COGL_GLES2_MAX_TEXTURE_UNITS];
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ cogl_program_use (CoglHandle handle)
|
|||||||
|
|
||||||
int
|
int
|
||||||
cogl_program_get_uniform_location (CoglHandle handle,
|
cogl_program_get_uniform_location (CoglHandle handle,
|
||||||
const gchar *uniform_name)
|
const char *uniform_name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CoglProgram *program;
|
CoglProgram *program;
|
||||||
@ -156,24 +156,24 @@ cogl_program_get_uniform_location (CoglHandle handle,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_1f (int uniform_no,
|
cogl_program_uniform_1f (int uniform_no,
|
||||||
gfloat value)
|
float value)
|
||||||
{
|
{
|
||||||
cogl_program_uniform_float (uniform_no, 1, 1, &value);
|
cogl_program_uniform_float (uniform_no, 1, 1, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_1i (int uniform_no,
|
cogl_program_uniform_1i (int uniform_no,
|
||||||
gint value)
|
int value)
|
||||||
{
|
{
|
||||||
cogl_program_uniform_int (uniform_no, 1, 1, &value);
|
cogl_program_uniform_int (uniform_no, 1, 1, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_program_uniform_x (int uniform_no,
|
cogl_program_uniform_x (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
CoglBoxedType type,
|
CoglBoxedType type,
|
||||||
size_t value_size,
|
gsize value_size,
|
||||||
gconstpointer value)
|
gconstpointer value)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -216,8 +216,8 @@ cogl_program_uniform_x (int uniform_no,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_float (int uniform_no,
|
cogl_program_uniform_float (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
const GLfloat *value)
|
const GLfloat *value)
|
||||||
{
|
{
|
||||||
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_FLOAT,
|
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_FLOAT,
|
||||||
@ -226,18 +226,18 @@ cogl_program_uniform_float (int uniform_no,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_int (int uniform_no,
|
cogl_program_uniform_int (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
const GLint *value)
|
const GLint *value)
|
||||||
{
|
{
|
||||||
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_INT,
|
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_INT,
|
||||||
sizeof (gint) * size, value);
|
sizeof (int) * size, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_matrix (int uniform_no,
|
cogl_program_uniform_matrix (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
gboolean transpose,
|
gboolean transpose,
|
||||||
const GLfloat *value)
|
const GLfloat *value)
|
||||||
{
|
{
|
||||||
@ -298,37 +298,37 @@ cogl_program_use (CoglHandle program_handle)
|
|||||||
|
|
||||||
int
|
int
|
||||||
cogl_program_get_uniform_location (CoglHandle program_handle,
|
cogl_program_get_uniform_location (CoglHandle program_handle,
|
||||||
const gchar *uniform_name)
|
const char *uniform_name)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_1f (int uniform_no,
|
cogl_program_uniform_1f (int uniform_no,
|
||||||
gfloat value)
|
float value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_float (int uniform_no,
|
cogl_program_uniform_float (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
const GLfloat *value)
|
const GLfloat *value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_int (int uniform_no,
|
cogl_program_uniform_int (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
const int *value)
|
const int *value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_program_uniform_matrix (int uniform_no,
|
cogl_program_uniform_matrix (int uniform_no,
|
||||||
gint size,
|
int size,
|
||||||
gint count,
|
int count,
|
||||||
gboolean transpose,
|
gboolean transpose,
|
||||||
const GLfloat *value)
|
const GLfloat *value)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ cogl_shader_compile (CoglHandle handle)
|
|||||||
glCompileShader (shader->gl_handle);
|
glCompileShader (shader->gl_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
char *
|
||||||
cogl_shader_get_info_log (CoglHandle handle)
|
cogl_shader_get_info_log (CoglHandle handle)
|
||||||
{
|
{
|
||||||
CoglShader *shader;
|
CoglShader *shader;
|
||||||
@ -200,7 +200,7 @@ cogl_shader_compile (CoglHandle shader_handle)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
char *
|
||||||
cogl_shader_get_info_log (CoglHandle handle)
|
cogl_shader_get_info_log (CoglHandle handle)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -52,7 +52,7 @@ _cogl_texture_driver_gen (GLenum gl_target,
|
|||||||
GLsizei n,
|
GLsizei n,
|
||||||
GLuint *textures)
|
GLuint *textures)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
|
|
||||||
GE (glGenTextures (n, textures));
|
GE (glGenTextures (n, textures));
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||||||
slice_bmp.width = width;
|
slice_bmp.width = width;
|
||||||
slice_bmp.height = height;
|
slice_bmp.height = height;
|
||||||
slice_bmp.rowstride = bpp * slice_bmp.width;
|
slice_bmp.rowstride = bpp * slice_bmp.width;
|
||||||
slice_bmp.data = (guchar*) g_malloc (slice_bmp.rowstride * slice_bmp.height);
|
slice_bmp.data = g_malloc (slice_bmp.rowstride * slice_bmp.height);
|
||||||
|
|
||||||
/* Setup gl alignment to match rowstride and top-left corner */
|
/* Setup gl alignment to match rowstride and top-left corner */
|
||||||
_cogl_texture_driver_prep_gl_for_pixels_upload (slice_bmp.rowstride,
|
_cogl_texture_driver_prep_gl_for_pixels_upload (slice_bmp.rowstride,
|
||||||
|
49
doc/CODING_STYLE
Normal file
49
doc/CODING_STYLE
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
Cogl Coding Style
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
This document is intended to be a short description of the preferred
|
||||||
|
coding style to be used for the Cogl source code.
|
||||||
|
|
||||||
|
Coding style is a matter of consistency, readability and maintainance;
|
||||||
|
coding style is also completely arbitrary and a matter of taste. This
|
||||||
|
document will use examples at the very least to provide authoritative
|
||||||
|
and consistent answers to common questions regarding the coding style,
|
||||||
|
and will also try to identify the allowed exceptions.
|
||||||
|
|
||||||
|
The Cogl coding style is currently defined relative to the Clutter
|
||||||
|
coding style, so please first read clutter/docs/CODING_STYLE.
|
||||||
|
|
||||||
|
Differences to the Clutter coding style:
|
||||||
|
|
||||||
|
+ Headers
|
||||||
|
|
||||||
|
Cogl headers are not exempt from the 80 characters limit as they are in
|
||||||
|
Clutter. Function prototypes should not be arranged into vertical
|
||||||
|
columns but should instead follow the "+ Functions" section of the
|
||||||
|
Clutter CODING_STYLE like:
|
||||||
|
|
||||||
|
void
|
||||||
|
my_function (CoglType type,
|
||||||
|
CoglType *a_pointer,
|
||||||
|
CoglType another_type);
|
||||||
|
|
||||||
|
+ Types
|
||||||
|
|
||||||
|
Avoid the use of redundant glib typedefs and wherever possible simply
|
||||||
|
use ANSI C types.
|
||||||
|
|
||||||
|
The following types should not be used:
|
||||||
|
gint, guint, gfloat, gdouble, glong, gulong, gchar and guchar
|
||||||
|
Instead use:
|
||||||
|
int, unsigned int, float, double, long, unsigned long, char, and
|
||||||
|
guint8/unsigned char
|
||||||
|
|
||||||
|
The glib types that we continue to use for portability are gboolean,
|
||||||
|
gint{8,16,32,64}, guint{8,16,32,64} and gsize. When ever you need a
|
||||||
|
byte size type for dealing with pixel data then guint8 should be used.
|
||||||
|
|
||||||
|
The general intention is that Cogl should look palatable to the widest
|
||||||
|
range of C programmers including those outside the Gnome community so
|
||||||
|
- especially for the public API - we want to minimize the number of
|
||||||
|
foreign looking typedefs.
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user