2007-06-22 Matthew Allum <mallum@openedhand.com>

* NEWS:
        * README.in:
        * TODO:
        Update for 0.3 release.

        * clutter/clutter-actor.c:
        Minor doc fixups

        * clutter/clutter-texture.c:
        Various minor additions for handling non RGBA data.
        Fix a typo breaking clutter_texture_get_pixbuf() on tiled textures.

        * tests/test-actors.c:
        Disable scaling to avoid drifting (temporary till API is fixed)
This commit is contained in:
Matthew Allum 2007-06-22 15:16:40 +00:00
parent b302c80864
commit ee6156cb01
7 changed files with 348 additions and 88 deletions

View File

@ -1,3 +1,20 @@
2007-06-22 Matthew Allum <mallum@openedhand.com>
* NEWS:
* README.in:
* TODO:
Update for 0.3 release.
* clutter/clutter-actor.c:
Minor doc fixups
* clutter/clutter-texture.c:
Various minor additions for handling non RGBA data.
Fix a typo breaking clutter_texture_get_pixbuf() on tiled textures.
* tests/test-actors.c:
Disable scaling to avoid drifting (temporary till API is fixed)
2007-06-21 Emmanuele Bassi <ebassi@openedhand.com> 2007-06-21 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-timeline.c: Allow disabling the timeline pool * clutter/clutter-timeline.c: Allow disabling the timeline pool

116
NEWS
View File

