2007-10-12 Tomas Frydrych <tf@o-hand.com>

Portability fixes:

	* clutter/clutter-private.h:
	Bracket #include "unistd.h" with #ifdef HAVE_UNISTD_H

	* clutter/clutter-fixed.c:
	Use "", not <> for inclusion of local files.

	(clutter_sqrtx): forward declare local variables.

	* clutter/clutter-debug.h:
	Added non-gcc (c99) implementation of variadic debug macros for
	when not compiling with gcc.

	* clutter/pango/pangoclutter-render.c:
	Fixed some strange uses of CLUTTER_NOTE() + stripped trailing
	whitespace.
This commit is contained in:
Tomas Frydrych 2007-10-12 09:39:41 +00:00
parent abd6832dd9
commit 174bd04b49
5 changed files with 116 additions and 65 deletions

View File

@ -1,3 +1,23 @@
2007-10-12 Tomas Frydrych <tf@o-hand.com>
Portability fixes:
* clutter/clutter-private.h:
Bracket #include "unistd.h" with #ifdef HAVE_UNISTD_H
* clutter/clutter-fixed.c:
Use "", not <> for inclusion of local files.
(clutter_sqrtx): forward declare local variables.
* clutter/clutter-debug.h:
Added non-gcc (c99) implementation of variadic debug macros for
when not compiling with gcc.
* clutter/pango/pangoclutter-render.c:
Fixed some strange uses of CLUTTER_NOTE() + stripped trailing
whitespace.
2007-10-12 Tomas Frydrych <tf@o-hand.com>
* clutter/clutter-actor.c:

View File

@ -23,11 +23,42 @@ typedef enum {
#ifdef CLUTTER_ENABLE_DEBUG
#ifdef __GNUC_
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
{ g_message ("[" #type "] " G_STRLOC ": " x, ##a); } \
} G_STMT_END
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
x, clutter_get_timestamp(), ##a); } \
} G_STMT_END
#else
/* Try the C99 version; unfortunately, this does not allow us to pass
* empty arguments to the macro, which means we have to
* do an intemediate printf.
*/
#define CLUTTER_NOTE(type,...) G_STMT_START { \
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
{ \
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \
g_free (_fmt); \
} \
} G_STMT_END
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
{ \
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
clutter_get_timestamp(), _fmt); \
g_free (_fmt); \
} \
} G_STMT_END
#endif
#define CLUTTER_MARK() CLUTTER_NOTE(MISC, "== mark ==")
#define CLUTTER_DBG(x) { a }
@ -38,19 +69,14 @@ typedef enum {
g_warning (G_STRLOC ": GL Error %x", _err); \
} } G_STMT_END
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
x, clutter_get_timestamp(), ##a); } \
} G_STMT_END
#else /* !CLUTTER_ENABLE_DEBUG */
#define CLUTTER_NOTE(type,x,a...)
#define CLUTTER_NOTE(type,...)
#define CLUTTER_MARK()
#define CLUTTER_DBG(x)
#define CLUTTER_GLERR()
#define CLUTTER_TIMESTAMP(type,x,a...)
#define CLUTTER_TIMESTAMP(type,...)
#endif /* CLUTTER_ENABLE_DEBUG */

View File

@ -27,8 +27,8 @@
#include "config.h"
#endif
#include <clutter-fixed.h>
#include <clutter-private.h>
#include "clutter-fixed.h"
#include "clutter-private.h"
/**
* SECTION:clutter-fixed
@ -517,6 +517,7 @@ clutter_sqrtx (ClutterFixed x)
unsigned int mask = 0x40000000;
unsigned fract = x & 0x0000ffff;
unsigned int d1, d2;
ClutterFixed v1, v2;
if (x <= 0)
return 0;
@ -579,8 +580,8 @@ clutter_sqrtx (ClutterFixed x)
}
/* Do a weighted average of the two nearest values */
ClutterFixed v1 = sqrt_tbl[t];
ClutterFixed v2 = sqrt_tbl[t+1];
v1 = sqrt_tbl[t];
v2 = sqrt_tbl[t+1];
/*
* 12 is fairly arbitrary -- we want integer that is not too big to cost

View File

@ -29,7 +29,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <math.h>
#include <glib.h>

View File

@ -106,8 +106,8 @@ tc_get (tc_area *area, int width, int height)
/* create a new texture if necessary */
if (!match)
{
CLUTTER_NOTE (PANGO, g_message ("creating new texture %i x %i\n",
TC_WIDTH, TC_HEIGHT));
CLUTTER_NOTE (PANGO, "creating new texture %i x %i",
TC_WIDTH, TC_HEIGHT);
match = g_slice_new (tc_texture);
match->next = first_texture;
@ -348,7 +348,7 @@ draw_glyph (PangoRenderer *renderer_,
g->left = bm.left;
g->top = bm.top;
CLUTTER_NOTE (PANGO, g_message ("cache fail; subimage2d %i\n", glyph));
CLUTTER_NOTE (PANGO, "cache fail; subimage2d %i", glyph);
cogl_texture_bind (CGL_TEXTURE_2D, g->tex.name);
@ -368,7 +368,7 @@ draw_glyph (PangoRenderer *renderer_,
renderer->curtex = g->tex.name;
}
else CLUTTER_NOTE (PANGO, g_message ("cache succsess %i\n", glyph));
else CLUTTER_NOTE (PANGO, "cache succsess %i\n", glyph);
x += g->left;
y -= g->top;