diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 521d4264ca02c6a783b25123c83aa57bafca08e8..7de72e63303acaa7b14f920e3e2341e6da0aff7c 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -4880,7 +4880,8 @@ clutter_actor_set_scale_factor (ClutterActor *self, g_assert (pspec != NULL); g_assert (scale_p != NULL); - _clutter_actor_create_transition (self, pspec, *scale_p, factor); + if (*scale_p != factor) + _clutter_actor_create_transition (self, pspec, *scale_p, factor); } static inline void @@ -10312,9 +10313,10 @@ clutter_actor_set_position (ClutterActor *self, cur_position.x = clutter_actor_get_x (self); cur_position.y = clutter_actor_get_y (self); - _clutter_actor_create_transition (self, obj_props[PROP_POSITION], - &cur_position, - &new_position); + if (!clutter_point_equals (&cur_position, &new_position)) + _clutter_actor_create_transition (self, obj_props[PROP_POSITION], + &cur_position, + &new_position); } /** diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c index 787fabea2d4002702fb7bd839bd282d4ac6680a0..c0deaebf3a639893fac074fef7660a35448be93e 100644 --- a/clutter/clutter/clutter-paint-volume.c +++ b/clutter/clutter/clutter-paint-volume.c @@ -1164,6 +1164,21 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv, _clutter_paint_volume_get_bounding_box (&projected_pv, box); + if (pv->is_2d && pv->actor && + clutter_actor_get_z_position (pv->actor) == 0) + { + /* If the volume/actor are perfectly 2D, take the bounding box as + * good. We won't need to add any extra room for sub-pixel positioning + * in this case. + */ + clutter_paint_volume_free (&projected_pv); + box->x1 = CLUTTER_NEARBYINT (box->x1); + box->y1 = CLUTTER_NEARBYINT (box->y1); + box->x2 = CLUTTER_NEARBYINT (box->x2); + box->y2 = CLUTTER_NEARBYINT (box->y2); + return; + } + /* The aim here is that for a given rectangle defined with floating point * coordinates we want to determine a stable quantized size in pixels * that doesn't vary due to the original box's sub-pixel position. diff --git a/clutter/tests/conform/actor-anchors.c b/clutter/tests/conform/actor-anchors.c index ee3b6a5e6cf166c2373396d7434a84097f562ea7..55395880b4102618364d5dd0bbd3877d3c91bcc1 100644 --- a/clutter/tests/conform/actor-anchors.c +++ b/clutter/tests/conform/actor-anchors.c @@ -407,8 +407,7 @@ test_scale_center (TestState *state) g_assert (scale_x == 4.0); g_assert (scale_y == 2.0); g_assert (gravity == CLUTTER_GRAVITY_NONE); - assert_notifications (NOTIFY_SCALE_X | NOTIFY_SCALE_Y - | NOTIFY_SCALE_CENTER_X | NOTIFY_SCALE_CENTER_Y + assert_notifications (NOTIFY_SCALE_CENTER_X | NOTIFY_SCALE_CENTER_Y | NOTIFY_SCALE_GRAVITY); assert_coords (state, 100 + 10 - 10 * 4, 200 + 20 - 20 * 2, 100 + 10 + (RECT_WIDTH - 10) * 4, diff --git a/clutter/tests/conform/actor-shader-effect.c b/clutter/tests/conform/actor-shader-effect.c index d3ddd384f0bd8ca08ccc9b26e876258fe1ba8c2d..93a43ea8b940b224a0db5dc63960e811aa4cff7c 100644 --- a/clutter/tests/conform/actor-shader-effect.c +++ b/clutter/tests/conform/actor-shader-effect.c @@ -230,13 +230,13 @@ paint_cb (ClutterStage *stage, gboolean *was_painted = data; /* old shader effect */ - g_assert_cmpint (get_pixel (50, 50), ==, 0xff0000); + g_assert_cmpint (get_pixel (0, 25), ==, 0xff0000); /* new shader effect */ - g_assert_cmpint (get_pixel (150, 50), ==, 0x00ffff); + g_assert_cmpint (get_pixel (100, 25), ==, 0x00ffff); /* another new shader effect */ - g_assert_cmpint (get_pixel (250, 50), ==, 0xff00ff); + g_assert_cmpint (get_pixel (200, 25), ==, 0xff00ff); /* new shader effect */ - g_assert_cmpint (get_pixel (350, 50), ==, 0x00ffff); + g_assert_cmpint (get_pixel (300, 25), ==, 0x00ffff); *was_painted = TRUE; } diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h index d78bd408d451849544f848d86785950c22c25d9f..46a1d146d3b31d304f70cfc322f03d4f8a937da2 100644 --- a/cogl/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl/cogl-framebuffer-private.h @@ -192,6 +192,11 @@ struct _CoglFramebuffer CoglFramebufferBits bits; int samples_per_pixel; + + /* Whether the depth buffer was enabled for this framebuffer, + * usually means it needs to be cleared before being reused next. + */ + CoglBool depth_buffer_clear_needed; }; typedef enum { diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index f2df9c229a8a95724b0a790c4d6f597c1090adc6..8660f910afb5bbbf5e69facef0bb0a82b25ec483 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -116,6 +116,7 @@ _cogl_framebuffer_init (CoglFramebuffer *framebuffer, framebuffer->viewport_age_for_scissor_workaround = -1; framebuffer->dither_enabled = TRUE; framebuffer->depth_writing_enabled = TRUE; + framebuffer->depth_buffer_clear_needed = TRUE; framebuffer->modelview_stack = cogl_matrix_stack_new (ctx); framebuffer->projection_stack = cogl_matrix_stack_new (ctx); @@ -267,6 +268,13 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer, int scissor_y1; CoglBool saved_viewport_scissor_workaround; + if (!framebuffer->depth_buffer_clear_needed && + (buffers & COGL_BUFFER_BIT_DEPTH)) + buffers &= ~(COGL_BUFFER_BIT_DEPTH); + + if (buffers == 0) + return; + _cogl_clip_stack_get_bounds (clip_stack, &scissor_x0, &scissor_y0, &scissor_x1, &scissor_y1); @@ -414,6 +422,9 @@ cleared: _cogl_framebuffer_mark_mid_scene (framebuffer); _cogl_framebuffer_mark_clear_clip_dirty (framebuffer); + if (buffers & COGL_BUFFER_BIT_DEPTH) + framebuffer->depth_buffer_clear_needed = FALSE; + if (buffers & COGL_BUFFER_BIT_COLOR && buffers & COGL_BUFFER_BIT_DEPTH) { /* For our fast-path for reading back a single pixel of simple diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c index 0e8f7c698852d906d91248aa02807a4a621bec17..1de4b65eb6cd695c354cdf37ffda6886889d2974 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c @@ -378,7 +378,11 @@ flush_depth_state (CoglContext *ctx, if (ctx->depth_test_enabled_cache != depth_state->test_enabled) { if (depth_state->test_enabled == TRUE) - GE (ctx, glEnable (GL_DEPTH_TEST)); + { + GE (ctx, glEnable (GL_DEPTH_TEST)); + if (ctx->current_draw_buffer) + ctx->current_draw_buffer->depth_buffer_clear_needed = TRUE; + } else GE (ctx, glDisable (GL_DEPTH_TEST)); ctx->depth_test_enabled_cache = depth_state->test_enabled; diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c index ab358dd6d65e38d01d9f830bdc0d603f1e76fb4f..ed3cc1795387f71ee5a4fdd6cb0e2befa05a7890 100644 --- a/src/compositor/meta-shadow-factory.c +++ b/src/compositor/meta-shadow-factory.c @@ -221,9 +221,7 @@ meta_shadow_paint (MetaShadow *shadow, int dest_x[4]; int dest_y[4]; int n_x, n_y; - - cogl_pipeline_set_color4ub (shadow->pipeline, - opacity, opacity, opacity, opacity); + gboolean source_updated = FALSE; if (shadow->scale_width) { @@ -299,6 +297,17 @@ meta_shadow_paint (MetaShadow *shadow, else overlap = CAIRO_REGION_OVERLAP_IN; + if (overlap == CAIRO_REGION_OVERLAP_OUT) + continue; + + if (!source_updated) + { + cogl_pipeline_set_color4ub (shadow->pipeline, + opacity, opacity, opacity, opacity); + cogl_set_source (shadow->pipeline); + source_updated = TRUE; + } + /* There's quite a bit of overhead from allocating a new * region in order to find an exact intersection and * generating more geometry - we make the assumption that