@ -1,4 +1,118 @@
Clutter 0.2 () Clutter 0.3 ()
========================
* List of changes between 0.2.3 and 0.3
o Clutter now supports both switchable windowing system and GL backends.
Window systems supported include GLX, EGL and SDL.
GL support includes OpenGL 1.2+ and OpenGL ES 1.1. This is
provided by a small basic abstraction layer 'cogl.h'. Cogl is not
yet documented - usage external to Clutter is not yet advised.
Backends may provide specific command line options.
Notes;
GLX
---
The GLX backend is built by default and is currently the most
developed, supported and featured windowing system backend. Only
OpenGL is supported via GLX.
SDL
---
Clutter has experimental support for using SDL. Open GL is supported as
is OpenGL ES via Dogles (very experimental).
EGL
---
Clutter has experimental support for using EGL. Only Open GL ES
is supported by EGL.
EGL support assumes an EGL implementation running atop X Windows.
Open GL ES.
-----------
Clutter now has experimental support for Open GL ES.
Current known issues;
+ Unrealising a ClutterTexture will not move pixel data from video
into system memory but simply destroy it.
+ BGRA, YUV Texture data not currently supported.
(Use the clutter_feature API to probe for above at runtime)
Open Source ES implementations this has been tested against
include `Vincent' and `dgles'. Support for commerical
implementations may require modifications to the configure.ac
script.
vincent: http://ogl-es.sourceforge.net/
(Also see: http://svn.o-hand.com/repos/misc/trunk/ogles/ )
dgles: http://developer.hybrid.fi/dgles/index.html
o New ClutterEffect class provides a simplified (and thus less flexible)
API wrapping around behaviours, alphas and timelines.
o New Behaviours - bspline, ellipsis, rotation.
o New built in Alpha functions;
CLUTTER_ALPHA_SINE_INC
CLUTTER_ALPHA_SINE_DEC
CLUTTER_ALPHA_SINE_HALF
CLUTTER_ALPHA_SQUARE
CLUTTER_ALPHA_SMOOTHSTEP_INC
CLUTTER_ALPHA_SMOOTHSTEP_DEC
CLUTTER_ALPHA_EXP_INC
CLUTTER_ALPHA_EXP_DEC
o New Actors
+ ClutterContainer and ClutterVBox, ClutterHBox layout actors.
+ ClutterEntry, text entry actor
o ClutterTexture now handles BGRA, YUV and premultiplied alpha data.
o All internal math now fixed point based.
o Clutter now has it own internal event queue.
o ClutterStage new features;
+ Title property for naming in window decorations.
+ Perspective setting - The stages perspective can now be modified.
o New Clutter_actor *project API calls allow for querying of tranformed
actor vertices and points.
o New Clutter Feature checks.
o Initial ClutterUnit implementation for device independant positioning.
* List of Bugs fixed
o Various issues with very poor performance and Intel drivers.
o #138 Fix typo in x rotation transform.
Clutter 0.2.3 (2007-04-11)
==========================
* List of changed between 0.2.2 and 0.2.3
o Fixes to tile based textures and again clutter_texture_get_pixbuf(). [Matthew]
o Implement Gravity for ClutterScaleBehaviour. [Matthew, Rob]
Clutter 0.2.2 (2007-03-22)
==========================
* List of changed between 0.2.1 and 0.2.2
o Addition of basic XEMBED support for clutter stage. [Matthew]
o Fixes to clutter_texture_get_pixbuf(). [Matthew]
o Export clutter_group_remove_all and add associated fixes. [Matthew]
Clutter 0.2.1 (2007-02-07)
==========================
* List of changed between 0.2.0 and 0.2.1
o Add even faster double to integer (and back) conversion
functions. [Tomas]
o Fix some errors in the fixed point sine waveform
function. [Tomas]
o Use fixed point math in the Pango renderer. [Tomas]
o Improve the GL version check. [Matthew]
o Add a square waveform function. [Emmanuele]
* List of bugs fixed
o #215 - macro CLUTTER_MARK() not disabled for non-debug builds
Clutter 0.2 (18-01-2007)
======================== ========================
* List of changes between 0.2 and 0.1 * List of changes between 0.2 and 0.1

View File

@ -1,33 +1,34 @@
Clutter README. Clutter README.
=============== ===============
This is Clutter @CLUTTER_VERSION@. Clutter aims to give a nice easy This is Clutter 0.3. Clutter is a GObject based user interface toolkit
GObject based API for creating fast, mainly 2D single window stylalised intended for the creation of fast, visually bespoke and impressive
applications such as media box UI's, presentaions, kiosk style apps etc. applications. Open GL is used for rendering.
It uses OpenGL for rendering.
Its not meant to be a full featured GUI toolkit for regular desktop Its not meant to be a full featured GUI toolkit for regular desktop
apps nor provide a general interface to *all* OpenGL functionality. apps nor provide a general interface to *all* OpenGL functionality.
It currently uses fairly low end GL functionality with an aim to still
work well on open source graphics drivers as well as possibly making
an eventual GL ES port feasable.
Clutter currently requires: Clutter currently requires:
* GLib >= 2.10.0 * GLib >= 2.10.0
* GdkPixbuf * GdkPixbuf
* OpenGL >= 1.2 * Pango 1.x
* OpenGL >= 1.2 or OpenGL ES 1.1
* GLX, SDL or an EGL Implementation
Its also recommended you have some kind of working hardware OpenGL on The official website is:
your target system. http://www.clutter-project.org
The Clutter blog is at
http://www.clutter-project.org/blog
To subscribe to the Clutter mailing list, send mail to:
clutter+subscribe@o-hand.com
The official mailing list archive is:
http://lists.o-hand.com/clutter/
New bug page on Bugzilla:
http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter
Clutter is LGPL licensed. Clutter is LGPL licensed.
The official website is: http://www.clutter-project.org
The official mailing list is: http://lists.o-hand.com/clutter/
New bug page on Bugzilla: http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter
INSTALLATION INSTALLATION
==== ====
See the INSTALL file See the INSTALL file
@ -35,9 +36,18 @@ See the INSTALL file
RELEASE NOTES RELEASE NOTES
==== ====
Release Notes for Clutter 0.4 Relevant information for developers with existing Clutter applications
wanting to port to newer releases;
Release Notes for Clutter 0.3
----------------------------- -----------------------------
* ClutterTexture changes:
+ clutter_texture_set_pixbuf() now takes a GError paremeter.
+ clutter_texture_upload_data has been split into two new and
more functional versions; clutter_texture_set_from_rgb_data(),
clutter_texture_set_from_yuv_data().
* The GLX specific API has been moved to the GLX backend code and * The GLX specific API has been moved to the GLX backend code and
it's now under the ClutterGlx namespace. it's now under the ClutterGlx namespace.
@ -45,7 +55,7 @@ Release Notes for Clutter 0.4
reviewed and changed were necessary. Every paint is queued with a reviewed and changed were necessary. Every paint is queued with a
priority of G_PRIORITY_DEFAULT + 10; timelines are allocated with priority of G_PRIORITY_DEFAULT + 10; timelines are allocated with
a G_PRIORITY_DEFAULT + 30 priority; events are processed with a a G_PRIORITY_DEFAULT + 30 priority; events are processed with a
G_PRIORITY_DEFAUTL priority. This ensures that events are processed G_PRIORITY_DEFAULT priority. This ensures that events are processed
before the paints take place. before the paints take place.
* The ClutterActor::allocate_coords() has been renamed to * The ClutterActor::allocate_coords() has been renamed to
@ -71,6 +81,16 @@ Release Notes for Clutter 0.4
If an application experiences bad behaviours during animations If an application experiences bad behaviours during animations
use "export CLUTTER_TIMELINE=no-pool" to disable the timeout pool. use "export CLUTTER_TIMELINE=no-pool" to disable the timeout pool.
* clutter_color_parse() now handles color definitions with alpha. Alpha
will default to fully Opaque rather than fully transparent if not specified.
* The Clutter examples/ directory has been removed and replaced with a
tests/ directory.
* Event API changes and event queue (Ebassi) .
* Runtime options now dependant on backend.
HACKING HACKING
==== ====
If you want to hack on and improve clutter check the TODO file. If you want to hack on and improve clutter check the TODO file.
@ -86,7 +106,8 @@ You will need an account.
In the report you should include: In the report you should include:
* what system you're running Clutter on; * what system you're running Clutter on;
* which version of GLib, GdkPixbuf and OpenGL you are using; * which version of GLib, GdkPixbuf and OpenGL you are using;
* which video card and which drivers you are using; * which video card and which drivers you are using, including output of
glxinfo and xdpyinfo.
* how to reproduce the bug. * how to reproduce the bug.
If you cannot reproduce the bug with one of the tests that come with Clutter If you cannot reproduce the bug with one of the tests that come with Clutter

8
TODO
View File

@ -1,7 +1,7 @@
TODO TODO
==== ====
Last updated 31/05/2007 Last updated 22/06/2007
0.4 (July 07) 0.4 (July 07)
@ -32,8 +32,9 @@ Maybe:
Definetly: Definetly:
- Fragment shader support infrastructure - More ClutterUnits support, convert actor API to units.
- Device independant units - Device independant units
- Fragment shader support infrastructure
- XML/JSON type 'layout' files - include actors + behaviours + timeline etc. - XML/JSON type 'layout' files - include actors + behaviours + timeline etc.
- App developers manual. - App developers manual.
@ -43,4 +44,5 @@ Nice/Maybe:
- Rectangle like props to all actors - Rectangle like props to all actors
- Glitz integration - Glitz integration
- Some kind of focus model. - Some kind of focus model.
- Apple/Win native backends. - Apple/Win native backends.
- Glitz backend over GLX (would cover above)

View File

@ -59,10 +59,10 @@ struct _ClutterActorPrivate
{ {
ClutterActorBox coords; ClutterActorBox coords;
ClutterGeometry clip; ClutterGeometry clip; /* FIXME: Should be Units */
guint has_clip : 1; guint has_clip : 1;
ClutterFixed rxang, ryang, rzang; /* Rotation*/ ClutterFixed rxang, ryang, rzang; /* Rotation*/
gint rzx, rzy, rxy, rxz, ryx, ryz; gint rzx, rzy, rxy, rxz, ryx, ryz; /* FIXME: Should be Units */
gint z; gint z;
guint8 opacity; guint8 opacity;
ClutterActor *parent_actor; ClutterActor *parent_actor;
@ -498,9 +498,9 @@ clutter_actor_transform_vertices (ClutterActor * self,
* @verts: Pointer to a location of an array of 4 #ClutterVertex where to * @verts: Pointer to a location of an array of 4 #ClutterVertex where to
* store the result. * store the result.
* *
* Calculates the screen coordinaces of the four corners or the actor; the * Calculates the tranformed screen coordinaces of the four corners of
* returned corners are in the following order: bottomleft, bottomright, * the actor; the returned corners are in the following order:
* topright, topleft. * bottomleft, bottomright, topright, topleft.
* *
* Since: 0.4 * Since: 0.4
**/ **/
@ -706,9 +706,10 @@ clutter_actor_paint (ClutterActor *self)
/** /**
* clutter_actor_request_coords: * clutter_actor_request_coords:
* @self: A #ClutterActor * @self: A #ClutterActor
* @box: A #ClutterActorBox with requested new co-ordinates. * @box: A #ClutterActorBox with requested new co-ordinates in ClutterUnits
* *
* Requests new co-ordinates for the #ClutterActor ralative to any parent. * Requests new untransformed co-ordinates for the #ClutterActor
* ralative to any parent.
* *
* This function should not be called directly by applications instead * This function should not be called directly by applications instead
* the various position/geometry methods should be used. * the various position/geometry methods should be used.
@ -767,8 +768,8 @@ clutter_actor_request_coords (ClutterActor *self,
* @self: A #ClutterActor * @self: A #ClutterActor
* @box: A location to store the actors #ClutterActorBox co-ordinates * @box: A location to store the actors #ClutterActorBox co-ordinates
* *
* Requests the queryd un transformed co-ordinates for the #ClutterActor * Requests the untransformed co-ordinates (in ClutterUnits) for the
* relative to any parent. * #ClutterActor relative to any parent.
* *
* This function should not be called directly by applications instead * This function should not be called directly by applications instead
* the various position/geometry methods should be used. * the various position/geometry methods should be used.
@ -1212,7 +1213,8 @@ clutter_actor_queue_redraw (ClutterActor *self)
* @self: A #ClutterActor * @self: A #ClutterActor
* @geometry: A #ClutterGeometry * @geometry: A #ClutterGeometry
* *
* Sets the actors geometry in pixels relative to any parent actor. * Sets the actors untransformed geometry in pixels relative to any
* parent actor.
*/ */
void void
clutter_actor_set_geometry (ClutterActor *self, clutter_actor_set_geometry (ClutterActor *self,
@ -1233,7 +1235,8 @@ clutter_actor_set_geometry (ClutterActor *self,
* @self: A #ClutterActor * @self: A #ClutterActor
* @geometry: A location to store actors #ClutterGeometry * @geometry: A location to store actors #ClutterGeometry
* *
* Gets the actors geometry in pixels relative to any parent actor. * Gets the actors untransformed geometry in pixels relative to any
* parent actor.
*/ */
void void
clutter_actor_get_geometry (ClutterActor *self, clutter_actor_get_geometry (ClutterActor *self,
@ -1259,7 +1262,7 @@ clutter_actor_get_geometry (ClutterActor *self,
* @x2: A location to store actors right position if non NULL. * @x2: A location to store actors right position if non NULL.
* @y2: A location to store actors bottom position if non NULL. * @y2: A location to store actors bottom position if non NULL.
* *
* Gets the actors bounding rectangle co-ordinates in pixels * Gets the actors untransformed bounding rectangle co-ordinates in pixels
* relative to any parent actor. * relative to any parent actor.
*/ */
void void
@ -1324,7 +1327,7 @@ clutter_actor_set_position (ClutterActor *self,
* @dy: Distance to move Actor on Y axis. * @dy: Distance to move Actor on Y axis.
* *
* Moves an actor by specified distance relative to * Moves an actor by specified distance relative to
* current position. * current position in pixels.
* *
* Since: 0.2 * Since: 0.2
*/ */
@ -1355,8 +1358,7 @@ clutter_actor_move_by (ClutterActor *self,
* @width: New width of actor in pixels * @width: New width of actor in pixels
* @height: New height of actor in pixels * @height: New height of actor in pixels
* *
* Sets the actors position in pixels relative to any * Sets the actors size in pixels.
* parent actor.
*/ */
void void
clutter_actor_set_size (ClutterActor *self, clutter_actor_set_size (ClutterActor *self,
@ -1381,7 +1383,7 @@ clutter_actor_set_size (ClutterActor *self,
* @width: Location to store width if non NULL. * @width: Location to store width if non NULL.
* @height: Location to store height if non NULL. * @height: Location to store height if non NULL.
* *
* Gets the size of an actor ignoring any scaling factors * Gets the size of an actor in pixels ignoring any scaling factors.
* *
* Since: 0.2 * Since: 0.2
*/ */
@ -1522,7 +1524,7 @@ clutter_actor_get_abs_size (ClutterActor *self,
* clutter_actor_get_width * clutter_actor_get_width
* @self: A #ClutterActor * @self: A #ClutterActor
* *
* Retrieves the actors width. * Retrieves the actors width ignoring any scaling factors.
* *
* Return value: The actor width in pixels * Return value: The actor width in pixels
**/ **/
@ -1542,7 +1544,7 @@ clutter_actor_get_width (ClutterActor *self)
* clutter_actor_get_height * clutter_actor_get_height
* @self: A #ClutterActor * @self: A #ClutterActor
* *
* Retrieves the actors height. * Retrieves the actors height ignoring any scaling factors.
* *
* Return value: The actor height in pixels * Return value: The actor height in pixels
**/ **/
@ -1599,7 +1601,8 @@ clutter_actor_set_height (ClutterActor *self, guint height)
* *
* Retrieves the actors x position relative to any parent. * Retrieves the actors x position relative to any parent.
* *
* Return value: The actor x position in pixels * Return value: The actor x position in pixels ignoring any tranforms
* (i.e scaling, rotation).
**/ **/
gint gint
clutter_actor_get_x (ClutterActor *self) clutter_actor_get_x (ClutterActor *self)
@ -1619,7 +1622,8 @@ clutter_actor_get_x (ClutterActor *self)
* *
* Retrieves the actors y position relative to any parent. * Retrieves the actors y position relative to any parent.
* *
* Return value: The actor y position in pixels * Return value: The actor y position in pixels ignoring any tranforms
* (i.e scaling, rotation).
**/ **/
gint gint
clutter_actor_get_y (ClutterActor *self) clutter_actor_get_y (ClutterActor *self)
@ -1639,7 +1643,7 @@ clutter_actor_get_y (ClutterActor *self)
* @scale_x: #ClutterFixed factor to scale actor by horizontally. * @scale_x: #ClutterFixed factor to scale actor by horizontally.
* @scale_y: #ClutterFixed factor to scale actor by vertically. * @scale_y: #ClutterFixed factor to scale actor by vertically.
* *
* Scale an actor. * Scales an actor with fixed point parameters.
*/ */
void void
clutter_actor_set_scalex (ClutterActor *self, clutter_actor_set_scalex (ClutterActor *self,
@ -1658,10 +1662,10 @@ clutter_actor_set_scalex (ClutterActor *self,
/** /**
* clutter_actor_set_scale: * clutter_actor_set_scale:
* @self: A #ClutterActor * @self: A #ClutterActor
* @scale_x: double * @scale_x: double factor to scale actor by horizontally.
* @scale_y: double * @scale_y: double factor to scale actor by vertically.
* *
* FIXME * Scales an actor with floating point parameters.
* *
* Since: 0.2 * Since: 0.2
*/ */
@ -1680,10 +1684,10 @@ clutter_actor_set_scale (ClutterActor *self,
/** /**
* clutter_actor_get_scalex: * clutter_actor_get_scalex:
* @self: A #ClutterActor * @self: A #ClutterActor
* @scale_x: FIXME * @scale_x: Location to store horizonal fixed scale factor if non NULL.
* @scale_y: FIXME * @scale_y: Location to store vertical fixed scale factor if non NULL.
* *
* FIXME * Retrieves an actors scale in fixed point.
* *
* Since: 0.2 * Since: 0.2
*/ */
@ -1702,10 +1706,10 @@ clutter_actor_get_scalex (ClutterActor *self,
/** /**
* clutter_actor_get_scale: * clutter_actor_get_scale:
* @self: A #ClutterActor * @self: A #ClutterActor
* @scale_x: FIXME * @scale_x: Location to store horizonal float scale factor if non NULL.
* @scale_y: FIXME * @scale_y: Location to store vertical float scale factor if non NULL.
* *
* FIXME * Retrieves an actors scale in floating point.
* *
* Since: 0.2 * Since: 0.2
*/ */
@ -1735,14 +1739,14 @@ clutter_actor_get_scale (ClutterActor *self,
*/ */
void void
clutter_actor_set_scale_with_gravity (ClutterActor *self, clutter_actor_set_scale_with_gravity (ClutterActor *self,
gfloat scale_x, gfloat scale_x,
gfloat scale_y, gfloat scale_y,
ClutterGravity gravity) ClutterGravity gravity)
{ {
clutter_actor_set_scale_with_gravityx (self, clutter_actor_set_scale_with_gravityx (self,
CLUTTER_FLOAT_TO_FIXED (scale_x), CLUTTER_FLOAT_TO_FIXED (scale_x),
CLUTTER_FLOAT_TO_FIXED (scale_y), CLUTTER_FLOAT_TO_FIXED (scale_y),
gravity); gravity);
} }
/** /**
@ -1927,7 +1931,8 @@ clutter_actor_get_id (ClutterActor *self)
* @self: a #ClutterActor * @self: a #ClutterActor
* @depth: Z co-ord * @depth: Z co-ord
* *
* Sets the Z co-ordinate of @self to @depth. * Sets the Z co-ordinate of @self to @depth. The Units of which are dependant
* on the perspective setup.
*/ */
void void
clutter_actor_set_depth (ClutterActor *self, clutter_actor_set_depth (ClutterActor *self,
@ -1942,7 +1947,7 @@ clutter_actor_set_depth (ClutterActor *self,
/* Sets Z value. - FIXME: should invert ?*/ /* Sets Z value. - FIXME: should invert ?*/
priv->z = depth; priv->z = depth;
if (priv->parent_actor) if (priv->parent_actor && CLUTTER_IS_GROUP (priv->parent_actor))
{ {
/* We need to resort the group stacking order as to /* We need to resort the group stacking order as to
* correctly render alpha values. * correctly render alpha values.
@ -2060,7 +2065,7 @@ clutter_actor_rotate_y (ClutterActor *self,
* @width: Width of the clip rectangle * @width: Width of the clip rectangle
* @height: Height of the clip rectangle * @height: Height of the clip rectangle
* *
* Sets clip area for @self. * Sets clip area in pixels for @self.
*/ */
void void
clutter_actor_set_clip (ClutterActor *self, clutter_actor_set_clip (ClutterActor *self,
@ -2090,7 +2095,7 @@ clutter_actor_set_clip (ClutterActor *self,
* clutter_actor_remove_clip * clutter_actor_remove_clip
* @self: A #ClutterActor * @self: A #ClutterActor
* *
* Removes clip area from @self. * Removes clip area in pixels from @self.
*/ */
void void
clutter_actor_remove_clip (ClutterActor *self) clutter_actor_remove_clip (ClutterActor *self)
@ -2128,7 +2133,8 @@ clutter_actor_has_clip (ClutterActor *self)
* Sets the parent of @self to @parent. The opposite function is * Sets the parent of @self to @parent. The opposite function is
* clutter_actor_unparent(). * clutter_actor_unparent().
* *
* This function should not be used by applications. * This function should not be used by applications but by custom
* 'composite' actor sub classes.
*/ */
void void
clutter_actor_set_parent (ClutterActor *self, clutter_actor_set_parent (ClutterActor *self,
@ -2265,8 +2271,9 @@ clutter_actor_reparent (ClutterActor *self,
g_object_ref (self); g_object_ref (self);
/* XXX: below assumes only containers can reparent */ /* FIXME: below assumes only containers can reparent */
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->parent_actor), self); clutter_container_remove_actor (CLUTTER_CONTAINER (priv->parent_actor),
self);
clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self); clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self);
g_object_unref (self); g_object_unref (self);

View File

@ -112,6 +112,77 @@ enum
static int texture_signals[LAST_SIGNAL] = { 0 }; static int texture_signals[LAST_SIGNAL] = { 0 };
static guchar*
un_pre_multiply_alpha (const guchar *data,
gint width,
gint height,
gint rowstride)
{
gint x,y;
unsigned char *ret, *dst, *src;
ret = dst = g_malloc(sizeof(guchar) * height * rowstride);
/* FIXME: Optimise */
for (y = 0; y < height; y++)
{
src = (guchar*)data + y * rowstride;
for (x = 0; x < width; x++)
{
guchar alpha = src[3];
if (alpha == 0)
{
src[0] = src[1] = src[2] = src[3] = alpha;
}
else
{
dst[0] = (((src[0] >> 16) & 0xff) * 255 ) / alpha;
dst[1] = (((src[1] >> 8) & 0xff) * 255 ) / alpha;
dst[2] = (((src[2] >> 0) & 0xff) * 255 ) / alpha;
dst[3] = alpha;
}
dst += 4;
src += 4;
}
}
return ret;
}
static guchar*
rgb_to_bgr (const guchar *data,
gboolean has_alpha,
gint width,
gint height,
gint rowstride)
{
gint x,y, bpp = 4;
unsigned char *ret, *dst, *src;
ret = dst = g_malloc(sizeof(guchar) * height * rowstride);
if (!has_alpha)
bpp = 3;
/* FIXME: Optimise */
for (y = 0; y < height; y++)
{
src = (guchar*)data + y * rowstride;
for (x = 0; x < width; x++)
{
dst[0] = src[2];
dst[1] = src[1];
dst[2] = src[0];
if (has_alpha)
dst[3] = src[3];
dst += bpp;
src += bpp;
}
}
return ret;
}
static int static int
tile_dimension (int to_fill, tile_dimension (int to_fill,
int start_size, int start_size,
@ -447,11 +518,6 @@ texture_upload_data (ClutterTexture *texture,
src_w = priv->x_tiles[x].size; src_w = priv->x_tiles[x].size;
src_h = priv->y_tiles[y].size; src_h = priv->y_tiles[y].size;
pixtmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
has_alpha,
8,
src_w, src_h);
/* clip */ /* clip */
if (priv->x_tiles[x].pos + src_w > priv->width) if (priv->x_tiles[x].pos + src_w > priv->width)
src_w = priv->width - priv->x_tiles[x].pos; src_w = priv->width - priv->x_tiles[x].pos;
@ -459,6 +525,11 @@ texture_upload_data (ClutterTexture *texture,
if (priv->y_tiles[y].pos + src_h > priv->height) if (priv->y_tiles[y].pos + src_h > priv->height)
src_h = priv->height - priv->y_tiles[y].pos; src_h = priv->height - priv->y_tiles[y].pos;
pixtmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
has_alpha,
8,
src_w, src_h);
gdk_pixbuf_copy_area (master_pixbuf, gdk_pixbuf_copy_area (master_pixbuf,
priv->x_tiles[x].pos, priv->x_tiles[x].pos,
priv->y_tiles[y].pos, priv->y_tiles[y].pos,
@ -466,7 +537,6 @@ texture_upload_data (ClutterTexture *texture,
src_h, src_h,
pixtmp, pixtmp,
0, 0); 0, 0);
#ifdef CLUTTER_DUMP_TILES #ifdef CLUTTER_DUMP_TILES
{ {
gchar *filename; gchar *filename;
@ -543,6 +613,8 @@ clutter_texture_unrealize (ClutterActor *actor)
* GL/ES cant do this - it probably makes sense * GL/ES cant do this - it probably makes sense
* to move this kind of thing into a ClutterProxyTexture * to move this kind of thing into a ClutterProxyTexture
* where this behaviour can be better controlled. * where this behaviour can be better controlled.
*
* Or make it controllable via a property.
*/ */
if (priv->local_pixbuf == NULL) if (priv->local_pixbuf == NULL)
{ {
@ -1009,7 +1081,10 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
if (priv->tiles == NULL) if (priv->tiles == NULL)
return NULL; return NULL;
if (priv->pixel_format == CGL_RGB) if (priv->pixel_format == CGL_YCBCR_MESA)
return NULL; /* FIXME: convert YUV */
if (priv->pixel_format == CGL_RGB || priv->pixel_format == CGL_BGR)
bpp = 3; bpp = 3;
if (!priv->is_tiled) if (!priv->is_tiled)
@ -1019,8 +1094,6 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
if (!pixels) if (!pixels)
return NULL; return NULL;
/* FIXME: cogl */
glBindTexture(priv->target_type, priv->tiles[0]); glBindTexture(priv->target_type, priv->tiles[0]);
glPixelStorei (GL_UNPACK_ROW_LENGTH, priv->width); glPixelStorei (GL_UNPACK_ROW_LENGTH, priv->width);
@ -1030,13 +1103,16 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
/* No such func in gles... */ /* No such func in gles... */
glGetTexImage (priv->target_type, glGetTexImage (priv->target_type,
0, 0,
priv->pixel_format, (priv->pixel_format == CGL_RGBA
priv->pixel_type, || priv->pixel_format == CGL_BGRA) ?
CGL_RGBA : CGL_RGB,
PIXEL_TYPE,
(GLvoid*)pixels); (GLvoid*)pixels);
pixbuf = gdk_pixbuf_new_from_data ((const guchar*)pixels, pixbuf = gdk_pixbuf_new_from_data ((const guchar*)pixels,
GDK_COLORSPACE_RGB, GDK_COLORSPACE_RGB,
(priv->pixel_format == GL_RGBA), (priv->pixel_format == CGL_RGBA
|| priv->pixel_format == CGL_BGRA),
8, 8,
priv->width, priv->width,
priv->height, priv->height,
@ -1051,7 +1127,8 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
i = 0; i = 0;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
(priv->pixel_format == GL_RGBA), (priv->pixel_format == CGL_RGBA
|| priv->pixel_format == CGL_BGRA),
8, 8,
priv->width, priv->width,
priv->height); priv->height);
@ -1074,8 +1151,10 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
glGetTexImage (priv->target_type, glGetTexImage (priv->target_type,
0, 0,
priv->pixel_format, (priv->pixel_format == CGL_RGBA
priv->pixel_type, || priv->pixel_format == CGL_BGRA) ?
CGL_RGBA : CGL_RGB,
PIXEL_TYPE,
(GLvoid *) pixels); (GLvoid *) pixels);
/* Clip */ /* Clip */
@ -1083,12 +1162,13 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
src_w = priv->width - priv->x_tiles[x].pos; src_w = priv->width - priv->x_tiles[x].pos;
if (priv->y_tiles[y].pos + src_h > priv->height) if (priv->y_tiles[y].pos + src_h > priv->height)
src_h = priv->height = priv->y_tiles[y].pos; src_h = priv->height - priv->y_tiles[y].pos;
tmp_pixb = tmp_pixb =
gdk_pixbuf_new_from_data ((const guchar*)pixels, gdk_pixbuf_new_from_data ((const guchar*)pixels,
GDK_COLORSPACE_RGB, GDK_COLORSPACE_RGB,
(priv->pixel_format == GL_RGBA), (priv->pixel_format == CGL_RGBA
|| priv->pixel_format == CGL_BGRA),
8, 8,
src_w, src_w,
src_h, src_h,
@ -1109,7 +1189,7 @@ clutter_texture_get_pixbuf (ClutterTexture* texture)
i++; i++;
} }
} }
return pixbuf; return pixbuf;
@ -1154,6 +1234,7 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
ClutterTexturePrivate *priv; ClutterTexturePrivate *priv;
gboolean texture_dirty = TRUE, size_change = FALSE; gboolean texture_dirty = TRUE, size_change = FALSE;
COGLenum prev_format; COGLenum prev_format;
guchar *copy_data = NULL;
priv = texture->priv; priv = texture->priv;
@ -1173,13 +1254,20 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
if (flags & CLUTTER_TEXTURE_RGB_FLAG_BGR) if (flags & CLUTTER_TEXTURE_RGB_FLAG_BGR)
{ {
/* FIXME: We actually need to convert for GLES */ #if HAVE_COGL_GL
if (has_alpha) if (has_alpha)
priv->pixel_format = CGL_BGRA; priv->pixel_format = CGL_BGRA;
else else
priv->pixel_format = CGL_BGR; priv->pixel_format = CGL_BGR;
#else
/* GLES has no BGR format*/
copy_data = rgb_to_bgr (data, has_alpha, width, height, rowstride);
#endif
} }
if (flags & CLUTTER_TEXTURE_RGB_FLAG_PREMULT)
copy_data = un_pre_multiply_alpha (data, width, height, rowstride);
if (prev_format != priv->pixel_format || priv->pixel_type != PIXEL_TYPE) if (prev_format != priv->pixel_format || priv->pixel_type != PIXEL_TYPE)
texture_dirty = TRUE; texture_dirty = TRUE;
@ -1232,7 +1320,7 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
/* Set Error from this */ /* Set Error from this */
texture_upload_data (texture, texture_upload_data (texture,
data, copy_data != NULL ? copy_data : data,
has_alpha, has_alpha,
width, width,
height, height,
@ -1259,6 +1347,9 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
if (CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR(texture))) if (CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR(texture)))
clutter_actor_queue_redraw (CLUTTER_ACTOR(texture)); clutter_actor_queue_redraw (CLUTTER_ACTOR(texture));
if (copy_data != NULL)
g_free (copy_data);
return TRUE; return TRUE;
} }

View File

@ -94,17 +94,23 @@ frame_cb (ClutterTimeline *timeline,
{ {
gdouble scale_x, scale_y; gdouble scale_x, scale_y;
clutter_actor_get_scale (oh->hand[i], &scale_x, &scale_y); clutter_actor_get_scale (oh->hand[i], &scale_x, &scale_y);
/* Rotate each hand around there centers - to get this we need /* Rotate each hand around there centers - to get this we need
* to take into account any scaling. * to take into account any scaling.
*
* FIXME: scaling causes drift so disabled for now. Need rotation
* unit based functions to fix.
*/ */
clutter_actor_rotate_z clutter_actor_rotate_z
(oh->hand[i], (oh->hand[i],
- 6.0 * frame_num, - 6.0 * frame_num,
#if 0
(clutter_actor_get_width (oh->hand[i]) / 2) * scale_x, (clutter_actor_get_width (oh->hand[i]) / 2) * scale_x,
(clutter_actor_get_height (oh->hand[i]) / 2) * scale_y); (clutter_actor_get_height (oh->hand[i]) / 2) * scale_y
#endif
(clutter_actor_get_width (oh->hand[i]) / 2),
(clutter_actor_get_height (oh->hand[i]) / 2));
} }
} }
@ -203,10 +209,12 @@ main (int argc, char *argv[])
/* Add to our group group */ /* Add to our group group */
clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]); clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);
#if 0 /* FIXME: disabled as causes drift - see comment above */
if (i % 2) if (i % 2)
clutter_behaviour_apply (scaler_1, oh->hand[i]); clutter_behaviour_apply (scaler_1, oh->hand[i]);
else else
clutter_behaviour_apply (scaler_2, oh->hand[i]); clutter_behaviour_apply (scaler_2, oh->hand[i]);
#endif
} }
clutter_actor_show_all (oh->group); clutter_actor_show_all (oh->group);