mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 11:02:05 +00:00
2006-06-06 Matthew Allum <mallum@openedhand.com>
* configure.ac: Use pkg-config to check for X. Really Check for GL libs. Make gtk binding optional. Cleanup a little. * Makefile.am: * gtk/Makefile.am: Make gtk binding optional * clutter/clutter-element.c: Cleanup a little, notify on size change. * clutter/clutter-texture.c: Lots of cleanups. Add waste prop. Add filter quality prop. * clutter/clutter-clone-texture.c: Make object construction simpler to work better with bindings. * clutter/clutter-stage.c: * clutter/clutter-timeline.c: Minor reformating, cleanups. * examples/test-text.c: (main): Random experimentation
This commit is contained in:
parent
17fedd5997
commit
f00e84606c
26
ChangeLog
26
ChangeLog
@ -1,3 +1,29 @@
|
||||
2006-06-06 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* configure.ac:
|
||||
Use pkg-config to check for X. Really Check for GL libs.
|
||||
Make gtk binding optional. Cleanup a little.
|
||||
|
||||
* Makefile.am:
|
||||
* gtk/Makefile.am:
|
||||
Make gtk binding optional
|
||||
|
||||
* clutter/clutter-element.c:
|
||||
Cleanup a little, notify on size change.
|
||||
|
||||
* clutter/clutter-texture.c:
|
||||
Lots of cleanups. Add waste prop. Add filter quality prop.
|
||||
|
||||
* clutter/clutter-clone-texture.c:
|
||||
Make object construction simpler to work better with bindings.
|
||||
|
||||
* clutter/clutter-stage.c:
|
||||
* clutter/clutter-timeline.c:
|
||||
Minor reformating, cleanups.
|
||||
|
||||
* examples/test-text.c: (main):
|
||||
Random experimentation
|
||||
|
||||
2006-06-06 Iain Holmes <iain@openedhand.com>
|
||||
|
||||
* gtk/gtk-clutter.c (size_request): Take the size of the widget from
|
||||
|
@ -1,4 +1,8 @@
|
||||
SUBDIRS=clutter gtk bindings doc examples
|
||||
SUBDIRS=clutter bindings doc examples
|
||||
|
||||
if ENABLE_GTK
|
||||
SUBDIRS += gtk
|
||||
endif
|
||||
|
||||
pcfiles = clutter-@CLUTTER_MAJORMINOR@.pc
|
||||
|
||||
|
@ -129,6 +129,9 @@ clone_texture_render_to_gl_quad (ClutterCloneTexture *ctexture,
|
||||
qy1 = y1 + lasty;
|
||||
qy2 = qy1 + ((qheight * actual_h) / pheight );
|
||||
|
||||
CLUTTER_DBG("rendering text tile x: %i, y: %i - %ix%i",
|
||||
x, y, actual_w, actual_h);
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (tx, ty); glVertex2i (qx2, qy2);
|
||||
glTexCoord2f (0, ty); glVertex2i (qx1, qy2);
|
||||
@ -167,6 +170,10 @@ clutter_clone_texture_paint (ClutterElement *self)
|
||||
glColor4ub(255, 255, 255, clutter_element_get_opacity(self));
|
||||
|
||||
clutter_element_get_coords (self, &x1, &y1, &x2, &y2);
|
||||
|
||||
CLUTTER_DBG("paint to x1: %i, y1: %i x2: %i, y2: %i opacity: %i",
|
||||
x1, y1, x2, y2, clutter_element_get_opacity(self) );
|
||||
|
||||
clone_texture_render_to_gl_quad (CLUTTER_CLONE_TEXTURE(self),
|
||||
x1, y1, x2, y2);
|
||||
|
||||
@ -187,7 +194,17 @@ set_parent_texture (ClutterCloneTexture *ctexture,
|
||||
}
|
||||
|
||||
if (texture)
|
||||
{
|
||||
gint width, height;
|
||||
|
||||
priv->parent_texture = g_object_ref (texture);
|
||||
|
||||
/* Sync up the size to parent texture base pixbuf size.
|
||||
*/
|
||||
clutter_texture_get_base_size (texture, &width, &height);
|
||||
clutter_element_set_size (CLUTTER_ELEMENT(ctexture), width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -285,22 +302,17 @@ clutter_clone_texture_init (ClutterCloneTexture *self)
|
||||
* clutter_clone_texture_new:
|
||||
* @texture: a #ClutterTexture
|
||||
*
|
||||
* FIXME
|
||||
* Creates an efficient 'clone' of a pre-existing texture if which it
|
||||
* shares the underlying pixbuf data.
|
||||
*
|
||||
* Return value: the newly created #ClutterCloneTexture
|
||||
*/
|
||||
ClutterElement *
|
||||
clutter_clone_texture_new (ClutterTexture *texture)
|
||||
{
|
||||
gint width, height;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), NULL);
|
||||
|
||||
clutter_texture_get_base_size (texture, &width, &height);
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_CLONE_TEXTURE,
|
||||
"parent-texture", texture,
|
||||
"width", width,
|
||||
"height", height,
|
||||
NULL);
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ clutter_element_paint (ClutterElement *self)
|
||||
|
||||
glLoadName (clutter_element_get_id (self));
|
||||
|
||||
/* FIXME: Less clunky */
|
||||
/* FIXME: Less clunky ? */
|
||||
|
||||
if (self->priv->rzang)
|
||||
{
|
||||
@ -319,6 +319,7 @@ clutter_element_request_coords (ClutterElement *self,
|
||||
ClutterElementBox *box)
|
||||
{
|
||||
ClutterElementClass *klass;
|
||||
gboolean x_change, y_change, width_change, height_change;
|
||||
|
||||
klass = CLUTTER_ELEMENT_GET_CLASS (self);
|
||||
|
||||
@ -326,15 +327,34 @@ clutter_element_request_coords (ClutterElement *self,
|
||||
if (klass->request_coords)
|
||||
klass->request_coords(self, box);
|
||||
|
||||
x_change = (self->priv->coords.x1 != box->x1);
|
||||
y_change = (self->priv->coords.y1 != box->y1);
|
||||
width_change = (self->priv->coords.x2 - self->priv->coords.x1
|
||||
!= box->x2 - box->x1);
|
||||
height_change = (self->priv->coords.y2 - self->priv->coords.y1
|
||||
!= box->y2 - box->y1);
|
||||
|
||||
self->priv->coords.x1 = box->x1;
|
||||
self->priv->coords.y1 = box->y1;
|
||||
self->priv->coords.x2 = box->x2;
|
||||
self->priv->coords.y2 = box->y2;
|
||||
|
||||
/* TODO: Fire a signal ? Could be usage for WM resizing stage */
|
||||
|
||||
if (CLUTTER_ELEMENT_IS_VISIBLE (self))
|
||||
clutter_element_queue_redraw (self);
|
||||
|
||||
/* FIXME: Below really needed ? If so should add to other _set calls.
|
||||
*/
|
||||
if (x_change)
|
||||
g_object_notify (G_OBJECT (self), "x");
|
||||
|
||||
if (y_change)
|
||||
g_object_notify (G_OBJECT (self), "y");
|
||||
|
||||
if (width_change)
|
||||
g_object_notify (G_OBJECT (self), "width");
|
||||
|
||||
if (height_change)
|
||||
g_object_notify (G_OBJECT (self), "height");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -342,7 +362,7 @@ clutter_element_request_coords (ClutterElement *self,
|
||||
* @self: A #ClutterElement
|
||||
* @box: A location to store the elements #ClutterElementBox co-ordinates
|
||||
*
|
||||
* Requests the allocated co-ordinates for the #ClutterElement ralative
|
||||
* Requests the allocated co-ordinates for the #ClutterElement relative
|
||||
* to any parent.
|
||||
*
|
||||
* This function should not be called directly by applications instead
|
||||
@ -543,14 +563,6 @@ clutter_element_class_init (ClutterElementClass *klass)
|
||||
0xff,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
|
||||
/* FIXME: add - as boxed ?
|
||||
* g_object_class_install_property
|
||||
* (gobject_class, PROP_CLIP,
|
||||
* g_param_spec_pointer ("clip",
|
||||
* "Clip",
|
||||
* "Clip",
|
||||
* G_PARAM_READWRITE));
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
@ -935,33 +947,18 @@ clutter_element_get_id (ClutterElement *self)
|
||||
return self->priv->id;
|
||||
}
|
||||
|
||||
static void
|
||||
depth_sorter_foreach (ClutterElement *element, gpointer user_data)
|
||||
{
|
||||
ClutterElement *element_to_sort = CLUTTER_ELEMENT(user_data);
|
||||
gint z_copy;
|
||||
|
||||
z_copy = element->priv->z;
|
||||
|
||||
if (element_to_sort->priv->z > element->priv->z)
|
||||
{
|
||||
clutter_element_raise (element_to_sort, element);
|
||||
element->priv->z = z_copy;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_element_set_depth:
|
||||
* @self: a #ClutterElement
|
||||
* @depth: FIXME
|
||||
*
|
||||
* FIXME
|
||||
* FIXME ( Basically sets Z value )
|
||||
*/
|
||||
void
|
||||
clutter_element_set_depth (ClutterElement *self,
|
||||
gint depth)
|
||||
{
|
||||
/* Sets Z value.*/
|
||||
/* Sets Z value. - FIXME: should invert ?*/
|
||||
self->priv->z = depth;
|
||||
|
||||
if (self->priv->parent_element)
|
||||
@ -1198,7 +1195,6 @@ clutter_element_lower (ClutterElement *self, ClutterElement *above)
|
||||
g_return_if_fail (CLUTTER_IS_ELEMENT(self));
|
||||
g_return_if_fail (clutter_element_get_parent (self) != NULL);
|
||||
|
||||
/* FIXME: fix Z ordering ? */
|
||||
if (above != NULL)
|
||||
{
|
||||
g_return_if_fail
|
||||
|
@ -111,7 +111,6 @@ sync_fullscreen (ClutterStage *stage)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME */
|
||||
if (stage->priv->xwin != None)
|
||||
XDeleteProperty(clutter_xdisplay(),
|
||||
stage->priv->xwin, atom_WINDOW_STATE);
|
||||
@ -367,6 +366,9 @@ clutter_stage_request_coords (ClutterElement *self,
|
||||
stage = CLUTTER_STAGE (self);
|
||||
priv = stage->priv;
|
||||
|
||||
/* FIXME: some how have X configure_notfiys call this ?
|
||||
*/
|
||||
|
||||
new_width = ABS(box->x2 - box->x1);
|
||||
new_height = ABS(box->y2 - box->y1);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "clutter-texture.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-util.h"
|
||||
#include "clutter-private.h" /* for DBG */
|
||||
|
||||
#include <GL/glx.h>
|
||||
@ -39,28 +40,7 @@ G_DEFINE_TYPE (ClutterTexture, clutter_texture, CLUTTER_TYPE_ELEMENT);
|
||||
#define PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
|
||||
#endif
|
||||
|
||||
#define PIXEL_FORMAT GL_RGBA
|
||||
|
||||
/* Some code below based on luminocity - copyright Owen Taylor */
|
||||
|
||||
/* MAX_WASTE: The maximum dimension of blank area we'll accept
|
||||
* in a pixmap. Bigger values use less textures, smaller
|
||||
* values less texture memory. The current value of
|
||||
* 256 means that the smallest texture we'll split to
|
||||
* save texture memory is 513x512. (That will be split into
|
||||
* a 512x512 and, if overlap is 32, a 64x512 texture)
|
||||
*/
|
||||
#define MAX_WASTE 64 /* FIXME: Make property */
|
||||
|
||||
/*
|
||||
* OVERLAP: when we divide the full-resolution image into
|
||||
* tiles to deal with hardware limitations, we overlap
|
||||
* tiles by this much. This means that we can scale
|
||||
* down by up to OVERLAP before we start getting
|
||||
* seems.
|
||||
*/
|
||||
|
||||
#define OVERLAP 0 /* 32 */
|
||||
#define OVERLAP 0
|
||||
|
||||
/* FIXME: actually use */
|
||||
typedef struct ClutterTextureTileDimention
|
||||
@ -77,8 +57,9 @@ struct ClutterTexturePrivate
|
||||
GLenum pixel_type;
|
||||
|
||||
gboolean sync_element_size;
|
||||
gint tile_max_waste;
|
||||
gboolean repeat_x, repeat_y;
|
||||
gint max_tile_waste;
|
||||
guint filter_quality;
|
||||
gboolean repeat_x, repeat_y; /* non working */
|
||||
|
||||
gboolean tiled;
|
||||
ClutterTextureTileDimention *x_tiles, *y_tiles;
|
||||
@ -96,7 +77,8 @@ enum
|
||||
PROP_PIXEL_FORMAT, /* Texture format */
|
||||
PROP_SYNC_SIZE,
|
||||
PROP_REPEAT_Y,
|
||||
PROP_REPEAT_X
|
||||
PROP_REPEAT_X,
|
||||
PROP_FILTER_QUALITY
|
||||
};
|
||||
|
||||
enum
|
||||
@ -111,17 +93,6 @@ static int texture_signals[LAST_SIGNAL] = { 0 };
|
||||
static void
|
||||
init_tiles (ClutterTexture *texture);
|
||||
|
||||
static int
|
||||
next_p2 (int a)
|
||||
{
|
||||
int rval=1;
|
||||
|
||||
while(rval < a)
|
||||
rval <<= 1;
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
can_create (int width,
|
||||
int height,
|
||||
@ -147,6 +118,7 @@ can_create (int width,
|
||||
static int
|
||||
tile_dimension (int to_fill,
|
||||
int start_size,
|
||||
int waste,
|
||||
ClutterTextureTileDimention *tiles)
|
||||
{
|
||||
int pos = 0;
|
||||
@ -174,7 +146,7 @@ tile_dimension (int to_fill,
|
||||
{
|
||||
to_fill -= (size - OVERLAP);
|
||||
pos += size - OVERLAP;
|
||||
while (size >= 2 * to_fill || size - to_fill > MAX_WASTE)
|
||||
while (size >= 2 * to_fill || size - to_fill > waste)
|
||||
size /= 2;
|
||||
}
|
||||
}
|
||||
@ -190,20 +162,21 @@ init_tiles (ClutterTexture *texture)
|
||||
|
||||
priv = texture->priv;
|
||||
|
||||
x_pot = next_p2 (priv->width);
|
||||
y_pot = next_p2 (priv->height);
|
||||
x_pot = clutter_util_next_p2 (priv->width);
|
||||
y_pot = clutter_util_next_p2 (priv->height);
|
||||
|
||||
if (x_pot - priv->width > MAX_WASTE && y_pot - priv->height > MAX_WASTE)
|
||||
if (x_pot - priv->width > priv->max_tile_waste
|
||||
&& y_pot - priv->height > priv->max_tile_waste)
|
||||
{
|
||||
while (!(can_create (x_pot, y_pot, priv->pixel_format, priv->pixel_type)
|
||||
&& (x_pot - priv->width < MAX_WASTE)
|
||||
&& (y_pot - priv->height < MAX_WASTE)))
|
||||
&& (x_pot - priv->width < priv->max_tile_waste)
|
||||
&& (y_pot - priv->height < priv->max_tile_waste)))
|
||||
{
|
||||
CLUTTER_DBG("x_pot:%i - width:%i < max_waste:%i",
|
||||
x_pot, priv->width, MAX_WASTE );
|
||||
x_pot, priv->width, priv->max_tile_waste);
|
||||
|
||||
CLUTTER_DBG("y_pot:%i - height:%i < max_waste:%i",
|
||||
y_pot, priv->height, MAX_WASTE );
|
||||
y_pot, priv->height, priv->max_tile_waste);
|
||||
|
||||
if (x_pot > y_pot)
|
||||
x_pot /= 2;
|
||||
@ -215,20 +188,22 @@ init_tiles (ClutterTexture *texture)
|
||||
if (priv->x_tiles)
|
||||
g_free(priv->x_tiles);
|
||||
|
||||
priv->n_x_tiles = tile_dimension (priv->width, x_pot, NULL);
|
||||
priv->n_x_tiles = tile_dimension (priv->width, x_pot,
|
||||
priv->max_tile_waste, NULL);
|
||||
priv->x_tiles = g_new (ClutterTextureTileDimention, priv->n_x_tiles);
|
||||
tile_dimension (priv->width, x_pot, priv->x_tiles);
|
||||
tile_dimension (priv->width, x_pot, priv->max_tile_waste, priv->x_tiles);
|
||||
|
||||
if (priv->y_tiles)
|
||||
g_free(priv->y_tiles);
|
||||
|
||||
priv->n_y_tiles = tile_dimension (priv->height, y_pot, NULL);
|
||||
priv->n_y_tiles = tile_dimension (priv->height, y_pot,
|
||||
priv->max_tile_waste, NULL);
|
||||
priv->y_tiles = g_new (ClutterTextureTileDimention, priv->n_y_tiles);
|
||||
tile_dimension (priv->height, y_pot, priv->y_tiles);
|
||||
tile_dimension (priv->height, y_pot, priv->max_tile_waste, priv->y_tiles);
|
||||
|
||||
CLUTTER_DBG("x_pot:%i, width:%i, y_pot:%i, height: %i max_waste:%i, "
|
||||
" n_x_tiles: %i, n_y_tiles: %i",
|
||||
x_pot, priv->width, y_pot, priv->height, MAX_WASTE,
|
||||
x_pot, priv->width, y_pot, priv->height, priv->max_tile_waste,
|
||||
priv->n_x_tiles, priv->n_y_tiles);
|
||||
|
||||
}
|
||||
@ -267,8 +242,8 @@ texture_render_to_gl_quad (ClutterTexture *texture,
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, priv->tiles[0]);
|
||||
|
||||
tx = (float) priv->width / next_p2 (priv->width);
|
||||
ty = (float) priv->height / next_p2 (priv->height);
|
||||
tx = (float) priv->width / clutter_util_next_p2 (priv->width);
|
||||
ty = (float) priv->height / clutter_util_next_p2 (priv->height);
|
||||
|
||||
qx1 = x1; qx2 = x2;
|
||||
qy1 = y1; qy2 = y2;
|
||||
@ -407,8 +382,11 @@ clutter_texture_sync_pixbuf (ClutterTexture *texture)
|
||||
GL_TEXTURE_WRAP_T,
|
||||
priv->repeat_y ? GL_REPEAT : GL_CLAMP);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
priv->filter_quality ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
priv->filter_quality ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH,
|
||||
gdk_pixbuf_get_width(priv->pixbuf));
|
||||
@ -422,8 +400,8 @@ clutter_texture_sync_pixbuf (ClutterTexture *texture)
|
||||
0,
|
||||
(gdk_pixbuf_get_n_channels (priv->pixbuf) == 4) ?
|
||||
GL_RGBA : GL_RGB,
|
||||
next_p2(priv->width),
|
||||
next_p2(priv->height),
|
||||
clutter_util_next_p2(priv->width),
|
||||
clutter_util_next_p2(priv->height),
|
||||
0,
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
@ -518,8 +496,12 @@ clutter_texture_sync_pixbuf (ClutterTexture *texture)
|
||||
GL_TEXTURE_WRAP_T,
|
||||
priv->repeat_y ? GL_REPEAT : GL_CLAMP);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
priv->filter_quality ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
priv->filter_quality ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, gdk_pixbuf_get_width(pixtmp));
|
||||
@ -535,10 +517,6 @@ clutter_texture_sync_pixbuf (ClutterTexture *texture)
|
||||
GL_RGBA : GL_RGB,
|
||||
priv->x_tiles[x].size,
|
||||
priv->y_tiles[y].size,
|
||||
/*
|
||||
gdk_pixbuf_get_width(pixtmp),
|
||||
gdk_pixbuf_get_height(pixtmp),
|
||||
*/
|
||||
0,
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
@ -552,10 +530,6 @@ clutter_texture_sync_pixbuf (ClutterTexture *texture)
|
||||
0, 0,
|
||||
priv->x_tiles[x].size,
|
||||
priv->y_tiles[y].size,
|
||||
/*
|
||||
gdk_pixbuf_get_width(pixtmp),
|
||||
gdk_pixbuf_get_height(pixtmp),
|
||||
*/
|
||||
priv->pixel_format,
|
||||
priv->pixel_type,
|
||||
gdk_pixbuf_get_pixels(pixtmp));
|
||||
@ -690,7 +664,7 @@ clutter_texture_set_property (GObject *object,
|
||||
CLUTTER_DBG("Texture is tiled ? %i", priv->tiled);
|
||||
break;
|
||||
case PROP_MAX_TILE_WASTE:
|
||||
priv->tile_max_waste = g_value_get_int (value);
|
||||
priv->max_tile_waste = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_PIXEL_TYPE:
|
||||
priv->pixel_type = g_value_get_int (value);
|
||||
@ -707,6 +681,9 @@ clutter_texture_set_property (GObject *object,
|
||||
case PROP_REPEAT_Y:
|
||||
priv->repeat_y = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_FILTER_QUALITY:
|
||||
priv->filter_quality = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -734,7 +711,7 @@ clutter_texture_get_property (GObject *object,
|
||||
g_value_set_boolean (value, priv->tiled);
|
||||
break;
|
||||
case PROP_MAX_TILE_WASTE:
|
||||
g_value_set_int (value, priv->tile_max_waste);
|
||||
g_value_set_int (value, priv->max_tile_waste);
|
||||
break;
|
||||
case PROP_PIXEL_TYPE:
|
||||
g_value_set_int (value, priv->pixel_type);
|
||||
@ -751,6 +728,9 @@ clutter_texture_get_property (GObject *object,
|
||||
case PROP_REPEAT_Y:
|
||||
g_value_set_boolean (value, priv->repeat_y);
|
||||
break;
|
||||
case PROP_FILTER_QUALITY:
|
||||
g_value_set_int (value, priv->filter_quality);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -808,7 +788,7 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
g_param_spec_boolean ("repeat-x",
|
||||
"Tile underlying pixbuf in x direction",
|
||||
"Reapeat underlying pixbuf rather than scale"
|
||||
"in x direction",
|
||||
"in x direction. Currently UNWORKING",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
|
||||
@ -817,17 +797,32 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
g_param_spec_boolean ("repeat-y",
|
||||
"Tile underlying pixbuf in y direction",
|
||||
"Reapeat underlying pixbuf rather than scale"
|
||||
"in y direction",
|
||||
"in y direction. Currently UNWORKING",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
|
||||
/* FIXME: non working atm */
|
||||
/* FIXME: Ideally this option needs to have some kind of global
|
||||
* overide as to imporve performance.
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_FILTER_QUALITY,
|
||||
g_param_spec_int ("filter-quality",
|
||||
"Quality of filter used when scaling a texture",
|
||||
"Values 0 and 1 current only supported, with 0"
|
||||
"being lower quality but fast, 1 being better "
|
||||
"quality but slower. ( Currently just maps to "
|
||||
" GL_NEAREST / GL_LINEAR )",
|
||||
0,
|
||||
G_MAXINT,
|
||||
1,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_MAX_TILE_WASTE,
|
||||
g_param_spec_int ("tile-waste",
|
||||
"Tile dimention to waste",
|
||||
"The maximum dimension of blank area we'll accept"
|
||||
"in a pixmap. Bigger values use less textures, "
|
||||
"Max wastage dimention of a texture when using "
|
||||
"tiled textures. Bigger values use less textures, "
|
||||
"smaller values less texture memory. ",
|
||||
0,
|
||||
G_MAXINT,
|
||||
@ -851,7 +846,7 @@ clutter_texture_class_init (ClutterTextureClass *klass)
|
||||
"GL texture pixel format used",
|
||||
0,
|
||||
G_MAXINT,
|
||||
PIXEL_FORMAT,
|
||||
GL_RGBA,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
||||
|
||||
texture_signals[SIGNAL_SIZE_CHANGE] =
|
||||
@ -971,27 +966,13 @@ clutter_texture_set_pixbuf (ClutterTexture *texture, GdkPixbuf *pixbuf)
|
||||
/* Force tiling if pixbuf is too big for single texture */
|
||||
if (priv->tiled == FALSE
|
||||
&& texture_dirty
|
||||
&& !can_create(next_p2(priv->width), next_p2(priv->height),
|
||||
priv->pixel_format, priv->pixel_type))
|
||||
&& !can_create(clutter_util_next_p2(priv->width),
|
||||
clutter_util_next_p2(priv->height),
|
||||
priv->pixel_format,
|
||||
priv->pixel_type))
|
||||
priv->tiled = TRUE;
|
||||
clutter_threads_leave();
|
||||
|
||||
/* FIXME: for priv->tiled = FALSE textures, pixbuf could be
|
||||
* format we dont like ( ie no alpha ). therfore
|
||||
* we need to pixbuf_copy it into one that is.
|
||||
*
|
||||
* Actually I dont think this is worth worrying about...
|
||||
* is non tiled textures are being used, texture data
|
||||
* type can be set at initialisation.
|
||||
*/
|
||||
|
||||
/* reset set if element does not yet have size */
|
||||
/* FIXME: caller has to handle this via signal, OR
|
||||
set prop so its always handled automatically OR
|
||||
always happens and client can resize via signal
|
||||
if (clutter_element_width (CLUTTER_ELEMENT(texture)) == 0
|
||||
|| clutter_element_height (CLUTTER_ELEMENT(texture)) == 0)
|
||||
*/
|
||||
if (priv->sync_element_size)
|
||||
clutter_element_set_size (CLUTTER_ELEMENT(texture),
|
||||
priv->width,
|
||||
|
@ -486,7 +486,7 @@ clutter_timeline_is_playing (ClutterTimeline *timeline)
|
||||
*
|
||||
* Return Value: a new #ClutterTimeline
|
||||
*/
|
||||
ClutterTimeline *
|
||||
ClutterTimeline*
|
||||
clutter_timeline_new (guint nframes,
|
||||
guint fps)
|
||||
{
|
||||
|
72
configure.ac
72
configure.ac
@ -9,7 +9,7 @@ m4_define(clutter_version_micro, 1)
|
||||
|
||||
AC_INIT([clutter],
|
||||
clutter_version_major.clutter_version_minor.clutter_version_micro,
|
||||
[mallum@o-hand.com])
|
||||
[http://bugzilla.o-hand.com/enter_bug.cgi?product=clutter])
|
||||
AC_CONFIG_SRCDIR([clutter/clutter.h])
|
||||
AM_CONFIG_HEADER([config.h])
|
||||
|
||||
@ -53,45 +53,40 @@ AC_CHECK_FUNCS([memset munmap strcasecmp strdup])
|
||||
|
||||
dnl ========================================================================
|
||||
|
||||
# FIXME: redo below
|
||||
PKG_CHECK_MODULES(X11, x11)
|
||||
|
||||
AC_PATH_XTRA
|
||||
# FIXME: Needed ?
|
||||
AC_MSG_CHECKING([for XTHREADS in Xlib])
|
||||
|
||||
if test "x$have_x" = "xyes"; then
|
||||
GLX_LIBS="$X_LIBS -lX11 -lGL"
|
||||
GLX_CFLAGS="$X_CFLAGS"
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $GLX_CFLAGS"
|
||||
LIBS="$LIBS $GLX_LIBS"
|
||||
|
||||
AC_MSG_CHECKING([for XTHREADS in Xlib])
|
||||
AC_RUN_IFELSE(
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
|
||||
[[return XInitThreads() == 0 ? 0 : 1;]])],
|
||||
[xthreads=no],
|
||||
[xthreads=yes],
|
||||
[xthreads=yes])
|
||||
|
||||
AC_MSG_RESULT($xthreads)
|
||||
AC_MSG_RESULT($xthreads)
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test "x$xthreads" = "xyes"
|
||||
then
|
||||
GLX_LIBS="$GLX_LIBS -lpthread"
|
||||
if test "x$xthreads" = "xyes"
|
||||
then
|
||||
X11_LIBS="$X11_LIBS -lpthread"
|
||||
AC_DEFINE([XTHREADS], [], [1])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([*** Cannot find X + GL ****])
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(GL, glXCreateContext, HAVE_LIBGL=yes, HAVE_LIBGL=no)
|
||||
|
||||
if test "x$HAVE_LIBGL" = "xno"; then
|
||||
AC_MSG_ERROR(libGL not found);
|
||||
else
|
||||
GLX_LIBS="$X11_LIBS -lGL"
|
||||
fi
|
||||
|
||||
GLX_CFLAGS="$X11_CFLAGS"
|
||||
|
||||
dnl ========================================================================
|
||||
|
||||
pkg_modules="pangoft2 glib-2.0 >= 2.8 gthread-2.0 gdk-pixbuf-2.0"
|
||||
PKG_CHECK_MODULES(CLUTTER, [$pkg_modules])
|
||||
PKG_CHECK_MODULES(CLUTTER_DEPS, [$pkg_modules])
|
||||
|
||||
dnl ========================================================================
|
||||
|
||||
@ -104,8 +99,14 @@ GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -
|
||||
|
||||
dnl ========================================================================
|
||||
|
||||
pkg_modules="gtk+-2.0"
|
||||
PKG_CHECK_MODULES(GTK, [$pkg_modules])
|
||||
AC_ARG_ENABLE(gtk,
|
||||
[AC_HELP_STRING([--enable-gtk], [Buld Gtk+ Clutter widget])],enable_gtk="$enableval",enable_gtk=no)
|
||||
|
||||
if test "x$enable_gtk" = "xyes"; then
|
||||
PKG_CHECK_MODULES(GTK, [gtk+-2.0])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_GTK, test x$enable_gtk = xyes)
|
||||
|
||||
dnl ========================================================================
|
||||
|
||||
@ -183,8 +184,8 @@ AC_SUBST(GST_LIBS)
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
|
||||
CLUTTER_CFLAGS="$GLX_CLAGS $CLUTTER_CFLAGS"
|
||||
CLUTTER_LIBS="$GLX_LIBS $CLUTTER_LIBS"
|
||||
CLUTTER_CFLAGS="$GLX_CLAGS $CLUTTER_DEPS_CFLAGS"
|
||||
CLUTTER_LIBS="$GLX_LIBS $CLUTTER_DEPS_LIBS"
|
||||
|
||||
AC_SUBST(CLUTTER_CFLAGS)
|
||||
AC_SUBST(CLUTTER_LIBS)
|
||||
@ -199,3 +200,16 @@ doc/Makefile
|
||||
doc/reference/Makefile
|
||||
clutter.pc
|
||||
])
|
||||
|
||||
dnl ========================================================================
|
||||
|
||||
echo ""
|
||||
echo " Clutter $VERSION"
|
||||
echo " ==================="
|
||||
echo ""
|
||||
echo " prefix: ${prefix}"
|
||||
echo ""
|
||||
echo " Python Bindings: ${enable_python}"
|
||||
echo " GTK+ Widget: ${enable_gtk}"
|
||||
echo " Documentation: ${enable_gtk_doc}"
|
||||
echo ""
|
@ -1,8 +1,21 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
void
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterElement *label = (ClutterElement*)data;
|
||||
|
||||
clutter_element_set_depth(label, -400 + (frame_num * 40));
|
||||
clutter_element_set_opacity (label, 255 - frame_num );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
ClutterElement *label;
|
||||
ClutterElement *stage;
|
||||
gchar *text;
|
||||
@ -22,12 +35,21 @@ main (int argc, char *argv[])
|
||||
|
||||
label = clutter_label_new_with_text ("Mono 8", text);
|
||||
clutter_label_set_color (CLUTTER_LABEL (label), &label_color);
|
||||
/* clutter_label_set_text_extents (CLUTTER_LABEL(label), 200, 0); */
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP (stage), label);
|
||||
clutter_group_show_all (CLUTTER_GROUP (stage));
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
|
||||
timeline = clutter_timeline_new (400, 60); /* num frames, fps */
|
||||
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
|
||||
|
||||
g_signal_connect(timeline, "new-frame", G_CALLBACK (frame_cb), label);
|
||||
|
||||
/* and start it */
|
||||
clutter_timeline_start (timeline);
|
||||
|
||||
g_signal_connect (stage, "key-press-event",
|
||||
G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
g_object_unref (stage);
|
||||
|
||||
clutter_main();
|
||||
|
@ -3,11 +3,12 @@ INCLUDES = @GCC_FLAGS@ @CLUTTER_CFLAGS@ $(GST_CFLAGS) $(GTK_CFLAGS)
|
||||
lib_LTLIBRARIES = libgtkclutter-@CLUTTER_MAJORMINOR@.la
|
||||
|
||||
libgtkclutter_@CLUTTER_MAJORMINOR@_la_SOURCES = gtk-clutter.c
|
||||
|
||||
libgtkclutter_@CLUTTER_MAJORMINOR@_la_LIBADD = @CLUTTER_LIBS@ $(GST_LIBS) $(GTK_LIBS)
|
||||
libgtkclutter_@CLUTTER_MAJORMINOR@_la_LIBADD = \
|
||||
@CLUTTER_LIBS@ $(GST_LIBS) $(GTK_LIBS)
|
||||
libgtkclutter_@CLUTTER_MAJORMINOR@_la_LDFLAGS = @CLUTTER_LT_LDFLAGS@
|
||||
|
||||
gtkclutterheadersdir = $(includedir)/gtk-clutter-@CLUTTER_MAJORMINOR@/gtk-clutter
|
||||
gtkclutterheadersdir = \
|
||||
$(includedir)/gtk-clutter-@CLUTTER_MAJORMINOR@/gtk-clutter
|
||||
gtkclutterheaders_DATA = gtk-clutter.h
|
||||
|
||||
noinst_PROGRAMS = gtk-clutter-test
|
||||
|
Loading…
Reference in New Issue
Block a user