diff --git a/ChangeLog b/ChangeLog index f71424c1d..06b3f940a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-02-03 Matthew Allum + + * clutter/clutter-actor.c: (clutter_actor_set_rotationx): + Add notify signal for set_rotate + + * clutter/clutter-texture.c: + Add basic cleanup code for fbo's + + * tests/test-fbo.c: (main): + Minor notes. + + * clutter/osx/clutter-stage-osx.c: (clutter_stage_osx_realize): + Turn on vblanking. + 2008-02-03 Matthew Allum * clutter/clutter-shader.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index f3cbe98ee..103b4a86f 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -3256,27 +3256,38 @@ clutter_actor_set_rotationx (ClutterActor *self, priv = self->priv; + g_object_ref (self); + g_object_freeze_notify (G_OBJECT (self)); + switch (axis) { case CLUTTER_X_AXIS: priv->rxang = angle; priv->rxy = CLUTTER_UNITS_FROM_DEVICE (y); priv->rxz = CLUTTER_UNITS_FROM_DEVICE (z); + g_object_notify (G_OBJECT (self), "rotation-angle-x"); + g_object_notify (G_OBJECT (self), "rotation-center-x"); break; case CLUTTER_Y_AXIS: priv->ryang = angle; priv->ryx = CLUTTER_UNITS_FROM_DEVICE (x); priv->ryz = CLUTTER_UNITS_FROM_DEVICE (z); + g_object_notify (G_OBJECT (self), "rotation-angle-y"); + g_object_notify (G_OBJECT (self), "rotation-center-y"); break; - case CLUTTER_Z_AXIS: priv->rzang = angle; priv->rzx = CLUTTER_UNITS_FROM_DEVICE (x); priv->rzy = CLUTTER_UNITS_FROM_DEVICE (y); + g_object_notify (G_OBJECT (self), "rotation-angle-z"); + g_object_notify (G_OBJECT (self), "rotation-center-z"); break; } + g_object_thaw_notify (G_OBJECT (self)); + g_object_unref (self); + if (CLUTTER_ACTOR_IS_VISIBLE (self)) clutter_actor_queue_redraw (self); } diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 949561ed1..0e522a570 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -124,6 +124,9 @@ enum static int texture_signals[LAST_SIGNAL] = { 0 }; +static void +texture_fbo_free_resources (ClutterTexture *texture); + GQuark clutter_texture_error_quark (void) { @@ -830,6 +833,7 @@ clutter_texture_dispose (GObject *object) priv = texture->priv; texture_free_gl_resources (texture); + texture_fbo_free_resources (texture); if (priv->local_pixbuf != NULL) { @@ -2075,7 +2079,8 @@ clutter_texture_set_area_from_rgb_data (ClutterTexture *texture, priv = texture->priv; - if (!texture_prepare_upload (FALSE, texture, data, has_alpha, width, height, rowstride, + if (!texture_prepare_upload (FALSE, texture, data, has_alpha, + width, height, rowstride, bpp, flags, ©_data, NULL, NULL)) { return FALSE; @@ -2125,16 +2130,16 @@ clutter_texture_new_from_actor (ClutterActor *actor) ClutterTexturePrivate *priv; guint w, h; - /* TODO (before 0.6 release): * * - Figure out getting source actor size correctly. - * - Figure out refing/reparenting source actor. * - Handle source actor resizing. * - Handle failure better. * - Handle cleanup on destruction. * - Beef up test-fbo. - * - Have the source actor as a prop? + * - Have the source actor as a prop, realize/unrealize ? + * - Avoid infinite loop in shaders + * - Fix shader rendering order */ g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL); @@ -2163,9 +2168,9 @@ clutter_texture_new_from_actor (ClutterActor *actor) if (w == 0 || h == 0) return NULL; - if (!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB, - CGL_RGBA, PIXEL_TYPE, w, h)) - return NULL; + if (!cogl_texture_can_size (CGL_TEXTURE_RECTANGLE_ARB, + CGL_RGBA, PIXEL_TYPE, w, h)) + return NULL; texture = g_object_new (CLUTTER_TYPE_TEXTURE, NULL); @@ -2201,3 +2206,26 @@ clutter_texture_new_from_actor (ClutterActor *actor) return CLUTTER_ACTOR(texture); } + +static void +texture_fbo_free_resources (ClutterTexture *texture) +{ + ClutterTexturePrivate *priv; + + priv = texture->priv; + + CLUTTER_MARK(); + + if (priv->fbo_source != NULL) + { + g_object_unref (priv->fbo_source); + priv->fbo_source = NULL; + } + + if (priv->fbo_handle != 0) + { + cogl_offscreen_destroy (priv->fbo_handle); + priv->fbo_handle = 0; + } +} + diff --git a/clutter/osx/clutter-stage-osx.c b/clutter/osx/clutter-stage-osx.c index 096acbbe6..31074c0d2 100644 --- a/clutter/osx/clutter-stage-osx.c +++ b/clutter/osx/clutter-stage-osx.c @@ -118,10 +118,16 @@ clutter_stage_osx_state_update (ClutterStageOSX *self, @implementation ClutterGLView - (id) initWithFrame: (NSRect)aFrame pixelFormat:(NSOpenGLPixelFormat*)aFormat stage:(ClutterActor*)aStage { + int sw = 1; + if ((self = [super initWithFrame:aFrame pixelFormat:aFormat]) != nil) { self->stage = aStage; } + + /* Enable vblank sync - http://developer.apple.com/qa/qa2007/qa1521.html*/ + [[self openGLContext] setValues:&sw forParameter: NSOpenGLCPSwapInterval]; + return self; } @@ -289,6 +295,7 @@ clutter_stage_osx_realize (ClutterActor *actor) [self->view setOpenGLContext: context]; [context setView: self->view]; + CLUTTER_OSX_POOL_RELEASE(); CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_SYNC_MATRICES); diff --git a/tests/test-fbo.c b/tests/test-fbo.c index 1a06ec21b..f6a1cd9c0 100644 --- a/tests/test-fbo.c +++ b/tests/test-fbo.c @@ -169,6 +169,11 @@ main (gint argc, clutter_actor_set_position (fbo, padx*3, pady); clutter_group_add (stage, fbo); + /* TODO: + * Check realize/unrealize + * get_pixbuf() + * set_rgba on fbo texture. + */ clutter_actor_show_all (stage); clutter_main ();