diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index f7f29836e..19f9cd57f 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -449,6 +449,8 @@ cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, float width, float height) { + CoglContext *context = framebuffer->context; + _COGL_RETURN_IF_FAIL (width > 0 && height > 0); if (framebuffer->viewport_x == x && @@ -465,9 +467,13 @@ cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, framebuffer->viewport_height = height; framebuffer->viewport_age++; - if (framebuffer->context->current_draw_buffer == framebuffer) - framebuffer->context->current_draw_buffer_changes |= - COGL_FRAMEBUFFER_STATE_VIEWPORT; + if (context->current_draw_buffer == framebuffer) + { + context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_VIEWPORT; + + if (context->needs_viewport_scissor_workaround) + context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + } } float diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c index 4aaa5de4e..3c1e148de 100644 --- a/cogl/cogl-onscreen.c +++ b/cogl/cogl-onscreen.c @@ -387,17 +387,7 @@ _cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer, framebuffer->width = width; framebuffer->height = height; - framebuffer->viewport_x = 0; - framebuffer->viewport_y = 0; - framebuffer->viewport_width = width; - framebuffer->viewport_height = height; - - /* If the framebuffer being updated is the current framebuffer we - * mark the viewport state as changed so it will be updated the next - * time _cogl_framebuffer_flush_state() is called. */ - if (framebuffer->context->current_draw_buffer == framebuffer) - framebuffer->context->current_draw_buffer_changes |= - COGL_FRAMEBUFFER_STATE_VIEWPORT; + cogl_framebuffer_set_viewport (framebuffer, 0, 0, width, height); } void