mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland: Use surface size helper functions
Use meta_wayland_surface_get_width / meta_wayland_surface_get_width to determine the size of a surface.
This commit is contained in:
parent
ad864083f9
commit
db22c13c4f
@ -42,21 +42,12 @@ meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_su
|
|||||||
META_WAYLAND_SURFACE_ROLE (shell_surface);
|
META_WAYLAND_SURFACE_ROLE (shell_surface);
|
||||||
MetaWaylandSurface *surface =
|
MetaWaylandSurface *surface =
|
||||||
meta_wayland_surface_role_get_surface (surface_role);
|
meta_wayland_surface_role_get_surface (surface_role);
|
||||||
MetaWaylandBuffer *buffer;
|
|
||||||
CoglTexture *texture;
|
|
||||||
MetaRectangle geometry;
|
MetaRectangle geometry;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
buffer = surface->buffer_ref.buffer;
|
|
||||||
if (!buffer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
texture = meta_wayland_buffer_get_texture (buffer);
|
|
||||||
geometry = (MetaRectangle) {
|
geometry = (MetaRectangle) {
|
||||||
.x = 0,
|
.width = meta_wayland_surface_get_width (surface),
|
||||||
.y = 0,
|
.height = meta_wayland_surface_get_height (surface),
|
||||||
.width = cogl_texture_get_width (texture) / surface->scale,
|
|
||||||
.height = cogl_texture_get_height (texture) / surface->scale,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (l = surface->subsurfaces; l; l = l->next)
|
for (l = surface->subsurfaces; l; l = l->next)
|
||||||
|
@ -152,21 +152,14 @@ meta_wayland_subsurface_union_geometry (MetaWaylandSubsurface *subsurface,
|
|||||||
MetaWaylandSurfaceRole *surface_role = META_WAYLAND_SURFACE_ROLE (subsurface);
|
MetaWaylandSurfaceRole *surface_role = META_WAYLAND_SURFACE_ROLE (subsurface);
|
||||||
MetaWaylandSurface *surface =
|
MetaWaylandSurface *surface =
|
||||||
meta_wayland_surface_role_get_surface (surface_role);
|
meta_wayland_surface_role_get_surface (surface_role);
|
||||||
MetaWaylandBuffer *buffer;
|
|
||||||
CoglTexture *texture;
|
|
||||||
MetaRectangle geometry;
|
MetaRectangle geometry;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
buffer = surface->buffer_ref.buffer;
|
|
||||||
if (!buffer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
texture = meta_wayland_buffer_get_texture (buffer);
|
|
||||||
geometry = (MetaRectangle) {
|
geometry = (MetaRectangle) {
|
||||||
.x = surface->offset_x + surface->sub.x,
|
.x = surface->offset_x + surface->sub.x,
|
||||||
.y = surface->offset_y + surface->sub.y,
|
.y = surface->offset_y + surface->sub.y,
|
||||||
.width = cogl_texture_get_width (texture) / surface->scale,
|
.width = meta_wayland_surface_get_width (surface),
|
||||||
.height = cogl_texture_get_height (texture) / surface->scale,
|
.height = meta_wayland_surface_get_height (surface),
|
||||||
};
|
};
|
||||||
|
|
||||||
meta_rectangle_union (out_geometry, &geometry, out_geometry);
|
meta_rectangle_union (out_geometry, &geometry, out_geometry);
|
||||||
|
@ -257,8 +257,6 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
cairo_region_t *buffer_region)
|
cairo_region_t *buffer_region)
|
||||||
{
|
{
|
||||||
MetaWaylandBuffer *buffer = surface->buffer_ref.buffer;
|
MetaWaylandBuffer *buffer = surface->buffer_ref.buffer;
|
||||||
unsigned int buffer_width;
|
|
||||||
unsigned int buffer_height;
|
|
||||||
cairo_rectangle_int_t surface_rect;
|
cairo_rectangle_int_t surface_rect;
|
||||||
cairo_region_t *scaled_region;
|
cairo_region_t *scaled_region;
|
||||||
int i, n_rectangles;
|
int i, n_rectangles;
|
||||||
@ -273,11 +271,9 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
/* Intersect the damage region with the surface region before scaling in
|
/* Intersect the damage region with the surface region before scaling in
|
||||||
* order to avoid integer overflow when scaling a damage region is too large
|
* order to avoid integer overflow when scaling a damage region is too large
|
||||||
* (for example INT32_MAX which mesa passes). */
|
* (for example INT32_MAX which mesa passes). */
|
||||||
buffer_width = cogl_texture_get_width (buffer->texture);
|
|
||||||
buffer_height = cogl_texture_get_height (buffer->texture);
|
|
||||||
surface_rect = (cairo_rectangle_int_t) {
|
surface_rect = (cairo_rectangle_int_t) {
|
||||||
.width = buffer_width / surface->scale,
|
.width = meta_wayland_surface_get_width (surface),
|
||||||
.height = buffer_height / surface->scale,
|
.height = meta_wayland_surface_get_height (surface),
|
||||||
};
|
};
|
||||||
cairo_region_intersect_rectangle (surface_region, &surface_rect);
|
cairo_region_intersect_rectangle (surface_region, &surface_rect);
|
||||||
|
|
||||||
@ -1689,15 +1685,13 @@ meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface)
|
|||||||
{
|
{
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
cairo_rectangle_int_t buffer_rect;
|
cairo_rectangle_int_t buffer_rect;
|
||||||
CoglTexture *texture;
|
|
||||||
|
|
||||||
if (!surface->buffer_ref.buffer)
|
if (!surface->buffer_ref.buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
texture = surface->buffer_ref.buffer->texture;
|
|
||||||
buffer_rect = (cairo_rectangle_int_t) {
|
buffer_rect = (cairo_rectangle_int_t) {
|
||||||
.width = cogl_texture_get_width (texture) / surface->scale,
|
.width = meta_wayland_surface_get_width (surface),
|
||||||
.height = cogl_texture_get_height (texture) / surface->scale,
|
.height = meta_wayland_surface_get_height (surface),
|
||||||
};
|
};
|
||||||
region = cairo_region_create_rectangle (&buffer_rect);
|
region = cairo_region_create_rectangle (&buffer_rect);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user