2008-06-23 Emmanuele Bassi <ebassi@openedhand.com>

Bug 982 - __COGL_GET_CONTEXT MS compiler issue (Haakon Sporsheim)

	* clutter/cogl/common/cogl-handle.h:
	* clutter/cogl/common/cogl-primitives.c: Remove C99-isms.

	* clutter/cogl/gl/cogl-fbo.c:
	* clutter/cogl/gl/cogl-primitives.c:
	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gl/cogl.c: Ditto as above.

	* clutter/cogl/gles/cogl-fbo.c:
	* clutter/cogl/gles/cogl-primitives.c:
	* clutter/cogl/gles/cogl-texture.c: Ditto as above.
This commit is contained in:
Emmanuele Bassi 2008-06-23 11:01:30 +00:00
parent 04e5b4a710
commit d9b657bdfc
10 changed files with 75 additions and 62 deletions

View File

@ -1,3 +1,19 @@
2008-06-23 Emmanuele Bassi <ebassi@openedhand.com>
Bug 982 - __COGL_GET_CONTEXT MS compiler issue (Haakon Sporsheim)
* clutter/cogl/common/cogl-handle.h:
* clutter/cogl/common/cogl-primitives.c: Remove C99-isms.
* clutter/cogl/gl/cogl-fbo.c:
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gl/cogl-texture.c:
* clutter/cogl/gl/cogl.c: Ditto as above.
* clutter/cogl/gles/cogl-fbo.c:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl-texture.c: Ditto as above.
2008-06-23 Emmanuele Bassi <ebassi@openedhand.com>
Bug 984 - pango_clutter_render_layout() declared void, but

View File

