mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
frame: Pass the frame area for get_mask()
Currently, `meta_frame_get_mask()` and `meta_ui_frame_get_mask()` will return the frame mask applied to the current frame size, by querying the frame themselves. To be able to get the frame mask at an arbitrary size, change the API to take a rectangle representing the size at which the frame mask should be rendered. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1009
This commit is contained in:
parent
7dbb4bc3f5
commit
c0321c7b21
@ -890,6 +890,9 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
||||
{
|
||||
cairo_region_t *frame_paint_region, *scanned_region;
|
||||
cairo_rectangle_int_t rect = { 0, 0, tex_width, tex_height };
|
||||
cairo_rectangle_int_t frame_rect;
|
||||
|
||||
meta_window_get_frame_rect (window, &frame_rect);
|
||||
|
||||
/* Make sure we don't paint the frame over the client window. */
|
||||
frame_paint_region = cairo_region_create_rectangle (&rect);
|
||||
@ -899,7 +902,7 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
||||
gdk_cairo_region (cr, frame_paint_region);
|
||||
cairo_clip (cr);
|
||||
|
||||
meta_frame_get_mask (window->frame, cr);
|
||||
meta_frame_get_mask (window->frame, &frame_rect, cr);
|
||||
|
||||
cairo_surface_flush (image);
|
||||
scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
|
||||
|
@ -371,10 +371,11 @@ meta_frame_get_frame_bounds (MetaFrame *frame)
|
||||
}
|
||||
|
||||
void
|
||||
meta_frame_get_mask (MetaFrame *frame,
|
||||
cairo_t *cr)
|
||||
meta_frame_get_mask (MetaFrame *frame,
|
||||
cairo_rectangle_int_t *frame_rect,
|
||||
cairo_t *cr)
|
||||
{
|
||||
meta_ui_frame_get_mask (frame->ui_frame, cr);
|
||||
meta_ui_frame_get_mask (frame->ui_frame, frame_rect, cr);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -72,8 +72,9 @@ void meta_frame_clear_cached_borders (MetaFrame *frame);
|
||||
|
||||
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
|
||||
|
||||
void meta_frame_get_mask (MetaFrame *frame,
|
||||
cairo_t *cr);
|
||||
void meta_frame_get_mask (MetaFrame *frame,
|
||||
cairo_rectangle_int_t *frame_rect,
|
||||
cairo_t *cr);
|
||||
|
||||
void meta_frame_set_screen_cursor (MetaFrame *frame,
|
||||
MetaCursor cursor);
|
||||
|
@ -1423,22 +1423,20 @@ get_visible_frame_border_region (MetaUIFrame *frame)
|
||||
* frame's alpha channel, as a mask to be applied to an opaque pixmap.
|
||||
*
|
||||
* @frame: This frame
|
||||
* @xwindow: The X window for the frame, which has the client window as a child
|
||||
* @frame_rect: The frame rect
|
||||
* @cr: Used to draw the resulting mask
|
||||
*/
|
||||
void
|
||||
meta_ui_frame_get_mask (MetaUIFrame *frame,
|
||||
cairo_t *cr)
|
||||
meta_ui_frame_get_mask (MetaUIFrame *frame,
|
||||
cairo_rectangle_int_t *frame_rect,
|
||||
cairo_t *cr)
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
MetaFrameFlags flags;
|
||||
MetaRectangle frame_rect;
|
||||
cairo_surface_t *surface;
|
||||
double xscale, yscale;
|
||||
int scale;
|
||||
|
||||
meta_window_get_frame_rect (frame->meta_window, &frame_rect);
|
||||
|
||||
flags = meta_frame_get_flags (frame->meta_window->frame);
|
||||
|
||||
meta_style_info_set_flags (frame->style_info, flags);
|
||||
@ -1453,11 +1451,11 @@ meta_ui_frame_get_mask (MetaUIFrame *frame,
|
||||
gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_FRAME], cr,
|
||||
borders.invisible.left / scale,
|
||||
borders.invisible.top / scale,
|
||||
frame_rect.width / scale, frame_rect.height / scale);
|
||||
frame_rect->width / scale, frame_rect->height / scale);
|
||||
gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_TITLEBAR], cr,
|
||||
borders.invisible.left / scale,
|
||||
borders.invisible.top / scale,
|
||||
frame_rect.width / scale, borders.total.top / scale);
|
||||
frame_rect->width / scale, borders.total.top / scale);
|
||||
|
||||
cairo_surface_set_device_scale (surface, xscale, yscale);
|
||||
}
|
||||
|
@ -135,8 +135,9 @@ void meta_ui_frame_get_borders (MetaUIFrame *frame,
|
||||
|
||||
cairo_region_t * meta_ui_frame_get_bounds (MetaUIFrame *frame);
|
||||
|
||||
void meta_ui_frame_get_mask (MetaUIFrame *frame,
|
||||
cairo_t *cr);
|
||||
void meta_ui_frame_get_mask (MetaUIFrame *frame,
|
||||
cairo_rectangle_int_t *frame_rect,
|
||||
cairo_t *cr);
|
||||
|
||||
void meta_ui_frame_move_resize (MetaUIFrame *frame,
|
||||
int x, int y, int width, int height);
|
||||
|
Loading…
Reference in New Issue
Block a user