cogl: Replace deprecated Cogl API

This commit is contained in:
Emmanuele Bassi 2013-07-03 18:35:55 +01:00
parent 5a061ed4a3
commit 6dd9da05c7

View File

@ -395,6 +395,7 @@ static void
clutter_stage_cogl_redraw (ClutterStageWindow *stage_window) clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
{ {
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
ClutterBackend *backend = clutter_get_default_backend ();
gboolean may_use_clipped_redraw; gboolean may_use_clipped_redraw;
gboolean use_clipped_redraw; gboolean use_clipped_redraw;
gboolean can_blit_sub_buffer; gboolean can_blit_sub_buffer;
@ -419,17 +420,18 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
"The time spent in blit_sub_buffer", "The time spent in blit_sub_buffer",
0 /* no application private data */); 0 /* no application private data */);
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
if (!stage_cogl->onscreen) if (!stage_cogl->onscreen)
return; return;
CLUTTER_TIMER_START (_clutter_uprof_context, painting_timer); CLUTTER_TIMER_START (_clutter_uprof_context, painting_timer);
can_blit_sub_buffer = wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION);
has_buffer_age = cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); can_blit_sub_buffer = cogl_has_feature (backend->cogl_context,
COGL_WINSYS_FEATURE_SWAP_REGION);
has_buffer_age = cogl_has_feature (backend->cogl_context,
COGL_WINSYS_FEATURE_BUFFER_AGE);
may_use_clipped_redraw = FALSE; may_use_clipped_redraw = FALSE;
if (_clutter_stage_window_can_clip_redraws (stage_window) && if (_clutter_stage_window_can_clip_redraws (stage_window) &&
@ -513,6 +515,8 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
if (use_clipped_redraw) if (use_clipped_redraw)
{ {
CoglFramebuffer *fb = COGL_FRAMEBUFFER (stage_cogl->onscreen);
CLUTTER_NOTE (CLIPPING, CLUTTER_NOTE (CLIPPING,
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n", "Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
clip_region->x, clip_region->x,
@ -522,13 +526,14 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
stage_cogl->using_clipped_redraw = TRUE; stage_cogl->using_clipped_redraw = TRUE;
cogl_clip_push_window_rectangle (clip_region->x, cogl_framebuffer_push_scissor_clip (fb,
clip_region->y, clip_region->x,
clip_region->width, clip_region->y,
clip_region->height); clip_region->width,
_clutter_stage_do_paint (CLUTTER_STAGE (wrapper), clip_region->height);
clip_region); _clutter_stage_do_paint (CLUTTER_STAGE (wrapper), clip_region);
cogl_clip_pop ();
cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE; stage_cogl->using_clipped_redraw = FALSE;
} }
@ -673,20 +678,23 @@ static void
clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window, clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
int *x, int *y) int *x, int *y)
{ {
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
gboolean has_buffer_age = cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); ClutterBackend *backend = clutter_get_default_backend ();
if ((stage_cogl->damage_history == NULL && has_buffer_age) || !has_buffer_age) gboolean has_buffer_age;
{
*x = 0; has_buffer_age = cogl_has_feature (backend->cogl_context, COGL_WINSYS_FEATURE_BUFFER_AGE);
*y = 0; if ((stage_cogl->damage_history == NULL && has_buffer_age) || !has_buffer_age)
} {
else *x = 0;
{ *y = 0;
cairo_rectangle_int_t *rect; }
rect = (cairo_rectangle_int_t *) (stage_cogl->damage_history->data); else
*x = rect->x; {
*y = rect->y; cairo_rectangle_int_t *rect;
} rect = (cairo_rectangle_int_t *) (stage_cogl->damage_history->data);
*x = rect->x;
*y = rect->y;
}
} }
static void static void