From 680cd23b4346999dd3d1bc2df7dc00c450fc082e Mon Sep 17 00:00:00 2001 From: Matthew Allum Date: Sun, 3 Feb 2008 23:25:12 +0000 Subject: [PATCH] 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. --- ChangeLog | 14 ++++++++++++++ clutter/clutter-actor.c | 13 ++++++++++++- clutter/clutter-texture.c | 42 ++++++++++++++++++++++++++++++++++------- clutter/osx/clutter-stage-osx.c | 7 +++++++ tests/test-fbo.c | 5 +++++ 5 files changed, 73 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f71424c..06b3f94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 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: Minor formatting cleanups to fit in 80 cols. diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index f3cbe98..103b4a8 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 949561e..0e522a5 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 096acbb..31074c0 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 1a06ec2..f6a1cd9 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 (); -- 2.7.4