mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
Port to MtkRegion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
This commit is contained in:
parent
7c98910488
commit
655b4a9c75
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
struct _ClutterDamageHistory
|
struct _ClutterDamageHistory
|
||||||
{
|
{
|
||||||
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
|
MtkRegion *damages[DAMAGE_HISTORY_LENGTH];
|
||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ clutter_damage_history_free (ClutterDamageHistory *history)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
||||||
g_clear_pointer (&history->damages[i], cairo_region_destroy);
|
g_clear_pointer (&history->damages[i], mtk_region_unref);
|
||||||
|
|
||||||
g_free (history);
|
g_free (history);
|
||||||
}
|
}
|
||||||
@ -65,10 +65,10 @@ clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
|||||||
|
|
||||||
void
|
void
|
||||||
clutter_damage_history_record (ClutterDamageHistory *history,
|
clutter_damage_history_record (ClutterDamageHistory *history,
|
||||||
const cairo_region_t *damage)
|
const MtkRegion *damage)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
|
g_clear_pointer (&history->damages[history->index], mtk_region_unref);
|
||||||
history->damages[history->index] = cairo_region_copy (damage);
|
history->damages[history->index] = mtk_region_copy (damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
@ -84,7 +84,7 @@ clutter_damage_history_step (ClutterDamageHistory *history)
|
|||||||
history->index = step_damage_index (history->index, 1);
|
history->index = step_damage_index (history->index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cairo_region_t *
|
const MtkRegion *
|
||||||
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||||
int age)
|
int age)
|
||||||
{
|
{
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "clutter/clutter-macros.h"
|
#include "clutter/clutter-macros.h"
|
||||||
|
#include "mtk/mtk.h"
|
||||||
|
|
||||||
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
||||||
|
|
||||||
@ -37,11 +37,11 @@ gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
|||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_damage_history_record (ClutterDamageHistory *history,
|
void clutter_damage_history_record (ClutterDamageHistory *history,
|
||||||
const cairo_region_t *damage);
|
const MtkRegion *damage);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_damage_history_step (ClutterDamageHistory *history);
|
void clutter_damage_history_step (ClutterDamageHistory *history);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
const MtkRegion * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||||
int age);
|
int age);
|
||||||
|
@ -115,7 +115,7 @@ void clutter_stage_update_device (ClutterStage *stage,
|
|||||||
graphene_point_t point,
|
graphene_point_t point,
|
||||||
uint32_t time,
|
uint32_t time,
|
||||||
ClutterActor *new_actor,
|
ClutterActor *new_actor,
|
||||||
cairo_region_t *region,
|
MtkRegion *region,
|
||||||
gboolean emit_crossing);
|
gboolean emit_crossing);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include "clutter/clutter-paint-context.h"
|
#include "clutter/clutter-paint-context.h"
|
||||||
|
|
||||||
ClutterPaintContext *
|
ClutterPaintContext *
|
||||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
GArray *clip_frusta,
|
GArray *clip_frusta,
|
||||||
ClutterPaintFlag paint_flags);
|
ClutterPaintFlag paint_flags);
|
||||||
|
|
||||||
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ struct _ClutterPaintContext
|
|||||||
ClutterStageView *view;
|
ClutterStageView *view;
|
||||||
ClutterFrame *frame;
|
ClutterFrame *frame;
|
||||||
|
|
||||||
cairo_region_t *redraw_clip;
|
MtkRegion *redraw_clip;
|
||||||
GArray *clip_frusta;
|
GArray *clip_frusta;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
|
|||||||
clutter_paint_context_unref)
|
clutter_paint_context_unref)
|
||||||
|
|
||||||
ClutterPaintContext *
|
ClutterPaintContext *
|
||||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
GArray *clip_frusta,
|
GArray *clip_frusta,
|
||||||
ClutterPaintFlag paint_flags)
|
ClutterPaintFlag paint_flags)
|
||||||
{
|
{
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
@ -51,7 +51,7 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
|
|||||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||||
g_ref_count_init (&paint_context->ref_count);
|
g_ref_count_init (&paint_context->ref_count);
|
||||||
paint_context->view = view;
|
paint_context->view = view;
|
||||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
paint_context->redraw_clip = mtk_region_copy (redraw_clip);
|
||||||
paint_context->clip_frusta = g_array_ref (clip_frusta);
|
paint_context->clip_frusta = g_array_ref (clip_frusta);
|
||||||
paint_context->paint_flags = paint_flags;
|
paint_context->paint_flags = paint_flags;
|
||||||
|
|
||||||
@ -65,15 +65,15 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
|
|||||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||||
*/
|
*/
|
||||||
ClutterPaintContext *
|
ClutterPaintContext *
|
||||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterPaintFlag paint_flags)
|
ClutterPaintFlag paint_flags)
|
||||||
{
|
{
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
|
|
||||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||||
g_ref_count_init (&paint_context->ref_count);
|
g_ref_count_init (&paint_context->ref_count);
|
||||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
paint_context->redraw_clip = mtk_region_copy (redraw_clip);
|
||||||
paint_context->paint_flags = paint_flags;
|
paint_context->paint_flags = paint_flags;
|
||||||
|
|
||||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||||
@ -93,7 +93,7 @@ clutter_paint_context_dispose (ClutterPaintContext *paint_context)
|
|||||||
{
|
{
|
||||||
g_list_free_full (paint_context->framebuffers, g_object_unref);
|
g_list_free_full (paint_context->framebuffers, g_object_unref);
|
||||||
paint_context->framebuffers = NULL;
|
paint_context->framebuffers = NULL;
|
||||||
g_clear_pointer (&paint_context->redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&paint_context->redraw_clip, mtk_region_unref);
|
||||||
g_clear_pointer (&paint_context->clip_frusta, g_array_unref);
|
g_clear_pointer (&paint_context->clip_frusta, g_array_unref);
|
||||||
g_clear_pointer (&paint_context->frame, clutter_frame_unref);
|
g_clear_pointer (&paint_context->frame, clutter_frame_unref);
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
|
|||||||
paint_context->framebuffers);
|
paint_context->framebuffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cairo_region_t *
|
const MtkRegion *
|
||||||
clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context)
|
clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context)
|
||||||
{
|
{
|
||||||
return paint_context->redraw_clip;
|
return paint_context->redraw_clip;
|
||||||
|
@ -42,9 +42,9 @@ CLUTTER_EXPORT
|
|||||||
GType clutter_paint_context_get_type (void);
|
GType clutter_paint_context_get_type (void);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterPaintFlag paint_flags);
|
ClutterPaintFlag paint_flags);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||||
@ -69,7 +69,7 @@ CLUTTER_EXPORT
|
|||||||
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
const MtkRegion * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
|
ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
|
||||||
|
@ -61,7 +61,7 @@ ClutterActor *
|
|||||||
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
||||||
const graphene_point3d_t *point,
|
const graphene_point3d_t *point,
|
||||||
const graphene_ray_t *ray,
|
const graphene_ray_t *ray,
|
||||||
cairo_region_t **clear_area);
|
MtkRegion **clear_area);
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPickStack, clutter_pick_stack_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPickStack, clutter_pick_stack_unref)
|
||||||
|
|
||||||
|
@ -455,9 +455,9 @@ static void
|
|||||||
calculate_clear_area (ClutterPickStack *pick_stack,
|
calculate_clear_area (ClutterPickStack *pick_stack,
|
||||||
PickRecord *pick_rec,
|
PickRecord *pick_rec,
|
||||||
int elem,
|
int elem,
|
||||||
cairo_region_t **clear_area)
|
MtkRegion **clear_area)
|
||||||
{
|
{
|
||||||
cairo_region_t *area = NULL;
|
MtkRegion *area = NULL;
|
||||||
graphene_point3d_t verts[4];
|
graphene_point3d_t verts[4];
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
int i;
|
int i;
|
||||||
@ -478,7 +478,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
|
|||||||
rect.height =
|
rect.height =
|
||||||
MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1));
|
MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1));
|
||||||
|
|
||||||
area = cairo_region_create_rectangle (&rect);
|
area = mtk_region_create_rectangle (&rect);
|
||||||
|
|
||||||
for (i = elem + 1; i < pick_stack->vertices_stack->len; i++)
|
for (i = elem + 1; i < pick_stack->vertices_stack->len; i++)
|
||||||
{
|
{
|
||||||
@ -487,33 +487,31 @@ calculate_clear_area (ClutterPickStack *pick_stack,
|
|||||||
ClutterActorBox paint_box;
|
ClutterActorBox paint_box;
|
||||||
|
|
||||||
if (!rec->is_overlap &&
|
if (!rec->is_overlap &&
|
||||||
(rec->base.rect.x1 == rec->base.rect.x2 ||
|
(rec->base.rect.x1 == rec->base.rect.x2 ||
|
||||||
rec->base.rect.y1 == rec->base.rect.y2))
|
rec->base.rect.y1 == rec->base.rect.y2))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!clutter_actor_get_paint_box (rec->actor, &paint_box))
|
if (!clutter_actor_get_paint_box (rec->actor, &paint_box))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cairo_region_subtract_rectangle (area,
|
mtk_region_subtract_rectangle (area,
|
||||||
&(MtkRectangle) {
|
&MTK_RECTANGLE_INIT (paint_box.x1, paint_box.y1,
|
||||||
.x = paint_box.x1,
|
paint_box.x2 - paint_box.x1,
|
||||||
.y = paint_box.y1,
|
paint_box.y2 - paint_box.y1)
|
||||||
.width = paint_box.x2 - paint_box.x1,
|
);
|
||||||
.height = paint_box.y2 - paint_box.y1,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clear_area)
|
if (clear_area)
|
||||||
*clear_area = g_steal_pointer (&area);
|
*clear_area = g_steal_pointer (&area);
|
||||||
|
|
||||||
g_clear_pointer (&area, cairo_region_destroy);
|
g_clear_pointer (&area, mtk_region_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterActor *
|
ClutterActor *
|
||||||
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
||||||
const graphene_point3d_t *point,
|
const graphene_point3d_t *point,
|
||||||
const graphene_ray_t *ray,
|
const graphene_ray_t *ray,
|
||||||
cairo_region_t **clear_area)
|
MtkRegion **clear_area)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@ typedef enum
|
|||||||
|
|
||||||
/* stage */
|
/* stage */
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_paint_view (ClutterStage *stage,
|
void clutter_stage_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame);
|
ClutterFrame *frame);
|
||||||
|
|
||||||
void clutter_stage_emit_before_update (ClutterStage *stage,
|
void clutter_stage_emit_before_update (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
@ -122,7 +122,7 @@ void clutter_stage_update_device_entry (ClutterStage *self,
|
|||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
graphene_point_t coords,
|
graphene_point_t coords,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
cairo_region_t *clear_area);
|
MtkRegion *clear_area);
|
||||||
|
|
||||||
void clutter_stage_remove_device_entry (ClutterStage *self,
|
void clutter_stage_remove_device_entry (ClutterStage *self,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_view_after_paint (ClutterStageView *view,
|
void clutter_stage_view_after_paint (ClutterStageView *view,
|
||||||
cairo_region_t *redraw_clip);
|
MtkRegion *redraw_clip);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||||
const cairo_region_t *swap_region);
|
const MtkRegion *swap_region);
|
||||||
|
|
||||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||||
|
|
||||||
@ -54,13 +54,13 @@ gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view);
|
|||||||
|
|
||||||
gboolean clutter_stage_view_has_redraw_clip (ClutterStageView *view);
|
gboolean clutter_stage_view_has_redraw_clip (ClutterStageView *view);
|
||||||
|
|
||||||
const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
|
const MtkRegion * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
MtkRegion * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
cairo_region_t * clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view);
|
MtkRegion * clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view);
|
void clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view);
|
||||||
|
@ -84,9 +84,9 @@ typedef struct _ClutterStageViewPrivate
|
|||||||
CoglScanout *next_scanout;
|
CoglScanout *next_scanout;
|
||||||
|
|
||||||
gboolean has_redraw_clip;
|
gboolean has_redraw_clip;
|
||||||
cairo_region_t *redraw_clip;
|
MtkRegion *redraw_clip;
|
||||||
gboolean has_accumulated_redraw_clip;
|
gboolean has_accumulated_redraw_clip;
|
||||||
cairo_region_t *accumulated_redraw_clip;
|
MtkRegion *accumulated_redraw_clip;
|
||||||
|
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
int64_t vblank_duration_us;
|
int64_t vblank_duration_us;
|
||||||
@ -228,11 +228,11 @@ clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paint_transformed_framebuffer (ClutterStageView *view,
|
paint_transformed_framebuffer (ClutterStageView *view,
|
||||||
CoglPipeline *pipeline,
|
CoglPipeline *pipeline,
|
||||||
CoglOffscreen *src_framebuffer,
|
CoglOffscreen *src_framebuffer,
|
||||||
CoglFramebuffer *dst_framebuffer,
|
CoglFramebuffer *dst_framebuffer,
|
||||||
const cairo_region_t *redraw_clip)
|
const MtkRegion *redraw_clip)
|
||||||
{
|
{
|
||||||
graphene_matrix_t matrix;
|
graphene_matrix_t matrix;
|
||||||
unsigned int n_rectangles, i;
|
unsigned int n_rectangles, i;
|
||||||
@ -246,10 +246,8 @@ paint_transformed_framebuffer (ClutterStageView *view,
|
|||||||
dst_height = cogl_framebuffer_get_height (dst_framebuffer);
|
dst_height = cogl_framebuffer_get_height (dst_framebuffer);
|
||||||
clutter_stage_view_get_layout (view, &view_layout);
|
clutter_stage_view_get_layout (view, &view_layout);
|
||||||
clutter_stage_view_transform_rect_to_onscreen (view,
|
clutter_stage_view_transform_rect_to_onscreen (view,
|
||||||
&(MtkRectangle) {
|
&MTK_RECTANGLE_INIT (0, 0,
|
||||||
.width = view_layout.width,
|
view_layout.width, view_layout.height),
|
||||||
.height = view_layout.height,
|
|
||||||
},
|
|
||||||
view_layout.width,
|
view_layout.width,
|
||||||
view_layout.height,
|
view_layout.height,
|
||||||
&onscreen_layout);
|
&onscreen_layout);
|
||||||
@ -269,7 +267,7 @@ paint_transformed_framebuffer (ClutterStageView *view,
|
|||||||
cogl_framebuffer_set_viewport (dst_framebuffer,
|
cogl_framebuffer_set_viewport (dst_framebuffer,
|
||||||
0, 0, dst_width, dst_height);
|
0, 0, dst_width, dst_height);
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (redraw_clip);
|
n_rectangles = mtk_region_num_rectangles (redraw_clip);
|
||||||
coordinates = g_newa (float, 2 * 4 * n_rectangles);
|
coordinates = g_newa (float, 2 * 4 * n_rectangles);
|
||||||
|
|
||||||
for (i = 0; i < n_rectangles; i++)
|
for (i = 0; i < n_rectangles; i++)
|
||||||
@ -277,7 +275,7 @@ paint_transformed_framebuffer (ClutterStageView *view,
|
|||||||
MtkRectangle src_rect;
|
MtkRectangle src_rect;
|
||||||
MtkRectangle dst_rect;
|
MtkRectangle dst_rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (redraw_clip, i, &src_rect);
|
src_rect = mtk_region_get_rectangle (redraw_clip, i);
|
||||||
src_rect.x -= view_layout.x;
|
src_rect.x -= view_layout.x;
|
||||||
src_rect.y -= view_layout.y;
|
src_rect.y -= view_layout.y;
|
||||||
|
|
||||||
@ -463,7 +461,7 @@ init_shadowfb (ClutterStageView *view)
|
|||||||
|
|
||||||
void
|
void
|
||||||
clutter_stage_view_after_paint (ClutterStageView *view,
|
clutter_stage_view_after_paint (ClutterStageView *view,
|
||||||
cairo_region_t *redraw_clip)
|
MtkRegion *redraw_clip)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
@ -520,14 +518,14 @@ flip_dma_buf_idx (int idx)
|
|||||||
return (idx + 1) % 2;
|
return (idx + 1) % 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
find_damaged_tiles (ClutterStageView *view,
|
find_damaged_tiles (ClutterStageView *view,
|
||||||
const cairo_region_t *damage_region,
|
const MtkRegion *damage_region,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
cairo_region_t *tile_damage_region;
|
MtkRegion *tile_damage_region;
|
||||||
MtkRectangle damage_extents;
|
MtkRectangle damage_extents;
|
||||||
MtkRectangle fb_rect;
|
MtkRectangle fb_rect;
|
||||||
int prev_dma_buf_idx;
|
int prev_dma_buf_idx;
|
||||||
@ -573,7 +571,7 @@ find_damaged_tiles (ClutterStageView *view,
|
|||||||
.height = height,
|
.height = height,
|
||||||
};
|
};
|
||||||
|
|
||||||
cairo_region_get_extents (damage_region, &damage_extents);
|
damage_extents = mtk_region_get_extents (damage_region);
|
||||||
|
|
||||||
tile_x_min = damage_extents.x / tile_size;
|
tile_x_min = damage_extents.x / tile_size;
|
||||||
tile_x_max = ((damage_extents.x + damage_extents.width + tile_size - 1) /
|
tile_x_max = ((damage_extents.x + damage_extents.width + tile_size - 1) /
|
||||||
@ -582,7 +580,7 @@ find_damaged_tiles (ClutterStageView *view,
|
|||||||
tile_y_max = ((damage_extents.y + damage_extents.height + tile_size - 1) /
|
tile_y_max = ((damage_extents.y + damage_extents.height + tile_size - 1) /
|
||||||
tile_size);
|
tile_size);
|
||||||
|
|
||||||
tile_damage_region = cairo_region_create ();
|
tile_damage_region = mtk_region_create ();
|
||||||
|
|
||||||
for (tile_y = tile_y_min; tile_y <= tile_y_max; tile_y++)
|
for (tile_y = tile_y_min; tile_y <= tile_y_max; tile_y++)
|
||||||
{
|
{
|
||||||
@ -595,14 +593,14 @@ find_damaged_tiles (ClutterStageView *view,
|
|||||||
.height = tile_size,
|
.height = tile_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cairo_region_contains_rectangle (damage_region, &tile) ==
|
if (mtk_region_contains_rectangle (damage_region, &tile) ==
|
||||||
CAIRO_REGION_OVERLAP_OUT)
|
MTK_REGION_OVERLAP_OUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mtk_rectangle_intersect (&tile, &fb_rect, &tile);
|
mtk_rectangle_intersect (&tile, &fb_rect, &tile);
|
||||||
|
|
||||||
if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
|
if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
|
||||||
cairo_region_union_rectangle (tile_damage_region, &tile);
|
mtk_region_union_rectangle (tile_damage_region, &tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +621,7 @@ find_damaged_tiles (ClutterStageView *view,
|
|||||||
cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
|
cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
|
||||||
cogl_dma_buf_handle_munmap (current_dma_buf_handle, current_data, NULL);
|
cogl_dma_buf_handle_munmap (current_dma_buf_handle, current_data, NULL);
|
||||||
|
|
||||||
cairo_region_intersect (tile_damage_region, damage_region);
|
mtk_region_intersect (tile_damage_region, damage_region);
|
||||||
|
|
||||||
return tile_damage_region;
|
return tile_damage_region;
|
||||||
|
|
||||||
@ -660,33 +658,33 @@ swap_dma_buf_framebuffer (ClutterStageView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_shadowfb_to_onscreen (ClutterStageView *view,
|
copy_shadowfb_to_onscreen (ClutterStageView *view,
|
||||||
const cairo_region_t *swap_region)
|
const MtkRegion *swap_region)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
ClutterDamageHistory *damage_history = priv->shadow.dma_buf.damage_history;
|
ClutterDamageHistory *damage_history = priv->shadow.dma_buf.damage_history;
|
||||||
cairo_region_t *damage_region;
|
g_autoptr (MtkRegion) damage_region = NULL;
|
||||||
int age;
|
int age;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (cairo_region_is_empty (swap_region))
|
if (mtk_region_is_empty (swap_region))
|
||||||
{
|
{
|
||||||
MtkRectangle full_damage = {
|
MtkRectangle full_damage = {
|
||||||
.width = cogl_framebuffer_get_width (priv->framebuffer),
|
.width = cogl_framebuffer_get_width (priv->framebuffer),
|
||||||
.height = cogl_framebuffer_get_height (priv->framebuffer),
|
.height = cogl_framebuffer_get_height (priv->framebuffer),
|
||||||
};
|
};
|
||||||
damage_region = cairo_region_create_rectangle (&full_damage);
|
damage_region = mtk_region_create_rectangle (&full_damage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
damage_region = cairo_region_copy (swap_region);
|
damage_region = mtk_region_copy (swap_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_shadowfb_double_buffered (view))
|
if (is_shadowfb_double_buffered (view))
|
||||||
{
|
{
|
||||||
CoglOnscreen *onscreen = COGL_ONSCREEN (priv->framebuffer);
|
CoglOnscreen *onscreen = COGL_ONSCREEN (priv->framebuffer);
|
||||||
cairo_region_t *changed_region;
|
g_autoptr (MtkRegion) changed_region = NULL;
|
||||||
|
|
||||||
if (cogl_onscreen_get_frame_counter (onscreen) >= 1)
|
if (cogl_onscreen_get_frame_counter (onscreen) >= 1)
|
||||||
{
|
{
|
||||||
@ -708,7 +706,7 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
changed_region = cairo_region_copy (damage_region);
|
changed_region = mtk_region_copy (damage_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed_region)
|
if (changed_region)
|
||||||
@ -722,31 +720,27 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
|
|||||||
{
|
{
|
||||||
for (age = 1; age <= buffer_age; age++)
|
for (age = 1; age <= buffer_age; age++)
|
||||||
{
|
{
|
||||||
const cairo_region_t *old_damage;
|
const MtkRegion *old_damage;
|
||||||
|
|
||||||
old_damage = clutter_damage_history_lookup (damage_history, age);
|
old_damage = clutter_damage_history_lookup (damage_history, age);
|
||||||
cairo_region_union (changed_region, old_damage);
|
mtk_region_union (changed_region, old_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (damage_region);
|
g_clear_pointer (&damage_region, mtk_region_unref);
|
||||||
damage_region = g_steal_pointer (&changed_region);
|
damage_region = g_steal_pointer (&changed_region);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
cairo_region_destroy (changed_region);
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_damage_history_step (damage_history);
|
clutter_damage_history_step (damage_history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < cairo_region_num_rectangles (damage_region); i++)
|
for (i = 0; i < mtk_region_num_rectangles (damage_region); i++)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *shadowfb = COGL_FRAMEBUFFER (priv->shadow.framebuffer);
|
CoglFramebuffer *shadowfb = COGL_FRAMEBUFFER (priv->shadow.framebuffer);
|
||||||
g_autoptr (GError) error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (damage_region, i, &rect);
|
rect = mtk_region_get_rectangle (damage_region, i);
|
||||||
|
|
||||||
if (!cogl_blit_framebuffer (shadowfb,
|
if (!cogl_blit_framebuffer (shadowfb,
|
||||||
priv->framebuffer,
|
priv->framebuffer,
|
||||||
@ -756,20 +750,17 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
|
|||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
||||||
cairo_region_destroy (damage_region);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (damage_region);
|
|
||||||
|
|
||||||
if (is_shadowfb_double_buffered (view))
|
if (is_shadowfb_double_buffered (view))
|
||||||
swap_dma_buf_framebuffer (view);
|
swap_dma_buf_framebuffer (view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||||
const cairo_region_t *swap_region)
|
const MtkRegion *swap_region)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
@ -930,18 +921,18 @@ clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_mark_full_redraw (ClutterStageView *view,
|
maybe_mark_full_redraw (ClutterStageView *view,
|
||||||
cairo_region_t **region)
|
MtkRegion **region)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
|
|
||||||
if (cairo_region_num_rectangles (*region) == 1)
|
if (mtk_region_num_rectangles (*region) == 1)
|
||||||
{
|
{
|
||||||
MtkRectangle region_extents;
|
MtkRectangle region_extents;
|
||||||
|
|
||||||
cairo_region_get_extents (*region, ®ion_extents);
|
region_extents = mtk_region_get_extents (*region);
|
||||||
if (mtk_rectangle_equal (&priv->layout, ®ion_extents))
|
if (mtk_rectangle_equal (&priv->layout, ®ion_extents))
|
||||||
g_clear_pointer (region, cairo_region_destroy);
|
g_clear_pointer (region, mtk_region_unref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -957,7 +948,7 @@ clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
|||||||
|
|
||||||
if (!clip)
|
if (!clip)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||||
priv->has_redraw_clip = TRUE;
|
priv->has_redraw_clip = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -968,11 +959,11 @@ clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
|||||||
if (!priv->redraw_clip)
|
if (!priv->redraw_clip)
|
||||||
{
|
{
|
||||||
if (!mtk_rectangle_equal (&priv->layout, clip))
|
if (!mtk_rectangle_equal (&priv->layout, clip))
|
||||||
priv->redraw_clip = cairo_region_create_rectangle (clip);
|
priv->redraw_clip = mtk_region_create_rectangle (clip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cairo_region_union_rectangle (priv->redraw_clip, clip);
|
mtk_region_union_rectangle (priv->redraw_clip, clip);
|
||||||
maybe_mark_full_redraw (view, &priv->redraw_clip);
|
maybe_mark_full_redraw (view, &priv->redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,7 +988,7 @@ clutter_stage_view_has_full_redraw_clip (ClutterStageView *view)
|
|||||||
return priv->has_redraw_clip && !priv->redraw_clip;
|
return priv->has_redraw_clip && !priv->redraw_clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cairo_region_t *
|
const MtkRegion *
|
||||||
clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
|
clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
@ -1006,7 +997,7 @@ clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
|
|||||||
return priv->redraw_clip;
|
return priv->redraw_clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
@ -1017,7 +1008,7 @@ clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
|||||||
return g_steal_pointer (&priv->redraw_clip);
|
return g_steal_pointer (&priv->redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view)
|
clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
@ -1041,7 +1032,7 @@ clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view)
|
|||||||
|
|
||||||
if (priv->redraw_clip && priv->accumulated_redraw_clip)
|
if (priv->redraw_clip && priv->accumulated_redraw_clip)
|
||||||
{
|
{
|
||||||
cairo_region_union (priv->accumulated_redraw_clip, priv->redraw_clip);
|
mtk_region_union (priv->accumulated_redraw_clip, priv->redraw_clip);
|
||||||
maybe_mark_full_redraw (view, &priv->accumulated_redraw_clip);
|
maybe_mark_full_redraw (view, &priv->accumulated_redraw_clip);
|
||||||
}
|
}
|
||||||
else if (priv->redraw_clip && !priv->has_accumulated_redraw_clip)
|
else if (priv->redraw_clip && !priv->has_accumulated_redraw_clip)
|
||||||
@ -1050,10 +1041,10 @@ clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_clear_pointer (&priv->accumulated_redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->accumulated_redraw_clip, mtk_region_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||||
priv->has_accumulated_redraw_clip = TRUE;
|
priv->has_accumulated_redraw_clip = TRUE;
|
||||||
priv->has_redraw_clip = FALSE;
|
priv->has_redraw_clip = FALSE;
|
||||||
}
|
}
|
||||||
@ -1486,8 +1477,8 @@ clutter_stage_view_dispose (GObject *object)
|
|||||||
|
|
||||||
g_clear_object (&priv->offscreen);
|
g_clear_object (&priv->offscreen);
|
||||||
g_clear_object (&priv->offscreen_pipeline);
|
g_clear_object (&priv->offscreen_pipeline);
|
||||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||||
g_clear_pointer (&priv->accumulated_redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->accumulated_redraw_clip, mtk_region_unref);
|
||||||
g_clear_pointer (&priv->frame_clock, clutter_frame_clock_destroy);
|
g_clear_pointer (&priv->frame_clock, clutter_frame_clock_destroy);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "clutter/clutter-build-config.h"
|
#include "clutter/clutter-build-config.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <cairo-gobject.h>
|
|
||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
|
||||||
@ -102,7 +101,7 @@ typedef struct _PointerDeviceEntry
|
|||||||
ClutterEventSequence *sequence;
|
ClutterEventSequence *sequence;
|
||||||
graphene_point_t coords;
|
graphene_point_t coords;
|
||||||
ClutterActor *current_actor;
|
ClutterActor *current_actor;
|
||||||
cairo_region_t *clear_area;
|
MtkRegion *clear_area;
|
||||||
|
|
||||||
unsigned int press_count;
|
unsigned int press_count;
|
||||||
ClutterActor *implicit_grab_actor;
|
ClutterActor *implicit_grab_actor;
|
||||||
@ -400,10 +399,10 @@ setup_clip_frustum (ClutterStage *stage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
const cairo_region_t *redraw_clip)
|
const MtkRegion *redraw_clip)
|
||||||
{
|
{
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
MtkRectangle clip_rect;
|
MtkRectangle clip_rect;
|
||||||
@ -415,7 +414,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
|||||||
int n_rectangles;
|
int n_rectangles;
|
||||||
ClutterPaintFlag paint_flags;
|
ClutterPaintFlag paint_flags;
|
||||||
|
|
||||||
n_rectangles = redraw_clip ? cairo_region_num_rectangles (redraw_clip) : 0;
|
n_rectangles = redraw_clip ? mtk_region_num_rectangles (redraw_clip) : 0;
|
||||||
if (redraw_clip && n_rectangles < MAX_FRUSTA)
|
if (redraw_clip && n_rectangles < MAX_FRUSTA)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -426,7 +425,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
|||||||
|
|
||||||
for (i = 0; i < n_rectangles; i++)
|
for (i = 0; i < n_rectangles; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (redraw_clip, i, &clip_rect);
|
clip_rect = mtk_region_get_rectangle (redraw_clip, i);
|
||||||
setup_clip_frustum (stage, &clip_rect, &clip_frustum);
|
setup_clip_frustum (stage, &clip_rect, &clip_frustum);
|
||||||
g_array_append_val (clip_frusta, clip_frustum);
|
g_array_append_val (clip_frusta, clip_frustum);
|
||||||
}
|
}
|
||||||
@ -437,7 +436,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
|||||||
sizeof (graphene_frustum_t),
|
sizeof (graphene_frustum_t),
|
||||||
1);
|
1);
|
||||||
if (redraw_clip)
|
if (redraw_clip)
|
||||||
cairo_region_get_extents (redraw_clip, &clip_rect);
|
clip_rect = mtk_region_get_extents (redraw_clip);
|
||||||
else
|
else
|
||||||
clutter_stage_view_get_layout (view, &clip_rect);
|
clutter_stage_view_get_layout (view, &clip_rect);
|
||||||
|
|
||||||
@ -475,10 +474,10 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
|||||||
* for picking or painting...
|
* for picking or painting...
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_stage_paint_view (ClutterStage *stage,
|
clutter_stage_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame)
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
|
|
||||||
@ -1073,7 +1072,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
|||||||
float y,
|
float y,
|
||||||
ClutterPickMode mode,
|
ClutterPickMode mode,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_region_t **clear_area)
|
MtkRegion **clear_area)
|
||||||
{
|
{
|
||||||
g_autoptr (ClutterPickStack) pick_stack = NULL;
|
g_autoptr (ClutterPickStack) pick_stack = NULL;
|
||||||
ClutterPickContext *pick_context;
|
ClutterPickContext *pick_context;
|
||||||
@ -1127,7 +1126,7 @@ _clutter_stage_do_pick (ClutterStage *stage,
|
|||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
ClutterPickMode mode,
|
ClutterPickMode mode,
|
||||||
cairo_region_t **clear_area)
|
MtkRegion **clear_area)
|
||||||
{
|
{
|
||||||
ClutterActor *actor = CLUTTER_ACTOR (stage);
|
ClutterActor *actor = CLUTTER_ACTOR (stage);
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
@ -1300,10 +1299,10 @@ clutter_stage_finalize (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_real_paint_view (ClutterStage *stage,
|
clutter_stage_real_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame)
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
clutter_stage_do_paint_view (stage, view, frame, redraw_clip);
|
clutter_stage_do_paint_view (stage, view, frame, redraw_clip);
|
||||||
}
|
}
|
||||||
@ -1571,7 +1570,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
* ClutterStage::paint-view:
|
* ClutterStage::paint-view:
|
||||||
* @stage: the stage that received the event
|
* @stage: the stage that received the event
|
||||||
* @view: a #ClutterStageView
|
* @view: a #ClutterStageView
|
||||||
* @redraw_clip: a #cairo_region_t with the redraw clip
|
* @redraw_clip: a #MtkRegion with the redraw clip
|
||||||
* @frame: a #ClutterFrame
|
* @frame: a #ClutterFrame
|
||||||
*
|
*
|
||||||
* The signal is emitted before a [class@Clutter.StageView] is being
|
* The signal is emitted before a [class@Clutter.StageView] is being
|
||||||
@ -1590,7 +1589,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
_clutter_marshal_VOID__OBJECT_BOXED_BOXED,
|
_clutter_marshal_VOID__OBJECT_BOXED_BOXED,
|
||||||
G_TYPE_NONE, 3,
|
G_TYPE_NONE, 3,
|
||||||
CLUTTER_TYPE_STAGE_VIEW,
|
CLUTTER_TYPE_STAGE_VIEW,
|
||||||
CAIRO_GOBJECT_TYPE_REGION | G_SIGNAL_TYPE_STATIC_SCOPE,
|
MTK_TYPE_REGION | G_SIGNAL_TYPE_STATIC_SCOPE,
|
||||||
CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE);
|
CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
g_signal_set_va_marshaller (stage_signals[PAINT_VIEW],
|
g_signal_set_va_marshaller (stage_signals[PAINT_VIEW],
|
||||||
G_TYPE_FROM_CLASS (gobject_class),
|
G_TYPE_FROM_CLASS (gobject_class),
|
||||||
@ -1945,7 +1944,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
|||||||
ClutterActorBox box;
|
ClutterActorBox box;
|
||||||
GList *l;
|
GList *l;
|
||||||
ClutterStageView *view;
|
ClutterStageView *view;
|
||||||
cairo_region_t *clip;
|
g_autoptr (MtkRegion) clip = NULL;
|
||||||
MtkRectangle clip_rect;
|
MtkRectangle clip_rect;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
float view_scale;
|
float view_scale;
|
||||||
@ -1977,27 +1976,17 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
|||||||
view = l->data;
|
view = l->data;
|
||||||
|
|
||||||
clutter_stage_view_get_layout (view, &clip_rect);
|
clutter_stage_view_get_layout (view, &clip_rect);
|
||||||
clip = cairo_region_create_rectangle (&clip_rect);
|
clip = mtk_region_create_rectangle (&clip_rect);
|
||||||
cairo_region_intersect_rectangle (clip,
|
mtk_region_intersect_rectangle (clip,
|
||||||
&(MtkRectangle) {
|
&MTK_RECTANGLE_INIT (x, y, width, height));
|
||||||
.x = x,
|
clip_rect = mtk_region_get_extents (clip);
|
||||||
.y = y,
|
|
||||||
.width = width,
|
|
||||||
.height = height,
|
|
||||||
});
|
|
||||||
cairo_region_get_extents (clip, &clip_rect);
|
|
||||||
|
|
||||||
if (clip_rect.width == 0 || clip_rect.height == 0)
|
if (clip_rect.width == 0 || clip_rect.height == 0)
|
||||||
{
|
return NULL;
|
||||||
cairo_region_destroy (clip);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||||
clutter_stage_do_paint_view (stage, view, NULL, clip);
|
clutter_stage_do_paint_view (stage, view, NULL, clip);
|
||||||
|
|
||||||
cairo_region_destroy (clip);
|
|
||||||
|
|
||||||
view_scale = clutter_stage_view_get_scale (view);
|
view_scale = clutter_stage_view_get_scale (view);
|
||||||
pixel_width = roundf (clip_rect.width * view_scale);
|
pixel_width = roundf (clip_rect.width * view_scale);
|
||||||
pixel_height = roundf (clip_rect.height * view_scale);
|
pixel_height = roundf (clip_rect.height * view_scale);
|
||||||
@ -2725,7 +2714,7 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
|
|||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
cairo_region_t *redraw_clip;
|
g_autoptr (MtkRegion) redraw_clip = NULL;
|
||||||
|
|
||||||
if (paint_flags & CLUTTER_PAINT_FLAG_CLEAR)
|
if (paint_flags & CLUTTER_PAINT_FLAG_CLEAR)
|
||||||
{
|
{
|
||||||
@ -2735,12 +2724,11 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
|
|||||||
cogl_framebuffer_clear (framebuffer, COGL_BUFFER_BIT_COLOR, &clear_color);
|
cogl_framebuffer_clear (framebuffer, COGL_BUFFER_BIT_COLOR, &clear_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw_clip = cairo_region_create_rectangle (rect);
|
redraw_clip = mtk_region_create_rectangle (rect);
|
||||||
paint_context =
|
paint_context =
|
||||||
clutter_paint_context_new_for_framebuffer (framebuffer,
|
clutter_paint_context_new_for_framebuffer (framebuffer,
|
||||||
redraw_clip,
|
redraw_clip,
|
||||||
paint_flags);
|
paint_flags);
|
||||||
cairo_region_destroy (redraw_clip);
|
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (framebuffer);
|
cogl_framebuffer_push_matrix (framebuffer);
|
||||||
cogl_framebuffer_set_projection_matrix (framebuffer, &priv->projection);
|
cogl_framebuffer_set_projection_matrix (framebuffer, &priv->projection);
|
||||||
@ -3048,7 +3036,7 @@ free_pointer_device_entry (PointerDeviceEntry *entry)
|
|||||||
if (entry->current_actor)
|
if (entry->current_actor)
|
||||||
_clutter_actor_set_has_pointer (entry->current_actor, FALSE);
|
_clutter_actor_set_has_pointer (entry->current_actor, FALSE);
|
||||||
|
|
||||||
g_clear_pointer (&entry->clear_area, cairo_region_destroy);
|
g_clear_pointer (&entry->clear_area, mtk_region_unref);
|
||||||
|
|
||||||
g_assert (!entry->press_count);
|
g_assert (!entry->press_count);
|
||||||
g_assert (entry->event_emission_chain->len == 0);
|
g_assert (entry->event_emission_chain->len == 0);
|
||||||
@ -3063,7 +3051,7 @@ clutter_stage_update_device_entry (ClutterStage *self,
|
|||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
graphene_point_t coords,
|
graphene_point_t coords,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
cairo_region_t *clear_area)
|
MtkRegion *clear_area)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = self->priv;
|
ClutterStagePrivate *priv = self->priv;
|
||||||
PointerDeviceEntry *entry = NULL;
|
PointerDeviceEntry *entry = NULL;
|
||||||
@ -3108,9 +3096,9 @@ clutter_stage_update_device_entry (ClutterStage *self,
|
|||||||
_clutter_actor_set_has_pointer (actor, TRUE);
|
_clutter_actor_set_has_pointer (actor, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer (&entry->clear_area, cairo_region_destroy);
|
g_clear_pointer (&entry->clear_area, mtk_region_unref);
|
||||||
if (clear_area)
|
if (clear_area)
|
||||||
entry->clear_area = cairo_region_reference (clear_area);
|
entry->clear_area = mtk_region_ref (clear_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3446,7 +3434,7 @@ clutter_stage_update_device (ClutterStage *stage,
|
|||||||
graphene_point_t point,
|
graphene_point_t point,
|
||||||
uint32_t time_ms,
|
uint32_t time_ms,
|
||||||
ClutterActor *new_actor,
|
ClutterActor *new_actor,
|
||||||
cairo_region_t *clear_area,
|
MtkRegion *clear_area,
|
||||||
gboolean emit_crossing)
|
gboolean emit_crossing)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceType device_type;
|
ClutterInputDeviceType device_type;
|
||||||
@ -3587,8 +3575,8 @@ clutter_stage_check_in_clear_area (ClutterStage *stage,
|
|||||||
if (!entry->clear_area)
|
if (!entry->clear_area)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return cairo_region_contains_point (entry->clear_area,
|
return mtk_region_contains_point (entry->clear_area,
|
||||||
point.x, point.y);
|
point.x, point.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterActor *
|
ClutterActor *
|
||||||
@ -3601,7 +3589,7 @@ clutter_stage_pick_and_update_device (ClutterStage *stage,
|
|||||||
uint32_t time_ms)
|
uint32_t time_ms)
|
||||||
{
|
{
|
||||||
ClutterActor *new_actor;
|
ClutterActor *new_actor;
|
||||||
cairo_region_t *clear_area = NULL;
|
MtkRegion *clear_area = NULL;
|
||||||
|
|
||||||
if ((flags & CLUTTER_DEVICE_UPDATE_IGNORE_CACHE) == 0)
|
if ((flags & CLUTTER_DEVICE_UPDATE_IGNORE_CACHE) == 0)
|
||||||
{
|
{
|
||||||
@ -3632,7 +3620,7 @@ clutter_stage_pick_and_update_device (ClutterStage *stage,
|
|||||||
clear_area,
|
clear_area,
|
||||||
!!(flags & CLUTTER_DEVICE_UPDATE_EMIT_CROSSING));
|
!!(flags & CLUTTER_DEVICE_UPDATE_EMIT_CROSSING));
|
||||||
|
|
||||||
g_clear_pointer (&clear_area, cairo_region_destroy);
|
g_clear_pointer (&clear_area, mtk_region_unref);
|
||||||
|
|
||||||
return new_actor;
|
return new_actor;
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,10 @@ struct _ClutterStageClass
|
|||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
ClutterFrame *frame);
|
ClutterFrame *frame);
|
||||||
|
|
||||||
void (* paint_view) (ClutterStage *stage,
|
void (* paint_view) (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame);
|
ClutterFrame *frame);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,8 +272,8 @@ _cogl_clip_stack_push_primitive (CoglClipStack *stack,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglClipStack *
|
CoglClipStack *
|
||||||
cogl_clip_stack_push_region (CoglClipStack *stack,
|
cogl_clip_stack_push_region (CoglClipStack *stack,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
CoglClipStack *entry;
|
CoglClipStack *entry;
|
||||||
CoglClipStackRegion *entry_region;
|
CoglClipStackRegion *entry_region;
|
||||||
@ -284,13 +284,13 @@ cogl_clip_stack_push_region (CoglClipStack *stack,
|
|||||||
COGL_CLIP_STACK_REGION);
|
COGL_CLIP_STACK_REGION);
|
||||||
entry = (CoglClipStack *) entry_region;
|
entry = (CoglClipStack *) entry_region;
|
||||||
|
|
||||||
cairo_region_get_extents (region, &bounds);
|
bounds = mtk_region_get_extents (region);
|
||||||
entry->bounds_x0 = bounds.x;
|
entry->bounds_x0 = bounds.x;
|
||||||
entry->bounds_x1 = bounds.x + bounds.width;
|
entry->bounds_x1 = bounds.x + bounds.width;
|
||||||
entry->bounds_y0 = bounds.y;
|
entry->bounds_y0 = bounds.y;
|
||||||
entry->bounds_y1 = bounds.y + bounds.height;
|
entry->bounds_y1 = bounds.y + bounds.height;
|
||||||
|
|
||||||
entry_region->region = cairo_region_reference (region);
|
entry_region->region = mtk_region_ref (region);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
|
|||||||
case COGL_CLIP_STACK_REGION:
|
case COGL_CLIP_STACK_REGION:
|
||||||
{
|
{
|
||||||
CoglClipStackRegion *region = (CoglClipStackRegion *) entry;
|
CoglClipStackRegion *region = (CoglClipStackRegion *) entry;
|
||||||
cairo_region_destroy (region->region);
|
g_clear_pointer (®ion->region, mtk_region_unref);
|
||||||
g_free (entry);
|
g_free (entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ struct _CoglClipStackRegion
|
|||||||
{
|
{
|
||||||
CoglClipStack _parent_data;
|
CoglClipStack _parent_data;
|
||||||
|
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
};
|
};
|
||||||
|
|
||||||
COGL_EXPORT CoglClipStack *
|
COGL_EXPORT CoglClipStack *
|
||||||
@ -181,8 +181,8 @@ _cogl_clip_stack_push_primitive (CoglClipStack *stack,
|
|||||||
CoglMatrixEntry *projection_entry,
|
CoglMatrixEntry *projection_entry,
|
||||||
const float *viewport);
|
const float *viewport);
|
||||||
CoglClipStack *
|
CoglClipStack *
|
||||||
cogl_clip_stack_push_region (CoglClipStack *stack,
|
cogl_clip_stack_push_region (CoglClipStack *stack,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
|
|
||||||
CoglClipStack *
|
CoglClipStack *
|
||||||
_cogl_clip_stack_pop (CoglClipStack *stack);
|
_cogl_clip_stack_pop (CoglClipStack *stack);
|
||||||
|
@ -2070,7 +2070,7 @@ cogl_framebuffer_push_primitive_clip (CoglFramebuffer *framebuffer,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_framebuffer_push_region_clip (CoglFramebuffer *framebuffer,
|
cogl_framebuffer_push_region_clip (CoglFramebuffer *framebuffer,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
CoglFramebufferPrivate *priv =
|
CoglFramebufferPrivate *priv =
|
||||||
cogl_framebuffer_get_instance_private (framebuffer);
|
cogl_framebuffer_get_instance_private (framebuffer);
|
||||||
|
@ -38,9 +38,9 @@
|
|||||||
#include "cogl/cogl-indices.h"
|
#include "cogl/cogl-indices.h"
|
||||||
#include "cogl/cogl-bitmap.h"
|
#include "cogl/cogl-bitmap.h"
|
||||||
#include "cogl/cogl-texture.h"
|
#include "cogl/cogl-texture.h"
|
||||||
|
#include "mtk/mtk.h"
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#include <graphene.h>
|
#include <graphene.h>
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ cogl_framebuffer_push_primitive_clip (CoglFramebuffer *framebuffer,
|
|||||||
|
|
||||||
COGL_EXPORT void
|
COGL_EXPORT void
|
||||||
cogl_framebuffer_push_region_clip (CoglFramebuffer *framebuffer,
|
cogl_framebuffer_push_region_clip (CoglFramebuffer *framebuffer,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_framebuffer_pop_clip:
|
* cogl_framebuffer_pop_clip:
|
||||||
|
@ -122,13 +122,13 @@ add_stencil_clip_rectangle (CoglFramebuffer *framebuffer,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
||||||
cairo_region_t *region,
|
MtkRegion *region,
|
||||||
gboolean merge)
|
gboolean merge)
|
||||||
{
|
{
|
||||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
CoglMatrixEntry *old_projection_entry, *old_modelview_entry;
|
CoglMatrixEntry *old_projection_entry, *old_modelview_entry;
|
||||||
graphene_matrix_t matrix;
|
graphene_matrix_t matrix;
|
||||||
int num_rectangles = cairo_region_num_rectangles (region);
|
int num_rectangles = mtk_region_num_rectangles (region);
|
||||||
int i;
|
int i;
|
||||||
CoglVertexP2 *vertices;
|
CoglVertexP2 *vertices;
|
||||||
graphene_point3d_t p;
|
graphene_point3d_t p;
|
||||||
@ -189,7 +189,7 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
|||||||
float x2, y2, z2, w2;
|
float x2, y2, z2, w2;
|
||||||
CoglVertexP2 *v = vertices + i * 6;
|
CoglVertexP2 *v = vertices + i * 6;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
|
|
||||||
x1 = rect.x;
|
x1 = rect.x;
|
||||||
y1 = rect.y;
|
y1 = rect.y;
|
||||||
@ -527,7 +527,7 @@ _cogl_clip_stack_gl_flush (CoglClipStack *stack,
|
|||||||
/* If nrectangles <= 1, it can be fully represented with the
|
/* If nrectangles <= 1, it can be fully represented with the
|
||||||
* scissor clip.
|
* scissor clip.
|
||||||
*/
|
*/
|
||||||
if (cairo_region_num_rectangles (region->region) > 1 ||
|
if (mtk_region_num_rectangles (region->region) > 1 ||
|
||||||
G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_STENCILLING)))
|
G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_STENCILLING)))
|
||||||
{
|
{
|
||||||
COGL_NOTE (CLIPPING, "Adding stencil clip for region");
|
COGL_NOTE (CLIPPING, "Adding stencil clip for region");
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
struct _MetaPointerConstraint
|
struct _MetaPointerConstraint
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
double min_edge_distance;
|
double min_edge_distance;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ meta_pointer_constraint_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
MetaPointerConstraint *constraint = META_POINTER_CONSTRAINT (object);
|
MetaPointerConstraint *constraint = META_POINTER_CONSTRAINT (object);
|
||||||
|
|
||||||
g_clear_pointer (&constraint->region, cairo_region_destroy);
|
g_clear_pointer (&constraint->region, mtk_region_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_pointer_constraint_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_pointer_constraint_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -81,19 +81,19 @@ meta_pointer_constraint_class_init (MetaPointerConstraintClass *klass)
|
|||||||
|
|
||||||
|
|
||||||
MetaPointerConstraint *
|
MetaPointerConstraint *
|
||||||
meta_pointer_constraint_new (const cairo_region_t *region,
|
meta_pointer_constraint_new (const MtkRegion *region,
|
||||||
double min_edge_distance)
|
double min_edge_distance)
|
||||||
{
|
{
|
||||||
MetaPointerConstraint *constraint;
|
MetaPointerConstraint *constraint;
|
||||||
|
|
||||||
constraint = g_object_new (META_TYPE_POINTER_CONSTRAINT, NULL);
|
constraint = g_object_new (META_TYPE_POINTER_CONSTRAINT, NULL);
|
||||||
constraint->region = cairo_region_copy (region);
|
constraint->region = mtk_region_copy (region);
|
||||||
constraint->min_edge_distance = min_edge_distance;
|
constraint->min_edge_distance = min_edge_distance;
|
||||||
|
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_pointer_constraint_get_region (MetaPointerConstraint *constraint)
|
meta_pointer_constraint_get_region (MetaPointerConstraint *constraint)
|
||||||
{
|
{
|
||||||
return constraint->region;
|
return constraint->region;
|
||||||
|
@ -32,10 +32,10 @@ G_BEGIN_DECLS
|
|||||||
G_DECLARE_FINAL_TYPE (MetaPointerConstraint, meta_pointer_constraint,
|
G_DECLARE_FINAL_TYPE (MetaPointerConstraint, meta_pointer_constraint,
|
||||||
META, POINTER_CONSTRAINT, GObject);
|
META, POINTER_CONSTRAINT, GObject);
|
||||||
|
|
||||||
MetaPointerConstraint * meta_pointer_constraint_new (const cairo_region_t *region,
|
MetaPointerConstraint * meta_pointer_constraint_new (const MtkRegion *region,
|
||||||
double min_edge_distance);
|
double min_edge_distance);
|
||||||
|
|
||||||
cairo_region_t * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint);
|
MtkRegion * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint);
|
||||||
|
|
||||||
double meta_pointer_constraint_get_min_edge_distance (MetaPointerConstraint *constraint);
|
double meta_pointer_constraint_get_min_edge_distance (MetaPointerConstraint *constraint);
|
||||||
|
|
||||||
|
@ -243,11 +243,11 @@ maybe_record_frame_on_idle (gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
before_stage_painted (MetaStage *stage,
|
before_stage_painted (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaScreenCastAreaStreamSrc *area_src =
|
MetaScreenCastAreaStreamSrc *area_src =
|
||||||
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
|
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
|
||||||
@ -263,11 +263,11 @@ before_stage_painted (MetaStage *stage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stage_painted (MetaStage *stage,
|
stage_painted (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaScreenCastAreaStreamSrc *area_src =
|
MetaScreenCastAreaStreamSrc *area_src =
|
||||||
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
|
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
|
||||||
@ -283,12 +283,12 @@ stage_painted (MetaStage *stage,
|
|||||||
|
|
||||||
if (redraw_clip)
|
if (redraw_clip)
|
||||||
{
|
{
|
||||||
switch (cairo_region_contains_rectangle (redraw_clip, area))
|
switch (mtk_region_contains_rectangle (redraw_clip, area))
|
||||||
{
|
{
|
||||||
case CAIRO_REGION_OVERLAP_IN:
|
case MTK_REGION_OVERLAP_IN:
|
||||||
case CAIRO_REGION_OVERLAP_PART:
|
case MTK_REGION_OVERLAP_PART:
|
||||||
break;
|
break;
|
||||||
case CAIRO_REGION_OVERLAP_OUT:
|
case MTK_REGION_OVERLAP_OUT:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ maybe_record_frame_on_idle (gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stage_painted (MetaStage *stage,
|
stage_painted (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaScreenCastMonitorStreamSrc *monitor_src =
|
MetaScreenCastMonitorStreamSrc *monitor_src =
|
||||||
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
|
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
|
||||||
@ -187,11 +187,11 @@ stage_painted (MetaStage *stage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
before_stage_painted (MetaStage *stage,
|
before_stage_painted (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaScreenCastMonitorStreamSrc *monitor_src =
|
MetaScreenCastMonitorStreamSrc *monitor_src =
|
||||||
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
|
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
|
||||||
|
@ -112,7 +112,7 @@ typedef struct _MetaScreenCastStreamSrcPrivate
|
|||||||
gboolean uses_dma_bufs;
|
gboolean uses_dma_bufs;
|
||||||
GHashTable *dmabuf_handles;
|
GHashTable *dmabuf_handles;
|
||||||
|
|
||||||
cairo_region_t *redraw_clip;
|
MtkRegion *redraw_clip;
|
||||||
} MetaScreenCastStreamSrcPrivate;
|
} MetaScreenCastStreamSrcPrivate;
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
@ -687,7 +687,7 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src,
|
|||||||
int num_buffers_available;
|
int num_buffers_available;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
n_rectangles = cairo_region_num_rectangles (priv->redraw_clip);
|
n_rectangles = mtk_region_num_rectangles (priv->redraw_clip);
|
||||||
num_buffers_available = 0;
|
num_buffers_available = 0;
|
||||||
|
|
||||||
spa_meta_for_each (meta_region, spa_meta_video_damage)
|
spa_meta_for_each (meta_region, spa_meta_video_damage)
|
||||||
@ -714,7 +714,7 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src,
|
|||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (priv->redraw_clip, i, &rect);
|
rect = mtk_region_get_rectangle (priv->redraw_clip, i);
|
||||||
meta_region->region = SPA_REGION (rect.x, rect.y,
|
meta_region->region = SPA_REGION (rect.x, rect.y,
|
||||||
rect.width, rect.height);
|
rect.width, rect.height);
|
||||||
|
|
||||||
@ -724,13 +724,13 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaScreenCastRecordResult
|
MetaScreenCastRecordResult
|
||||||
meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||||
MetaScreenCastRecordFlag flags,
|
MetaScreenCastRecordFlag flags,
|
||||||
const cairo_region_t *redraw_clip)
|
const MtkRegion *redraw_clip)
|
||||||
{
|
{
|
||||||
int64_t now_us = g_get_monotonic_time ();
|
int64_t now_us = g_get_monotonic_time ();
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
|||||||
MetaScreenCastRecordResult
|
MetaScreenCastRecordResult
|
||||||
meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
||||||
MetaScreenCastRecordFlag flags,
|
MetaScreenCastRecordFlag flags,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
int64_t frame_timestamp_us)
|
int64_t frame_timestamp_us)
|
||||||
{
|
{
|
||||||
MetaScreenCastStreamSrcPrivate *priv =
|
MetaScreenCastStreamSrcPrivate *priv =
|
||||||
@ -762,9 +762,9 @@ meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStr
|
|||||||
if (redraw_clip)
|
if (redraw_clip)
|
||||||
{
|
{
|
||||||
if (priv->redraw_clip)
|
if (priv->redraw_clip)
|
||||||
cairo_region_union (priv->redraw_clip, redraw_clip);
|
mtk_region_union (priv->redraw_clip, redraw_clip);
|
||||||
else
|
else
|
||||||
priv->redraw_clip = cairo_region_copy (redraw_clip);
|
priv->redraw_clip = mtk_region_copy (redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->buffer_count == 0)
|
if (priv->buffer_count == 0)
|
||||||
|
@ -91,11 +91,11 @@ gboolean meta_screen_cast_stream_src_is_enabled (MetaScreenCastStreamSrc *src);
|
|||||||
|
|
||||||
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||||
MetaScreenCastRecordFlag flags,
|
MetaScreenCastRecordFlag flags,
|
||||||
const cairo_region_t *redraw_clip);
|
const MtkRegion *redraw_clip);
|
||||||
|
|
||||||
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
||||||
MetaScreenCastRecordFlag flags,
|
MetaScreenCastRecordFlag flags,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
int64_t frame_timestamp_us);
|
int64_t frame_timestamp_us);
|
||||||
|
|
||||||
gboolean meta_screen_cast_stream_src_pending_follow_up_frame (MetaScreenCastStreamSrc *src);
|
gboolean meta_screen_cast_stream_src_pending_follow_up_frame (MetaScreenCastStreamSrc *src);
|
||||||
|
@ -194,11 +194,11 @@ uninhibit_hw_cursor (MetaScreenCastVirtualStreamSrc *virtual_src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
actors_painted (MetaStage *stage,
|
actors_painted (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (user_data);
|
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (user_data);
|
||||||
MetaScreenCastRecordFlag flags;
|
MetaScreenCastRecordFlag flags;
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#include "backends/meta-backend-types.h"
|
#include "backends/meta-backend-types.h"
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ meta_stage_impl_resize (ClutterStageWindow *stage_window,
|
|||||||
static void
|
static void
|
||||||
paint_damage_region (ClutterStageWindow *stage_window,
|
paint_damage_region (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_region_t *swap_region,
|
MtkRegion *swap_region,
|
||||||
cairo_region_t *queued_redraw_clip)
|
MtkRegion *queued_redraw_clip)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
@ -154,13 +154,13 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
|||||||
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
|
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
|
||||||
}
|
}
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (swap_region);
|
n_rects = mtk_region_num_rectangles (swap_region);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
float x_1, x_2, y_1, y_2;
|
float x_1, x_2, y_1, y_2;
|
||||||
|
|
||||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
rect = mtk_region_get_rectangle (swap_region, i);
|
||||||
x_1 = rect.x;
|
x_1 = rect.x;
|
||||||
x_2 = rect.x + rect.width;
|
x_2 = rect.x + rect.width;
|
||||||
y_1 = rect.y;
|
y_1 = rect.y;
|
||||||
@ -180,13 +180,13 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
|||||||
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
|
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
|
||||||
}
|
}
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (queued_redraw_clip);
|
n_rects = mtk_region_num_rectangles (queued_redraw_clip);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
float x_1, x_2, y_1, y_2;
|
float x_1, x_2, y_1, y_2;
|
||||||
|
|
||||||
cairo_region_get_rectangle (queued_redraw_clip, i, &rect);
|
rect = mtk_region_get_rectangle (queued_redraw_clip, i);
|
||||||
x_1 = rect.x;
|
x_1 = rect.x;
|
||||||
x_2 = rect.x + rect.width;
|
x_2 = rect.x + rect.width;
|
||||||
y_1 = rect.y;
|
y_1 = rect.y;
|
||||||
@ -202,7 +202,7 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
|||||||
static void
|
static void
|
||||||
queue_damage_region (ClutterStageWindow *stage_window,
|
queue_damage_region (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *stage_view,
|
ClutterStageView *stage_view,
|
||||||
cairo_region_t *damage_region)
|
MtkRegion *damage_region)
|
||||||
{
|
{
|
||||||
int *damage, n_rects, i;
|
int *damage, n_rects, i;
|
||||||
g_autofree int *freeme = NULL;
|
g_autofree int *freeme = NULL;
|
||||||
@ -211,7 +211,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
|||||||
int fb_width;
|
int fb_width;
|
||||||
int fb_height;
|
int fb_height;
|
||||||
|
|
||||||
if (cairo_region_is_empty (damage_region))
|
if (mtk_region_is_empty (damage_region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
framebuffer = clutter_stage_view_get_onscreen (stage_view);
|
framebuffer = clutter_stage_view_get_onscreen (stage_view);
|
||||||
@ -222,7 +222,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
|||||||
fb_width = cogl_framebuffer_get_width (framebuffer);
|
fb_width = cogl_framebuffer_get_width (framebuffer);
|
||||||
fb_height = cogl_framebuffer_get_height (framebuffer);
|
fb_height = cogl_framebuffer_get_height (framebuffer);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (damage_region);
|
n_rects = mtk_region_num_rectangles (damage_region);
|
||||||
|
|
||||||
if (n_rects < MAX_STACK_RECTS)
|
if (n_rects < MAX_STACK_RECTS)
|
||||||
damage = g_newa (int, n_rects * 4);
|
damage = g_newa (int, n_rects * 4);
|
||||||
@ -233,7 +233,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
|||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (damage_region, i, &rect);
|
rect = mtk_region_get_rectangle (damage_region, i);
|
||||||
|
|
||||||
clutter_stage_view_transform_rect_to_onscreen (stage_view,
|
clutter_stage_view_transform_rect_to_onscreen (stage_view,
|
||||||
&rect,
|
&rect,
|
||||||
@ -254,7 +254,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
|||||||
static void
|
static void
|
||||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *stage_view,
|
ClutterStageView *stage_view,
|
||||||
cairo_region_t *swap_region,
|
MtkRegion *swap_region,
|
||||||
gboolean swap_with_damage,
|
gboolean swap_with_damage,
|
||||||
ClutterFrame *frame)
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
@ -273,13 +273,13 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
int *damage, n_rects, i;
|
int *damage, n_rects, i;
|
||||||
CoglFrameInfo *frame_info;
|
CoglFrameInfo *frame_info;
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (swap_region);
|
n_rects = mtk_region_num_rectangles (swap_region);
|
||||||
damage = g_newa (int, n_rects * 4);
|
damage = g_newa (int, n_rects * 4);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
rect = mtk_region_get_rectangle (swap_region, i);
|
||||||
damage[i * 4] = rect.x;
|
damage[i * 4] = rect.x;
|
||||||
damage[i * 4 + 1] = rect.y;
|
damage[i * 4 + 1] = rect.y;
|
||||||
damage[i * 4 + 2] = rect.width;
|
damage[i * 4 + 2] = rect.width;
|
||||||
@ -333,20 +333,20 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
offset_scale_and_clamp_region (const cairo_region_t *region,
|
offset_scale_and_clamp_region (const MtkRegion *region,
|
||||||
int offset_x,
|
int offset_x,
|
||||||
int offset_y,
|
int offset_y,
|
||||||
float scale)
|
float scale)
|
||||||
{
|
{
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
g_autofree MtkRectangle *freeme = NULL;
|
g_autofree MtkRectangle *freeme = NULL;
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
|
|
||||||
if (n_rects == 0)
|
if (n_rects == 0)
|
||||||
return cairo_region_create ();
|
return mtk_region_create ();
|
||||||
|
|
||||||
if (n_rects < MAX_STACK_RECTS)
|
if (n_rects < MAX_STACK_RECTS)
|
||||||
rects = g_newa (MtkRectangle, n_rects);
|
rects = g_newa (MtkRectangle, n_rects);
|
||||||
@ -358,7 +358,7 @@ offset_scale_and_clamp_region (const cairo_region_t *region,
|
|||||||
MtkRectangle *rect = &rects[i];
|
MtkRectangle *rect = &rects[i];
|
||||||
graphene_rect_t tmp;
|
graphene_rect_t tmp;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, rect);
|
*rect = mtk_region_get_rectangle (region, i);
|
||||||
|
|
||||||
tmp = mtk_rectangle_to_graphene_rect (rect);
|
tmp = mtk_rectangle_to_graphene_rect (rect);
|
||||||
graphene_rect_offset (&tmp, offset_x, offset_y);
|
graphene_rect_offset (&tmp, offset_x, offset_y);
|
||||||
@ -367,23 +367,23 @@ offset_scale_and_clamp_region (const cairo_region_t *region,
|
|||||||
rect);
|
rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cairo_region_create_rectangles (rects, n_rects);
|
return mtk_region_create_rectangles (rects, n_rects);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
scale_offset_and_clamp_region (const cairo_region_t *region,
|
scale_offset_and_clamp_region (const MtkRegion *region,
|
||||||
float scale,
|
float scale,
|
||||||
int offset_x,
|
int offset_x,
|
||||||
int offset_y)
|
int offset_y)
|
||||||
{
|
{
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
g_autofree MtkRectangle *freeme = NULL;
|
g_autofree MtkRectangle *freeme = NULL;
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
|
|
||||||
if (n_rects == 0)
|
if (n_rects == 0)
|
||||||
return cairo_region_create ();
|
return mtk_region_create ();
|
||||||
|
|
||||||
if (n_rects < MAX_STACK_RECTS)
|
if (n_rects < MAX_STACK_RECTS)
|
||||||
rects = g_newa (MtkRectangle, n_rects);
|
rects = g_newa (MtkRectangle, n_rects);
|
||||||
@ -395,7 +395,7 @@ scale_offset_and_clamp_region (const cairo_region_t *region,
|
|||||||
MtkRectangle *rect = &rects[i];
|
MtkRectangle *rect = &rects[i];
|
||||||
graphene_rect_t tmp;
|
graphene_rect_t tmp;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, rect);
|
*rect = mtk_region_get_rectangle (region, i);
|
||||||
|
|
||||||
tmp = mtk_rectangle_to_graphene_rect (rect);
|
tmp = mtk_rectangle_to_graphene_rect (rect);
|
||||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||||
@ -405,13 +405,13 @@ scale_offset_and_clamp_region (const cairo_region_t *region,
|
|||||||
rect);
|
rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cairo_region_create_rectangles (rects, n_rects);
|
return mtk_region_create_rectangles (rects, n_rects);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paint_stage (MetaStageImpl *stage_impl,
|
paint_stage (MetaStageImpl *stage_impl,
|
||||||
ClutterStageView *stage_view,
|
ClutterStageView *stage_view,
|
||||||
cairo_region_t *redraw_clip,
|
MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame)
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
ClutterStage *stage = stage_impl->wrapper;
|
ClutterStage *stage = stage_impl->wrapper;
|
||||||
@ -422,31 +422,31 @@ paint_stage (MetaStageImpl *stage_impl,
|
|||||||
clutter_stage_view_after_paint (stage_view, redraw_clip);
|
clutter_stage_view_after_paint (stage_view, redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
transform_swap_region_to_onscreen (ClutterStageView *stage_view,
|
transform_swap_region_to_onscreen (ClutterStageView *stage_view,
|
||||||
cairo_region_t *swap_region)
|
MtkRegion *swap_region)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (stage_view);
|
CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (stage_view);
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
cairo_region_t *transformed_region;
|
MtkRegion *transformed_region;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
width = cogl_framebuffer_get_width (onscreen);
|
width = cogl_framebuffer_get_width (onscreen);
|
||||||
height = cogl_framebuffer_get_height (onscreen);
|
height = cogl_framebuffer_get_height (onscreen);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (swap_region);
|
n_rects = mtk_region_num_rectangles (swap_region);
|
||||||
rects = g_newa (MtkRectangle, n_rects);
|
rects = g_newa (MtkRectangle, n_rects);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (swap_region, i, &rects[i]);
|
rects[i] = mtk_region_get_rectangle (swap_region, i);
|
||||||
clutter_stage_view_transform_rect_to_onscreen (stage_view,
|
clutter_stage_view_transform_rect_to_onscreen (stage_view,
|
||||||
&rects[i],
|
&rects[i],
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
&rects[i]);
|
&rects[i]);
|
||||||
}
|
}
|
||||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
transformed_region = mtk_region_create_rectangles (rects, n_rects);
|
||||||
|
|
||||||
return transformed_region;
|
return transformed_region;
|
||||||
}
|
}
|
||||||
@ -506,10 +506,10 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
gboolean buffer_has_valid_damage_history = FALSE;
|
gboolean buffer_has_valid_damage_history = FALSE;
|
||||||
gboolean has_buffer_age;
|
gboolean has_buffer_age;
|
||||||
gboolean swap_with_damage;
|
gboolean swap_with_damage;
|
||||||
cairo_region_t *redraw_clip;
|
g_autoptr (MtkRegion) redraw_clip = NULL;
|
||||||
cairo_region_t *queued_redraw_clip = NULL;
|
g_autoptr (MtkRegion) queued_redraw_clip = NULL;
|
||||||
cairo_region_t *fb_clip_region;
|
g_autoptr (MtkRegion) fb_clip_region = NULL;
|
||||||
cairo_region_t *swap_region;
|
g_autoptr (MtkRegion) swap_region = NULL;
|
||||||
ClutterDrawDebugFlag paint_debug_flags;
|
ClutterDrawDebugFlag paint_debug_flags;
|
||||||
ClutterDamageHistory *damage_history;
|
ClutterDamageHistory *damage_history;
|
||||||
float fb_scale;
|
float fb_scale;
|
||||||
@ -577,16 +577,16 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
.width = fb_width,
|
.width = fb_width,
|
||||||
.height = fb_height,
|
.height = fb_height,
|
||||||
};
|
};
|
||||||
fb_clip_region = cairo_region_create_rectangle (&fb_rect);
|
fb_clip_region = mtk_region_create_rectangle (&fb_rect);
|
||||||
|
|
||||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&redraw_clip, mtk_region_unref);
|
||||||
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
redraw_clip = mtk_region_create_rectangle (&view_rect);
|
||||||
|
|
||||||
if (G_UNLIKELY (paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
|
if (G_UNLIKELY (paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
|
||||||
queued_redraw_clip = cairo_region_reference (redraw_clip);
|
queued_redraw_clip = mtk_region_ref (redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_return_if_fail (!cairo_region_is_empty (fb_clip_region));
|
g_return_if_fail (!mtk_region_is_empty (fb_clip_region));
|
||||||
|
|
||||||
/* XXX: It seems there will be a race here in that the stage
|
/* XXX: It seems there will be a race here in that the stage
|
||||||
* window may be resized before the cogl_onscreen_swap_region
|
* window may be resized before the cogl_onscreen_swap_region
|
||||||
@ -598,11 +598,11 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
*/
|
*/
|
||||||
/* swap_region does not need damage history, set it up before that */
|
/* swap_region does not need damage history, set it up before that */
|
||||||
if (!use_clipped_redraw)
|
if (!use_clipped_redraw)
|
||||||
swap_region = cairo_region_create ();
|
swap_region = mtk_region_create ();
|
||||||
else if (clutter_stage_view_has_shadowfb (stage_view))
|
else if (clutter_stage_view_has_shadowfb (stage_view))
|
||||||
swap_region = cairo_region_reference (fb_clip_region);
|
swap_region = mtk_region_ref (fb_clip_region);
|
||||||
else
|
else
|
||||||
swap_region = cairo_region_copy (fb_clip_region);
|
swap_region = mtk_region_copy (fb_clip_region);
|
||||||
|
|
||||||
swap_with_damage = FALSE;
|
swap_with_damage = FALSE;
|
||||||
if (has_buffer_age)
|
if (has_buffer_age)
|
||||||
@ -615,17 +615,17 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
|
|
||||||
for (age = 1; age <= buffer_age; age++)
|
for (age = 1; age <= buffer_age; age++)
|
||||||
{
|
{
|
||||||
const cairo_region_t *old_damage;
|
const MtkRegion *old_damage;
|
||||||
|
|
||||||
old_damage =
|
old_damage =
|
||||||
clutter_damage_history_lookup (damage_history, age);
|
clutter_damage_history_lookup (damage_history, age);
|
||||||
cairo_region_union (fb_clip_region, old_damage);
|
mtk_region_union (fb_clip_region, old_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_topic (META_DEBUG_BACKEND,
|
meta_topic (META_DEBUG_BACKEND,
|
||||||
"Reusing back buffer(age=%d) - repairing region: num rects: %d",
|
"Reusing back buffer(age=%d) - repairing region: num rects: %d",
|
||||||
buffer_age,
|
buffer_age,
|
||||||
cairo_region_num_rectangles (fb_clip_region));
|
mtk_region_num_rectangles (fb_clip_region));
|
||||||
|
|
||||||
swap_with_damage = TRUE;
|
swap_with_damage = TRUE;
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
* offset_scale_and_clamp_region. So we need to ensure redraw_clip
|
* offset_scale_and_clamp_region. So we need to ensure redraw_clip
|
||||||
* is a superset of fb_clip_region to avoid such gaps.
|
* is a superset of fb_clip_region to avoid such gaps.
|
||||||
*/
|
*/
|
||||||
cairo_region_destroy (redraw_clip);
|
g_clear_pointer (&redraw_clip, mtk_region_unref);
|
||||||
redraw_clip = scale_offset_and_clamp_region (fb_clip_region,
|
redraw_clip = scale_offset_and_clamp_region (fb_clip_region,
|
||||||
1.0 / fb_scale,
|
1.0 / fb_scale,
|
||||||
view_rect.x,
|
view_rect.x,
|
||||||
@ -652,11 +652,10 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
|
|
||||||
if (paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)
|
if (paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)
|
||||||
{
|
{
|
||||||
cairo_region_t *debug_redraw_clip;
|
g_autoptr (MtkRegion) debug_redraw_clip = NULL;
|
||||||
|
|
||||||
debug_redraw_clip = cairo_region_create_rectangle (&view_rect);
|
debug_redraw_clip = mtk_region_create_rectangle (&view_rect);
|
||||||
paint_stage (stage_impl, stage_view, debug_redraw_clip, frame);
|
paint_stage (stage_impl, stage_view, debug_redraw_clip, frame);
|
||||||
cairo_region_destroy (debug_redraw_clip);
|
|
||||||
}
|
}
|
||||||
else if (use_clipped_redraw)
|
else if (use_clipped_redraw)
|
||||||
{
|
{
|
||||||
@ -675,15 +674,15 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
paint_stage (stage_impl, stage_view, redraw_clip, frame);
|
paint_stage (stage_impl, stage_view, redraw_clip, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&redraw_clip, mtk_region_unref);
|
||||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
g_clear_pointer (&fb_clip_region, mtk_region_unref);
|
||||||
|
|
||||||
COGL_TRACE_BEGIN_SCOPED (MetaStageImplRedrawViewSwapFramebuffer,
|
COGL_TRACE_BEGIN_SCOPED (MetaStageImplRedrawViewSwapFramebuffer,
|
||||||
"Paint (swap framebuffer)");
|
"Paint (swap framebuffer)");
|
||||||
|
|
||||||
if (queued_redraw_clip)
|
if (queued_redraw_clip)
|
||||||
{
|
{
|
||||||
cairo_region_t *swap_region_in_stage_space;
|
g_autoptr (MtkRegion) swap_region_in_stage_space = NULL;
|
||||||
|
|
||||||
swap_region_in_stage_space =
|
swap_region_in_stage_space =
|
||||||
scale_offset_and_clamp_region (swap_region,
|
scale_offset_and_clamp_region (swap_region,
|
||||||
@ -691,25 +690,22 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
view_rect.x,
|
view_rect.x,
|
||||||
view_rect.y);
|
view_rect.y);
|
||||||
|
|
||||||
cairo_region_subtract (swap_region_in_stage_space, queued_redraw_clip);
|
mtk_region_subtract (swap_region_in_stage_space, queued_redraw_clip);
|
||||||
|
|
||||||
paint_damage_region (stage_window, stage_view,
|
paint_damage_region (stage_window, stage_view,
|
||||||
swap_region_in_stage_space, queued_redraw_clip);
|
swap_region_in_stage_space, queued_redraw_clip);
|
||||||
|
|
||||||
cairo_region_destroy (queued_redraw_clip);
|
|
||||||
cairo_region_destroy (swap_region_in_stage_space);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clutter_stage_view_get_onscreen (stage_view) !=
|
if (clutter_stage_view_get_onscreen (stage_view) !=
|
||||||
clutter_stage_view_get_framebuffer (stage_view) &&
|
clutter_stage_view_get_framebuffer (stage_view) &&
|
||||||
cairo_region_num_rectangles (swap_region) != 0)
|
mtk_region_num_rectangles (swap_region) != 0)
|
||||||
{
|
{
|
||||||
cairo_region_t *transformed_swap_region;
|
g_autoptr (MtkRegion) transformed_swap_region = NULL;
|
||||||
|
|
||||||
transformed_swap_region =
|
transformed_swap_region =
|
||||||
transform_swap_region_to_onscreen (stage_view, swap_region);
|
transform_swap_region_to_onscreen (stage_view, swap_region);
|
||||||
cairo_region_destroy (swap_region);
|
g_clear_pointer (&swap_region, mtk_region_unref);
|
||||||
swap_region = transformed_swap_region;
|
swap_region = g_steal_pointer (&transformed_swap_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
swap_framebuffer (stage_window,
|
swap_framebuffer (stage_window,
|
||||||
@ -717,8 +713,6 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
|||||||
swap_region,
|
swap_region,
|
||||||
swap_with_damage,
|
swap_with_damage,
|
||||||
frame);
|
frame);
|
||||||
|
|
||||||
cairo_region_destroy (swap_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -36,11 +36,11 @@ typedef enum
|
|||||||
META_STAGE_WATCH_AFTER_PAINT,
|
META_STAGE_WATCH_AFTER_PAINT,
|
||||||
} MetaStageWatchPhase;
|
} MetaStageWatchPhase;
|
||||||
|
|
||||||
typedef void (* MetaStageWatchFunc) (MetaStage *stage,
|
typedef void (* MetaStageWatchFunc) (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
ClutterActor *meta_stage_new (MetaBackend *backend);
|
ClutterActor *meta_stage_new (MetaBackend *backend);
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#include "backends/meta-stage-view.h"
|
#include "backends/meta-stage-view.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -175,11 +175,11 @@ meta_stage_finalize (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notify_watchers_for_mode (MetaStage *stage,
|
notify_watchers_for_mode (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
MetaStageWatchPhase watch_phase)
|
MetaStageWatchPhase watch_phase)
|
||||||
{
|
{
|
||||||
GPtrArray *watchers;
|
GPtrArray *watchers;
|
||||||
int i;
|
int i;
|
||||||
@ -215,7 +215,7 @@ meta_stage_paint (ClutterActor *actor,
|
|||||||
MetaStage *stage = META_STAGE (actor);
|
MetaStage *stage = META_STAGE (actor);
|
||||||
ClutterStageView *view;
|
ClutterStageView *view;
|
||||||
ClutterFrame *frame;
|
ClutterFrame *frame;
|
||||||
const cairo_region_t *redraw_clip;
|
const MtkRegion *redraw_clip;
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (meta_stage_parent_class)->paint (actor, paint_context);
|
CLUTTER_ACTOR_CLASS (meta_stage_parent_class)->paint (actor, paint_context);
|
||||||
|
|
||||||
@ -258,10 +258,10 @@ meta_stage_paint (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_stage_paint_view (ClutterStage *stage,
|
meta_stage_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame)
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
MetaStage *meta_stage = META_STAGE (stage);
|
MetaStage *meta_stage = META_STAGE (stage);
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ meta_backend_native_set_pointer_constraint (MetaBackend *backend,
|
|||||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||||
MetaPointerConstraintImpl *constraint_impl = NULL;
|
MetaPointerConstraintImpl *constraint_impl = NULL;
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
|
|
||||||
if (constraint)
|
if (constraint)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ struct _MetaPointerConstraintImplNative
|
|||||||
{
|
{
|
||||||
MetaPointerConstraintImpl parent;
|
MetaPointerConstraintImpl parent;
|
||||||
MetaPointerConstraint *constraint;
|
MetaPointerConstraint *constraint;
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
double min_edge_distance;
|
double min_edge_distance;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,8 +223,8 @@ add_band_bottom_edges (MetaBox *boxes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
region_to_outline (cairo_region_t *region,
|
region_to_outline (MtkRegion *region,
|
||||||
GArray *borders)
|
GArray *borders)
|
||||||
{
|
{
|
||||||
MetaBox *boxes;
|
MetaBox *boxes;
|
||||||
int num_boxes;
|
int num_boxes;
|
||||||
@ -249,12 +249,12 @@ region_to_outline (cairo_region_t *region,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
num_boxes = cairo_region_num_rectangles (region);
|
num_boxes = mtk_region_num_rectangles (region);
|
||||||
boxes = g_new (MetaBox, num_boxes);
|
boxes = g_new (MetaBox, num_boxes);
|
||||||
for (i = 0; i < num_boxes; i++)
|
for (i = 0; i < num_boxes; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
boxes[i] = (MetaBox) {
|
boxes[i] = (MetaBox) {
|
||||||
.x1 = rect.x,
|
.x1 = rect.x,
|
||||||
.y1 = rect.y,
|
.y1 = rect.y,
|
||||||
@ -451,7 +451,7 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
|
|||||||
float *y_inout)
|
float *y_inout)
|
||||||
{
|
{
|
||||||
MetaPointerConstraintImplNative *constraint_impl_native;
|
MetaPointerConstraintImplNative *constraint_impl_native;
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
float x, y;
|
float x, y;
|
||||||
g_autoptr (GArray) borders = NULL;
|
g_autoptr (GArray) borders = NULL;
|
||||||
MetaLine2 motion;
|
MetaLine2 motion;
|
||||||
@ -460,7 +460,7 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
|
|||||||
|
|
||||||
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
|
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
|
||||||
|
|
||||||
region = cairo_region_reference (constraint_impl_native->region);
|
region = mtk_region_ref (constraint_impl_native->region);
|
||||||
x = *x_inout;
|
x = *x_inout;
|
||||||
y = *y_inout;
|
y = *y_inout;
|
||||||
|
|
||||||
@ -484,7 +484,6 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
|
|||||||
* confined motion vectors.
|
* confined motion vectors.
|
||||||
*/
|
*/
|
||||||
region_to_outline (region, borders);
|
region_to_outline (region, borders);
|
||||||
cairo_region_destroy (region);
|
|
||||||
|
|
||||||
motion = (MetaLine2) {
|
motion = (MetaLine2) {
|
||||||
.a = (MetaVector2) {
|
.a = (MetaVector2) {
|
||||||
@ -590,19 +589,19 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
|
|||||||
{
|
{
|
||||||
MetaPointerConstraintImplNative *constraint_impl_native;
|
MetaPointerConstraintImplNative *constraint_impl_native;
|
||||||
graphene_point_t point;
|
graphene_point_t point;
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
|
|
||||||
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
|
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
|
||||||
region = cairo_region_reference (constraint_impl_native->region);
|
region = mtk_region_ref (constraint_impl_native->region);
|
||||||
|
|
||||||
clutter_seat_query_state (clutter_input_device_get_seat (device),
|
clutter_seat_query_state (clutter_input_device_get_seat (device),
|
||||||
device, NULL, &point, NULL);
|
device, NULL, &point, NULL);
|
||||||
x = point.x;
|
x = point.x;
|
||||||
y = point.y;
|
y = point.y;
|
||||||
|
|
||||||
if (!cairo_region_contains_point (region, (int) x, (int) y))
|
if (!mtk_region_contains_point (region, (int) x, (int) y))
|
||||||
{
|
{
|
||||||
g_autoptr (GArray) borders = NULL;
|
g_autoptr (GArray) borders = NULL;
|
||||||
float closest_distance_2 = FLT_MAX;
|
float closest_distance_2 = FLT_MAX;
|
||||||
@ -632,8 +631,6 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
|
|||||||
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||||
clutter_seat_warp_pointer (seat, x, y);
|
clutter_seat_warp_pointer (seat, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -642,7 +639,7 @@ meta_pointer_constraint_impl_native_finalize (GObject *object)
|
|||||||
MetaPointerConstraintImplNative *constraint_impl_native;
|
MetaPointerConstraintImplNative *constraint_impl_native;
|
||||||
|
|
||||||
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (object);
|
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (object);
|
||||||
g_clear_pointer (&constraint_impl_native->region, cairo_region_destroy);
|
g_clear_pointer (&constraint_impl_native->region, mtk_region_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_pointer_constraint_impl_native_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_pointer_constraint_impl_native_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -669,7 +666,7 @@ meta_pointer_constraint_impl_native_class_init (MetaPointerConstraintImplNativeC
|
|||||||
|
|
||||||
MetaPointerConstraintImpl *
|
MetaPointerConstraintImpl *
|
||||||
meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint,
|
meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint,
|
||||||
const cairo_region_t *region,
|
const MtkRegion *region,
|
||||||
double min_edge_distance)
|
double min_edge_distance)
|
||||||
{
|
{
|
||||||
MetaPointerConstraintImplNative *constraint_impl;
|
MetaPointerConstraintImplNative *constraint_impl;
|
||||||
@ -677,7 +674,7 @@ meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint,
|
|||||||
constraint_impl = g_object_new (META_TYPE_POINTER_CONSTRAINT_IMPL_NATIVE,
|
constraint_impl = g_object_new (META_TYPE_POINTER_CONSTRAINT_IMPL_NATIVE,
|
||||||
NULL);
|
NULL);
|
||||||
constraint_impl->constraint = constraint;
|
constraint_impl->constraint = constraint;
|
||||||
constraint_impl->region = cairo_region_copy (region);
|
constraint_impl->region = mtk_region_copy (region);
|
||||||
constraint_impl->min_edge_distance = min_edge_distance;
|
constraint_impl->min_edge_distance = min_edge_distance;
|
||||||
|
|
||||||
return META_POINTER_CONSTRAINT_IMPL (constraint_impl);
|
return META_POINTER_CONSTRAINT_IMPL (constraint_impl);
|
||||||
|
@ -36,7 +36,7 @@ G_DECLARE_FINAL_TYPE (MetaPointerConstraintImplNative,
|
|||||||
MetaPointerConstraintImpl)
|
MetaPointerConstraintImpl)
|
||||||
|
|
||||||
MetaPointerConstraintImpl * meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint_impl,
|
MetaPointerConstraintImpl * meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint_impl,
|
||||||
const cairo_region_t *region,
|
const MtkRegion *region,
|
||||||
double min_edge_distance);
|
double min_edge_distance);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -1024,7 +1024,7 @@ meta_compositor_real_before_paint (MetaCompositor *compositor,
|
|||||||
ClutterActor *stage = meta_backend_get_stage (priv->backend);
|
ClutterActor *stage = meta_backend_get_stage (priv->backend);
|
||||||
ClutterStageView *stage_view;
|
ClutterStageView *stage_view;
|
||||||
MtkRectangle stage_rect;
|
MtkRectangle stage_rect;
|
||||||
cairo_region_t *unobscured_region;
|
MtkRegion *unobscured_region;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
stage_rect = (MtkRectangle) {
|
stage_rect = (MtkRectangle) {
|
||||||
@ -1033,17 +1033,17 @@ meta_compositor_real_before_paint (MetaCompositor *compositor,
|
|||||||
clutter_actor_get_height (stage),
|
clutter_actor_get_height (stage),
|
||||||
};
|
};
|
||||||
|
|
||||||
unobscured_region = cairo_region_create_rectangle (&stage_rect);
|
unobscured_region = mtk_region_create_rectangle (&stage_rect);
|
||||||
meta_cullable_cull_unobscured (META_CULLABLE (priv->window_group), unobscured_region);
|
meta_cullable_cull_unobscured (META_CULLABLE (priv->window_group), unobscured_region);
|
||||||
cairo_region_destroy (unobscured_region);
|
mtk_region_unref (unobscured_region);
|
||||||
|
|
||||||
unobscured_region = cairo_region_create_rectangle (&stage_rect);
|
unobscured_region = mtk_region_create_rectangle (&stage_rect);
|
||||||
meta_cullable_cull_unobscured (META_CULLABLE (priv->top_window_group), unobscured_region);
|
meta_cullable_cull_unobscured (META_CULLABLE (priv->top_window_group), unobscured_region);
|
||||||
cairo_region_destroy (unobscured_region);
|
mtk_region_unref (unobscured_region);
|
||||||
|
|
||||||
unobscured_region = cairo_region_create_rectangle (&stage_rect);
|
unobscured_region = mtk_region_create_rectangle (&stage_rect);
|
||||||
meta_cullable_cull_unobscured (META_CULLABLE (priv->feedback_group), unobscured_region);
|
meta_cullable_cull_unobscured (META_CULLABLE (priv->feedback_group), unobscured_region);
|
||||||
cairo_region_destroy (unobscured_region);
|
mtk_region_unref (unobscured_region);
|
||||||
|
|
||||||
stage_view = meta_compositor_view_get_stage_view (compositor_view);
|
stage_view = meta_compositor_view_get_stage_view (compositor_view);
|
||||||
|
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
#include "meta/meta-background-actor.h"
|
#include "meta/meta-background-actor.h"
|
||||||
|
|
||||||
cairo_region_t *meta_background_actor_get_clip_region (MetaBackgroundActor *self);
|
MtkRegion *meta_background_actor_get_clip_region (MetaBackgroundActor *self);
|
||||||
|
@ -164,8 +164,8 @@ meta_background_actor_new (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_background_actor_cull_unobscured (MetaCullable *cullable,
|
meta_background_actor_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (cullable);
|
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (cullable);
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ meta_background_actor_cull_unobscured (MetaCullable *cullable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_background_actor_cull_redraw_clip (MetaCullable *cullable,
|
meta_background_actor_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (cullable);
|
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (cullable);
|
||||||
|
|
||||||
@ -198,11 +198,11 @@ cullable_iface_init (MetaCullableInterface *iface)
|
|||||||
* meta_background_actor_get_clip_region:
|
* meta_background_actor_get_clip_region:
|
||||||
* @self: a #MetaBackgroundActor
|
* @self: a #MetaBackgroundActor
|
||||||
*
|
*
|
||||||
* Return value (transfer none): a #cairo_region_t that represents the part of
|
* Return value (transfer none): a #MtkRegion that represents the part of
|
||||||
* the background not obscured by other #MetaBackgroundActor or
|
* the background not obscured by other #MetaBackgroundActor or
|
||||||
* #MetaWindowActor objects.
|
* #MetaWindowActor objects.
|
||||||
*/
|
*/
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_background_actor_get_clip_region (MetaBackgroundActor *self)
|
meta_background_actor_get_clip_region (MetaBackgroundActor *self)
|
||||||
{
|
{
|
||||||
if (!self->content)
|
if (!self->content)
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
#include "meta/meta-background-content.h"
|
#include "meta/meta-background-content.h"
|
||||||
|
|
||||||
cairo_region_t *meta_background_content_get_clip_region (MetaBackgroundContent *self);
|
MtkRegion *meta_background_content_get_clip_region (MetaBackgroundContent *self);
|
||||||
|
|
||||||
void meta_background_content_cull_unobscured (MetaBackgroundContent *self,
|
void meta_background_content_cull_unobscured (MetaBackgroundContent *self,
|
||||||
cairo_region_t *unobscured_region);
|
MtkRegion *unobscured_region);
|
||||||
|
|
||||||
void meta_background_content_cull_redraw_clip (MetaBackgroundContent *self,
|
void meta_background_content_cull_redraw_clip (MetaBackgroundContent *self,
|
||||||
cairo_region_t *clip_region);
|
MtkRegion *clip_region);
|
||||||
|
@ -232,8 +232,8 @@ struct _MetaBackgroundContent
|
|||||||
MtkRectangle texture_area;
|
MtkRectangle texture_area;
|
||||||
int texture_width, texture_height;
|
int texture_width, texture_height;
|
||||||
|
|
||||||
cairo_region_t *clip_region;
|
MtkRegion *clip_region;
|
||||||
cairo_region_t *unobscured_region;
|
MtkRegion *unobscured_region;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
static void clutter_content_iface_init (ClutterContentInterface *iface);
|
||||||
@ -264,29 +264,29 @@ static GParamSpec *properties[N_PROPS] = { NULL, };
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
set_clip_region (MetaBackgroundContent *self,
|
set_clip_region (MetaBackgroundContent *self,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&self->clip_region, cairo_region_destroy);
|
g_clear_pointer (&self->clip_region, mtk_region_unref);
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
{
|
{
|
||||||
if (cairo_region_is_empty (clip_region))
|
if (mtk_region_is_empty (clip_region))
|
||||||
self->clip_region = cairo_region_reference (clip_region);
|
self->clip_region = mtk_region_ref (clip_region);
|
||||||
else
|
else
|
||||||
self->clip_region = cairo_region_copy (clip_region);
|
self->clip_region = mtk_region_copy (clip_region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_unobscured_region (MetaBackgroundContent *self,
|
set_unobscured_region (MetaBackgroundContent *self,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&self->unobscured_region, cairo_region_destroy);
|
g_clear_pointer (&self->unobscured_region, mtk_region_unref);
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
{
|
{
|
||||||
if (cairo_region_is_empty (unobscured_region))
|
if (mtk_region_is_empty (unobscured_region))
|
||||||
self->unobscured_region = cairo_region_reference (unobscured_region);
|
self->unobscured_region = mtk_region_ref (unobscured_region);
|
||||||
else
|
else
|
||||||
self->unobscured_region = cairo_region_copy (unobscured_region);
|
self->unobscured_region = mtk_region_copy (unobscured_region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,12 +661,12 @@ meta_background_content_paint_content (ClutterContent *content,
|
|||||||
ClutterActorBox actor_box;
|
ClutterActorBox actor_box;
|
||||||
MtkRectangle rect_within_actor;
|
MtkRectangle rect_within_actor;
|
||||||
MtkRectangle rect_within_stage;
|
MtkRectangle rect_within_stage;
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
int i, n_rects;
|
int i, n_rects;
|
||||||
float transformed_x, transformed_y, transformed_width, transformed_height;
|
float transformed_x, transformed_y, transformed_width, transformed_height;
|
||||||
gboolean untransformed;
|
gboolean untransformed;
|
||||||
|
|
||||||
if ((self->clip_region && cairo_region_is_empty (self->clip_region)))
|
if ((self->clip_region && mtk_region_is_empty (self->clip_region)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clutter_actor_get_content_box (actor, &actor_box);
|
clutter_actor_get_content_box (actor, &actor_box);
|
||||||
@ -704,22 +704,22 @@ meta_background_content_paint_content (ClutterContent *content,
|
|||||||
{
|
{
|
||||||
if (self->clip_region)
|
if (self->clip_region)
|
||||||
{
|
{
|
||||||
region = cairo_region_copy (self->clip_region);
|
region = mtk_region_copy (self->clip_region);
|
||||||
cairo_region_intersect_rectangle (region, &rect_within_stage);
|
mtk_region_intersect_rectangle (region, &rect_within_stage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const cairo_region_t *redraw_clip;
|
const MtkRegion *redraw_clip;
|
||||||
|
|
||||||
redraw_clip = clutter_paint_context_get_redraw_clip (paint_context);
|
redraw_clip = clutter_paint_context_get_redraw_clip (paint_context);
|
||||||
if (redraw_clip)
|
if (redraw_clip)
|
||||||
{
|
{
|
||||||
region = cairo_region_copy (redraw_clip);
|
region = mtk_region_copy (redraw_clip);
|
||||||
cairo_region_intersect_rectangle (region, &rect_within_stage);
|
mtk_region_intersect_rectangle (region, &rect_within_stage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
region = cairo_region_create_rectangle (&rect_within_stage);
|
region = mtk_region_create_rectangle (&rect_within_stage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,24 +727,21 @@ meta_background_content_paint_content (ClutterContent *content,
|
|||||||
{
|
{
|
||||||
if (self->clip_region)
|
if (self->clip_region)
|
||||||
{
|
{
|
||||||
region = cairo_region_copy (self->clip_region);
|
region = mtk_region_copy (self->clip_region);
|
||||||
cairo_region_intersect_rectangle (region, &rect_within_actor);
|
mtk_region_intersect_rectangle (region, &rect_within_actor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
region = cairo_region_create_rectangle (&rect_within_actor);
|
region = mtk_region_create_rectangle (&rect_within_actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->unobscured_region)
|
if (self->unobscured_region)
|
||||||
cairo_region_intersect (region, self->unobscured_region);
|
mtk_region_intersect (region, self->unobscured_region);
|
||||||
|
|
||||||
/* region is now in actor space */
|
/* region is now in actor space */
|
||||||
if (cairo_region_is_empty (region))
|
if (mtk_region_is_empty (region))
|
||||||
{
|
return;
|
||||||
cairo_region_destroy (region);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_pipeline (self, actor, paint_context, &rect_within_actor);
|
setup_pipeline (self, actor, paint_context, &rect_within_actor);
|
||||||
set_glsl_parameters (self, &rect_within_actor);
|
set_glsl_parameters (self, &rect_within_actor);
|
||||||
@ -753,24 +750,22 @@ meta_background_content_paint_content (ClutterContent *content,
|
|||||||
* fall back and draw the whole thing */
|
* fall back and draw the whole thing */
|
||||||
#define MAX_RECTS 64
|
#define MAX_RECTS 64
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
if (n_rects <= MAX_RECTS)
|
if (n_rects <= MAX_RECTS)
|
||||||
{
|
{
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
paint_clipped_rectangle (self, node, &actor_box, &rect);
|
paint_clipped_rectangle (self, node, &actor_box, &rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_extents (region, &rect);
|
rect = mtk_region_get_extents (region);
|
||||||
paint_clipped_rectangle (self, node, &actor_box, &rect);
|
paint_clipped_rectangle (self, node, &actor_box, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -1208,7 +1203,7 @@ meta_background_content_set_rounded_clip_bounds (MetaBackgroundContent *self,
|
|||||||
clutter_content_invalidate (CLUTTER_CONTENT (self));
|
clutter_content_invalidate (CLUTTER_CONTENT (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_background_content_get_clip_region (MetaBackgroundContent *self)
|
meta_background_content_get_clip_region (MetaBackgroundContent *self)
|
||||||
{
|
{
|
||||||
return self->clip_region;
|
return self->clip_region;
|
||||||
@ -1216,14 +1211,14 @@ meta_background_content_get_clip_region (MetaBackgroundContent *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_background_content_cull_unobscured (MetaBackgroundContent *self,
|
meta_background_content_cull_unobscured (MetaBackgroundContent *self,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
set_unobscured_region (self, unobscured_region);
|
set_unobscured_region (self, unobscured_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_background_content_cull_redraw_clip (MetaBackgroundContent *self,
|
meta_background_content_cull_redraw_clip (MetaBackgroundContent *self,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
set_clip_region (self, clip_region);
|
set_clip_region (self, clip_region);
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ meta_background_group_class_init (MetaBackgroundGroupClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_background_group_cull_unobscured (MetaCullable *cullable,
|
meta_background_group_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_background_group_cull_redraw_clip (MetaCullable *cullable,
|
meta_background_group_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_redraw_clip_children (cullable, clip_region);
|
meta_cullable_cull_redraw_clip_children (cullable, clip_region);
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,12 @@ has_active_effects (ClutterActor *actor)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
region_apply_transform_expand_maybe_ref (cairo_region_t *region,
|
region_apply_transform_expand_maybe_ref (MtkRegion *region,
|
||||||
graphene_matrix_t *transform)
|
graphene_matrix_t *transform)
|
||||||
{
|
{
|
||||||
if (cairo_region_is_empty (region))
|
if (mtk_region_is_empty (region))
|
||||||
return cairo_region_reference (region);
|
return mtk_region_ref (region);
|
||||||
|
|
||||||
return meta_region_apply_matrix_transform_expand (region, transform);
|
return meta_region_apply_matrix_transform_expand (region, transform);
|
||||||
}
|
}
|
||||||
@ -75,12 +75,12 @@ region_apply_transform_expand_maybe_ref (cairo_region_t *region,
|
|||||||
* so that actors underneath know not to draw there as well.
|
* so that actors underneath know not to draw there as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef void (* ChildCullMethod) (MetaCullable *cullable,
|
typedef void (* ChildCullMethod) (MetaCullable *cullable,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cull_out_children_common (MetaCullable *cullable,
|
cull_out_children_common (MetaCullable *cullable,
|
||||||
cairo_region_t *region,
|
MtkRegion *region,
|
||||||
ChildCullMethod method)
|
ChildCullMethod method)
|
||||||
{
|
{
|
||||||
ClutterActor *actor = CLUTTER_ACTOR (cullable);
|
ClutterActor *actor = CLUTTER_ACTOR (cullable);
|
||||||
@ -121,7 +121,8 @@ cull_out_children_common (MetaCullable *cullable,
|
|||||||
|
|
||||||
if (needs_culling)
|
if (needs_culling)
|
||||||
{
|
{
|
||||||
cairo_region_t *actor_region, *reduced_region;
|
g_autoptr (MtkRegion) actor_region = NULL;
|
||||||
|
g_autoptr (MtkRegion) reduced_region = NULL;
|
||||||
graphene_matrix_t actor_transform, inverted_actor_transform;
|
graphene_matrix_t actor_transform, inverted_actor_transform;
|
||||||
|
|
||||||
clutter_actor_get_transform (child, &actor_transform);
|
clutter_actor_get_transform (child, &actor_transform);
|
||||||
@ -155,10 +156,7 @@ cull_out_children_common (MetaCullable *cullable,
|
|||||||
|
|
||||||
g_assert (reduced_region);
|
g_assert (reduced_region);
|
||||||
|
|
||||||
cairo_region_intersect (region, reduced_region);
|
mtk_region_intersect (region, reduced_region);
|
||||||
|
|
||||||
cairo_region_destroy (actor_region);
|
|
||||||
cairo_region_destroy (reduced_region);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -178,8 +176,8 @@ cull_out_children_common (MetaCullable *cullable,
|
|||||||
* See #MetaCullable and meta_cullable_cull_unobscured() for more details.
|
* See #MetaCullable and meta_cullable_cull_unobscured() for more details.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
meta_cullable_cull_unobscured_children (MetaCullable *cullable,
|
meta_cullable_cull_unobscured_children (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
cull_out_children_common (cullable,
|
cull_out_children_common (cullable,
|
||||||
unobscured_region,
|
unobscured_region,
|
||||||
@ -197,8 +195,8 @@ meta_cullable_cull_unobscured_children (MetaCullable *cullable,
|
|||||||
* See #MetaCullable and meta_cullable_cull_redraw_clip() for more details.
|
* See #MetaCullable and meta_cullable_cull_redraw_clip() for more details.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
meta_cullable_cull_redraw_clip_children (MetaCullable *cullable,
|
meta_cullable_cull_redraw_clip_children (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
cull_out_children_common (cullable,
|
cull_out_children_common (cullable,
|
||||||
clip_region,
|
clip_region,
|
||||||
@ -227,8 +225,8 @@ meta_cullable_default_init (MetaCullableInterface *iface)
|
|||||||
* helper method to do a simple cull across all their children.
|
* helper method to do a simple cull across all their children.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
meta_cullable_cull_unobscured (MetaCullable *cullable,
|
meta_cullable_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
META_CULLABLE_GET_IFACE (cullable)->cull_unobscured (cullable, unobscured_region);
|
META_CULLABLE_GET_IFACE (cullable)->cull_unobscured (cullable, unobscured_region);
|
||||||
}
|
}
|
||||||
@ -251,8 +249,8 @@ meta_cullable_cull_unobscured (MetaCullable *cullable,
|
|||||||
* helper method to do a simple cull across all their children.
|
* helper method to do a simple cull across all their children.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
meta_cullable_cull_redraw_clip (MetaCullable *cullable,
|
meta_cullable_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
META_CULLABLE_GET_IFACE (cullable)->cull_redraw_clip (cullable, clip_region);
|
META_CULLABLE_GET_IFACE (cullable)->cull_redraw_clip (cullable, clip_region);
|
||||||
}
|
}
|
||||||
|
@ -35,21 +35,21 @@ struct _MetaCullableInterface
|
|||||||
{
|
{
|
||||||
GTypeInterface g_iface;
|
GTypeInterface g_iface;
|
||||||
|
|
||||||
void (* cull_unobscured) (MetaCullable *cullable,
|
void (* cull_unobscured) (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region);
|
MtkRegion *unobscured_region);
|
||||||
void (* cull_redraw_clip) (MetaCullable *cullable,
|
void (* cull_redraw_clip) (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region);
|
MtkRegion *clip_region);
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_cullable_cull_unobscured (MetaCullable *cullable,
|
void meta_cullable_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region);
|
MtkRegion *unobscured_region);
|
||||||
void meta_cullable_cull_redraw_clip (MetaCullable *cullable,
|
void meta_cullable_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region);
|
MtkRegion *clip_region);
|
||||||
|
|
||||||
/* Utility methods for implementations */
|
/* Utility methods for implementations */
|
||||||
void meta_cullable_cull_unobscured_children (MetaCullable *cullable,
|
void meta_cullable_cull_unobscured_children (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region);
|
MtkRegion *unobscured_region);
|
||||||
void meta_cullable_cull_redraw_clip_children (MetaCullable *cullable,
|
void meta_cullable_cull_redraw_clip_children (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region);
|
MtkRegion *clip_region);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -200,7 +200,7 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
int window_width,
|
int window_width,
|
||||||
int window_height,
|
int window_height,
|
||||||
guint8 opacity,
|
guint8 opacity,
|
||||||
cairo_region_t *clip,
|
MtkRegion *clip,
|
||||||
gboolean clip_strictly)
|
gboolean clip_strictly)
|
||||||
{
|
{
|
||||||
float texture_width = cogl_texture_get_width (shadow->texture);
|
float texture_width = cogl_texture_get_width (shadow->texture);
|
||||||
@ -212,7 +212,7 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
int dest_y[4];
|
int dest_y[4];
|
||||||
int n_x, n_y;
|
int n_x, n_y;
|
||||||
|
|
||||||
if (clip && cairo_region_is_empty (clip))
|
if (clip && mtk_region_is_empty (clip))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (shadow->pipeline,
|
cogl_pipeline_set_color4ub (shadow->pipeline,
|
||||||
@ -279,7 +279,7 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
|
|
||||||
for (i = 0; i < n_x; i++)
|
for (i = 0; i < n_x; i++)
|
||||||
{
|
{
|
||||||
cairo_region_overlap_t overlap;
|
MtkRegionOverlap overlap;
|
||||||
|
|
||||||
dest_rect.x = dest_x[i];
|
dest_rect.x = dest_x[i];
|
||||||
dest_rect.width = dest_x[i + 1] - dest_x[i];
|
dest_rect.width = dest_x[i + 1] - dest_x[i];
|
||||||
@ -288,11 +288,11 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (clip)
|
if (clip)
|
||||||
overlap = cairo_region_contains_rectangle (clip, &dest_rect);
|
overlap = mtk_region_contains_rectangle (clip, &dest_rect);
|
||||||
else
|
else
|
||||||
overlap = CAIRO_REGION_OVERLAP_IN;
|
overlap = MTK_REGION_OVERLAP_IN;
|
||||||
|
|
||||||
if (overlap == CAIRO_REGION_OVERLAP_OUT)
|
if (overlap == MTK_REGION_OVERLAP_OUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* There's quite a bit of overhead from allocating a new
|
/* There's quite a bit of overhead from allocating a new
|
||||||
@ -301,8 +301,8 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
* unless we have to clip strictly it will be cheaper to
|
* unless we have to clip strictly it will be cheaper to
|
||||||
* just draw the entire rectangle.
|
* just draw the entire rectangle.
|
||||||
*/
|
*/
|
||||||
if (overlap == CAIRO_REGION_OVERLAP_IN ||
|
if (overlap == MTK_REGION_OVERLAP_IN ||
|
||||||
(overlap == CAIRO_REGION_OVERLAP_PART && !clip_strictly))
|
(overlap == MTK_REGION_OVERLAP_PART && !clip_strictly))
|
||||||
{
|
{
|
||||||
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
||||||
shadow->pipeline,
|
shadow->pipeline,
|
||||||
@ -311,21 +311,21 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
src_x[i], src_y[j],
|
src_x[i], src_y[j],
|
||||||
src_x[i + 1], src_y[j + 1]);
|
src_x[i + 1], src_y[j + 1]);
|
||||||
}
|
}
|
||||||
else if (overlap == CAIRO_REGION_OVERLAP_PART)
|
else if (overlap == MTK_REGION_OVERLAP_PART)
|
||||||
{
|
{
|
||||||
cairo_region_t *intersection;
|
g_autoptr (MtkRegion) intersection = NULL;
|
||||||
int n_rectangles, k;
|
int n_rectangles, k;
|
||||||
|
|
||||||
intersection = cairo_region_create_rectangle (&dest_rect);
|
intersection = mtk_region_create_rectangle (&dest_rect);
|
||||||
cairo_region_intersect (intersection, clip);
|
mtk_region_intersect (intersection, clip);
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (intersection);
|
n_rectangles = mtk_region_num_rectangles (intersection);
|
||||||
for (k = 0; k < n_rectangles; k++)
|
for (k = 0; k < n_rectangles; k++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
float src_x1, src_x2, src_y1, src_y2;
|
float src_x1, src_x2, src_y1, src_y2;
|
||||||
|
|
||||||
cairo_region_get_rectangle (intersection, k, &rect);
|
rect = mtk_region_get_rectangle (intersection, k);
|
||||||
|
|
||||||
/* Separately linear interpolate X and Y coordinates in the source
|
/* Separately linear interpolate X and Y coordinates in the source
|
||||||
* based on the destination X and Y coordinates */
|
* based on the destination X and Y coordinates */
|
||||||
@ -346,8 +346,6 @@ meta_shadow_paint (MetaShadow *shadow,
|
|||||||
rect.x + rect.width, rect.y + rect.height,
|
rect.x + rect.width, rect.y + rect.height,
|
||||||
src_x1, src_y1, src_x2, src_y2);
|
src_x1, src_y1, src_x2, src_y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (intersection);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,13 +563,13 @@ blur_xspan (guchar *row,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
blur_rows (cairo_region_t *convolve_region,
|
blur_rows (MtkRegion *convolve_region,
|
||||||
int x_offset,
|
int x_offset,
|
||||||
int y_offset,
|
int y_offset,
|
||||||
guchar *buffer,
|
guchar *buffer,
|
||||||
int buffer_width,
|
int buffer_width,
|
||||||
int buffer_height,
|
int buffer_height,
|
||||||
int d)
|
int d)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int n_rectangles;
|
int n_rectangles;
|
||||||
@ -579,12 +577,12 @@ blur_rows (cairo_region_t *convolve_region,
|
|||||||
|
|
||||||
tmp_buffer = g_malloc (buffer_width);
|
tmp_buffer = g_malloc (buffer_width);
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (convolve_region);
|
n_rectangles = mtk_region_num_rectangles (convolve_region);
|
||||||
for (i = 0; i < n_rectangles; i++)
|
for (i = 0; i < n_rectangles; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (convolve_region, i, &rect);
|
rect = mtk_region_get_rectangle (convolve_region, i);
|
||||||
|
|
||||||
for (j = y_offset + rect.y; j < y_offset + rect.y + rect.height; j++)
|
for (j = y_offset + rect.y; j < y_offset + rect.y + rect.height; j++)
|
||||||
{
|
{
|
||||||
@ -702,8 +700,8 @@ flip_buffer (guchar *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_shadow (MetaShadow *shadow,
|
make_shadow (MetaShadow *shadow,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
||||||
@ -711,8 +709,8 @@ make_shadow (MetaShadow *shadow,
|
|||||||
int d = get_box_filter_size (shadow->key.radius);
|
int d = get_box_filter_size (shadow->key.radius);
|
||||||
int spread = get_shadow_spread (shadow->key.radius);
|
int spread = get_shadow_spread (shadow->key.radius);
|
||||||
MtkRectangle extents;
|
MtkRectangle extents;
|
||||||
cairo_region_t *row_convolve_region;
|
g_autoptr (MtkRegion) row_convolve_region = NULL;
|
||||||
cairo_region_t *column_convolve_region;
|
g_autoptr (MtkRegion) column_convolve_region = NULL;
|
||||||
guchar *buffer;
|
guchar *buffer;
|
||||||
int buffer_width;
|
int buffer_width;
|
||||||
int buffer_height;
|
int buffer_height;
|
||||||
@ -720,7 +718,7 @@ make_shadow (MetaShadow *shadow,
|
|||||||
int y_offset;
|
int y_offset;
|
||||||
int n_rectangles, j, k;
|
int n_rectangles, j, k;
|
||||||
|
|
||||||
cairo_region_get_extents (region, &extents);
|
extents = mtk_region_get_extents (region);
|
||||||
|
|
||||||
/* In the case where top_fade >= 0 and the portion above the top
|
/* In the case where top_fade >= 0 and the portion above the top
|
||||||
* edge of the shape will be cropped, it seems like we could create
|
* edge of the shape will be cropped, it seems like we could create
|
||||||
@ -760,12 +758,12 @@ make_shadow (MetaShadow *shadow,
|
|||||||
y_offset = spread;
|
y_offset = spread;
|
||||||
|
|
||||||
/* Step 1: unblurred image */
|
/* Step 1: unblurred image */
|
||||||
n_rectangles = cairo_region_num_rectangles (region);
|
n_rectangles = mtk_region_num_rectangles (region);
|
||||||
for (k = 0; k < n_rectangles; k++)
|
for (k = 0; k < n_rectangles; k++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, k, &rect);
|
rect = mtk_region_get_rectangle (region, k);
|
||||||
for (j = y_offset + rect.y; j < y_offset + rect.y + rect.height; j++)
|
for (j = y_offset + rect.y; j < y_offset + rect.y + rect.height; j++)
|
||||||
memset (buffer + buffer_width * j + x_offset + rect.x, 255, rect.width);
|
memset (buffer + buffer_width * j + x_offset + rect.x, 255, rect.width);
|
||||||
}
|
}
|
||||||
@ -813,8 +811,6 @@ make_shadow (MetaShadow *shadow,
|
|||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (row_convolve_region);
|
|
||||||
cairo_region_destroy (column_convolve_region);
|
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
|
|
||||||
shadow->pipeline = meta_create_texture_pipeline (shadow->texture);
|
shadow->pipeline = meta_create_texture_pipeline (shadow->texture);
|
||||||
@ -880,7 +876,7 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
|
|||||||
MetaShadowParams *params;
|
MetaShadowParams *params;
|
||||||
MetaShadowCacheKey key;
|
MetaShadowCacheKey key;
|
||||||
MetaShadow *shadow;
|
MetaShadow *shadow;
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
int spread;
|
int spread;
|
||||||
int shape_border_top, shape_border_right, shape_border_bottom, shape_border_left;
|
int shape_border_top, shape_border_right, shape_border_bottom, shape_border_left;
|
||||||
int inner_border_top, inner_border_right, inner_border_bottom, inner_border_left;
|
int inner_border_top, inner_border_right, inner_border_bottom, inner_border_left;
|
||||||
@ -983,8 +979,6 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
|
|||||||
region = meta_window_shape_to_region (shape, center_width, center_height);
|
region = meta_window_shape_to_region (shape, center_width, center_height);
|
||||||
make_shadow (shadow, region);
|
make_shadow (shadow, region);
|
||||||
|
|
||||||
cairo_region_destroy (region);
|
|
||||||
|
|
||||||
if (cacheable)
|
if (cacheable)
|
||||||
g_hash_table_insert (factory->shadows, &shadow->key, shadow);
|
g_hash_table_insert (factory->shadows, &shadow->key, shadow);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
|
|||||||
void meta_shaped_texture_set_fallback_size (MetaShapedTexture *stex,
|
void meta_shaped_texture_set_fallback_size (MetaShapedTexture *stex,
|
||||||
int fallback_width,
|
int fallback_width,
|
||||||
int fallback_height);
|
int fallback_height);
|
||||||
cairo_region_t * meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex);
|
MtkRegion * meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex);
|
||||||
gboolean meta_shaped_texture_is_opaque (MetaShapedTexture *stex);
|
gboolean meta_shaped_texture_is_opaque (MetaShapedTexture *stex);
|
||||||
gboolean meta_shaped_texture_has_alpha (MetaShapedTexture *stex);
|
gboolean meta_shaped_texture_has_alpha (MetaShapedTexture *stex);
|
||||||
void meta_shaped_texture_set_transform (MetaShapedTexture *stex,
|
void meta_shaped_texture_set_transform (MetaShapedTexture *stex,
|
||||||
@ -67,9 +67,9 @@ float meta_shaped_texture_get_unscaled_width (MetaShapedTexture *stex);
|
|||||||
float meta_shaped_texture_get_unscaled_height (MetaShapedTexture *stex);
|
float meta_shaped_texture_get_unscaled_height (MetaShapedTexture *stex);
|
||||||
|
|
||||||
void meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
|
void meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *clip_region);
|
MtkRegion *clip_region);
|
||||||
void meta_shaped_texture_set_opaque_region (MetaShapedTexture *stex,
|
void meta_shaped_texture_set_opaque_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *opaque_region);
|
MtkRegion *opaque_region);
|
||||||
|
|
||||||
void meta_shaped_texture_ensure_size_valid (MetaShapedTexture *stex);
|
void meta_shaped_texture_ensure_size_valid (MetaShapedTexture *stex);
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ struct _MetaShapedTexture
|
|||||||
gboolean is_y_inverted;
|
gboolean is_y_inverted;
|
||||||
|
|
||||||
/* The region containing only fully opaque pixels */
|
/* The region containing only fully opaque pixels */
|
||||||
cairo_region_t *opaque_region;
|
MtkRegion *opaque_region;
|
||||||
|
|
||||||
/* MetaCullable regions, see that documentation for more details */
|
/* MetaCullable regions, see that documentation for more details */
|
||||||
cairo_region_t *clip_region;
|
MtkRegion *clip_region;
|
||||||
|
|
||||||
gboolean size_invalid;
|
gboolean size_invalid;
|
||||||
MetaMonitorTransform transform;
|
MetaMonitorTransform transform;
|
||||||
@ -216,11 +216,11 @@ meta_shaped_texture_ensure_size_valid (MetaShapedTexture *stex)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
|
meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&stex->clip_region, cairo_region_destroy);
|
g_clear_pointer (&stex->clip_region, mtk_region_unref);
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
stex->clip_region = cairo_region_reference (clip_region);
|
stex->clip_region = mtk_region_ref (clip_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -248,8 +248,8 @@ meta_shaped_texture_dispose (GObject *object)
|
|||||||
meta_shaped_texture_set_mask_texture (stex, NULL);
|
meta_shaped_texture_set_mask_texture (stex, NULL);
|
||||||
meta_shaped_texture_reset_pipelines (stex);
|
meta_shaped_texture_reset_pipelines (stex);
|
||||||
|
|
||||||
g_clear_pointer (&stex->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&stex->opaque_region, mtk_region_unref);
|
||||||
g_clear_pointer (&stex->clip_region, cairo_region_destroy);
|
g_clear_pointer (&stex->clip_region, mtk_region_unref);
|
||||||
|
|
||||||
g_clear_pointer (&stex->snippet, g_object_unref);
|
g_clear_pointer (&stex->snippet, g_object_unref);
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
int dst_width, dst_height;
|
int dst_width, dst_height;
|
||||||
MtkRectangle content_rect;
|
MtkRectangle content_rect;
|
||||||
gboolean use_opaque_region;
|
gboolean use_opaque_region;
|
||||||
cairo_region_t *blended_tex_region;
|
MtkRegion *blended_tex_region;
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
CoglPipelineFilter min_filter, mag_filter;
|
CoglPipelineFilter min_filter, mag_filter;
|
||||||
MetaTransforms transforms;
|
MetaTransforms transforms;
|
||||||
@ -710,16 +710,16 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
if (use_opaque_region)
|
if (use_opaque_region)
|
||||||
{
|
{
|
||||||
if (stex->clip_region)
|
if (stex->clip_region)
|
||||||
blended_tex_region = cairo_region_copy (stex->clip_region);
|
blended_tex_region = mtk_region_copy (stex->clip_region);
|
||||||
else
|
else
|
||||||
blended_tex_region = cairo_region_create_rectangle (&content_rect);
|
blended_tex_region = mtk_region_create_rectangle (&content_rect);
|
||||||
|
|
||||||
cairo_region_subtract (blended_tex_region, stex->opaque_region);
|
mtk_region_subtract (blended_tex_region, stex->opaque_region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (stex->clip_region)
|
if (stex->clip_region)
|
||||||
blended_tex_region = cairo_region_reference (stex->clip_region);
|
blended_tex_region = mtk_region_ref (stex->clip_region);
|
||||||
else
|
else
|
||||||
blended_tex_region = NULL;
|
blended_tex_region = NULL;
|
||||||
}
|
}
|
||||||
@ -730,13 +730,13 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
|
|
||||||
if (blended_tex_region)
|
if (blended_tex_region)
|
||||||
{
|
{
|
||||||
int n_rects = cairo_region_num_rectangles (blended_tex_region);
|
int n_rects = mtk_region_num_rectangles (blended_tex_region);
|
||||||
if (n_rects > MAX_RECTS)
|
if (n_rects > MAX_RECTS)
|
||||||
{
|
{
|
||||||
/* Fall back to taking the fully blended path. */
|
/* Fall back to taking the fully blended path. */
|
||||||
use_opaque_region = FALSE;
|
use_opaque_region = FALSE;
|
||||||
|
|
||||||
g_clear_pointer (&blended_tex_region, cairo_region_destroy);
|
g_clear_pointer (&blended_tex_region, mtk_region_unref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,21 +745,21 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
/* First, paint the unblended parts, which are part of the opaque region. */
|
/* First, paint the unblended parts, which are part of the opaque region. */
|
||||||
if (use_opaque_region)
|
if (use_opaque_region)
|
||||||
{
|
{
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
int n_rects;
|
int n_rects;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (stex->clip_region)
|
if (stex->clip_region)
|
||||||
{
|
{
|
||||||
region = cairo_region_copy (stex->clip_region);
|
region = mtk_region_copy (stex->clip_region);
|
||||||
cairo_region_intersect (region, stex->opaque_region);
|
mtk_region_intersect (region, stex->opaque_region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
region = cairo_region_reference (stex->opaque_region);
|
region = mtk_region_ref (stex->opaque_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cairo_region_is_empty (region))
|
if (!mtk_region_is_empty (region))
|
||||||
{
|
{
|
||||||
CoglPipeline *opaque_pipeline;
|
CoglPipeline *opaque_pipeline;
|
||||||
|
|
||||||
@ -774,11 +774,11 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
min_filter, mag_filter);
|
min_filter, mag_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
paint_clipped_rectangle_node (stex, root_node,
|
paint_clipped_rectangle_node (stex, root_node,
|
||||||
opaque_pipeline,
|
opaque_pipeline,
|
||||||
&rect, alloc);
|
&rect, alloc);
|
||||||
@ -794,8 +794,6 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, go ahead and paint the blended parts. */
|
/* Now, go ahead and paint the blended parts. */
|
||||||
@ -808,7 +806,7 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
* 1) and 3) are the times where we have to paint stuff. This tests
|
* 1) and 3) are the times where we have to paint stuff. This tests
|
||||||
* for 1) and 3).
|
* for 1) and 3).
|
||||||
*/
|
*/
|
||||||
if (!blended_tex_region || !cairo_region_is_empty (blended_tex_region))
|
if (!blended_tex_region || !mtk_region_is_empty (blended_tex_region))
|
||||||
{
|
{
|
||||||
CoglPipeline *blended_pipeline;
|
CoglPipeline *blended_pipeline;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
@ -840,12 +838,12 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
{
|
{
|
||||||
/* 1) blended_tex_region is not empty. Paint the rectangles. */
|
/* 1) blended_tex_region is not empty. Paint the rectangles. */
|
||||||
int i;
|
int i;
|
||||||
int n_rects = cairo_region_num_rectangles (blended_tex_region);
|
int n_rects = mtk_region_num_rectangles (blended_tex_region);
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (blended_tex_region, i, &rect);
|
rect = mtk_region_get_rectangle (blended_tex_region, i);
|
||||||
|
|
||||||
if (!mtk_rectangle_intersect (&content_rect, &rect, &rect))
|
if (!mtk_rectangle_intersect (&content_rect, &rect, &rect))
|
||||||
continue;
|
continue;
|
||||||
@ -892,7 +890,7 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer (&blended_tex_region, cairo_region_destroy);
|
g_clear_pointer (&blended_tex_region, mtk_region_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -905,7 +903,7 @@ meta_shaped_texture_paint_content (ClutterContent *content,
|
|||||||
ClutterActorBox alloc;
|
ClutterActorBox alloc;
|
||||||
uint8_t opacity;
|
uint8_t opacity;
|
||||||
|
|
||||||
if (stex->clip_region && cairo_region_is_empty (stex->clip_region))
|
if (stex->clip_region && mtk_region_is_empty (stex->clip_region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The GL EXT_texture_from_pixmap extension does allow for it to be
|
/* The GL EXT_texture_from_pixmap extension does allow for it to be
|
||||||
@ -1190,14 +1188,14 @@ meta_shaped_texture_get_texture (MetaShapedTexture *stex)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
meta_shaped_texture_set_opaque_region (MetaShapedTexture *stex,
|
meta_shaped_texture_set_opaque_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *opaque_region)
|
MtkRegion *opaque_region)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&stex->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&stex->opaque_region, mtk_region_unref);
|
||||||
if (opaque_region)
|
if (opaque_region)
|
||||||
stex->opaque_region = cairo_region_reference (opaque_region);
|
stex->opaque_region = mtk_region_ref (opaque_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex)
|
meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
return stex->opaque_region;
|
return stex->opaque_region;
|
||||||
@ -1248,18 +1246,16 @@ meta_shaped_texture_is_opaque (MetaShapedTexture *stex)
|
|||||||
if (!stex->opaque_region)
|
if (!stex->opaque_region)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (cairo_region_num_rectangles (stex->opaque_region) != 1)
|
if (mtk_region_num_rectangles (stex->opaque_region) != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
cairo_region_get_extents (stex->opaque_region, &opaque_rect);
|
opaque_rect = mtk_region_get_extents (stex->opaque_region);
|
||||||
|
|
||||||
meta_shaped_texture_ensure_size_valid (stex);
|
meta_shaped_texture_ensure_size_valid (stex);
|
||||||
|
|
||||||
return mtk_rectangle_equal (&opaque_rect,
|
return mtk_rectangle_equal (&opaque_rect,
|
||||||
&(MtkRectangle) {
|
&MTK_RECTANGLE_INIT (0, 0,
|
||||||
.width = stex->dst_width,
|
stex->dst_width, stex->dst_height));
|
||||||
.height = stex->dst_height
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -42,14 +42,14 @@ typedef struct _MetaSurfaceActorPrivate
|
|||||||
{
|
{
|
||||||
MetaShapedTexture *texture;
|
MetaShapedTexture *texture;
|
||||||
|
|
||||||
cairo_region_t *input_region;
|
MtkRegion *input_region;
|
||||||
|
|
||||||
/* MetaCullable regions, see that documentation for more details */
|
/* MetaCullable regions, see that documentation for more details */
|
||||||
cairo_region_t *unobscured_region;
|
MtkRegion *unobscured_region;
|
||||||
gboolean is_obscured;
|
gboolean is_obscured;
|
||||||
|
|
||||||
/* Freeze/thaw accounting */
|
/* Freeze/thaw accounting */
|
||||||
cairo_region_t *pending_damage;
|
MtkRegion *pending_damage;
|
||||||
guint frozen : 1;
|
guint frozen : 1;
|
||||||
} MetaSurfaceActorPrivate;
|
} MetaSurfaceActorPrivate;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ typedef enum
|
|||||||
IN_ACTOR_PERSPECTIVE
|
IN_ACTOR_PERSPECTIVE
|
||||||
} ScalePerspectiveType;
|
} ScalePerspectiveType;
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
effective_unobscured_region (MetaSurfaceActor *surface_actor)
|
effective_unobscured_region (MetaSurfaceActor *surface_actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
@ -94,13 +94,13 @@ update_is_obscured (MetaSurfaceActor *surface_actor)
|
|||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (surface_actor);
|
meta_surface_actor_get_instance_private (surface_actor);
|
||||||
cairo_region_t *unobscured_region;
|
MtkRegion *unobscured_region;
|
||||||
gboolean is_obscured;
|
gboolean is_obscured;
|
||||||
|
|
||||||
unobscured_region = priv->unobscured_region;
|
unobscured_region = priv->unobscured_region;
|
||||||
|
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
is_obscured = cairo_region_is_empty (unobscured_region);
|
is_obscured = mtk_region_is_empty (unobscured_region);
|
||||||
else
|
else
|
||||||
is_obscured = FALSE;
|
is_obscured = FALSE;
|
||||||
|
|
||||||
@ -114,17 +114,17 @@ update_is_obscured (MetaSurfaceActor *surface_actor)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
set_unobscured_region (MetaSurfaceActor *surface_actor,
|
set_unobscured_region (MetaSurfaceActor *surface_actor,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (surface_actor);
|
meta_surface_actor_get_instance_private (surface_actor);
|
||||||
|
|
||||||
g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
|
g_clear_pointer (&priv->unobscured_region, mtk_region_unref);
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
{
|
{
|
||||||
if (cairo_region_is_empty (unobscured_region))
|
if (mtk_region_is_empty (unobscured_region))
|
||||||
{
|
{
|
||||||
priv->unobscured_region = cairo_region_reference (unobscured_region);
|
priv->unobscured_region = mtk_region_ref (unobscured_region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -139,9 +139,9 @@ set_unobscured_region (MetaSurfaceActor *surface_actor,
|
|||||||
.height = height,
|
.height = height,
|
||||||
};
|
};
|
||||||
|
|
||||||
priv->unobscured_region = cairo_region_copy (unobscured_region);
|
priv->unobscured_region = mtk_region_copy (unobscured_region);
|
||||||
|
|
||||||
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
mtk_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,25 +150,17 @@ set_unobscured_region (MetaSurfaceActor *surface_actor,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
set_clip_region (MetaSurfaceActor *surface_actor,
|
set_clip_region (MetaSurfaceActor *surface_actor,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (surface_actor);
|
meta_surface_actor_get_instance_private (surface_actor);
|
||||||
MetaShapedTexture *stex = priv->texture;
|
MetaShapedTexture *stex = priv->texture;
|
||||||
|
|
||||||
if (clip_region && !cairo_region_is_empty (clip_region))
|
if (clip_region && !mtk_region_is_empty (clip_region))
|
||||||
{
|
meta_shaped_texture_set_clip_region (stex,
|
||||||
cairo_region_t *clip_region_copy;
|
mtk_region_copy (clip_region));
|
||||||
|
|
||||||
clip_region_copy = cairo_region_copy (clip_region);
|
|
||||||
meta_shaped_texture_set_clip_region (stex, clip_region_copy);
|
|
||||||
|
|
||||||
cairo_region_destroy (clip_region_copy);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
meta_shaped_texture_set_clip_region (stex, clip_region);
|
||||||
meta_shaped_texture_set_clip_region (stex, clip_region);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -197,14 +189,14 @@ meta_surface_actor_pick (ClutterActor *actor,
|
|||||||
int n_rects;
|
int n_rects;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (priv->input_region);
|
n_rects = mtk_region_num_rectangles (priv->input_region);
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
ClutterActorBox box;
|
ClutterActorBox box;
|
||||||
|
|
||||||
cairo_region_get_rectangle (priv->input_region, i, &rect);
|
rect = mtk_region_get_rectangle (priv->input_region, i);
|
||||||
|
|
||||||
box.x1 = rect.x;
|
box.x1 = rect.x;
|
||||||
box.y1 = rect.y;
|
box.y1 = rect.y;
|
||||||
@ -255,7 +247,7 @@ meta_surface_actor_dispose (GObject *object)
|
|||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (self);
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
|
||||||
g_clear_pointer (&priv->input_region, cairo_region_destroy);
|
g_clear_pointer (&priv->input_region, mtk_region_unref);
|
||||||
g_clear_object (&priv->texture);
|
g_clear_object (&priv->texture);
|
||||||
|
|
||||||
set_unobscured_region (self, NULL);
|
set_unobscured_region (self, NULL);
|
||||||
@ -306,7 +298,7 @@ meta_surface_actor_is_opaque (MetaSurfaceActor *self)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
subtract_opaque_region (MetaSurfaceActor *surface_actor,
|
subtract_opaque_region (MetaSurfaceActor *surface_actor,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (surface_actor);
|
meta_surface_actor_get_instance_private (surface_actor);
|
||||||
@ -317,20 +309,20 @@ subtract_opaque_region (MetaSurfaceActor *surface_actor,
|
|||||||
|
|
||||||
if (opacity == 0xff)
|
if (opacity == 0xff)
|
||||||
{
|
{
|
||||||
cairo_region_t *opaque_region;
|
MtkRegion *opaque_region;
|
||||||
|
|
||||||
opaque_region = meta_shaped_texture_get_opaque_region (priv->texture);
|
opaque_region = meta_shaped_texture_get_opaque_region (priv->texture);
|
||||||
|
|
||||||
if (!opaque_region)
|
if (!opaque_region)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cairo_region_subtract (region, opaque_region);
|
mtk_region_subtract (region, opaque_region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_surface_actor_cull_redraw_clip (MetaCullable *cullable,
|
meta_surface_actor_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (cullable);
|
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (cullable);
|
||||||
|
|
||||||
@ -340,8 +332,8 @@ meta_surface_actor_cull_redraw_clip (MetaCullable *cullable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_surface_actor_cull_unobscured (MetaCullable *cullable,
|
meta_surface_actor_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (cullable);
|
MetaSurfaceActor *surface_actor = META_SURFACE_ACTOR (cullable);
|
||||||
|
|
||||||
@ -404,37 +396,35 @@ meta_surface_actor_update_area (MetaSurfaceActor *self,
|
|||||||
|
|
||||||
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height, &clip))
|
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height, &clip))
|
||||||
{
|
{
|
||||||
cairo_region_t *unobscured_region;
|
MtkRegion *unobscured_region;
|
||||||
|
|
||||||
unobscured_region = effective_unobscured_region (self);
|
unobscured_region = effective_unobscured_region (self);
|
||||||
|
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
{
|
{
|
||||||
cairo_region_t *intersection;
|
g_autoptr (MtkRegion) intersection = NULL;
|
||||||
|
|
||||||
if (cairo_region_is_empty (unobscured_region))
|
if (mtk_region_is_empty (unobscured_region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
intersection = cairo_region_copy (unobscured_region);
|
intersection = mtk_region_copy (unobscured_region);
|
||||||
cairo_region_intersect_rectangle (intersection, &clip);
|
mtk_region_intersect_rectangle (intersection, &clip);
|
||||||
|
|
||||||
if (!cairo_region_is_empty (intersection))
|
if (!mtk_region_is_empty (intersection))
|
||||||
{
|
{
|
||||||
int i, n_rectangles;
|
int i, n_rectangles;
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (intersection);
|
n_rectangles = mtk_region_num_rectangles (intersection);
|
||||||
for (i = 0; i < n_rectangles; i++)
|
for (i = 0; i < n_rectangles; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (intersection, i, &rect);
|
rect = mtk_region_get_rectangle (intersection, i);
|
||||||
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (self), &rect);
|
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (self), &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
repaint_scheduled = TRUE;
|
repaint_scheduled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_destroy (intersection);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -473,7 +463,7 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
ClutterStageView *stage_view,
|
ClutterStageView *stage_view,
|
||||||
float *unobscurred_fraction)
|
float *unobscurred_fraction)
|
||||||
{
|
{
|
||||||
cairo_region_t *unobscured_region;
|
MtkRegion *unobscured_region;
|
||||||
|
|
||||||
unobscured_region = effective_unobscured_region (self);
|
unobscured_region = effective_unobscured_region (self);
|
||||||
|
|
||||||
@ -482,7 +472,7 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (self);
|
meta_surface_actor_get_instance_private (self);
|
||||||
ClutterActor *stage = clutter_actor_get_stage (CLUTTER_ACTOR (self));
|
ClutterActor *stage = clutter_actor_get_stage (CLUTTER_ACTOR (self));
|
||||||
cairo_region_t *intersection_region;
|
g_autoptr (MtkRegion) intersection_region = NULL;
|
||||||
MtkRectangle stage_rect;
|
MtkRectangle stage_rect;
|
||||||
graphene_matrix_t transform;
|
graphene_matrix_t transform;
|
||||||
graphene_rect_t actor_bounds;
|
graphene_rect_t actor_bounds;
|
||||||
@ -491,7 +481,7 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
int intersection_size = 0;
|
int intersection_size = 0;
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
|
|
||||||
if (cairo_region_is_empty (unobscured_region))
|
if (mtk_region_is_empty (unobscured_region))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
clutter_actor_get_relative_transformation_matrix (CLUTTER_ACTOR (self),
|
clutter_actor_get_relative_transformation_matrix (CLUTTER_ACTOR (self),
|
||||||
@ -501,19 +491,13 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
intersection_region = meta_region_apply_matrix_transform_expand (unobscured_region, &transform);
|
intersection_region = meta_region_apply_matrix_transform_expand (unobscured_region, &transform);
|
||||||
|
|
||||||
clutter_stage_view_get_layout (stage_view, &stage_rect);
|
clutter_stage_view_get_layout (stage_view, &stage_rect);
|
||||||
cairo_region_intersect_rectangle (intersection_region,
|
mtk_region_intersect_rectangle (intersection_region,
|
||||||
&stage_rect);
|
&stage_rect);
|
||||||
|
|
||||||
if (cairo_region_is_empty (intersection_region))
|
if (mtk_region_is_empty (intersection_region))
|
||||||
{
|
return TRUE;
|
||||||
cairo_region_destroy (intersection_region);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (!unobscurred_fraction)
|
else if (!unobscurred_fraction)
|
||||||
{
|
return FALSE;
|
||||||
cairo_region_destroy (intersection_region);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_content_get_preferred_size (CLUTTER_CONTENT (priv->texture),
|
clutter_content_get_preferred_size (CLUTTER_CONTENT (priv->texture),
|
||||||
&bounds_width,
|
&bounds_width,
|
||||||
@ -523,15 +507,14 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
graphene_rect_round_extents (&actor_bounds, &actor_bounds);
|
graphene_rect_round_extents (&actor_bounds, &actor_bounds);
|
||||||
bounds_size = graphene_rect_get_area (&actor_bounds);
|
bounds_size = graphene_rect_get_area (&actor_bounds);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (intersection_region);
|
n_rects = mtk_region_num_rectangles (intersection_region);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (intersection_region, i, &rect);
|
rect = mtk_region_get_rectangle (intersection_region, i);
|
||||||
intersection_size += rect.width * rect.height;
|
intersection_size += rect.width * rect.height;
|
||||||
}
|
}
|
||||||
cairo_region_destroy (intersection_region);
|
|
||||||
|
|
||||||
g_return_val_if_fail (bounds_size > 0, FALSE);
|
g_return_val_if_fail (bounds_size > 0, FALSE);
|
||||||
|
|
||||||
@ -545,23 +528,22 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (self);
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->input_region)
|
g_clear_pointer (&priv->input_region, mtk_region_unref);
|
||||||
cairo_region_destroy (priv->input_region);
|
|
||||||
|
|
||||||
if (region)
|
if (region)
|
||||||
priv->input_region = cairo_region_reference (region);
|
priv->input_region = mtk_region_ref (region);
|
||||||
else
|
else
|
||||||
priv->input_region = NULL;
|
priv->input_region = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (self);
|
meta_surface_actor_get_instance_private (self);
|
||||||
@ -569,7 +551,7 @@ meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
|||||||
meta_shaped_texture_set_opaque_region (priv->texture, region);
|
meta_shaped_texture_set_opaque_region (priv->texture, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_surface_actor_get_opaque_region (MetaSurfaceActor *self)
|
meta_surface_actor_get_opaque_region (MetaSurfaceActor *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
@ -580,7 +562,10 @@ meta_surface_actor_get_opaque_region (MetaSurfaceActor *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
||||||
int x, int y, int width, int height)
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv =
|
MetaSurfaceActorPrivate *priv =
|
||||||
meta_surface_actor_get_instance_private (self);
|
meta_surface_actor_get_instance_private (self);
|
||||||
@ -603,9 +588,9 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
|||||||
MtkRectangle rect = { .x = x, .y = y, .width = width, .height = height };
|
MtkRectangle rect = { .x = x, .y = y, .width = width, .height = height };
|
||||||
|
|
||||||
if (!priv->pending_damage)
|
if (!priv->pending_damage)
|
||||||
priv->pending_damage = cairo_region_create_rectangle (&rect);
|
priv->pending_damage = mtk_region_create_rectangle (&rect);
|
||||||
else
|
else
|
||||||
cairo_region_union_rectangle (priv->pending_damage, &rect);
|
mtk_region_union_rectangle (priv->pending_damage, &rect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +611,7 @@ meta_surface_actor_set_frozen (MetaSurfaceActor *self,
|
|||||||
|
|
||||||
if (!frozen && priv->pending_damage)
|
if (!frozen && priv->pending_damage)
|
||||||
{
|
{
|
||||||
int i, n_rects = cairo_region_num_rectangles (priv->pending_damage);
|
int i, n_rects = mtk_region_num_rectangles (priv->pending_damage);
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
/* Since we ignore damage events while a window is frozen for certain effects
|
/* Since we ignore damage events while a window is frozen for certain effects
|
||||||
@ -634,11 +619,11 @@ meta_surface_actor_set_frozen (MetaSurfaceActor *self,
|
|||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (priv->pending_damage, i, &rect);
|
rect = mtk_region_get_rectangle (priv->pending_damage, i);
|
||||||
meta_surface_actor_process_damage (self, rect.x, rect.y,
|
meta_surface_actor_process_damage (self, rect.x, rect.y,
|
||||||
rect.width, rect.height);
|
rect.width, rect.height);
|
||||||
}
|
}
|
||||||
g_clear_pointer (&priv->pending_damage, cairo_region_destroy);
|
g_clear_pointer (&priv->pending_damage, mtk_region_unref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ gboolean meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self,
|
|||||||
float *unobscurred_fraction);
|
float *unobscurred_fraction);
|
||||||
|
|
||||||
void meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
void meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
cairo_region_t * meta_surface_actor_get_opaque_region (MetaSurfaceActor *self);
|
MtkRegion * meta_surface_actor_get_opaque_region (MetaSurfaceActor *self);
|
||||||
|
|
||||||
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
|
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
|
||||||
int x, int y, int width, int height);
|
int x, int y, int width, int height);
|
||||||
|
@ -78,15 +78,15 @@ surface_container_new (MetaWindowActor *window_actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
surface_container_cull_unobscured (MetaCullable *cullable,
|
surface_container_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
surface_container_cull_redraw_clip (MetaCullable *cullable,
|
surface_container_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_redraw_clip_children (cullable, clip_region);
|
meta_cullable_cull_redraw_clip_children (cullable, clip_region);
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor)
|
|||||||
&traverse_data);
|
&traverse_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
calculate_background_cull_region (MetaWindowActorWayland *self)
|
calculate_background_cull_region (MetaWindowActorWayland *self)
|
||||||
{
|
{
|
||||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (self);
|
MetaWindowActor *window_actor = META_WINDOW_ACTOR (self);
|
||||||
@ -288,12 +288,12 @@ calculate_background_cull_region (MetaWindowActorWayland *self)
|
|||||||
.height = clutter_actor_get_height (self->background) * geometry_scale,
|
.height = clutter_actor_get_height (self->background) * geometry_scale,
|
||||||
};
|
};
|
||||||
|
|
||||||
return cairo_region_create_rectangle (&rect);
|
return mtk_region_create_rectangle (&rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
subtract_background_opaque_region (MetaWindowActorWayland *self,
|
subtract_background_opaque_region (MetaWindowActorWayland *self,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
if (!region)
|
if (!region)
|
||||||
return;
|
return;
|
||||||
@ -301,19 +301,17 @@ subtract_background_opaque_region (MetaWindowActorWayland *self,
|
|||||||
if (self->background &&
|
if (self->background &&
|
||||||
clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self)) == 0xff)
|
clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self)) == 0xff)
|
||||||
{
|
{
|
||||||
cairo_region_t *background_cull_region;
|
g_autoptr (MtkRegion) background_cull_region = NULL;
|
||||||
|
|
||||||
background_cull_region = calculate_background_cull_region (self);
|
background_cull_region = calculate_background_cull_region (self);
|
||||||
|
|
||||||
cairo_region_subtract (region, background_cull_region);
|
mtk_region_subtract (region, background_cull_region);
|
||||||
|
|
||||||
cairo_region_destroy (background_cull_region);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_actor_wayland_cull_unobscured (MetaCullable *cullable,
|
meta_window_actor_wayland_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
MetaWindowActorWayland *self =
|
MetaWindowActorWayland *self =
|
||||||
META_WINDOW_ACTOR_WAYLAND (cullable);
|
META_WINDOW_ACTOR_WAYLAND (cullable);
|
||||||
@ -324,8 +322,8 @@ meta_window_actor_wayland_cull_unobscured (MetaCullable *cullable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_actor_wayland_cull_redraw_clip (MetaCullable *cullable,
|
meta_window_actor_wayland_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
MetaWindowActorWayland *self =
|
MetaWindowActorWayland *self =
|
||||||
META_WINDOW_ACTOR_WAYLAND (cullable);
|
META_WINDOW_ACTOR_WAYLAND (cullable);
|
||||||
|
@ -77,11 +77,11 @@ struct _MetaWindowActorX11
|
|||||||
MetaShadow *unfocused_shadow;
|
MetaShadow *unfocused_shadow;
|
||||||
|
|
||||||
/* A region that matches the shape of the window, including frame bounds */
|
/* A region that matches the shape of the window, including frame bounds */
|
||||||
cairo_region_t *shape_region;
|
MtkRegion *shape_region;
|
||||||
/* The region we should clip to when painting the shadow */
|
/* The region we should clip to when painting the shadow */
|
||||||
cairo_region_t *shadow_clip;
|
MtkRegion *shadow_clip;
|
||||||
/* The frame region */
|
/* The frame region */
|
||||||
cairo_region_t *frame_bounds;
|
MtkRegion *frame_bounds;
|
||||||
|
|
||||||
/* Extracted size-invariant shape used for shadows */
|
/* Extracted size-invariant shape used for shadows */
|
||||||
MetaWindowShape *shadow_shape;
|
MetaWindowShape *shadow_shape;
|
||||||
@ -523,7 +523,7 @@ static void
|
|||||||
get_shape_bounds (MetaWindowActorX11 *actor_x11,
|
get_shape_bounds (MetaWindowActorX11 *actor_x11,
|
||||||
MtkRectangle *bounds)
|
MtkRectangle *bounds)
|
||||||
{
|
{
|
||||||
cairo_region_get_extents (actor_x11->shape_region, bounds);
|
*bounds = mtk_region_get_extents (actor_x11->shape_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -587,7 +587,7 @@ clip_shadow_under_window (MetaWindowActorX11 *actor_x11)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_clip_region_beneath (MetaWindowActorX11 *actor_x11,
|
set_clip_region_beneath (MetaWindowActorX11 *actor_x11,
|
||||||
cairo_region_t *beneath_region)
|
MtkRegion *beneath_region)
|
||||||
{
|
{
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
gboolean appears_focused;
|
gboolean appears_focused;
|
||||||
@ -596,16 +596,16 @@ set_clip_region_beneath (MetaWindowActorX11 *actor_x11,
|
|||||||
appears_focused = meta_window_appears_focused (window);
|
appears_focused = meta_window_appears_focused (window);
|
||||||
if (appears_focused ? actor_x11->focused_shadow : actor_x11->unfocused_shadow)
|
if (appears_focused ? actor_x11->focused_shadow : actor_x11->unfocused_shadow)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&actor_x11->shadow_clip, cairo_region_destroy);
|
g_clear_pointer (&actor_x11->shadow_clip, mtk_region_unref);
|
||||||
|
|
||||||
if (beneath_region)
|
if (beneath_region)
|
||||||
{
|
{
|
||||||
actor_x11->shadow_clip = cairo_region_copy (beneath_region);
|
actor_x11->shadow_clip = mtk_region_copy (beneath_region);
|
||||||
|
|
||||||
if (clip_shadow_under_window (actor_x11))
|
if (clip_shadow_under_window (actor_x11))
|
||||||
{
|
{
|
||||||
if (actor_x11->frame_bounds)
|
if (actor_x11->frame_bounds)
|
||||||
cairo_region_subtract (actor_x11->shadow_clip, actor_x11->frame_bounds);
|
mtk_region_subtract (actor_x11->shadow_clip, actor_x11->frame_bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -699,12 +699,12 @@ meta_window_actor_x11_process_damage (MetaWindowActorX11 *actor_x11,
|
|||||||
meta_window_actor_notify_damaged (META_WINDOW_ACTOR (actor_x11));
|
meta_window_actor_notify_damaged (META_WINDOW_ACTOR (actor_x11));
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
scan_visible_region (guchar *mask_data,
|
scan_visible_region (guchar *mask_data,
|
||||||
int stride,
|
int stride,
|
||||||
cairo_region_t *scan_area)
|
MtkRegion *scan_area)
|
||||||
{
|
{
|
||||||
int i, n_rects = cairo_region_num_rectangles (scan_area);
|
int i, n_rects = mtk_region_num_rectangles (scan_area);
|
||||||
MetaRegionBuilder builder;
|
MetaRegionBuilder builder;
|
||||||
|
|
||||||
meta_region_builder_init (&builder);
|
meta_region_builder_init (&builder);
|
||||||
@ -714,7 +714,7 @@ scan_visible_region (guchar *mask_data,
|
|||||||
int x, y;
|
int x, y;
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (scan_area, i, &rect);
|
rect = mtk_region_get_rectangle (scan_area, i);
|
||||||
|
|
||||||
for (y = rect.y; y < (rect.y + rect.height); y++)
|
for (y = rect.y; y < (rect.y + rect.height); y++)
|
||||||
{
|
{
|
||||||
@ -772,8 +772,8 @@ get_client_area_rect (MetaWindowActorX11 *actor_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
||||||
cairo_region_t *shape_region)
|
MtkRegion *shape_region)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
MetaWindow *window =
|
MetaWindow *window =
|
||||||
@ -815,7 +815,8 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
|||||||
|
|
||||||
if (window->frame)
|
if (window->frame)
|
||||||
{
|
{
|
||||||
cairo_region_t *frame_paint_region, *scanned_region;
|
g_autoptr (MtkRegion) frame_paint_region = NULL;
|
||||||
|
g_autoptr (MtkRegion) scanned_region = NULL;
|
||||||
MtkRectangle rect = { 0, 0, tex_width, tex_height };
|
MtkRectangle rect = { 0, 0, tex_width, tex_height };
|
||||||
MtkRectangle client_area;
|
MtkRectangle client_area;
|
||||||
MtkRectangle frame_rect;
|
MtkRectangle frame_rect;
|
||||||
@ -838,8 +839,8 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we don't paint the frame over the client window. */
|
/* Make sure we don't paint the frame over the client window. */
|
||||||
frame_paint_region = cairo_region_create_rectangle (&rect);
|
frame_paint_region = mtk_region_create_rectangle (&rect);
|
||||||
cairo_region_subtract_rectangle (frame_paint_region, &client_area);
|
mtk_region_subtract_rectangle (frame_paint_region, &client_area);
|
||||||
|
|
||||||
meta_region_to_cairo_path (frame_paint_region, cr);
|
meta_region_to_cairo_path (frame_paint_region, cr);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
@ -848,9 +849,7 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
|
|||||||
|
|
||||||
cairo_surface_flush (image);
|
cairo_surface_flush (image);
|
||||||
scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
|
scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
|
||||||
cairo_region_union (shape_region, scanned_region);
|
mtk_region_union (shape_region, scanned_region);
|
||||||
cairo_region_destroy (scanned_region);
|
|
||||||
cairo_region_destroy (frame_paint_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
@ -897,32 +896,32 @@ update_shape_region (MetaWindowActorX11 *actor_x11)
|
|||||||
{
|
{
|
||||||
MetaWindow *window =
|
MetaWindow *window =
|
||||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||||
cairo_region_t *region = NULL;
|
MtkRegion *region = NULL;
|
||||||
MtkRectangle client_area;
|
MtkRectangle client_area;
|
||||||
|
|
||||||
get_client_area_rect (actor_x11, &client_area);
|
get_client_area_rect (actor_x11, &client_area);
|
||||||
|
|
||||||
if (window->frame && window->shape_region)
|
if (window->frame && window->shape_region)
|
||||||
{
|
{
|
||||||
region = cairo_region_copy (window->shape_region);
|
region = mtk_region_copy (window->shape_region);
|
||||||
cairo_region_translate (region, client_area.x, client_area.y);
|
mtk_region_translate (region, client_area.x, client_area.y);
|
||||||
}
|
}
|
||||||
else if (window->shape_region != NULL)
|
else if (window->shape_region != NULL)
|
||||||
{
|
{
|
||||||
region = cairo_region_reference (window->shape_region);
|
region = mtk_region_ref (window->shape_region);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* If we don't have a shape on the server, that means that
|
/* If we don't have a shape on the server, that means that
|
||||||
* we have an implicit shape of one rectangle covering the
|
* we have an implicit shape of one rectangle covering the
|
||||||
* entire window. */
|
* entire window. */
|
||||||
region = cairo_region_create_rectangle (&client_area);
|
region = mtk_region_create_rectangle (&client_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->shape_region || window->frame)
|
if (window->shape_region || window->frame)
|
||||||
build_and_scan_frame_mask (actor_x11, region);
|
build_and_scan_frame_mask (actor_x11, region);
|
||||||
|
|
||||||
g_clear_pointer (&actor_x11->shape_region, cairo_region_destroy);
|
g_clear_pointer (&actor_x11->shape_region, mtk_region_unref);
|
||||||
actor_x11->shape_region = region;
|
actor_x11->shape_region = region;
|
||||||
|
|
||||||
g_clear_pointer (&actor_x11->shadow_shape, meta_window_shape_unref);
|
g_clear_pointer (&actor_x11->shadow_shape, meta_window_shape_unref);
|
||||||
@ -937,24 +936,23 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
|||||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||||
MetaSurfaceActor *surface =
|
MetaSurfaceActor *surface =
|
||||||
meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11));
|
meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11));
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
|
|
||||||
if (window->shape_region && window->input_region)
|
if (window->shape_region && window->input_region)
|
||||||
{
|
{
|
||||||
MtkRectangle client_area;
|
MtkRectangle client_area;
|
||||||
cairo_region_t *frames_input;
|
g_autoptr (MtkRegion) frames_input = NULL;
|
||||||
cairo_region_t *client_input;
|
g_autoptr (MtkRegion) client_input = NULL;
|
||||||
|
|
||||||
get_client_area_rect (actor_x11, &client_area);
|
get_client_area_rect (actor_x11, &client_area);
|
||||||
|
|
||||||
frames_input = cairo_region_copy (window->input_region);
|
frames_input = mtk_region_copy (window->input_region);
|
||||||
cairo_region_subtract_rectangle (frames_input, &client_area);
|
mtk_region_subtract_rectangle (frames_input, &client_area);
|
||||||
|
|
||||||
client_input = cairo_region_copy (actor_x11->shape_region);
|
client_input = mtk_region_copy (actor_x11->shape_region);
|
||||||
cairo_region_intersect (client_input, window->input_region);
|
mtk_region_intersect (client_input, window->input_region);
|
||||||
|
|
||||||
cairo_region_union (frames_input, client_input);
|
mtk_region_union (frames_input, client_input);
|
||||||
cairo_region_destroy (client_input);
|
|
||||||
|
|
||||||
region = g_steal_pointer (&frames_input);
|
region = g_steal_pointer (&frames_input);
|
||||||
}
|
}
|
||||||
@ -964,20 +962,15 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
|||||||
|
|
||||||
meta_window_get_client_area_rect (window, &client_area);
|
meta_window_get_client_area_rect (window, &client_area);
|
||||||
|
|
||||||
region = cairo_region_copy (window->shape_region);
|
region = mtk_region_copy (window->shape_region);
|
||||||
cairo_region_translate (region, client_area.x, client_area.y);
|
mtk_region_translate (region, client_area.x, client_area.y);
|
||||||
}
|
}
|
||||||
else if (window->input_region)
|
else if (window->input_region)
|
||||||
{
|
region = mtk_region_ref (window->input_region);
|
||||||
region = cairo_region_reference (window->input_region);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
region = NULL;
|
||||||
region = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_surface_actor_set_input_region (surface, region);
|
meta_surface_actor_set_input_region (surface, region);
|
||||||
cairo_region_destroy (region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -1007,7 +1000,7 @@ update_opaque_region (MetaWindowActorX11 *actor_x11)
|
|||||||
MetaWindow *window =
|
MetaWindow *window =
|
||||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||||
gboolean is_maybe_transparent;
|
gboolean is_maybe_transparent;
|
||||||
cairo_region_t *opaque_region = NULL;
|
g_autoptr (MtkRegion) opaque_region = NULL;
|
||||||
MetaSurfaceActor *surface;
|
MetaSurfaceActor *surface;
|
||||||
|
|
||||||
is_maybe_transparent = is_actor_maybe_transparent (actor_x11);
|
is_maybe_transparent = is_actor_maybe_transparent (actor_x11);
|
||||||
@ -1018,16 +1011,16 @@ update_opaque_region (MetaWindowActorX11 *actor_x11)
|
|||||||
MtkRectangle client_area;
|
MtkRectangle client_area;
|
||||||
|
|
||||||
if (window->frame && window->frame->opaque_region)
|
if (window->frame && window->frame->opaque_region)
|
||||||
opaque_region = cairo_region_copy (window->frame->opaque_region);
|
opaque_region = mtk_region_copy (window->frame->opaque_region);
|
||||||
|
|
||||||
get_client_area_rect (actor_x11, &client_area);
|
get_client_area_rect (actor_x11, &client_area);
|
||||||
|
|
||||||
if (opaque_region && meta_window_x11_has_alpha_channel (window))
|
if (opaque_region && meta_window_x11_has_alpha_channel (window))
|
||||||
cairo_region_subtract_rectangle (opaque_region, &client_area);
|
mtk_region_subtract_rectangle (opaque_region, &client_area);
|
||||||
|
|
||||||
if (window->opaque_region)
|
if (window->opaque_region)
|
||||||
{
|
{
|
||||||
cairo_region_t *client_opaque_region;
|
g_autoptr (MtkRegion) client_opaque_region = NULL;
|
||||||
|
|
||||||
/* The opaque region is defined to be a part of the
|
/* The opaque region is defined to be a part of the
|
||||||
* window which ARGB32 will always paint with opaque
|
* window which ARGB32 will always paint with opaque
|
||||||
@ -1039,28 +1032,25 @@ update_opaque_region (MetaWindowActorX11 *actor_x11)
|
|||||||
* to be undefined, and considered a client bug. In mutter's
|
* to be undefined, and considered a client bug. In mutter's
|
||||||
* case, graphical glitches will occur.
|
* case, graphical glitches will occur.
|
||||||
*/
|
*/
|
||||||
client_opaque_region = cairo_region_copy (window->opaque_region);
|
client_opaque_region = mtk_region_copy (window->opaque_region);
|
||||||
cairo_region_translate (client_opaque_region,
|
mtk_region_translate (client_opaque_region,
|
||||||
client_area.x, client_area.y);
|
client_area.x, client_area.y);
|
||||||
|
|
||||||
if (opaque_region)
|
if (opaque_region)
|
||||||
cairo_region_union (opaque_region, client_opaque_region);
|
mtk_region_union (opaque_region, client_opaque_region);
|
||||||
else
|
else
|
||||||
opaque_region = cairo_region_reference (client_opaque_region);
|
opaque_region = mtk_region_ref (client_opaque_region);
|
||||||
|
|
||||||
cairo_region_destroy (client_opaque_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_intersect (opaque_region, actor_x11->shape_region);
|
mtk_region_intersect (opaque_region, actor_x11->shape_region);
|
||||||
}
|
}
|
||||||
else if (!is_maybe_transparent)
|
else if (!is_maybe_transparent)
|
||||||
{
|
{
|
||||||
opaque_region = cairo_region_reference (actor_x11->shape_region);
|
opaque_region = mtk_region_ref (actor_x11->shape_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11));
|
surface = meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11));
|
||||||
meta_surface_actor_set_opaque_region (surface, opaque_region);
|
meta_surface_actor_set_opaque_region (surface, opaque_region);
|
||||||
cairo_region_destroy (opaque_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1068,11 +1058,11 @@ update_frame_bounds (MetaWindowActorX11 *actor_x11)
|
|||||||
{
|
{
|
||||||
MetaWindow *window =
|
MetaWindow *window =
|
||||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||||
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (window);
|
MtkRegion *frame_bounds = meta_window_get_frame_bounds (window);
|
||||||
g_clear_pointer (&actor_x11->frame_bounds, cairo_region_destroy);
|
g_clear_pointer (&actor_x11->frame_bounds, mtk_region_unref);
|
||||||
|
|
||||||
if (frame_bounds)
|
if (frame_bounds)
|
||||||
actor_x11->frame_bounds = cairo_region_copy (frame_bounds);
|
actor_x11->frame_bounds = mtk_region_copy (frame_bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1214,7 +1204,7 @@ meta_window_actor_x11_paint (ClutterActor *actor,
|
|||||||
{
|
{
|
||||||
MetaShadowParams params;
|
MetaShadowParams params;
|
||||||
MtkRectangle shape_bounds;
|
MtkRectangle shape_bounds;
|
||||||
cairo_region_t *clip = actor_x11->shadow_clip;
|
MtkRegion *clip = actor_x11->shadow_clip;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
|
|
||||||
get_shape_bounds (actor_x11, &shape_bounds);
|
get_shape_bounds (actor_x11, &shape_bounds);
|
||||||
@ -1228,10 +1218,10 @@ meta_window_actor_x11_paint (ClutterActor *actor,
|
|||||||
MtkRectangle bounds;
|
MtkRectangle bounds;
|
||||||
|
|
||||||
get_shadow_bounds (actor_x11, appears_focused, &bounds);
|
get_shadow_bounds (actor_x11, appears_focused, &bounds);
|
||||||
clip = cairo_region_create_rectangle (&bounds);
|
clip = mtk_region_create_rectangle (&bounds);
|
||||||
|
|
||||||
if (actor_x11->frame_bounds)
|
if (actor_x11->frame_bounds)
|
||||||
cairo_region_subtract (clip, actor_x11->frame_bounds);
|
mtk_region_subtract (clip, actor_x11->frame_bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||||
@ -1247,7 +1237,7 @@ meta_window_actor_x11_paint (ClutterActor *actor,
|
|||||||
clip_shadow_under_window (actor_x11));
|
clip_shadow_under_window (actor_x11));
|
||||||
|
|
||||||
if (clip && clip != actor_x11->shadow_clip)
|
if (clip && clip != actor_x11->shadow_clip)
|
||||||
cairo_region_destroy (clip);
|
mtk_region_unref (clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (meta_window_actor_x11_parent_class)->paint (actor,
|
CLUTTER_ACTOR_CLASS (meta_window_actor_x11_parent_class)->paint (actor,
|
||||||
@ -1487,7 +1477,7 @@ meta_window_actor_x11_constructed (GObject *object)
|
|||||||
* Start off with an empty shape region to maintain the invariant that it's
|
* Start off with an empty shape region to maintain the invariant that it's
|
||||||
* always set.
|
* always set.
|
||||||
*/
|
*/
|
||||||
actor_x11->shape_region = cairo_region_create ();
|
actor_x11->shape_region = mtk_region_create ();
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_window_actor_x11_parent_class)->constructed (object);
|
G_OBJECT_CLASS (meta_window_actor_x11_parent_class)->constructed (object);
|
||||||
|
|
||||||
@ -1503,15 +1493,15 @@ meta_window_actor_x11_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_actor_x11_cull_unobscured (MetaCullable *cullable,
|
meta_window_actor_x11_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_actor_x11_cull_redraw_clip (MetaCullable *cullable,
|
meta_window_actor_x11_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
MetaWindowActorX11 *self = META_WINDOW_ACTOR_X11 (cullable);
|
MetaWindowActorX11 *self = META_WINDOW_ACTOR_X11 (cullable);
|
||||||
|
|
||||||
@ -1549,9 +1539,9 @@ meta_window_actor_x11_dispose (GObject *object)
|
|||||||
CLUTTER_ACTOR (surface_actor));
|
CLUTTER_ACTOR (surface_actor));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer (&actor_x11->shape_region, cairo_region_destroy);
|
g_clear_pointer (&actor_x11->shape_region, mtk_region_unref);
|
||||||
g_clear_pointer (&actor_x11->shadow_clip, cairo_region_destroy);
|
g_clear_pointer (&actor_x11->shadow_clip, mtk_region_unref);
|
||||||
g_clear_pointer (&actor_x11->frame_bounds, cairo_region_destroy);
|
g_clear_pointer (&actor_x11->frame_bounds, mtk_region_unref);
|
||||||
|
|
||||||
g_clear_pointer (&actor_x11->shadow_class, g_free);
|
g_clear_pointer (&actor_x11->shadow_class, g_free);
|
||||||
g_clear_pointer (&actor_x11->focused_shadow, meta_shadow_unref);
|
g_clear_pointer (&actor_x11->focused_shadow, meta_shadow_unref);
|
||||||
|
@ -31,15 +31,15 @@ G_DEFINE_TYPE_WITH_CODE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR,
|
|||||||
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_group_cull_unobscured (MetaCullable *cullable,
|
meta_window_group_cull_unobscured (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region)
|
MtkRegion *unobscured_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
meta_cullable_cull_unobscured_children (cullable, unobscured_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_group_cull_redraw_clip (MetaCullable *cullable,
|
meta_window_group_cull_redraw_clip (MetaCullable *cullable,
|
||||||
cairo_region_t *clip_region)
|
MtkRegion *clip_region)
|
||||||
{
|
{
|
||||||
meta_cullable_cull_redraw_clip_children (cullable, clip_region);
|
meta_cullable_cull_redraw_clip_children (cullable, clip_region);
|
||||||
}
|
}
|
||||||
@ -59,8 +59,8 @@ meta_window_group_paint (ClutterActor *actor,
|
|||||||
ClutterActorClass *parent_actor_class =
|
ClutterActorClass *parent_actor_class =
|
||||||
CLUTTER_ACTOR_CLASS (meta_window_group_parent_class);
|
CLUTTER_ACTOR_CLASS (meta_window_group_parent_class);
|
||||||
ClutterActor *stage = clutter_actor_get_stage (actor);
|
ClutterActor *stage = clutter_actor_get_stage (actor);
|
||||||
const cairo_region_t *redraw_clip;
|
const MtkRegion *redraw_clip;
|
||||||
cairo_region_t *clip_region;
|
g_autoptr (MtkRegion) clip_region = NULL;
|
||||||
graphene_matrix_t stage_to_actor;
|
graphene_matrix_t stage_to_actor;
|
||||||
|
|
||||||
redraw_clip = clutter_paint_context_get_redraw_clip (paint_context);
|
redraw_clip = clutter_paint_context_get_redraw_clip (paint_context);
|
||||||
@ -125,8 +125,6 @@ meta_window_group_paint (ClutterActor *actor,
|
|||||||
|
|
||||||
meta_cullable_cull_redraw_clip (META_CULLABLE (window_group), clip_region);
|
meta_cullable_cull_redraw_clip (META_CULLABLE (window_group), clip_region);
|
||||||
|
|
||||||
cairo_region_destroy (clip_region);
|
|
||||||
|
|
||||||
parent_actor_class->paint (actor, paint_context);
|
parent_actor_class->paint (actor, paint_context);
|
||||||
|
|
||||||
meta_cullable_cull_redraw_clip (META_CULLABLE (window_group), NULL);
|
meta_cullable_cull_redraw_clip (META_CULLABLE (window_group), NULL);
|
||||||
|
@ -40,7 +40,7 @@ struct _MetaWindowShape
|
|||||||
};
|
};
|
||||||
|
|
||||||
MetaWindowShape *
|
MetaWindowShape *
|
||||||
meta_window_shape_new (cairo_region_t *region)
|
meta_window_shape_new (MtkRegion *region)
|
||||||
{
|
{
|
||||||
MetaWindowShape *shape;
|
MetaWindowShape *shape;
|
||||||
MetaRegionIterator iter;
|
MetaRegionIterator iter;
|
||||||
@ -54,9 +54,9 @@ meta_window_shape_new (cairo_region_t *region)
|
|||||||
shape = g_new0 (MetaWindowShape, 1);
|
shape = g_new0 (MetaWindowShape, 1);
|
||||||
shape->ref_count = 1;
|
shape->ref_count = 1;
|
||||||
|
|
||||||
cairo_region_get_extents (region, &extents);
|
extents = mtk_region_get_extents (region);
|
||||||
|
|
||||||
shape->n_rectangles = cairo_region_num_rectangles (region);
|
shape->n_rectangles = mtk_region_num_rectangles (region);
|
||||||
|
|
||||||
if (shape->n_rectangles == 0)
|
if (shape->n_rectangles == 0)
|
||||||
{
|
{
|
||||||
@ -220,20 +220,20 @@ meta_window_shape_get_borders (MetaWindowShape *shape,
|
|||||||
* @center_width: size of the central region horizontally
|
* @center_width: size of the central region horizontally
|
||||||
* @center_height: size of the central region vertically
|
* @center_height: size of the central region vertically
|
||||||
*
|
*
|
||||||
* Converts the shape to to a cairo_region_t using the given width
|
* Converts the shape to to a MtkRegion using the given width
|
||||||
* and height for the central scaled region.
|
* and height for the central scaled region.
|
||||||
*
|
*
|
||||||
* Return value: a newly created region
|
* Return value: a newly created region
|
||||||
*/
|
*/
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_window_shape_to_region (MetaWindowShape *shape,
|
meta_window_shape_to_region (MetaWindowShape *shape,
|
||||||
int center_width,
|
int center_width,
|
||||||
int center_height)
|
int center_height)
|
||||||
{
|
{
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
region = cairo_region_create ();
|
region = mtk_region_create ();
|
||||||
|
|
||||||
for (i = 0; i < shape->n_rectangles; i++)
|
for (i = 0; i < shape->n_rectangles; i++)
|
||||||
{
|
{
|
||||||
@ -249,7 +249,7 @@ meta_window_shape_to_region (MetaWindowShape *shape,
|
|||||||
else if (rect.y >= shape->top + 1)
|
else if (rect.y >= shape->top + 1)
|
||||||
rect.y += center_height;
|
rect.y += center_height;
|
||||||
|
|
||||||
cairo_region_union_rectangle (region, &rect);
|
mtk_region_union_rectangle (region, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
/* Various algorithms in this file require unioning together a set of rectangles
|
/* Various algorithms in this file require unioning together a set of rectangles
|
||||||
* that are unsorted or overlap; unioning such a set of rectangles 1-by-1
|
* that are unsorted or overlap; unioning such a set of rectangles 1-by-1
|
||||||
* using cairo_region_union_rectangle() produces O(N^2) behavior (if the union
|
* using mtk_region_union_rectangle() produces O(N^2) behavior (if the union
|
||||||
* adds or removes rectangles in the middle of the region, then it has to
|
* adds or removes rectangles in the middle of the region, then it has to
|
||||||
* move all the rectangles after that.) To avoid this behavior, MetaRegionBuilder
|
* move all the rectangles after that.) To avoid this behavior, MetaRegionBuilder
|
||||||
* creates regions for small groups of rectangles and merges them together in
|
* creates regions for small groups of rectangles and merges them together in
|
||||||
@ -47,7 +47,7 @@
|
|||||||
*
|
*
|
||||||
* Possible improvement: From a glance at the code, accumulating all the rectangles
|
* Possible improvement: From a glance at the code, accumulating all the rectangles
|
||||||
* into a flat array and then calling the (not usefully documented)
|
* into a flat array and then calling the (not usefully documented)
|
||||||
* cairo_region_create_rectangles() would have the same behavior and would be
|
* mtk_region_create_rectangles() would have the same behavior and would be
|
||||||
* simpler and a bit more efficient.
|
* simpler and a bit more efficient.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -75,15 +75,15 @@ meta_region_builder_add_rectangle (MetaRegionBuilder *builder,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (builder->levels[0] == NULL)
|
if (builder->levels[0] == NULL)
|
||||||
builder->levels[0] = cairo_region_create ();
|
builder->levels[0] = mtk_region_create ();
|
||||||
|
|
||||||
rect.x = x;
|
rect.x = x;
|
||||||
rect.y = y;
|
rect.y = y;
|
||||||
rect.width = width;
|
rect.width = width;
|
||||||
rect.height = height;
|
rect.height = height;
|
||||||
|
|
||||||
cairo_region_union_rectangle (builder->levels[0], &rect);
|
mtk_region_union_rectangle (builder->levels[0], &rect);
|
||||||
if (cairo_region_num_rectangles (builder->levels[0]) >= MAX_CHUNK_RECTANGLES)
|
if (mtk_region_num_rectangles (builder->levels[0]) >= MAX_CHUNK_RECTANGLES)
|
||||||
{
|
{
|
||||||
for (i = 1; i < builder->n_levels + 1; i++)
|
for (i = 1; i < builder->n_levels + 1; i++)
|
||||||
{
|
{
|
||||||
@ -101,18 +101,18 @@ meta_region_builder_add_rectangle (MetaRegionBuilder *builder,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cairo_region_union (builder->levels[i], builder->levels[i - 1]);
|
mtk_region_union (builder->levels[i], builder->levels[i - 1]);
|
||||||
cairo_region_destroy (builder->levels[i - 1]);
|
mtk_region_unref (builder->levels[i - 1]);
|
||||||
builder->levels[i - 1] = NULL;
|
builder->levels[i - 1] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_region_builder_finish (MetaRegionBuilder *builder)
|
meta_region_builder_finish (MetaRegionBuilder *builder)
|
||||||
{
|
{
|
||||||
cairo_region_t *result = NULL;
|
MtkRegion *result = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < builder->n_levels; i++)
|
for (i = 0; i < builder->n_levels; i++)
|
||||||
@ -123,14 +123,14 @@ meta_region_builder_finish (MetaRegionBuilder *builder)
|
|||||||
result = builder->levels[i];
|
result = builder->levels[i];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cairo_region_union(result, builder->levels[i]);
|
mtk_region_union (result, builder->levels[i]);
|
||||||
cairo_region_destroy (builder->levels[i]);
|
mtk_region_unref (builder->levels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
result = cairo_region_create ();
|
result = mtk_region_create ();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -140,23 +140,23 @@ meta_region_builder_finish (MetaRegionBuilder *builder)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_region_iterator_init (MetaRegionIterator *iter,
|
meta_region_iterator_init (MetaRegionIterator *iter,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
iter->region = region;
|
iter->region = region;
|
||||||
iter->i = 0;
|
iter->i = 0;
|
||||||
iter->n_rectangles = cairo_region_num_rectangles (region);
|
iter->n_rectangles = mtk_region_num_rectangles (region);
|
||||||
iter->line_start = TRUE;
|
iter->line_start = TRUE;
|
||||||
|
|
||||||
if (iter->n_rectangles > 1)
|
if (iter->n_rectangles > 1)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (region, 0, &iter->rectangle);
|
iter->rectangle = mtk_region_get_rectangle (region, 0);
|
||||||
cairo_region_get_rectangle (region, 1, &iter->next_rectangle);
|
iter->next_rectangle = mtk_region_get_rectangle (region, 1);
|
||||||
|
|
||||||
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
|
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
|
||||||
}
|
}
|
||||||
else if (iter->n_rectangles > 0)
|
else if (iter->n_rectangles > 0)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (region, 0, &iter->rectangle);
|
iter->rectangle = mtk_region_get_rectangle (region, 0);
|
||||||
iter->line_end = TRUE;
|
iter->line_end = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ meta_region_iterator_next (MetaRegionIterator *iter)
|
|||||||
|
|
||||||
if (iter->i + 1 < iter->n_rectangles)
|
if (iter->i + 1 < iter->n_rectangles)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (iter->region, iter->i + 1, &iter->next_rectangle);
|
iter->next_rectangle = mtk_region_get_rectangle (iter->region, iter->i + 1);
|
||||||
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
|
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -185,28 +185,29 @@ meta_region_iterator_next (MetaRegionIterator *iter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_region_scale (cairo_region_t *region, int scale)
|
meta_region_scale (MtkRegion *region,
|
||||||
|
int scale)
|
||||||
{
|
{
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
cairo_region_t *scaled_region;
|
MtkRegion *scaled_region;
|
||||||
|
|
||||||
if (scale == 1)
|
if (scale == 1)
|
||||||
return cairo_region_copy (region);
|
return mtk_region_copy (region);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (region, i, &rects[i]);
|
rects[i] = mtk_region_get_rectangle (region, i);
|
||||||
rects[i].x *= scale;
|
rects[i].x *= scale;
|
||||||
rects[i].y *= scale;
|
rects[i].y *= scale;
|
||||||
rects[i].width *= scale;
|
rects[i].width *= scale;
|
||||||
rects[i].height *= scale;
|
rects[i].height *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
scaled_region = cairo_region_create_rectangles (rects, n_rects);
|
scaled_region = mtk_region_create_rectangles (rects, n_rects);
|
||||||
|
|
||||||
return scaled_region;
|
return scaled_region;
|
||||||
}
|
}
|
||||||
@ -231,11 +232,11 @@ add_expanded_rect (MetaRegionBuilder *builder,
|
|||||||
width + 2 * x_amount, height + 2 * y_amount);
|
width + 2 * x_amount, height + 2 * y_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
expand_region (cairo_region_t *region,
|
expand_region (MtkRegion *region,
|
||||||
int x_amount,
|
int x_amount,
|
||||||
int y_amount,
|
int y_amount,
|
||||||
gboolean flip)
|
gboolean flip)
|
||||||
{
|
{
|
||||||
MetaRegionBuilder builder;
|
MetaRegionBuilder builder;
|
||||||
int n;
|
int n;
|
||||||
@ -243,12 +244,12 @@ expand_region (cairo_region_t *region,
|
|||||||
|
|
||||||
meta_region_builder_init (&builder);
|
meta_region_builder_init (&builder);
|
||||||
|
|
||||||
n = cairo_region_num_rectangles (region);
|
n = mtk_region_num_rectangles (region);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
add_expanded_rect (&builder,
|
add_expanded_rect (&builder,
|
||||||
rect.x, rect.y, rect.width, rect.height,
|
rect.x, rect.y, rect.width, rect.height,
|
||||||
x_amount, y_amount, flip);
|
x_amount, y_amount, flip);
|
||||||
@ -259,11 +260,11 @@ expand_region (cairo_region_t *region,
|
|||||||
|
|
||||||
/* This computes a (clipped version) of the inverse of the region
|
/* This computes a (clipped version) of the inverse of the region
|
||||||
* and expands it by the given amount */
|
* and expands it by the given amount */
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
expand_region_inverse (cairo_region_t *region,
|
expand_region_inverse (MtkRegion *region,
|
||||||
int x_amount,
|
int x_amount,
|
||||||
int y_amount,
|
int y_amount,
|
||||||
gboolean flip)
|
gboolean flip)
|
||||||
{
|
{
|
||||||
MetaRegionBuilder builder;
|
MetaRegionBuilder builder;
|
||||||
MetaRegionIterator iter;
|
MetaRegionIterator iter;
|
||||||
@ -273,7 +274,7 @@ expand_region_inverse (cairo_region_t *region,
|
|||||||
|
|
||||||
meta_region_builder_init (&builder);
|
meta_region_builder_init (&builder);
|
||||||
|
|
||||||
cairo_region_get_extents (region, &extents);
|
extents = mtk_region_get_extents (region);
|
||||||
add_expanded_rect (&builder,
|
add_expanded_rect (&builder,
|
||||||
extents.x, extents.y - 1, extents.width, 1,
|
extents.x, extents.y - 1, extents.width, 1,
|
||||||
x_amount, y_amount, flip);
|
x_amount, y_amount, flip);
|
||||||
@ -316,7 +317,7 @@ expand_region_inverse (cairo_region_t *region,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_make_border_region:
|
* meta_make_border_region:
|
||||||
* @region: a #cairo_region_t
|
* @region: a #MtkRegion
|
||||||
* @x_amount: distance from the border to extend horizontally
|
* @x_amount: distance from the border to extend horizontally
|
||||||
* @y_amount: distance from the border to extend vertically
|
* @y_amount: distance from the border to extend vertically
|
||||||
* @flip: if true, the result is computed with x and y interchanged
|
* @flip: if true, the result is computed with x and y interchanged
|
||||||
@ -332,41 +333,40 @@ expand_region_inverse (cairo_region_t *region,
|
|||||||
*
|
*
|
||||||
* Return value: a new region which is the border of the given region
|
* Return value: a new region which is the border of the given region
|
||||||
*/
|
*/
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_make_border_region (cairo_region_t *region,
|
meta_make_border_region (MtkRegion *region,
|
||||||
int x_amount,
|
int x_amount,
|
||||||
int y_amount,
|
int y_amount,
|
||||||
gboolean flip)
|
gboolean flip)
|
||||||
{
|
{
|
||||||
cairo_region_t *border_region;
|
g_autoptr (MtkRegion) border_region = NULL;
|
||||||
cairo_region_t *inverse_region;
|
g_autoptr (MtkRegion) inverse_region = NULL;
|
||||||
|
|
||||||
border_region = expand_region (region, x_amount, y_amount, flip);
|
border_region = expand_region (region, x_amount, y_amount, flip);
|
||||||
inverse_region = expand_region_inverse (region, x_amount, y_amount, flip);
|
inverse_region = expand_region_inverse (region, x_amount, y_amount, flip);
|
||||||
cairo_region_intersect (border_region, inverse_region);
|
mtk_region_intersect (border_region, inverse_region);
|
||||||
cairo_region_destroy (inverse_region);
|
|
||||||
|
|
||||||
return border_region;
|
return g_steal_pointer (&border_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_region_transform (const cairo_region_t *region,
|
meta_region_transform (const MtkRegion *region,
|
||||||
MetaMonitorTransform transform,
|
MetaMonitorTransform transform,
|
||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
cairo_region_t *transformed_region;
|
MtkRegion *transformed_region;
|
||||||
|
|
||||||
if (transform == META_MONITOR_TRANSFORM_NORMAL)
|
if (transform == META_MONITOR_TRANSFORM_NORMAL)
|
||||||
return cairo_region_copy (region);
|
return mtk_region_copy (region);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (region, i, &rects[i]);
|
rects[i] = mtk_region_get_rectangle (region, i);
|
||||||
|
|
||||||
meta_rectangle_transform (&rects[i],
|
meta_rectangle_transform (&rects[i],
|
||||||
transform,
|
transform,
|
||||||
@ -375,20 +375,20 @@ meta_region_transform (const cairo_region_t *region,
|
|||||||
&rects[i]);
|
&rects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
transformed_region = mtk_region_create_rectangles (rects, n_rects);
|
||||||
|
|
||||||
return transformed_region;
|
return transformed_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_region_crop_and_scale (cairo_region_t *region,
|
meta_region_crop_and_scale (MtkRegion *region,
|
||||||
graphene_rect_t *src_rect,
|
graphene_rect_t *src_rect,
|
||||||
int dst_width,
|
int dst_width,
|
||||||
int dst_height)
|
int dst_height)
|
||||||
{
|
{
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
cairo_region_t *viewport_region;
|
MtkRegion *viewport_region;
|
||||||
|
|
||||||
if (G_APPROX_VALUE (src_rect->size.width, dst_width, FLT_EPSILON) &&
|
if (G_APPROX_VALUE (src_rect->size.width, dst_width, FLT_EPSILON) &&
|
||||||
G_APPROX_VALUE (src_rect->size.height, dst_height, FLT_EPSILON) &&
|
G_APPROX_VALUE (src_rect->size.height, dst_height, FLT_EPSILON) &&
|
||||||
@ -397,24 +397,24 @@ meta_region_crop_and_scale (cairo_region_t *region,
|
|||||||
G_APPROX_VALUE (roundf (src_rect->origin.y),
|
G_APPROX_VALUE (roundf (src_rect->origin.y),
|
||||||
src_rect->origin.y, FLT_EPSILON))
|
src_rect->origin.y, FLT_EPSILON))
|
||||||
{
|
{
|
||||||
viewport_region = cairo_region_copy (region);
|
viewport_region = mtk_region_copy (region);
|
||||||
|
|
||||||
if (!G_APPROX_VALUE (src_rect->origin.x, 0, FLT_EPSILON) ||
|
if (!G_APPROX_VALUE (src_rect->origin.x, 0, FLT_EPSILON) ||
|
||||||
!G_APPROX_VALUE (src_rect->origin.y, 0, FLT_EPSILON))
|
!G_APPROX_VALUE (src_rect->origin.y, 0, FLT_EPSILON))
|
||||||
{
|
{
|
||||||
cairo_region_translate (viewport_region,
|
mtk_region_translate (viewport_region,
|
||||||
(int) src_rect->origin.x,
|
(int) src_rect->origin.x,
|
||||||
(int) src_rect->origin.y);
|
(int) src_rect->origin.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return viewport_region;
|
return viewport_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (region, i, &rects[i]);
|
rects[i] = mtk_region_get_rectangle (region, i);
|
||||||
|
|
||||||
meta_rectangle_crop_and_scale (&rects[i],
|
meta_rectangle_crop_and_scale (&rects[i],
|
||||||
src_rect,
|
src_rect,
|
||||||
@ -423,46 +423,46 @@ meta_region_crop_and_scale (cairo_region_t *region,
|
|||||||
&rects[i]);
|
&rects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_region = cairo_region_create_rectangles (rects, n_rects);
|
viewport_region = mtk_region_create_rectangles (rects, n_rects);
|
||||||
|
|
||||||
return viewport_region;
|
return viewport_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_region_to_cairo_path (cairo_region_t *region,
|
meta_region_to_cairo_path (MtkRegion *region,
|
||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
|
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_region_apply_matrix_transform_expand (const cairo_region_t *region,
|
meta_region_apply_matrix_transform_expand (const MtkRegion *region,
|
||||||
graphene_matrix_t *transform)
|
graphene_matrix_t *transform)
|
||||||
{
|
{
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
MtkRectangle *rects;
|
MtkRectangle *rects;
|
||||||
cairo_region_t *transformed_region;
|
MtkRegion *transformed_region;
|
||||||
|
|
||||||
if (graphene_matrix_is_identity (transform))
|
if (graphene_matrix_is_identity (transform))
|
||||||
return cairo_region_copy (region);
|
return mtk_region_copy (region);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED (n_rects, rects);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
graphene_rect_t transformed_rect, rect;
|
graphene_rect_t transformed_rect, rect;
|
||||||
MtkRectangle int_rect;
|
MtkRectangle int_rect;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, &int_rect);
|
int_rect = mtk_region_get_rectangle (region, i);
|
||||||
rect = mtk_rectangle_to_graphene_rect (&int_rect);
|
rect = mtk_rectangle_to_graphene_rect (&int_rect);
|
||||||
|
|
||||||
graphene_matrix_transform_bounds (transform, &rect, &transformed_rect);
|
graphene_matrix_transform_bounds (transform, &rect, &transformed_rect);
|
||||||
@ -472,7 +472,7 @@ meta_region_apply_matrix_transform_expand (const cairo_region_t *region,
|
|||||||
&rects[i]);
|
&rects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
transformed_region = mtk_region_create_rectangles (rects, n_rects);
|
||||||
|
|
||||||
return transformed_region;
|
return transformed_region;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
* @line_start: whether the current rectangle starts a horizontal band
|
* @line_start: whether the current rectangle starts a horizontal band
|
||||||
* @line_end: whether the current rectangle ends a horizontal band
|
* @line_end: whether the current rectangle ends a horizontal band
|
||||||
*
|
*
|
||||||
* cairo_region_t is a yx banded region; sometimes its useful to iterate through
|
* MtkRegion is a yx banded region; sometimes its useful to iterate through
|
||||||
* such a region treating the start and end of each horizontal band in a distinct
|
* such a region treating the start and end of each horizontal band in a distinct
|
||||||
* fashion.
|
* fashion.
|
||||||
*
|
*
|
||||||
@ -51,7 +51,7 @@
|
|||||||
typedef struct _MetaRegionIterator MetaRegionIterator;
|
typedef struct _MetaRegionIterator MetaRegionIterator;
|
||||||
|
|
||||||
struct _MetaRegionIterator {
|
struct _MetaRegionIterator {
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
MtkRectangle rectangle;
|
MtkRectangle rectangle;
|
||||||
gboolean line_start;
|
gboolean line_start;
|
||||||
gboolean line_end;
|
gboolean line_end;
|
||||||
@ -76,7 +76,7 @@ struct _MetaRegionBuilder {
|
|||||||
* |d |c |ab |
|
* |d |c |ab |
|
||||||
* |e | | |abcd|
|
* |e | | |abcd|
|
||||||
*/
|
*/
|
||||||
cairo_region_t *levels[META_REGION_BUILDER_MAX_LEVELS];
|
MtkRegion *levels[META_REGION_BUILDER_MAX_LEVELS];
|
||||||
int n_levels;
|
int n_levels;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,34 +86,34 @@ void meta_region_builder_add_rectangle (MetaRegionBuilder *builder,
|
|||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
cairo_region_t * meta_region_builder_finish (MetaRegionBuilder *builder);
|
MtkRegion * meta_region_builder_finish (MetaRegionBuilder *builder);
|
||||||
|
|
||||||
void meta_region_iterator_init (MetaRegionIterator *iter,
|
void meta_region_iterator_init (MetaRegionIterator *iter,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
gboolean meta_region_iterator_at_end (MetaRegionIterator *iter);
|
gboolean meta_region_iterator_at_end (MetaRegionIterator *iter);
|
||||||
void meta_region_iterator_next (MetaRegionIterator *iter);
|
void meta_region_iterator_next (MetaRegionIterator *iter);
|
||||||
|
|
||||||
cairo_region_t * meta_region_scale (cairo_region_t *region,
|
MtkRegion * meta_region_scale (MtkRegion *region,
|
||||||
int scale);
|
int scale);
|
||||||
|
|
||||||
cairo_region_t * meta_make_border_region (cairo_region_t *region,
|
MtkRegion * meta_make_border_region (MtkRegion *region,
|
||||||
int x_amount,
|
int x_amount,
|
||||||
int y_amount,
|
int y_amount,
|
||||||
gboolean flip);
|
gboolean flip);
|
||||||
|
|
||||||
cairo_region_t * meta_region_transform (const cairo_region_t *region,
|
MtkRegion * meta_region_transform (const MtkRegion *region,
|
||||||
MetaMonitorTransform transform,
|
MetaMonitorTransform transform,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
cairo_region_t * meta_region_crop_and_scale (cairo_region_t *region,
|
MtkRegion * meta_region_crop_and_scale (MtkRegion *region,
|
||||||
graphene_rect_t *src_rect,
|
graphene_rect_t *src_rect,
|
||||||
int dst_width,
|
int dst_width,
|
||||||
int dst_height);
|
int dst_height);
|
||||||
|
|
||||||
void meta_region_to_cairo_path (cairo_region_t *region,
|
void meta_region_to_cairo_path (MtkRegion *region,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_region_apply_matrix_transform_expand (const cairo_region_t *region,
|
meta_region_apply_matrix_transform_expand (const MtkRegion *region,
|
||||||
graphene_matrix_t *transform);
|
graphene_matrix_t *transform);
|
||||||
|
@ -237,13 +237,8 @@ meta_window_destroy_frame (MetaWindow *window)
|
|||||||
meta_x11_display_unregister_x_window (x11_display, frame->xwindow);
|
meta_x11_display_unregister_x_window (x11_display, frame->xwindow);
|
||||||
|
|
||||||
window->frame = NULL;
|
window->frame = NULL;
|
||||||
if (window->frame_bounds)
|
g_clear_pointer (&window->frame_bounds, mtk_region_unref);
|
||||||
{
|
g_clear_pointer (&frame->opaque_region, mtk_region_unref);
|
||||||
cairo_region_destroy (window->frame_bounds);
|
|
||||||
window->frame_bounds = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_pointer (&frame->opaque_region, cairo_region_destroy);
|
|
||||||
|
|
||||||
/* Move keybindings to window instead of frame */
|
/* Move keybindings to window instead of frame */
|
||||||
meta_window_grab_keys (window);
|
meta_window_grab_keys (window);
|
||||||
@ -397,17 +392,17 @@ meta_frame_sync_to_window (MetaFrame *frame,
|
|||||||
return need_resize;
|
return need_resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_frame_get_frame_bounds (MetaFrame *frame)
|
meta_frame_get_frame_bounds (MetaFrame *frame)
|
||||||
{
|
{
|
||||||
MetaFrameBorders borders;
|
MetaFrameBorders borders;
|
||||||
cairo_region_t *bounds;
|
MtkRegion *bounds;
|
||||||
|
|
||||||
meta_frame_calc_borders (frame, &borders);
|
meta_frame_calc_borders (frame, &borders);
|
||||||
/* FIXME: currently just the client area, should shape closer to
|
/* FIXME: currently just the client area, should shape closer to
|
||||||
* frame border, incl. rounded corners.
|
* frame border, incl. rounded corners.
|
||||||
*/
|
*/
|
||||||
bounds = cairo_region_create_rectangle (&(MtkRectangle) {
|
bounds = mtk_region_create_rectangle (&(MtkRectangle) {
|
||||||
borders.total.left,
|
borders.total.left,
|
||||||
borders.total.top,
|
borders.total.top,
|
||||||
frame->rect.width - borders.total.left - borders.total.right,
|
frame->rect.width - borders.total.left - borders.total.right,
|
||||||
@ -583,18 +578,18 @@ meta_frame_get_sync_counter (MetaFrame *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_frame_set_opaque_region (MetaFrame *frame,
|
meta_frame_set_opaque_region (MetaFrame *frame,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
MetaWindow *window = frame->window;
|
MetaWindow *window = frame->window;
|
||||||
|
|
||||||
if (cairo_region_equal (frame->opaque_region, region))
|
if (mtk_region_equal (frame->opaque_region, region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&frame->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&frame->opaque_region, mtk_region_unref);
|
||||||
|
|
||||||
if (region != NULL)
|
if (region != NULL)
|
||||||
frame->opaque_region = cairo_region_reference (region);
|
frame->opaque_region = mtk_region_ref (region);
|
||||||
|
|
||||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ struct _MetaFrame
|
|||||||
|
|
||||||
MetaFrameBorders cached_borders; /* valid if borders_cached is set */
|
MetaFrameBorders cached_borders; /* valid if borders_cached is set */
|
||||||
|
|
||||||
cairo_region_t *opaque_region;
|
MtkRegion *opaque_region;
|
||||||
|
|
||||||
MetaSyncCounter sync_counter;
|
MetaSyncCounter sync_counter;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ gboolean meta_frame_sync_to_window (MetaFrame *frame,
|
|||||||
|
|
||||||
void meta_frame_clear_cached_borders (MetaFrame *frame);
|
void meta_frame_clear_cached_borders (MetaFrame *frame);
|
||||||
|
|
||||||
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
|
MtkRegion *meta_frame_get_frame_bounds (MetaFrame *frame);
|
||||||
|
|
||||||
void meta_frame_get_mask (MetaFrame *frame,
|
void meta_frame_get_mask (MetaFrame *frame,
|
||||||
MtkRectangle *frame_rect,
|
MtkRectangle *frame_rect,
|
||||||
@ -81,5 +81,5 @@ GSubprocess * meta_frame_launch_client (MetaX11Display *x11_display,
|
|||||||
|
|
||||||
MetaSyncCounter * meta_frame_get_sync_counter (MetaFrame *frame);
|
MetaSyncCounter * meta_frame_get_sync_counter (MetaFrame *frame);
|
||||||
|
|
||||||
void meta_frame_set_opaque_region (MetaFrame *frame,
|
void meta_frame_set_opaque_region (MetaFrame *frame,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
|
@ -246,17 +246,17 @@ struct _MetaWindow
|
|||||||
} fullscreen_monitors;
|
} fullscreen_monitors;
|
||||||
|
|
||||||
/* if non-NULL, the bounds of the window frame */
|
/* if non-NULL, the bounds of the window frame */
|
||||||
cairo_region_t *frame_bounds;
|
MtkRegion *frame_bounds;
|
||||||
|
|
||||||
/* if non-NULL, the bounding shape region of the window. Relative to
|
/* if non-NULL, the bounding shape region of the window. Relative to
|
||||||
* the server-side client window. */
|
* the server-side client window. */
|
||||||
cairo_region_t *shape_region;
|
MtkRegion *shape_region;
|
||||||
|
|
||||||
/* if non-NULL, the opaque region _NET_WM_OPAQUE_REGION */
|
/* if non-NULL, the opaque region _NET_WM_OPAQUE_REGION */
|
||||||
cairo_region_t *opaque_region;
|
MtkRegion *opaque_region;
|
||||||
|
|
||||||
/* the input shape region for picking */
|
/* the input shape region for picking */
|
||||||
cairo_region_t *input_region;
|
MtkRegion *input_region;
|
||||||
|
|
||||||
/* _NET_WM_WINDOW_OPACITY rescaled to 0xFF */
|
/* _NET_WM_WINDOW_OPACITY rescaled to 0xFF */
|
||||||
guint8 opacity;
|
guint8 opacity;
|
||||||
|
@ -313,17 +313,10 @@ meta_window_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
MetaWindow *window = META_WINDOW (object);
|
MetaWindow *window = META_WINDOW (object);
|
||||||
|
|
||||||
if (window->frame_bounds)
|
g_clear_pointer (&window->frame_bounds, mtk_region_unref);
|
||||||
cairo_region_destroy (window->frame_bounds);
|
g_clear_pointer (&window->shape_region, mtk_region_unref);
|
||||||
|
g_clear_pointer (&window->opaque_region, mtk_region_unref);
|
||||||
if (window->shape_region)
|
g_clear_pointer (&window->input_region, mtk_region_unref);
|
||||||
cairo_region_destroy (window->shape_region);
|
|
||||||
|
|
||||||
if (window->opaque_region)
|
|
||||||
cairo_region_destroy (window->opaque_region);
|
|
||||||
|
|
||||||
if (window->input_region)
|
|
||||||
cairo_region_destroy (window->input_region);
|
|
||||||
|
|
||||||
if (window->transient_for)
|
if (window->transient_for)
|
||||||
g_object_unref (window->transient_for);
|
g_object_unref (window->transient_for);
|
||||||
@ -3945,10 +3938,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
|
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
|
||||||
{
|
g_clear_pointer (&window->frame_bounds, mtk_region_unref);
|
||||||
cairo_region_destroy (window->frame_bounds);
|
|
||||||
window->frame_bounds = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_window_foreach_transient (window, maybe_move_attached_window, NULL);
|
meta_window_foreach_transient (window, maybe_move_attached_window, NULL);
|
||||||
|
|
||||||
@ -7024,11 +7014,11 @@ meta_window_get_frame_type (MetaWindow *window)
|
|||||||
*
|
*
|
||||||
* Gets a region representing the outer bounds of the window's frame.
|
* Gets a region representing the outer bounds of the window's frame.
|
||||||
*
|
*
|
||||||
* Return value: (transfer none) (nullable): a #cairo_region_t
|
* Return value: (transfer none) (nullable): a #MtkRegion
|
||||||
* holding the outer bounds of the window, or %NULL if the window
|
* holding the outer bounds of the window, or %NULL if the window
|
||||||
* doesn't have a frame.
|
* doesn't have a frame.
|
||||||
*/
|
*/
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_window_get_frame_bounds (MetaWindow *window)
|
meta_window_get_frame_bounds (MetaWindow *window)
|
||||||
{
|
{
|
||||||
if (!window->frame_bounds)
|
if (!window->frame_bounds)
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
#include "meta/meta-window-shape.h"
|
#include "meta/meta-window-shape.h"
|
||||||
@ -105,15 +103,15 @@ META_EXPORT
|
|||||||
void meta_shadow_unref (MetaShadow *shadow);
|
void meta_shadow_unref (MetaShadow *shadow);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
void meta_shadow_paint (MetaShadow *shadow,
|
void meta_shadow_paint (MetaShadow *shadow,
|
||||||
CoglFramebuffer *framebuffer,
|
CoglFramebuffer *framebuffer,
|
||||||
int window_x,
|
int window_x,
|
||||||
int window_y,
|
int window_y,
|
||||||
int window_width,
|
int window_width,
|
||||||
int window_height,
|
int window_height,
|
||||||
guint8 opacity,
|
guint8 opacity,
|
||||||
cairo_region_t *clip,
|
MtkRegion *clip,
|
||||||
gboolean clip_strictly);
|
gboolean clip_strictly);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
void meta_shadow_get_bounds (MetaShadow *shadow,
|
void meta_shadow_get_bounds (MetaShadow *shadow,
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include <meta/common.h>
|
#include <meta/common.h>
|
||||||
@ -45,7 +44,7 @@ GType meta_window_shape_get_type (void) G_GNUC_CONST;
|
|||||||
typedef struct _MetaWindowShape MetaWindowShape;
|
typedef struct _MetaWindowShape MetaWindowShape;
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
MetaWindowShape * meta_window_shape_new (cairo_region_t *region);
|
MetaWindowShape * meta_window_shape_new (MtkRegion *region);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
MetaWindowShape * meta_window_shape_ref (MetaWindowShape *shape);
|
MetaWindowShape * meta_window_shape_ref (MetaWindowShape *shape);
|
||||||
@ -68,6 +67,6 @@ void meta_window_shape_get_borders (MetaWindowShape *shape,
|
|||||||
int *border_left);
|
int *border_left);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
cairo_region_t *meta_window_shape_to_region (MetaWindowShape *shape,
|
MtkRegion * meta_window_shape_to_region (MetaWindowShape *shape,
|
||||||
int center_width,
|
int center_width,
|
||||||
int center_height);
|
int center_height);
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <cairo.h>
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include <meta/boxes.h>
|
#include <meta/boxes.h>
|
||||||
@ -355,7 +354,7 @@ META_EXPORT
|
|||||||
MetaFrameType meta_window_get_frame_type (MetaWindow *window);
|
MetaFrameType meta_window_get_frame_type (MetaWindow *window);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
cairo_region_t *meta_window_get_frame_bounds (MetaWindow *window);
|
MtkRegion *meta_window_get_frame_bounds (MetaWindow *window);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
MetaWindow *meta_window_get_tile_match (MetaWindow *window);
|
MetaWindow *meta_window_get_tile_match (MetaWindow *window);
|
||||||
|
@ -233,7 +233,7 @@ get_pixel (CoglFramebuffer *fb,
|
|||||||
static void
|
static void
|
||||||
view_painted_cb (ClutterStage *stage,
|
view_painted_cb (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_region_t *redraw_clip,
|
MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -270,11 +270,11 @@ typedef struct
|
|||||||
} CaptureViewData;
|
} CaptureViewData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_after_paint (MetaStage *stage,
|
on_after_paint (MetaStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip,
|
const MtkRegion *redraw_clip,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CaptureViewData *data = user_data;
|
CaptureViewData *data = user_data;
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
|
@ -148,7 +148,7 @@ on_scanout_before_paint (ClutterStage *stage,
|
|||||||
static void
|
static void
|
||||||
on_scanout_paint_view (ClutterStage *stage,
|
on_scanout_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *stage_view,
|
ClutterStageView *stage_view,
|
||||||
cairo_region_t *region,
|
MtkRegion *region,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
KmsRenderingTest *test)
|
KmsRenderingTest *test)
|
||||||
{
|
{
|
||||||
@ -389,7 +389,7 @@ on_scanout_fallback_before_paint (ClutterStage *stage,
|
|||||||
static void
|
static void
|
||||||
on_scanout_fallback_paint_view (ClutterStage *stage,
|
on_scanout_fallback_paint_view (ClutterStage *stage,
|
||||||
ClutterStageView *stage_view,
|
ClutterStageView *stage_view,
|
||||||
cairo_region_t *region,
|
MtkRegion *region,
|
||||||
ClutterFrame *frame,
|
ClutterFrame *frame,
|
||||||
KmsRenderingTest *test)
|
KmsRenderingTest *test)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "wayland/meta-pointer-confinement-wayland.h"
|
#include "wayland/meta-pointer-confinement-wayland.h"
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#include "backends/meta-backend-private.h"
|
#include "backends/meta-backend-private.h"
|
||||||
#include "backends/meta-pointer-constraint.h"
|
#include "backends/meta-pointer-constraint.h"
|
||||||
@ -225,7 +224,7 @@ meta_pointer_confinement_wayland_create_constraint (MetaPointerConfinementWaylan
|
|||||||
MetaPointerConfinementWaylandPrivate *priv;
|
MetaPointerConfinementWaylandPrivate *priv;
|
||||||
MetaPointerConstraint *constraint;
|
MetaPointerConstraint *constraint;
|
||||||
MetaWaylandSurface *surface;
|
MetaWaylandSurface *surface;
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
int geometry_scale;
|
int geometry_scale;
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
double min_edge_distance;
|
double min_edge_distance;
|
||||||
@ -239,19 +238,19 @@ meta_pointer_confinement_wayland_create_constraint (MetaPointerConfinementWaylan
|
|||||||
geometry_scale = meta_wayland_surface_get_geometry_scale (surface);
|
geometry_scale = meta_wayland_surface_get_geometry_scale (surface);
|
||||||
if (geometry_scale != 1)
|
if (geometry_scale != 1)
|
||||||
{
|
{
|
||||||
cairo_region_t *scaled_region;
|
g_autoptr (MtkRegion) scaled_region = NULL;
|
||||||
|
|
||||||
scaled_region = meta_region_scale (region, geometry_scale);
|
scaled_region = meta_region_scale (region, geometry_scale);
|
||||||
cairo_region_destroy (region);
|
g_clear_pointer (®ion, mtk_region_unref);
|
||||||
region = scaled_region;
|
region = g_steal_pointer (&scaled_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_wayland_surface_get_absolute_coordinates (surface, 0, 0, &dx, &dy);
|
meta_wayland_surface_get_absolute_coordinates (surface, 0, 0, &dx, &dy);
|
||||||
cairo_region_translate (region, dx, dy);
|
mtk_region_translate (region, dx, dy);
|
||||||
|
|
||||||
min_edge_distance = wl_fixed_to_double (1) * geometry_scale;
|
min_edge_distance = wl_fixed_to_double (1) * geometry_scale;
|
||||||
constraint = meta_pointer_constraint_new (region, min_edge_distance);
|
constraint = meta_pointer_constraint_new (g_steal_pointer (®ion),
|
||||||
cairo_region_destroy (region);
|
min_edge_distance);
|
||||||
|
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ meta_pointer_lock_wayland_create_constraint (MetaPointerConfinementWayland *conf
|
|||||||
MetaPointerConstraint *constraint;
|
MetaPointerConstraint *constraint;
|
||||||
graphene_point_t point;
|
graphene_point_t point;
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
float sx, sy, x, y;
|
float sx, sy, x, y;
|
||||||
|
|
||||||
clutter_seat_query_state (seat, pointer, NULL, &point, NULL);
|
clutter_seat_query_state (seat, pointer, NULL, &point, NULL);
|
||||||
@ -75,10 +75,9 @@ meta_pointer_lock_wayland_create_constraint (MetaPointerConfinementWayland *conf
|
|||||||
|
|
||||||
meta_wayland_surface_get_absolute_coordinates (surface, sx, sy, &x, &y);
|
meta_wayland_surface_get_absolute_coordinates (surface, sx, sy, &x, &y);
|
||||||
rect = (MtkRectangle) { .x = x, .y = y, .width = 1, .height = 1 };
|
rect = (MtkRectangle) { .x = x, .y = y, .width = 1, .height = 1 };
|
||||||
region = cairo_region_create_rectangle (&rect);
|
region = mtk_region_create_rectangle (&rect);
|
||||||
|
|
||||||
constraint = meta_pointer_constraint_new (region, 0.0);
|
constraint = meta_pointer_constraint_new (g_steal_pointer (®ion), 0.0);
|
||||||
cairo_region_destroy (region);
|
|
||||||
|
|
||||||
return constraint;
|
return constraint;
|
||||||
}
|
}
|
||||||
|
@ -215,43 +215,40 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
|
|||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
if (!META_IS_XWAYLAND_SURFACE (surface_role))
|
if (!META_IS_XWAYLAND_SURFACE (surface_role))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (surface->input_region)
|
if (surface->input_region)
|
||||||
{
|
{
|
||||||
cairo_region_t *input_region;
|
g_autoptr (MtkRegion) input_region = NULL;
|
||||||
|
|
||||||
input_region = cairo_region_copy (surface->input_region);
|
input_region = mtk_region_copy (surface->input_region);
|
||||||
cairo_region_intersect_rectangle (input_region, &surface_rect);
|
mtk_region_intersect_rectangle (input_region, &surface_rect);
|
||||||
meta_surface_actor_set_input_region (surface_actor, input_region);
|
meta_surface_actor_set_input_region (surface_actor, input_region);
|
||||||
cairo_region_destroy (input_region);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
meta_surface_actor_set_input_region (surface_actor, NULL);
|
||||||
meta_surface_actor_set_input_region (surface_actor, NULL);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!meta_shaped_texture_has_alpha (stex))
|
if (!meta_shaped_texture_has_alpha (stex))
|
||||||
{
|
{
|
||||||
cairo_region_t *opaque_region;
|
g_autoptr (MtkRegion) opaque_region = NULL;
|
||||||
|
|
||||||
opaque_region = cairo_region_create_rectangle (&surface_rect);
|
opaque_region = mtk_region_create_rectangle (&surface_rect);
|
||||||
meta_surface_actor_set_opaque_region (surface_actor, opaque_region);
|
meta_surface_actor_set_opaque_region (surface_actor, opaque_region);
|
||||||
cairo_region_destroy (opaque_region);
|
}
|
||||||
}
|
else if (surface->opaque_region)
|
||||||
else if (surface->opaque_region)
|
{
|
||||||
{
|
g_autoptr (MtkRegion) opaque_region = NULL;
|
||||||
cairo_region_t *opaque_region;
|
|
||||||
|
|
||||||
opaque_region = cairo_region_copy (surface->opaque_region);
|
opaque_region = mtk_region_copy (surface->opaque_region);
|
||||||
cairo_region_intersect_rectangle (opaque_region, &surface_rect);
|
mtk_region_intersect_rectangle (opaque_region, &surface_rect);
|
||||||
meta_surface_actor_set_opaque_region (surface_actor, opaque_region);
|
meta_surface_actor_set_opaque_region (surface_actor, opaque_region);
|
||||||
cairo_region_destroy (opaque_region);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
meta_surface_actor_set_opaque_region (surface_actor, NULL);
|
||||||
meta_surface_actor_set_opaque_region (surface_actor, NULL);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
meta_shaped_texture_set_transform (stex, surface->buffer_transform);
|
meta_shaped_texture_set_transform (stex, surface->buffer_transform);
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer)
|
|||||||
static gboolean
|
static gboolean
|
||||||
process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
||||||
MetaMultiTexture *texture,
|
MetaMultiTexture *texture,
|
||||||
cairo_region_t *region,
|
MtkRegion *region,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
struct wl_shm_buffer *shm_buffer;
|
struct wl_shm_buffer *shm_buffer;
|
||||||
@ -684,7 +684,7 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
|||||||
CoglPixelFormat format;
|
CoglPixelFormat format;
|
||||||
CoglTexture *cogl_texture;
|
CoglTexture *cogl_texture;
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (region);
|
n_rectangles = mtk_region_num_rectangles (region);
|
||||||
|
|
||||||
shm_buffer = wl_shm_buffer_get (buffer->resource);
|
shm_buffer = wl_shm_buffer_get (buffer->resource);
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
|||||||
int bpp;
|
int bpp;
|
||||||
|
|
||||||
bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0);
|
bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0);
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
|
|
||||||
if (!_cogl_texture_set_region (cogl_texture,
|
if (!_cogl_texture_set_region (cogl_texture,
|
||||||
rect.width, rect.height,
|
rect.width, rect.height,
|
||||||
@ -726,7 +726,7 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
|||||||
void
|
void
|
||||||
meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
|
meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
|
||||||
MetaMultiTexture *texture,
|
MetaMultiTexture *texture,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
@ -100,7 +99,7 @@ void meta_wayland_buffer_dec_use_count (MetaWaylandBuff
|
|||||||
gboolean meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer);
|
gboolean meta_wayland_buffer_is_y_inverted (MetaWaylandBuffer *buffer);
|
||||||
void meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
|
void meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
|
||||||
MetaMultiTexture *texture,
|
MetaMultiTexture *texture,
|
||||||
cairo_region_t *region);
|
MtkRegion *region);
|
||||||
CoglScanout * meta_wayland_buffer_try_acquire_scanout (MetaWaylandBuffer *buffer,
|
CoglScanout * meta_wayland_buffer_try_acquire_scanout (MetaWaylandBuffer *buffer,
|
||||||
CoglOnscreen *onscreen);
|
CoglOnscreen *onscreen);
|
||||||
|
|
||||||
|
@ -176,8 +176,8 @@ meta_wayland_cursor_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
|
|||||||
wl_list_init (&pending->frame_callback_list);
|
wl_list_init (&pending->frame_callback_list);
|
||||||
|
|
||||||
if (pending->newly_attached &&
|
if (pending->newly_attached &&
|
||||||
((!cairo_region_is_empty (pending->surface_damage) ||
|
((!mtk_region_is_empty (pending->surface_damage) ||
|
||||||
!cairo_region_is_empty (pending->buffer_damage)) ||
|
!mtk_region_is_empty (pending->buffer_damage)) ||
|
||||||
!priv->buffer))
|
!priv->buffer))
|
||||||
update_cursor_sprite_texture (META_WAYLAND_CURSOR_SURFACE (surface_role));
|
update_cursor_sprite_texture (META_WAYLAND_CURSOR_SURFACE (surface_role));
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ struct _MetaWaylandPointerConstraint
|
|||||||
|
|
||||||
MetaWaylandSurface *surface;
|
MetaWaylandSurface *surface;
|
||||||
gboolean is_enabled;
|
gboolean is_enabled;
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
MetaWaylandPointerGrab grab;
|
MetaWaylandPointerGrab grab;
|
||||||
MetaWaylandSeat *seat;
|
MetaWaylandSeat *seat;
|
||||||
@ -85,7 +85,7 @@ typedef struct _MetaWaylandSurfacePointerConstraintsData
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
MetaWaylandPointerConstraint *constraint;
|
MetaWaylandPointerConstraint *constraint;
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
gulong applied_handler_id;
|
gulong applied_handler_id;
|
||||||
} MetaWaylandPendingConstraintState;
|
} MetaWaylandPendingConstraintState;
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ meta_wayland_pointer_constraint_new (MetaWaylandSurface *su
|
|||||||
if (region)
|
if (region)
|
||||||
{
|
{
|
||||||
constraint->region =
|
constraint->region =
|
||||||
cairo_region_copy (meta_wayland_region_peek_cairo_region (region));
|
mtk_region_copy (meta_wayland_region_peek_cairo_region (region));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -437,7 +437,7 @@ meta_wayland_pointer_constraint_destroy (MetaWaylandPointerConstraint *constrain
|
|||||||
meta_wayland_pointer_constraint_disable (constraint);
|
meta_wayland_pointer_constraint_disable (constraint);
|
||||||
|
|
||||||
wl_resource_set_user_data (constraint->resource, NULL);
|
wl_resource_set_user_data (constraint->resource, NULL);
|
||||||
g_clear_pointer (&constraint->region, cairo_region_destroy);
|
g_clear_pointer (&constraint->region, mtk_region_unref);
|
||||||
g_object_unref (constraint);
|
g_object_unref (constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,14 +446,13 @@ is_within_constraint_region (MetaWaylandPointerConstraint *constraint,
|
|||||||
wl_fixed_t sx,
|
wl_fixed_t sx,
|
||||||
wl_fixed_t sy)
|
wl_fixed_t sy)
|
||||||
{
|
{
|
||||||
cairo_region_t *region;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
gboolean is_within;
|
gboolean is_within;
|
||||||
|
|
||||||
region = meta_wayland_pointer_constraint_calculate_effective_region (constraint);
|
region = meta_wayland_pointer_constraint_calculate_effective_region (constraint);
|
||||||
is_within = cairo_region_contains_point (region,
|
is_within = mtk_region_contains_point (region,
|
||||||
wl_fixed_to_int (sx),
|
wl_fixed_to_int (sx),
|
||||||
wl_fixed_to_int (sy));
|
wl_fixed_to_int (sy));
|
||||||
cairo_region_destroy (region);
|
|
||||||
|
|
||||||
return is_within;
|
return is_within;
|
||||||
}
|
}
|
||||||
@ -606,15 +605,15 @@ meta_wayland_pointer_constraint_maybe_enable_for_window (MetaWindow *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint)
|
meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint)
|
||||||
{
|
{
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
|
|
||||||
region = meta_wayland_surface_calculate_input_region (constraint->surface);
|
region = meta_wayland_surface_calculate_input_region (constraint->surface);
|
||||||
if (constraint->region)
|
if (constraint->region)
|
||||||
cairo_region_intersect (region, constraint->region);
|
mtk_region_intersect (region, constraint->region);
|
||||||
|
|
||||||
window = meta_wayland_surface_get_window (constraint->surface);
|
window = meta_wayland_surface_get_window (constraint->surface);
|
||||||
if (window && window->frame)
|
if (window && window->frame)
|
||||||
@ -630,12 +629,10 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
|
|||||||
frame->bottom_height);
|
frame->bottom_height);
|
||||||
if (actual_width > 0 && actual_height > 0)
|
if (actual_width > 0 && actual_height > 0)
|
||||||
{
|
{
|
||||||
cairo_region_intersect_rectangle (region, &(MtkRectangle) {
|
mtk_region_intersect_rectangle (region, &MTK_RECTANGLE_INIT (frame->child_x,
|
||||||
.x = frame->child_x,
|
frame->child_y,
|
||||||
.y = frame->child_y,
|
actual_width,
|
||||||
.width = actual_width,
|
actual_height));
|
||||||
.height = actual_height
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,7 +666,7 @@ pointer_constraint_resource_destroyed (struct wl_resource *resource)
|
|||||||
static void
|
static void
|
||||||
pending_constraint_state_free (MetaWaylandPendingConstraintState *constraint_pending)
|
pending_constraint_state_free (MetaWaylandPendingConstraintState *constraint_pending)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&constraint_pending->region, cairo_region_destroy);
|
g_clear_pointer (&constraint_pending->region, mtk_region_unref);
|
||||||
if (constraint_pending->constraint)
|
if (constraint_pending->constraint)
|
||||||
g_object_remove_weak_pointer (G_OBJECT (constraint_pending->constraint),
|
g_object_remove_weak_pointer (G_OBJECT (constraint_pending->constraint),
|
||||||
(gpointer *) &constraint_pending->constraint);
|
(gpointer *) &constraint_pending->constraint);
|
||||||
@ -759,7 +756,7 @@ pending_constraint_state_applied (MetaWaylandSurfaceState *pending,
|
|||||||
if (!constraint)
|
if (!constraint)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&constraint->region, cairo_region_destroy);
|
g_clear_pointer (&constraint->region, mtk_region_unref);
|
||||||
if (constraint_pending->region)
|
if (constraint_pending->region)
|
||||||
{
|
{
|
||||||
constraint->region = constraint_pending->region;
|
constraint->region = constraint_pending->region;
|
||||||
@ -815,11 +812,11 @@ meta_wayland_pointer_constraint_set_pending_region (MetaWaylandPointerConstraint
|
|||||||
|
|
||||||
constraint_pending = ensure_pending_constraint_state (constraint);
|
constraint_pending = ensure_pending_constraint_state (constraint);
|
||||||
|
|
||||||
g_clear_pointer (&constraint_pending->region, cairo_region_destroy);
|
g_clear_pointer (&constraint_pending->region, mtk_region_unref);
|
||||||
if (region)
|
if (region)
|
||||||
{
|
{
|
||||||
constraint_pending->region =
|
constraint_pending->region =
|
||||||
cairo_region_copy (meta_wayland_region_peek_cairo_region (region));
|
mtk_region_copy (meta_wayland_region_peek_cairo_region (region));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ G_DECLARE_FINAL_TYPE (MetaWaylandPointerConstraint,
|
|||||||
|
|
||||||
void meta_wayland_pointer_constraints_init (MetaWaylandCompositor *compositor);
|
void meta_wayland_pointer_constraints_init (MetaWaylandCompositor *compositor);
|
||||||
|
|
||||||
cairo_region_t * meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint);
|
MtkRegion * meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint);
|
||||||
|
|
||||||
MetaWaylandSurface * meta_wayland_pointer_constraint_get_surface (MetaWaylandPointerConstraint *constraint);
|
MetaWaylandSurface * meta_wayland_pointer_constraint_get_surface (MetaWaylandPointerConstraint *constraint);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
struct _MetaWaylandRegion
|
struct _MetaWaylandRegion
|
||||||
{
|
{
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -39,31 +39,31 @@ wl_region_destroy (struct wl_client *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wl_region_add (struct wl_client *client,
|
wl_region_add (struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
gint32 x,
|
gint32 x,
|
||||||
gint32 y,
|
gint32 y,
|
||||||
gint32 width,
|
gint32 width,
|
||||||
gint32 height)
|
gint32 height)
|
||||||
{
|
{
|
||||||
MetaWaylandRegion *region = wl_resource_get_user_data (resource);
|
MetaWaylandRegion *region = wl_resource_get_user_data (resource);
|
||||||
MtkRectangle rectangle = { x, y, width, height };
|
MtkRectangle rectangle = { x, y, width, height };
|
||||||
|
|
||||||
cairo_region_union_rectangle (region->region, &rectangle);
|
mtk_region_union_rectangle (region->region, &rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wl_region_subtract (struct wl_client *client,
|
wl_region_subtract (struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
gint32 x,
|
gint32 x,
|
||||||
gint32 y,
|
gint32 y,
|
||||||
gint32 width,
|
gint32 width,
|
||||||
gint32 height)
|
gint32 height)
|
||||||
{
|
{
|
||||||
MetaWaylandRegion *region = wl_resource_get_user_data (resource);
|
MetaWaylandRegion *region = wl_resource_get_user_data (resource);
|
||||||
MtkRectangle rectangle = { x, y, width, height };
|
MtkRectangle rectangle = { x, y, width, height };
|
||||||
|
|
||||||
cairo_region_subtract_rectangle (region->region, &rectangle);
|
mtk_region_subtract_rectangle (region->region, &rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_region_interface meta_wayland_wl_region_interface = {
|
static const struct wl_region_interface meta_wayland_wl_region_interface = {
|
||||||
@ -77,7 +77,7 @@ wl_region_destructor (struct wl_resource *resource)
|
|||||||
{
|
{
|
||||||
MetaWaylandRegion *region = wl_resource_get_user_data (resource);
|
MetaWaylandRegion *region = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
cairo_region_destroy (region->region);
|
g_clear_pointer (®ion->region, mtk_region_unref);
|
||||||
g_free (region);
|
g_free (region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,12 +92,12 @@ meta_wayland_region_create (MetaWaylandCompositor *compositor,
|
|||||||
region->resource = wl_resource_create (client, &wl_region_interface, wl_resource_get_version (compositor_resource), id);
|
region->resource = wl_resource_create (client, &wl_region_interface, wl_resource_get_version (compositor_resource), id);
|
||||||
wl_resource_set_implementation (region->resource, &meta_wayland_wl_region_interface, region, wl_region_destructor);
|
wl_resource_set_implementation (region->resource, &meta_wayland_wl_region_interface, region, wl_region_destructor);
|
||||||
|
|
||||||
region->region = cairo_region_create ();
|
region->region = mtk_region_create ();
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_wayland_region_peek_cairo_region (MetaWaylandRegion *region)
|
meta_wayland_region_peek_cairo_region (MetaWaylandRegion *region)
|
||||||
{
|
{
|
||||||
return region->region;
|
return region->region;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
@ -33,4 +32,4 @@ MetaWaylandRegion * meta_wayland_region_create (MetaWaylandCompositor *composito
|
|||||||
struct wl_resource *compositor_resource,
|
struct wl_resource *compositor_resource,
|
||||||
guint32 id);
|
guint32 id);
|
||||||
|
|
||||||
cairo_region_t * meta_wayland_region_peek_cairo_region (MetaWaylandRegion *region);
|
MtkRegion * meta_wayland_region_peek_cairo_region (MetaWaylandRegion *region);
|
||||||
|
@ -263,8 +263,8 @@ meta_wayland_surface_assign_role (MetaWaylandSurface *surface,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
surface_process_damage (MetaWaylandSurface *surface,
|
surface_process_damage (MetaWaylandSurface *surface,
|
||||||
cairo_region_t *surface_region,
|
MtkRegion *surface_region,
|
||||||
cairo_region_t *buffer_region)
|
MtkRegion *buffer_region)
|
||||||
{
|
{
|
||||||
MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface);
|
MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface);
|
||||||
MtkRectangle buffer_rect;
|
MtkRectangle buffer_rect;
|
||||||
@ -282,12 +282,12 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
.height = meta_wayland_surface_get_buffer_height (surface),
|
.height = meta_wayland_surface_get_buffer_height (surface),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!cairo_region_is_empty (surface_region))
|
if (!mtk_region_is_empty (surface_region))
|
||||||
{
|
{
|
||||||
MtkRectangle surface_rect;
|
MtkRectangle surface_rect;
|
||||||
cairo_region_t *scaled_region;
|
g_autoptr (MtkRegion) scaled_region = NULL;
|
||||||
cairo_region_t *transformed_region;
|
g_autoptr (MtkRegion) transformed_region = NULL;
|
||||||
cairo_region_t *viewport_region;
|
g_autoptr (MtkRegion) viewport_region = NULL;
|
||||||
graphene_rect_t src_rect;
|
graphene_rect_t src_rect;
|
||||||
|
|
||||||
/* Intersect the damage region with the surface region before scaling in
|
/* Intersect the damage region with the surface region before scaling in
|
||||||
@ -297,7 +297,7 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
.width = meta_wayland_surface_get_width (surface),
|
.width = meta_wayland_surface_get_width (surface),
|
||||||
.height = meta_wayland_surface_get_height (surface),
|
.height = meta_wayland_surface_get_height (surface),
|
||||||
};
|
};
|
||||||
cairo_region_intersect_rectangle (surface_region, &surface_rect);
|
mtk_region_intersect_rectangle (surface_region, &surface_rect);
|
||||||
|
|
||||||
/* The damage region must be in the same coordinate space as the buffer,
|
/* The damage region must be in the same coordinate space as the buffer,
|
||||||
* i.e. scaled with surface->scale. */
|
* i.e. scaled with surface->scale. */
|
||||||
@ -343,14 +343,10 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
/* Now add the scaled, cropped and transformed damage region to the
|
/* Now add the scaled, cropped and transformed damage region to the
|
||||||
* buffer damage. Buffer damage is already in the correct coordinate
|
* buffer damage. Buffer damage is already in the correct coordinate
|
||||||
* space. */
|
* space. */
|
||||||
cairo_region_union (buffer_region, transformed_region);
|
mtk_region_union (buffer_region, transformed_region);
|
||||||
|
|
||||||
cairo_region_destroy (viewport_region);
|
|
||||||
cairo_region_destroy (scaled_region);
|
|
||||||
cairo_region_destroy (transformed_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_intersect_rectangle (buffer_region, &buffer_rect);
|
mtk_region_intersect_rectangle (buffer_region, &buffer_rect);
|
||||||
|
|
||||||
meta_wayland_buffer_process_damage (buffer, surface->output_state.texture,
|
meta_wayland_buffer_process_damage (buffer, surface->output_state.texture,
|
||||||
buffer_region);
|
buffer_region);
|
||||||
@ -360,11 +356,11 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
{
|
{
|
||||||
int i, n_rectangles;
|
int i, n_rectangles;
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (buffer_region);
|
n_rectangles = mtk_region_num_rectangles (buffer_region);
|
||||||
for (i = 0; i < n_rectangles; i++)
|
for (i = 0; i < n_rectangles; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (buffer_region, i, &rect);
|
rect = mtk_region_get_rectangle (buffer_region, i);
|
||||||
|
|
||||||
meta_surface_actor_process_damage (actor,
|
meta_surface_actor_process_damage (actor,
|
||||||
rect.x, rect.y,
|
rect.x, rect.y,
|
||||||
@ -403,8 +399,8 @@ meta_wayland_surface_state_set_default (MetaWaylandSurfaceState *state)
|
|||||||
state->opaque_region = NULL;
|
state->opaque_region = NULL;
|
||||||
state->opaque_region_set = FALSE;
|
state->opaque_region_set = FALSE;
|
||||||
|
|
||||||
state->surface_damage = cairo_region_create ();
|
state->surface_damage = mtk_region_create ();
|
||||||
state->buffer_damage = cairo_region_create ();
|
state->buffer_damage = mtk_region_create ();
|
||||||
wl_list_init (&state->frame_callback_list);
|
wl_list_init (&state->frame_callback_list);
|
||||||
|
|
||||||
state->has_new_geometry = FALSE;
|
state->has_new_geometry = FALSE;
|
||||||
@ -442,10 +438,10 @@ meta_wayland_surface_state_clear (MetaWaylandSurfaceState *state)
|
|||||||
|
|
||||||
g_clear_object (&state->texture);
|
g_clear_object (&state->texture);
|
||||||
|
|
||||||
g_clear_pointer (&state->surface_damage, cairo_region_destroy);
|
g_clear_pointer (&state->surface_damage, mtk_region_unref);
|
||||||
g_clear_pointer (&state->buffer_damage, cairo_region_destroy);
|
g_clear_pointer (&state->buffer_damage, mtk_region_unref);
|
||||||
g_clear_pointer (&state->input_region, cairo_region_destroy);
|
g_clear_pointer (&state->input_region, mtk_region_unref);
|
||||||
g_clear_pointer (&state->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&state->opaque_region, mtk_region_unref);
|
||||||
g_clear_pointer (&state->xdg_positioner, g_free);
|
g_clear_pointer (&state->xdg_positioner, g_free);
|
||||||
|
|
||||||
if (state->buffer_destroy_handler_id)
|
if (state->buffer_destroy_handler_id)
|
||||||
@ -500,15 +496,15 @@ meta_wayland_surface_state_merge_into (MetaWaylandSurfaceState *from,
|
|||||||
wl_list_insert_list (&to->frame_callback_list, &from->frame_callback_list);
|
wl_list_insert_list (&to->frame_callback_list, &from->frame_callback_list);
|
||||||
wl_list_init (&from->frame_callback_list);
|
wl_list_init (&from->frame_callback_list);
|
||||||
|
|
||||||
cairo_region_union (to->surface_damage, from->surface_damage);
|
mtk_region_union (to->surface_damage, from->surface_damage);
|
||||||
cairo_region_union (to->buffer_damage, from->buffer_damage);
|
mtk_region_union (to->buffer_damage, from->buffer_damage);
|
||||||
|
|
||||||
if (from->input_region_set)
|
if (from->input_region_set)
|
||||||
{
|
{
|
||||||
if (to->input_region)
|
if (to->input_region)
|
||||||
cairo_region_union (to->input_region, from->input_region);
|
mtk_region_union (to->input_region, from->input_region);
|
||||||
else
|
else
|
||||||
to->input_region = cairo_region_reference (from->input_region);
|
to->input_region = mtk_region_ref (from->input_region);
|
||||||
|
|
||||||
to->input_region_set = TRUE;
|
to->input_region_set = TRUE;
|
||||||
}
|
}
|
||||||
@ -516,9 +512,9 @@ meta_wayland_surface_state_merge_into (MetaWaylandSurfaceState *from,
|
|||||||
if (from->opaque_region_set)
|
if (from->opaque_region_set)
|
||||||
{
|
{
|
||||||
if (to->opaque_region)
|
if (to->opaque_region)
|
||||||
cairo_region_union (to->opaque_region, from->opaque_region);
|
mtk_region_union (to->opaque_region, from->opaque_region);
|
||||||
else
|
else
|
||||||
to->opaque_region = cairo_region_reference (from->opaque_region);
|
to->opaque_region = mtk_region_ref (from->opaque_region);
|
||||||
|
|
||||||
to->opaque_region_set = TRUE;
|
to->opaque_region_set = TRUE;
|
||||||
}
|
}
|
||||||
@ -800,8 +796,8 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
|
|||||||
meta_wayland_surface_get_width (surface) != old_width ||
|
meta_wayland_surface_get_width (surface) != old_width ||
|
||||||
meta_wayland_surface_get_height (surface) != old_height;
|
meta_wayland_surface_get_height (surface) != old_height;
|
||||||
|
|
||||||
if (!cairo_region_is_empty (state->surface_damage) ||
|
if (!mtk_region_is_empty (state->surface_damage) ||
|
||||||
!cairo_region_is_empty (state->buffer_damage))
|
!mtk_region_is_empty (state->buffer_damage))
|
||||||
{
|
{
|
||||||
surface_process_damage (surface,
|
surface_process_damage (surface,
|
||||||
state->surface_damage,
|
state->surface_damage,
|
||||||
@ -814,22 +810,16 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
|
|||||||
|
|
||||||
if (state->opaque_region_set)
|
if (state->opaque_region_set)
|
||||||
{
|
{
|
||||||
if (surface->opaque_region)
|
g_clear_pointer (&surface->opaque_region, mtk_region_unref);
|
||||||
cairo_region_destroy (surface->opaque_region);
|
|
||||||
if (state->opaque_region)
|
if (state->opaque_region)
|
||||||
surface->opaque_region = cairo_region_reference (state->opaque_region);
|
surface->opaque_region = mtk_region_ref (state->opaque_region);
|
||||||
else
|
|
||||||
surface->opaque_region = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->input_region_set)
|
if (state->input_region_set)
|
||||||
{
|
{
|
||||||
if (surface->input_region)
|
g_clear_pointer (&surface->input_region, mtk_region_unref);
|
||||||
cairo_region_destroy (surface->input_region);
|
|
||||||
if (state->input_region)
|
if (state->input_region)
|
||||||
surface->input_region = cairo_region_reference (state->input_region);
|
surface->input_region = mtk_region_ref (state->input_region);
|
||||||
else
|
|
||||||
surface->input_region = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1072,7 +1062,7 @@ wl_surface_damage (struct wl_client *client,
|
|||||||
.width = width,
|
.width = width,
|
||||||
.height = height
|
.height = height
|
||||||
};
|
};
|
||||||
cairo_region_union_rectangle (pending->surface_damage, &rectangle);
|
mtk_region_union_rectangle (pending->surface_damage, &rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1114,12 +1104,12 @@ wl_surface_set_opaque_region (struct wl_client *client,
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
MetaWaylandSurfaceState *pending = surface->pending_state;
|
MetaWaylandSurfaceState *pending = surface->pending_state;
|
||||||
|
|
||||||
g_clear_pointer (&pending->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&pending->opaque_region, mtk_region_unref);
|
||||||
if (region_resource)
|
if (region_resource)
|
||||||
{
|
{
|
||||||
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
|
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
|
||||||
cairo_region_t *cr_region = meta_wayland_region_peek_cairo_region (region);
|
MtkRegion *cr_region = meta_wayland_region_peek_cairo_region (region);
|
||||||
pending->opaque_region = cairo_region_copy (cr_region);
|
pending->opaque_region = mtk_region_copy (cr_region);
|
||||||
}
|
}
|
||||||
pending->opaque_region_set = TRUE;
|
pending->opaque_region_set = TRUE;
|
||||||
}
|
}
|
||||||
@ -1132,12 +1122,12 @@ wl_surface_set_input_region (struct wl_client *client,
|
|||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
MetaWaylandSurfaceState *pending = surface->pending_state;
|
MetaWaylandSurfaceState *pending = surface->pending_state;
|
||||||
|
|
||||||
g_clear_pointer (&pending->input_region, cairo_region_destroy);
|
g_clear_pointer (&pending->input_region, mtk_region_unref);
|
||||||
if (region_resource)
|
if (region_resource)
|
||||||
{
|
{
|
||||||
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
|
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
|
||||||
cairo_region_t *cr_region = meta_wayland_region_peek_cairo_region (region);
|
MtkRegion *cr_region = meta_wayland_region_peek_cairo_region (region);
|
||||||
pending->input_region = cairo_region_copy (cr_region);
|
pending->input_region = mtk_region_copy (cr_region);
|
||||||
}
|
}
|
||||||
pending->input_region_set = TRUE;
|
pending->input_region_set = TRUE;
|
||||||
}
|
}
|
||||||
@ -1241,7 +1231,7 @@ wl_surface_damage_buffer (struct wl_client *client,
|
|||||||
.width = width,
|
.width = width,
|
||||||
.height = height
|
.height = height
|
||||||
};
|
};
|
||||||
cairo_region_union_rectangle (pending->buffer_damage, &rectangle);
|
mtk_region_union_rectangle (pending->buffer_damage, &rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1469,10 +1459,8 @@ meta_wayland_surface_finalize (GObject *object)
|
|||||||
g_clear_object (&surface->output_state.texture);
|
g_clear_object (&surface->output_state.texture);
|
||||||
g_clear_object (&surface->buffer);
|
g_clear_object (&surface->buffer);
|
||||||
|
|
||||||
if (surface->opaque_region)
|
g_clear_pointer (&surface->opaque_region, mtk_region_unref);
|
||||||
cairo_region_destroy (surface->opaque_region);
|
g_clear_pointer (&surface->input_region, mtk_region_unref);
|
||||||
if (surface->input_region)
|
|
||||||
cairo_region_destroy (surface->input_region);
|
|
||||||
|
|
||||||
meta_wayland_compositor_remove_frame_callback_surface (compositor, surface);
|
meta_wayland_compositor_remove_frame_callback_surface (compositor, surface);
|
||||||
meta_wayland_compositor_remove_presentation_feedback_surface (compositor,
|
meta_wayland_compositor_remove_presentation_feedback_surface (compositor,
|
||||||
@ -2076,10 +2064,10 @@ meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role)
|
|||||||
return priv->surface;
|
return priv->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
MtkRegion *
|
||||||
meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface)
|
meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
cairo_region_t *region;
|
MtkRegion *region;
|
||||||
MtkRectangle buffer_rect;
|
MtkRectangle buffer_rect;
|
||||||
|
|
||||||
if (!surface->buffer)
|
if (!surface->buffer)
|
||||||
@ -2089,10 +2077,10 @@ meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface)
|
|||||||
.width = meta_wayland_surface_get_width (surface),
|
.width = meta_wayland_surface_get_width (surface),
|
||||||
.height = meta_wayland_surface_get_height (surface),
|
.height = meta_wayland_surface_get_height (surface),
|
||||||
};
|
};
|
||||||
region = cairo_region_create_rectangle (&buffer_rect);
|
region = mtk_region_create_rectangle (&buffer_rect);
|
||||||
|
|
||||||
if (surface->input_region)
|
if (surface->input_region)
|
||||||
cairo_region_intersect (region, surface->input_region);
|
mtk_region_intersect (region, surface->input_region);
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
@ -88,13 +87,13 @@ struct _MetaWaylandSurfaceState
|
|||||||
int scale;
|
int scale;
|
||||||
|
|
||||||
/* wl_surface.damage */
|
/* wl_surface.damage */
|
||||||
cairo_region_t *surface_damage;
|
MtkRegion *surface_damage;
|
||||||
/* wl_surface.damage_buffer */
|
/* wl_surface.damage_buffer */
|
||||||
cairo_region_t *buffer_damage;
|
MtkRegion *buffer_damage;
|
||||||
|
|
||||||
cairo_region_t *input_region;
|
MtkRegion *input_region;
|
||||||
gboolean input_region_set;
|
gboolean input_region_set;
|
||||||
cairo_region_t *opaque_region;
|
MtkRegion *opaque_region;
|
||||||
gboolean opaque_region_set;
|
gboolean opaque_region_set;
|
||||||
|
|
||||||
/* wl_surface.frame */
|
/* wl_surface.frame */
|
||||||
@ -162,8 +161,8 @@ struct _MetaWaylandSurface
|
|||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
MetaWaylandCompositor *compositor;
|
MetaWaylandCompositor *compositor;
|
||||||
MetaWaylandSurfaceRole *role;
|
MetaWaylandSurfaceRole *role;
|
||||||
cairo_region_t *input_region;
|
MtkRegion *input_region;
|
||||||
cairo_region_t *opaque_region;
|
MtkRegion *opaque_region;
|
||||||
int scale;
|
int scale;
|
||||||
int32_t offset_x, offset_y;
|
int32_t offset_x, offset_y;
|
||||||
GHashTable *outputs;
|
GHashTable *outputs;
|
||||||
@ -346,7 +345,7 @@ void meta_wayland_surface_get_absolute_coordinates (MetaWaylandSu
|
|||||||
|
|
||||||
MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role);
|
MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role);
|
||||||
|
|
||||||
cairo_region_t * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface);
|
MtkRegion * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface);
|
||||||
|
|
||||||
|
|
||||||
gboolean meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
gboolean meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
|
||||||
|
@ -646,16 +646,16 @@ reload_wm_name (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_set_opaque_region (MetaWindow *window,
|
meta_window_set_opaque_region (MetaWindow *window,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
if (cairo_region_equal (window->opaque_region, region))
|
if (mtk_region_equal (window->opaque_region, region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&window->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&window->opaque_region, mtk_region_unref);
|
||||||
|
|
||||||
if (region != NULL)
|
if (region != NULL)
|
||||||
window->opaque_region = cairo_region_reference (region);
|
window->opaque_region = mtk_region_ref (region);
|
||||||
|
|
||||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||||
}
|
}
|
||||||
@ -665,7 +665,7 @@ reload_opaque_region (MetaWindow *window,
|
|||||||
MetaPropValue *value,
|
MetaPropValue *value,
|
||||||
gboolean initial)
|
gboolean initial)
|
||||||
{
|
{
|
||||||
cairo_region_t *opaque_region = NULL;
|
MtkRegion *opaque_region = NULL;
|
||||||
|
|
||||||
if (value->type != META_PROP_VALUE_INVALID)
|
if (value->type != META_PROP_VALUE_INVALID)
|
||||||
{
|
{
|
||||||
@ -703,7 +703,7 @@ reload_opaque_region (MetaWindow *window,
|
|||||||
rect_index++;
|
rect_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
opaque_region = cairo_region_create_rectangles (rects, nrects);
|
opaque_region = mtk_region_create_rectangles (rects, nrects);
|
||||||
|
|
||||||
g_free (rects);
|
g_free (rects);
|
||||||
}
|
}
|
||||||
@ -714,7 +714,7 @@ reload_opaque_region (MetaWindow *window,
|
|||||||
else if (window->frame && value->source_xwindow == window->frame->xwindow)
|
else if (window->frame && value->source_xwindow == window->frame->xwindow)
|
||||||
meta_frame_set_opaque_region (window->frame, opaque_region);
|
meta_frame_set_opaque_region (window->frame, opaque_region);
|
||||||
|
|
||||||
g_clear_pointer (&opaque_region, cairo_region_destroy);
|
g_clear_pointer (&opaque_region, mtk_region_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2365,14 +2365,14 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
|
|||||||
update_gtk_edge_constraints (window);
|
update_gtk_edge_constraints (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static MtkRegion *
|
||||||
region_create_from_x_rectangles (const XRectangle *rects,
|
region_create_from_x_rectangles (const XRectangle *rects,
|
||||||
int n_rects)
|
int n_rects)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
MtkRectangle *cairo_rects = g_newa (MtkRectangle, n_rects);
|
MtkRectangle *cairo_rects = g_newa (MtkRectangle, n_rects);
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i ++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_rects[i].x = rects[i].x;
|
cairo_rects[i].x = rects[i].x;
|
||||||
cairo_rects[i].y = rects[i].y;
|
cairo_rects[i].y = rects[i].y;
|
||||||
@ -2380,20 +2380,20 @@ region_create_from_x_rectangles (const XRectangle *rects,
|
|||||||
cairo_rects[i].height = rects[i].height;
|
cairo_rects[i].height = rects[i].height;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cairo_region_create_rectangles (cairo_rects, n_rects);
|
return mtk_region_create_rectangles (cairo_rects, n_rects);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_set_input_region (MetaWindow *window,
|
meta_window_set_input_region (MetaWindow *window,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
if (cairo_region_equal (window->input_region, region))
|
if (mtk_region_equal (window->input_region, region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&window->input_region, cairo_region_destroy);
|
g_clear_pointer (&window->input_region, mtk_region_unref);
|
||||||
|
|
||||||
if (region != NULL)
|
if (region != NULL)
|
||||||
window->input_region = cairo_region_reference (region);
|
window->input_region = mtk_region_ref (region);
|
||||||
|
|
||||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||||
}
|
}
|
||||||
@ -2401,17 +2401,17 @@ meta_window_set_input_region (MetaWindow *window,
|
|||||||
#if 0
|
#if 0
|
||||||
/* Print out a region; useful for debugging */
|
/* Print out a region; useful for debugging */
|
||||||
static void
|
static void
|
||||||
print_region (cairo_region_t *region)
|
print_region (MtkRegion *region)
|
||||||
{
|
{
|
||||||
int n_rects;
|
int n_rects;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
n_rects = mtk_region_num_rectangles (region);
|
||||||
g_print ("[");
|
g_print ("[");
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
rect = mtk_region_get_rectangle (region, i);
|
||||||
g_print ("+%d+%dx%dx%d ",
|
g_print ("+%d+%dx%dx%d ",
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
rect.x, rect.y, rect.width, rect.height);
|
||||||
}
|
}
|
||||||
@ -2423,7 +2423,7 @@ void
|
|||||||
meta_window_x11_update_input_region (MetaWindow *window)
|
meta_window_x11_update_input_region (MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaX11Display *x11_display = window->display->x11_display;
|
MetaX11Display *x11_display = window->display->x11_display;
|
||||||
cairo_region_t *region = NULL;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
@ -2446,7 +2446,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|||||||
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||||
{
|
{
|
||||||
/* Translate the set of XShape rectangles that we
|
/* Translate the set of XShape rectangles that we
|
||||||
* get from the X server to a cairo_region. */
|
* get from the X server to a MtkRegion. */
|
||||||
XRectangle *rects = NULL;
|
XRectangle *rects = NULL;
|
||||||
int n_rects = -1, ordering;
|
int n_rects = -1, ordering;
|
||||||
|
|
||||||
@ -2479,7 +2479,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|||||||
else if (n_rects == 0)
|
else if (n_rects == 0)
|
||||||
{
|
{
|
||||||
/* Client set an empty region. */
|
/* Client set an empty region. */
|
||||||
region = cairo_region_create ();
|
region = mtk_region_create ();
|
||||||
}
|
}
|
||||||
else if (n_rects == 1 &&
|
else if (n_rects == 1 &&
|
||||||
(rects[0].x == 0 &&
|
(rects[0].x == 0 &&
|
||||||
@ -2516,24 +2516,23 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|||||||
* window would have gotten if it was unshaped. In our case,
|
* window would have gotten if it was unshaped. In our case,
|
||||||
* this is simply the client area.
|
* this is simply the client area.
|
||||||
*/
|
*/
|
||||||
cairo_region_intersect_rectangle (region, &client_area);
|
mtk_region_intersect_rectangle (region, &client_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_window_set_input_region (window, region);
|
meta_window_set_input_region (window, region);
|
||||||
cairo_region_destroy (region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_set_shape_region (MetaWindow *window,
|
meta_window_set_shape_region (MetaWindow *window,
|
||||||
cairo_region_t *region)
|
MtkRegion *region)
|
||||||
{
|
{
|
||||||
if (cairo_region_equal (window->shape_region, region))
|
if (mtk_region_equal (window->shape_region, region))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_pointer (&window->shape_region, cairo_region_destroy);
|
g_clear_pointer (&window->shape_region, mtk_region_unref);
|
||||||
|
|
||||||
if (region != NULL)
|
if (region != NULL)
|
||||||
window->shape_region = cairo_region_reference (region);
|
window->shape_region = mtk_region_ref (region);
|
||||||
|
|
||||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||||
}
|
}
|
||||||
@ -2544,12 +2543,12 @@ meta_window_x11_update_shape_region (MetaWindow *window)
|
|||||||
MetaX11Display *x11_display = window->display->x11_display;
|
MetaX11Display *x11_display = window->display->x11_display;
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||||
cairo_region_t *region = NULL;
|
g_autoptr (MtkRegion) region = NULL;
|
||||||
|
|
||||||
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||||
{
|
{
|
||||||
/* Translate the set of XShape rectangles that we
|
/* Translate the set of XShape rectangles that we
|
||||||
* get from the X server to a cairo_region. */
|
* get from the X server to a MtkRegion. */
|
||||||
XRectangle *rects = NULL;
|
XRectangle *rects = NULL;
|
||||||
int n_rects, ordering;
|
int n_rects, ordering;
|
||||||
|
|
||||||
@ -2597,17 +2596,16 @@ meta_window_x11_update_shape_region (MetaWindow *window)
|
|||||||
* window would have gotten if it was unshaped. In our case,
|
* window would have gotten if it was unshaped. In our case,
|
||||||
* this is simply the client area.
|
* this is simply the client area.
|
||||||
*/
|
*/
|
||||||
cairo_region_intersect_rectangle (region, &client_area);
|
mtk_region_intersect_rectangle (region, &client_area);
|
||||||
/* Some applications might explicitly set their bounding region
|
/* Some applications might explicitly set their bounding region
|
||||||
* to the client area. Detect these cases, and throw out the
|
* to the client area. Detect these cases, and throw out the
|
||||||
* bounding region in this case for decorated windows. */
|
* bounding region in this case for decorated windows. */
|
||||||
if (window->decorated &&
|
if (window->decorated &&
|
||||||
cairo_region_contains_rectangle (region, &client_area) == CAIRO_REGION_OVERLAP_IN)
|
mtk_region_contains_rectangle (region, &client_area) == MTK_REGION_OVERLAP_IN)
|
||||||
g_clear_pointer (®ion, cairo_region_destroy);
|
g_clear_pointer (®ion, mtk_region_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_window_set_shape_region (window, region);
|
meta_window_set_shape_region (window, region);
|
||||||
cairo_region_destroy (region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generally meta_window_same_application() is a better idea
|
/* Generally meta_window_same_application() is a better idea
|
||||||
|
Loading…
Reference in New Issue
Block a user