diff --git a/cogl/cogl/cogl-scanout.c b/cogl/cogl/cogl-scanout.c index 94f5d5df7..5f30ce7af 100644 --- a/cogl/cogl/cogl-scanout.c +++ b/cogl/cogl/cogl-scanout.c @@ -48,7 +48,6 @@ struct _CoglScanout gboolean has_src_rect; graphene_rect_t src_rect; - gboolean has_dst_rect; MtkRectangle dst_rect; }; @@ -104,11 +103,16 @@ cogl_scanout_notify_failed (CoglScanout *scanout, } CoglScanout * -cogl_scanout_new (CoglScanoutBuffer *scanout_buffer) +cogl_scanout_new (CoglScanoutBuffer *scanout_buffer, + const MtkRectangle *dst_rect) { - CoglScanout *scanout = g_object_new (COGL_TYPE_SCANOUT, NULL); + CoglScanout *scanout; + g_return_val_if_fail (dst_rect, NULL); + + scanout = g_object_new (COGL_TYPE_SCANOUT, NULL); scanout->scanout_buffer = scanout_buffer; + scanout->dst_rect = *dst_rect; return scanout; } @@ -141,28 +145,9 @@ cogl_scanout_set_src_rect (CoglScanout *scanout, void cogl_scanout_get_dst_rect (CoglScanout *scanout, - MtkRectangle *rect) + MtkRectangle *dst_rect) { - if (scanout->has_dst_rect) - { - *rect = scanout->dst_rect; - return; - } - - rect->x = 0; - rect->y = 0; - rect->width = cogl_scanout_buffer_get_width (scanout->scanout_buffer); - rect->height = cogl_scanout_buffer_get_height (scanout->scanout_buffer); -} - -void -cogl_scanout_set_dst_rect (CoglScanout *scanout, - const MtkRectangle *rect) -{ - if (rect != NULL) - scanout->dst_rect = *rect; - - scanout->has_dst_rect = rect != NULL; + *dst_rect = scanout->dst_rect; } static void diff --git a/cogl/cogl/cogl-scanout.h b/cogl/cogl/cogl-scanout.h index a62a7d706..162e54cbb 100644 --- a/cogl/cogl/cogl-scanout.h +++ b/cogl/cogl/cogl-scanout.h @@ -81,7 +81,8 @@ void cogl_scanout_notify_failed (CoglScanout *scanout, CoglOnscreen *onscreen); COGL_EXPORT -CoglScanout * cogl_scanout_new (CoglScanoutBuffer *scanout_buffer); +CoglScanout * cogl_scanout_new (CoglScanoutBuffer *scanout_buffer, + const MtkRectangle *dst_rect); COGL_EXPORT void cogl_scanout_get_src_rect (CoglScanout *scanout, @@ -93,8 +94,4 @@ void cogl_scanout_set_src_rect (CoglScanout *scanout, COGL_EXPORT void cogl_scanout_get_dst_rect (CoglScanout *scanout, - MtkRectangle *rect); - -COGL_EXPORT -void cogl_scanout_set_dst_rect (CoglScanout *scanout, - const MtkRectangle *rect); + MtkRectangle *dst_rect); diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index 613a48d6f..58ef630d1 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -924,9 +924,9 @@ try_acquire_egl_image_scanout (MetaWaylandBuffer *buffer, return NULL; } - scanout = cogl_scanout_new (COGL_SCANOUT_BUFFER (g_steal_pointer (&fb))); + scanout = cogl_scanout_new (COGL_SCANOUT_BUFFER (g_steal_pointer (&fb)), + dst_rect); cogl_scanout_set_src_rect (scanout, src_rect); - cogl_scanout_set_dst_rect (scanout, dst_rect); if (!meta_onscreen_native_is_buffer_scanout_compatible (onscreen, scanout)) return NULL; diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index 8a2b0ec66..53a6ca8ca 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -666,9 +666,9 @@ meta_wayland_dma_buf_try_acquire_scanout (MetaWaylandBuffer *buffer, return NULL; } - scanout = cogl_scanout_new (COGL_SCANOUT_BUFFER (g_steal_pointer (&fb))); + scanout = cogl_scanout_new (COGL_SCANOUT_BUFFER (g_steal_pointer (&fb)), + dst_rect); cogl_scanout_set_src_rect (scanout, src_rect); - cogl_scanout_set_dst_rect (scanout, dst_rect); if (!meta_onscreen_native_is_buffer_scanout_compatible (onscreen, scanout)) { diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 463dace7a..734044543 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -2409,7 +2409,6 @@ meta_wayland_surface_try_acquire_scanout (MetaWaylandSurface *surface, MetaSurfaceActor *surface_actor; MtkMonitorTransform view_transform; ClutterActorBox actor_box; - MtkRectangle *crtc_dst_rect_ptr = NULL; MtkRectangle crtc_dst_rect; graphene_rect_t *src_rect_ptr = NULL; graphene_rect_t src_rect; @@ -2465,13 +2464,6 @@ meta_wayland_surface_try_acquire_scanout (MetaWaylandSurface *surface, view_crtc_height, &crtc_dst_rect); - /* Use an implicit destination rect when possible */ - if (surface->viewport.has_dst_size || - crtc_dst_rect.x != 0 || crtc_dst_rect.y != 0 || - crtc_dst_rect.width != view_crtc_width || - crtc_dst_rect.height != view_crtc_height) - crtc_dst_rect_ptr = &crtc_dst_rect; - if (surface->viewport.has_src_rect) { src_rect = surface->viewport.src_rect; @@ -2481,7 +2473,7 @@ meta_wayland_surface_try_acquire_scanout (MetaWaylandSurface *surface, return meta_wayland_buffer_try_acquire_scanout (surface->buffer, onscreen, src_rect_ptr, - crtc_dst_rect_ptr); + &crtc_dst_rect); } MetaCrtc *