@ -60,10 +60,10 @@
static gint \
_cogl_##type_name##_handle_find (CoglHandle handle) \
{ \
_COGL_GET_CONTEXT (ctx, -1); \
\
gint i; \
\
_COGL_GET_CONTEXT (ctx, -1); \
\
if (ctx->handle_array == NULL) \
return -1; \
\
@ -78,10 +78,10 @@
static CoglHandle \
_cogl_##type_name##_handle_new (Cogl##TypeName *obj) \
{ \
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); \
\
CoglHandle handle = (CoglHandle) obj; \
\
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); \
\
if (ctx->handle_array == NULL) \
ctx->handle_array \
= g_array_new (FALSE, FALSE, sizeof (CoglHandle)); \
@ -94,10 +94,10 @@
static void \
_cogl_##type_name##_handle_release (CoglHandle handle) \
{ \
_COGL_GET_CONTEXT (ctx, NO_RETVAL); \
\
gint i; \
\
_COGL_GET_CONTEXT (ctx, NO_RETVAL); \
\
if ( (i = _cogl_##type_name##_handle_find (handle)) == -1) \
return; \
\

View File

@ -325,10 +325,11 @@ cogl_path_round_rectangle (ClutterFixed x,
ClutterFixed radius,
ClutterAngle arc_step)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
ClutterFixed inner_width = width - (radius << 1);
ClutterFixed inner_height = height - (radius << 1);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_move_to (x, y + radius);
cogl_path_arc_rel (radius, 0,
radius, radius,
@ -464,10 +465,10 @@ cogl_path_curve_to (ClutterFixed x1,
ClutterFixed x3,
ClutterFixed y3)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglBezCubic cubic;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* Prepare cubic curve */
cubic.p1 = ctx->path_pen;
cubic.p2.x = x1;
@ -476,10 +477,10 @@ cogl_path_curve_to (ClutterFixed x1,
cubic.p3.y = y2;
cubic.p4.x = x3;
cubic.p4.y = y3;
/* Run subdivision */
_cogl_path_bezier3_sub (&cubic);
/* Add last point */
_cogl_path_add_node (cubic.p4.x, cubic.p4.y);
ctx->path_pen = cubic.p4;

View File

@ -62,11 +62,6 @@ COGL_HANDLE_DEFINE (Fbo, offscreen, fbo_handles);
CoglHandle
cogl_offscreen_new_to_texture (CoglHandle texhandle)
{
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
return COGL_INVALID_HANDLE;
CoglTexture *tex;
CoglFbo *fbo;
CoglTexSliceSpan *x_span;
@ -75,6 +70,11 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle)
GLuint fbo_gl_handle;
GLenum status;
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
return COGL_INVALID_HANDLE;
/* Make texhandle is a valid texture object */
if (!cogl_is_texture (texhandle))
return COGL_INVALID_HANDLE;
@ -157,14 +157,14 @@ cogl_offscreen_blit_region (CoglHandle src_buffer,
int dst_w,
int dst_h)
{
CoglFbo *src_fbo;
CoglFbo *dst_fbo;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT))
return;
CoglFbo *src_fbo;
CoglFbo *dst_fbo;
/* Make sure these are valid fbo handles */
if (!cogl_is_offscreen (src_buffer))
return;
@ -187,14 +187,14 @@ void
cogl_offscreen_blit (CoglHandle src_buffer,
CoglHandle dst_buffer)
{
CoglFbo *src_fbo;
CoglFbo *dst_fbo;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT))
return;
CoglFbo *src_fbo;
CoglFbo *dst_fbo;
/* Make sure these are valid fbo handles */
if (!cogl_is_offscreen (src_buffer))
return;
@ -216,10 +216,10 @@ cogl_offscreen_blit (CoglHandle src_buffer,
void
cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglFbo *fbo = NULL;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (target == COGL_OFFSCREEN_BUFFER)
{
/* Make sure it is a valid fbo handle */

View File

@ -85,10 +85,10 @@ void
_cogl_path_add_node (ClutterFixed x,
ClutterFixed y)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglFloatVec2 *new_nodes = NULL;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->path_nodes_size == ctx->path_nodes_cap)
{
new_nodes = g_realloc (ctx->path_nodes,
@ -135,13 +135,13 @@ _cogl_path_stroke_nodes ()
void
_cogl_path_fill_nodes ()
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
guint bounds_x;
guint bounds_y;
guint bounds_w;
guint bounds_h;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
GE( glClear (GL_STENCIL_BUFFER_BIT) );
GE( glEnable (GL_STENCIL_TEST) );

View File

@ -1706,8 +1706,6 @@ _cogl_texture_quad_sw (CoglTexture *tex,
ClutterFixed tx2,
ClutterFixed ty2)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglSpanIter iter_x , iter_y;
ClutterFixed tw , th;
ClutterFixed tqx , tqy;
@ -1718,14 +1716,15 @@ _cogl_texture_quad_sw (CoglTexture *tex,
ClutterFixed slice_qx1 , slice_qy1;
ClutterFixed slice_qx2 , slice_qy2;
GLuint gl_handle;
gulong enable_flags = 0;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
#if COGL_DEBUG
printf("=== Drawing Tex Quad (Software Tiling Mode) ===\n");
#endif
/* Prepare GL state */
gulong enable_flags = 0;
enable_flags |= COGL_ENABLE_TEXTURE_2D;
if (ctx->color_alpha < 255
@ -1865,19 +1864,18 @@ _cogl_texture_quad_hw (CoglTexture *tex,
ClutterFixed tx2,
ClutterFixed ty2)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglTexSliceSpan *x_span;
CoglTexSliceSpan *y_span;
GLuint gl_handle;
gulong enable_flags = 0;
#if COGL_DEBUG
printf("=== Drawing Tex Quad (Hardware Tiling Mode) ===\n");
#endif
/* Prepare GL state */
gulong enable_flags = 0;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* Prepare GL state */
enable_flags |= COGL_ENABLE_TEXTURE_2D;
if (ctx->color_alpha < 255

View File

@ -657,13 +657,13 @@ cogl_setup_viewport (guint width,
static void
_cogl_features_init ()
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
ClutterFeatureFlags flags = 0;
const gchar *gl_extensions;
GLint max_clip_planes = 0;
GLint stencil_bits = 0;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
flags = COGL_FEATURE_TEXTURE_READ_PIXELS;
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);

View File

@ -50,10 +50,10 @@
static gint
_cogl_fbo_handle_find (CoglHandle handle)
{
_COGL_GET_CONTEXT (ctx, -1);
gint i;
_COGL_GET_CONTEXT (ctx, -1);
if (ctx->fbo_handles == NULL)
return -1;

View File

@ -42,8 +42,6 @@ _cogl_rectangle (gint x,
guint width,
guint height)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* 32-bit integers are not supported as coord types
in GLES . Fixed type has got 16 bits left of the
point which is equal to short anyway. */
@ -55,6 +53,8 @@ _cogl_rectangle (gint x,
(GLshort) (x + width), (GLshort) (y + height)
};
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_enable (COGL_ENABLE_VERTEX_ARRAY
| (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0));
GE ( cogl_wrap_glVertexPointer (2, GL_SHORT, 0, rect_verts ) );
@ -68,8 +68,6 @@ _cogl_rectanglex (ClutterFixed x,
ClutterFixed width,
ClutterFixed height)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
GLfixed rect_verts[8] = {
x, y,
x + width, y,
@ -77,6 +75,8 @@ _cogl_rectanglex (ClutterFixed x,
x + width, y + height
};
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_enable (COGL_ENABLE_VERTEX_ARRAY
| (ctx->color_alpha < 255
? COGL_ENABLE_BLEND : 0));
@ -104,10 +104,10 @@ void
_cogl_path_add_node (ClutterFixed x,
ClutterFixed y)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglFixedVec2 *new_nodes = NULL;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->path_nodes_size == ctx->path_nodes_cap)
{
new_nodes = g_realloc (ctx->path_nodes,
@ -160,13 +160,13 @@ static gint compare_ints (gconstpointer a,
void
_cogl_path_fill_nodes ()
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
guint bounds_x;
guint bounds_y;
guint bounds_w;
guint bounds_h;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
bounds_x = CLUTTER_FIXED_FLOOR (ctx->path_nodes_min.x);
bounds_y = CLUTTER_FIXED_FLOOR (ctx->path_nodes_min.y);
bounds_w = CLUTTER_FIXED_CEIL (ctx->path_nodes_max.x - ctx->path_nodes_min.x);

View File

@ -1762,8 +1762,6 @@ _cogl_texture_quad_sw (CoglTexture *tex,
ClutterFixed tx2,
ClutterFixed ty2)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglSpanIter iter_x , iter_y;
ClutterFixed tw , th;
ClutterFixed tqx , tqy;
@ -1776,16 +1774,17 @@ _cogl_texture_quad_sw (CoglTexture *tex,
GLfixed tex_coords[8];
GLfixed quad_coords[8];
GLuint gl_handle;
gulong enable_flags = (COGL_ENABLE_TEXTURE_2D
| COGL_ENABLE_VERTEX_ARRAY
| COGL_ENABLE_TEXCOORD_ARRAY);
#if COGL_DEBUG
printf("=== Drawing Tex Quad (Software Tiling Mode) ===\n");
#endif
/* Prepare GL state */
gulong enable_flags = (COGL_ENABLE_TEXTURE_2D
| COGL_ENABLE_VERTEX_ARRAY
| COGL_ENABLE_TEXCOORD_ARRAY);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* Prepare GL state */
if (ctx->color_alpha < 255
|| tex->bitmap.format & COGL_A_BIT)
{
@ -1917,23 +1916,22 @@ _cogl_texture_quad_hw (CoglTexture *tex,
ClutterFixed tx2,
ClutterFixed ty2)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
GLfixed tex_coords[8];
GLfixed quad_coords[8];
GLuint gl_handle;
CoglTexSliceSpan *x_span;
CoglTexSliceSpan *y_span;
gulong enable_flags = (COGL_ENABLE_TEXTURE_2D
| COGL_ENABLE_VERTEX_ARRAY
| COGL_ENABLE_TEXCOORD_ARRAY);
#if COGL_DEBUG
printf("=== Drawing Tex Quad (Hardware Tiling Mode) ===\n");
#endif
/* Prepare GL state */
gulong enable_flags = (COGL_ENABLE_TEXTURE_2D
| COGL_ENABLE_VERTEX_ARRAY
| COGL_ENABLE_TEXCOORD_ARRAY);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* Prepare GL state */
if (ctx->color_alpha < 255
|| tex->bitmap.format & COGL_A_BIT)
{