clutter: Replace cairo_rectangle_int_t with MtkRectangle

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
This commit is contained in:
Bilal Elmoussaoui
2023-07-19 16:31:26 +02:00
parent 7ee5b0c3e6
commit 06b5cb0761
18 changed files with 187 additions and 180 deletions

View File

@ -20,7 +20,6 @@
#include "clutter/clutter-stage-view.h"
#include "clutter/clutter-stage-view-private.h"
#include <cairo-gobject.h>
#include <math.h>
#include "clutter/clutter-damage-history.h"
@ -64,7 +63,7 @@ typedef struct _ClutterStageViewPrivate
ClutterStage *stage;
cairo_rectangle_int_t layout;
MtkRectangle layout;
float scale;
CoglFramebuffer *framebuffer;
@ -116,8 +115,8 @@ clutter_stage_view_destroy (ClutterStageView *view)
}
void
clutter_stage_view_get_layout (ClutterStageView *view,
cairo_rectangle_int_t *rect)
clutter_stage_view_get_layout (ClutterStageView *view,
MtkRectangle *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
@ -213,11 +212,11 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
}
void
clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
const cairo_rectangle_int_t *src_rect,
int dst_width,
int dst_height,
cairo_rectangle_int_t *dst_rect)
clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
const MtkRectangle *src_rect,
int dst_width,
int dst_height,
MtkRectangle *dst_rect)
{
ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
@ -238,8 +237,8 @@ paint_transformed_framebuffer (ClutterStageView *view,
graphene_matrix_t matrix;
unsigned int n_rectangles, i;
int dst_width, dst_height;
cairo_rectangle_int_t view_layout;
cairo_rectangle_int_t onscreen_layout;
MtkRectangle view_layout;
MtkRectangle onscreen_layout;
float view_scale;
float *coordinates;
@ -247,7 +246,7 @@ paint_transformed_framebuffer (ClutterStageView *view,
dst_height = cogl_framebuffer_get_height (dst_framebuffer);
clutter_stage_view_get_layout (view, &view_layout);
clutter_stage_view_transform_rect_to_onscreen (view,
&(cairo_rectangle_int_t) {
&(MtkRectangle) {
.width = view_layout.width,
.height = view_layout.height,
},
@ -275,8 +274,8 @@ paint_transformed_framebuffer (ClutterStageView *view,
for (i = 0; i < n_rectangles; i++)
{
cairo_rectangle_int_t src_rect;
cairo_rectangle_int_t dst_rect;
MtkRectangle src_rect;
MtkRectangle dst_rect;
cairo_region_get_rectangle (redraw_clip, i, &src_rect);
_clutter_util_rectangle_offset (&src_rect,
@ -499,11 +498,11 @@ clutter_stage_view_after_paint (ClutterStageView *view,
}
static gboolean
is_tile_dirty (cairo_rectangle_int_t *tile,
uint8_t *current_data,
uint8_t *prev_data,
int bpp,
int stride)
is_tile_dirty (MtkRectangle *tile,
uint8_t *current_data,
uint8_t *prev_data,
int bpp,
int stride)
{
int y;
@ -532,8 +531,8 @@ find_damaged_tiles (ClutterStageView *view,
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
cairo_region_t *tile_damage_region;
cairo_rectangle_int_t damage_extents;
cairo_rectangle_int_t fb_rect;
MtkRectangle damage_extents;
MtkRectangle fb_rect;
int prev_dma_buf_idx;
CoglDmaBufHandle *prev_dma_buf_handle;
uint8_t *prev_data;
@ -572,7 +571,7 @@ find_damaged_tiles (ClutterStageView *view,
if (!current_data)
goto err_mmap_current;
fb_rect = (cairo_rectangle_int_t) {
fb_rect = (MtkRectangle) {
.width = width,
.height = height,
};
@ -592,7 +591,7 @@ find_damaged_tiles (ClutterStageView *view,
{
for (tile_x = tile_x_min; tile_x <= tile_x_max; tile_x++)
{
cairo_rectangle_int_t tile = {
MtkRectangle tile = {
.x = tile_x * tile_size,
.y = tile_y * tile_size,
.width = tile_size,
@ -676,7 +675,7 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
if (cairo_region_is_empty (swap_region))
{
cairo_rectangle_int_t full_damage = {
MtkRectangle full_damage = {
.width = cogl_framebuffer_get_width (priv->framebuffer),
.height = cogl_framebuffer_get_height (priv->framebuffer),
};
@ -748,7 +747,7 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
{
CoglFramebuffer *shadowfb = COGL_FRAMEBUFFER (priv->shadow.framebuffer);
g_autoptr (GError) error = NULL;
cairo_rectangle_int_t rect;
MtkRectangle rect;
cairo_region_get_rectangle (damage_region, i, &rect);
@ -941,7 +940,7 @@ maybe_mark_full_redraw (ClutterStageView *view,
if (cairo_region_num_rectangles (*region) == 1)
{
cairo_rectangle_int_t region_extents;
MtkRectangle region_extents;
cairo_region_get_extents (*region, &region_extents);
if (clutter_util_rectangle_equal (&priv->layout, &region_extents))
@ -950,8 +949,8 @@ maybe_mark_full_redraw (ClutterStageView *view,
}
void
clutter_stage_view_add_redraw_clip (ClutterStageView *view,
const cairo_rectangle_int_t *clip)
clutter_stage_view_add_redraw_clip (ClutterStageView *view,
const MtkRectangle *clip)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
@ -1410,8 +1409,7 @@ clutter_stage_view_set_property (GObject *object,
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
cairo_rectangle_int_t *layout;
MtkRectangle *layout;
switch (prop_id)
{
case PROP_NAME:
@ -1552,7 +1550,7 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
obj_props[PROP_LAYOUT] =
g_param_spec_boxed ("layout", NULL, NULL,
CAIRO_GOBJECT_TYPE_RECTANGLE_INT,
MTK_TYPE_RECTANGLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);