@ -483,12 +483,12 @@ weston_surface_create(struct weston_compositor *compositor)
surface - > buffer_viewport . transform = WL_OUTPUT_TRANSFORM_NORMAL ;
surface - > buffer_viewport . transform = WL_OUTPUT_TRANSFORM_NORMAL ;
surface - > buffer_viewport . scale = 1 ;
surface - > buffer_viewport . scale = 1 ;
surface - > buffer_viewport . scaler _set = 0 ;
surface - > buffer_viewport . viewport _set = 0 ;
surface - > pending . buffer_viewport = surface - > buffer_viewport ;
surface - > pending . buffer_viewport = surface - > buffer_viewport ;
surface - > output = NULL ;
surface - > output = NULL ;
surface - > pending . newly_attached = 0 ;
surface - > pending . newly_attached = 0 ;
surface - > surface_scaler _resource = NULL ;
surface - > viewport _resource = NULL ;
pixman_region32_init ( & surface - > damage ) ;
pixman_region32_init ( & surface - > damage ) ;
pixman_region32_init ( & surface - > opaque ) ;
pixman_region32_init ( & surface - > opaque ) ;
@ -720,7 +720,7 @@ static void
scaler_surface_to_buffer ( struct weston_surface * surface ,
scaler_surface_to_buffer ( struct weston_surface * surface ,
float sx , float sy , float * bx , float * by )
float sx , float sy , float * bx , float * by )
{
{
if ( surface - > buffer_viewport . scaler _set) {
if ( surface - > buffer_viewport . viewport _set) {
double a , b ;
double a , b ;
a = sx / surface - > buffer_viewport . dst_width ;
a = sx / surface - > buffer_viewport . dst_width ;
@ -1295,7 +1295,7 @@ weston_surface_set_size_from_buffer(struct weston_surface *surface)
return ;
return ;
}
}
if ( surface - > buffer_viewport . scaler _set) {
if ( surface - > buffer_viewport . viewport _set) {
surface - > width = surface - > buffer_viewport . dst_width ;
surface - > width = surface - > buffer_viewport . dst_width ;
surface - > height = surface - > buffer_viewport . dst_height ;
surface - > height = surface - > buffer_viewport . dst_height ;
return ;
return ;
@ -2103,7 +2103,7 @@ weston_surface_commit(struct weston_surface *surface)
/* wl_surface.set_buffer_transform */
/* wl_surface.set_buffer_transform */
/* wl_surface.set_buffer_scale */
/* wl_surface.set_buffer_scale */
/* wl_surface_scaler .set */
/* wl_viewport .set */
surface - > buffer_viewport = surface - > pending . buffer_viewport ;
surface - > buffer_viewport = surface - > pending . buffer_viewport ;
/* wl_surface.attach */
/* wl_surface.attach */
@ -2329,7 +2329,7 @@ weston_subsurface_commit_from_cache(struct weston_subsurface *sub)
/* wl_surface.set_buffer_transform */
/* wl_surface.set_buffer_transform */
/* wl_surface.set_buffer_scale */
/* wl_surface.set_buffer_scale */
/* wl_surface_scaler .set */
/* wl_viewport .set */
surface - > buffer_viewport = sub - > cached . buffer_viewport ;
surface - > buffer_viewport = sub - > cached . buffer_viewport ;
/* wl_surface.attach */
/* wl_surface.attach */
@ -3454,41 +3454,41 @@ weston_output_transform_coordinate(struct weston_output *output,
}
}
static void
static void
destroy_surface_scaler ( struct wl_resource * resource )
destroy_viewport ( struct wl_resource * resource )
{
{
struct weston_surface * surface =
struct weston_surface * surface =
wl_resource_get_user_data ( resource ) ;
wl_resource_get_user_data ( resource ) ;
surface - > surface_scaler _resource = NULL ;
surface - > viewport _resource = NULL ;
surface - > pending . buffer_viewport . scaler _set = 0 ;
surface - > pending . buffer_viewport . viewport _set = 0 ;
}
}
static void
static void
surface_scaler _destroy( struct wl_client * client ,
viewport _destroy( struct wl_client * client ,
struct wl_resource * resource )
struct wl_resource * resource )
{
{
wl_resource_destroy ( resource ) ;
wl_resource_destroy ( resource ) ;
}
}
static void
static void
surface_scaler _set( struct wl_client * client ,
viewport _set( struct wl_client * client ,
struct wl_resource * resource ,
struct wl_resource * resource ,
wl_fixed_t src_x ,
wl_fixed_t src_x ,
wl_fixed_t src_y ,
wl_fixed_t src_y ,
wl_fixed_t src_width ,
wl_fixed_t src_width ,
wl_fixed_t src_height ,
wl_fixed_t src_height ,
int32_t dst_width ,
int32_t dst_width ,
int32_t dst_height )
int32_t dst_height )
{
{
struct weston_surface * surface =
struct weston_surface * surface =
wl_resource_get_user_data ( resource ) ;
wl_resource_get_user_data ( resource ) ;
assert ( surface - > surface_scaler _resource ! = NULL ) ;
assert ( surface - > viewport _resource ! = NULL ) ;
if ( wl_fixed_to_double ( src_width ) < 0 | |
if ( wl_fixed_to_double ( src_width ) < 0 | |
wl_fixed_to_double ( src_height ) < 0 ) {
wl_fixed_to_double ( src_height ) < 0 ) {
wl_resource_post_error ( resource ,
wl_resource_post_error ( resource ,
WL_SURFACE_SCALER _ERROR_BAD_VALUE ,
WL_VIEWPORT _ERROR_BAD_VALUE ,
" source dimensions must be non-negative (%fx%f) " ,
" source dimensions must be non-negative (%fx%f) " ,
wl_fixed_to_double ( src_width ) ,
wl_fixed_to_double ( src_width ) ,
wl_fixed_to_double ( src_height ) ) ;
wl_fixed_to_double ( src_height ) ) ;
@ -3497,13 +3497,13 @@ surface_scaler_set(struct wl_client *client,
if ( dst_width < = 0 | | dst_height < = 0 ) {
if ( dst_width < = 0 | | dst_height < = 0 ) {
wl_resource_post_error ( resource ,
wl_resource_post_error ( resource ,
WL_SURFACE_SCALER _ERROR_BAD_VALUE ,
WL_VIEWPORT _ERROR_BAD_VALUE ,
" destination dimensions must be positive (%dx%d) " ,
" destination dimensions must be positive (%dx%d) " ,
dst_width , dst_height ) ;
dst_width , dst_height ) ;
return ;
return ;
}
}
surface - > pending . buffer_viewport . scaler _set = 1 ;
surface - > pending . buffer_viewport . viewport _set = 1 ;
surface - > pending . buffer_viewport . src_x = src_x ;
surface - > pending . buffer_viewport . src_x = src_x ;
surface - > pending . buffer_viewport . src_y = src_y ;
surface - > pending . buffer_viewport . src_y = src_y ;
@ -3513,9 +3513,9 @@ surface_scaler_set(struct wl_client *client,
surface - > pending . buffer_viewport . dst_height = dst_height ;
surface - > pending . buffer_viewport . dst_height = dst_height ;
}
}
static const struct wl_surface_scaler_interface surface_scaler _interface = {
static const struct wl_viewport_interface viewport _interface = {
surface_scaler _destroy,
viewport _destroy,
surface_scaler _set
viewport _set
} ;
} ;
static void
static void
@ -3526,37 +3526,37 @@ scaler_destroy(struct wl_client *client,
}
}
static void
static void
scaler_get_surface_scaler ( struct wl_client * client ,
scaler_get_viewport ( struct wl_client * client ,
struct wl_resource * scaler ,
struct wl_resource * scaler ,
uint32_t id ,
uint32_t id ,
struct wl_resource * surface_resource )
struct wl_resource * surface_resource )
{
{
struct weston_surface * surface = wl_resource_get_user_data ( surface_resource ) ;
struct weston_surface * surface = wl_resource_get_user_data ( surface_resource ) ;
struct wl_resource * resource ;
struct wl_resource * resource ;
if ( surface - > surface_scaler _resource) {
if ( surface - > viewport _resource) {
wl_resource_post_error ( scaler ,
wl_resource_post_error ( scaler ,
WL_SCALER_ERROR_SCALER _EXISTS ,
WL_SCALER_ERROR_VIEWPORT _EXISTS ,
" a surface scaler for that surface already exists " ) ;
" a viewport for that surface already exists " ) ;
return ;
return ;
}
}
resource = wl_resource_create ( client , & wl_surface_scaler _interface ,
resource = wl_resource_create ( client , & wl_viewport _interface ,
1 , id ) ;
1 , id ) ;
if ( resource = = NULL ) {
if ( resource = = NULL ) {
wl_client_post_no_memory ( client ) ;
wl_client_post_no_memory ( client ) ;
return ;
return ;
}
}
wl_resource_set_implementation ( resource , & surface_scaler _interface,
wl_resource_set_implementation ( resource , & viewport _interface,
surface , destroy_surface_scaler ) ;
surface , destroy_viewport ) ;
surface - > surface_scaler _resource = resource ;
surface - > viewport _resource = resource ;
}
}
static const struct wl_scaler_interface scaler_interface = {
static const struct wl_scaler_interface scaler_interface = {
scaler_destroy ,
scaler_destroy ,
scaler_get_surface_scaler
scaler_get_viewport
} ;
} ;
static void
static void