From: Taekyun Kim Date: Tue, 22 Sep 2015 02:25:33 +0000 (+0900) Subject: pepper: Update surface size when attached buffer is destroyed X-Git-Tag: accepted/tizen/mobile/20151221.050925~34^2~124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2e8018d99c9467d198c1495b9c6588191edbf1b;p=platform%2Fcore%2Fuifw%2Fpepper.git pepper: Update surface size when attached buffer is destroyed Change-Id: I7b7040eeef8c1b0be9d9a45b70927e6eeaf3cd67 --- diff --git a/src/lib/pepper/surface.c b/src/lib/pepper/surface.c index 3c33f2c..b925de7 100644 --- a/src/lib/pepper/surface.c +++ b/src/lib/pepper/surface.c @@ -1,6 +1,39 @@ #include "pepper-internal.h" static void +surface_update_size(pepper_surface_t *surface) +{ + if (surface->buffer.buffer) + { + switch (surface->buffer.transform) + { + case WL_OUTPUT_TRANSFORM_NORMAL: + case WL_OUTPUT_TRANSFORM_180: + case WL_OUTPUT_TRANSFORM_FLIPPED: + case WL_OUTPUT_TRANSFORM_FLIPPED_180: + surface->w = surface->buffer.buffer->w; + surface->h = surface->buffer.buffer->h; + break; + case WL_OUTPUT_TRANSFORM_90: + case WL_OUTPUT_TRANSFORM_270: + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + surface->w = surface->buffer.buffer->h; + surface->h = surface->buffer.buffer->w; + break; + } + + surface->w /= surface->buffer.scale; + surface->h /= surface->buffer.scale; + } + else + { + surface->w = 0; + surface->h = 0; + } +} + +static void surface_state_handle_buffer_destroy(pepper_event_listener_t *listener, pepper_object_t *object, uint32_t id, void *info, void *data) { @@ -14,6 +47,7 @@ surface_handle_buffer_destroy(pepper_event_listener_t *listener, { pepper_surface_t *surface = data; surface->buffer.buffer = NULL; + surface_update_size(surface); } static void @@ -309,37 +343,6 @@ pepper_surface_destroy(pepper_surface_t *surface) } static void -surface_update_size(pepper_surface_t *surface) -{ - surface->w = 0; - surface->h = 0; - - if (surface->buffer.buffer) - { - switch (surface->buffer.transform) - { - case WL_OUTPUT_TRANSFORM_NORMAL: - case WL_OUTPUT_TRANSFORM_180: - case WL_OUTPUT_TRANSFORM_FLIPPED: - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - surface->w = surface->buffer.buffer->w; - surface->h = surface->buffer.buffer->h; - break; - case WL_OUTPUT_TRANSFORM_90: - case WL_OUTPUT_TRANSFORM_270: - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - surface->w = surface->buffer.buffer->h; - surface->h = surface->buffer.buffer->w; - break; - } - - surface->w /= surface->buffer.scale; - surface->h /= surface->buffer.scale; - } -} - -static void attach_surface_to_outputs(pepper_surface_t *surface) { pepper_output_t *output;