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

@ -7706,8 +7706,8 @@ _clutter_actor_queue_only_relayout (ClutterActor *self)
* clutter_actor_queue_redraw(). * clutter_actor_queue_redraw().
*/ */
void void
clutter_actor_queue_redraw_with_clip (ClutterActor *self, clutter_actor_queue_redraw_with_clip (ClutterActor *self,
const cairo_rectangle_int_t *clip) const MtkRectangle *clip)
{ {
ClutterPaintVolume volume; ClutterPaintVolume volume;
graphene_point3d_t origin; graphene_point3d_t origin;

View File

@ -40,6 +40,7 @@
#include "clutter/clutter-event.h" #include "clutter/clutter-event.h"
#include "clutter/clutter-paint-context.h" #include "clutter/clutter-paint-context.h"
#include "clutter/clutter-pick-context.h" #include "clutter/clutter-pick-context.h"
#include "mtk/mtk.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -335,8 +336,8 @@ void clutter_actor_continue_pick
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_queue_redraw (ClutterActor *self); void clutter_actor_queue_redraw (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_queue_redraw_with_clip (ClutterActor *self, void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
const cairo_rectangle_int_t *clip); const MtkRectangle *clip);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_queue_relayout (ClutterActor *self); void clutter_actor_queue_relayout (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@ -356,12 +356,12 @@ clutter_image_set_bytes (ClutterImage *image,
* and %FALSE otherwise. * and %FALSE otherwise.
*/ */
gboolean gboolean
clutter_image_set_area (ClutterImage *image, clutter_image_set_area (ClutterImage *image,
const guint8 *data, const guint8 *data,
CoglPixelFormat pixel_format, CoglPixelFormat pixel_format,
const cairo_rectangle_int_t *area, const MtkRectangle *area,
guint row_stride, guint row_stride,
GError **error) GError **error)
{ {
ClutterImagePrivate *priv; ClutterImagePrivate *priv;

View File

@ -30,6 +30,7 @@
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "clutter/clutter-types.h" #include "clutter/clutter-types.h"
#include "mtk/mtk.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -61,12 +62,12 @@ gboolean clutter_image_set_data (ClutterImage
guint row_stride, guint row_stride,
GError **error); GError **error);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_image_set_area (ClutterImage *image, gboolean clutter_image_set_area (ClutterImage *image,
const guint8 *data, const guint8 *data,
CoglPixelFormat pixel_format, CoglPixelFormat pixel_format,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
guint row_stride, guint row_stride,
GError **error); GError **error);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_image_set_bytes (ClutterImage *image, gboolean clutter_image_set_bytes (ClutterImage *image,
GBytes *data, GBytes *data,

View File

@ -37,6 +37,7 @@
#include "clutter/clutter-stage-view.h" #include "clutter/clutter-stage-view.h"
#include "clutter/clutter-stage-view-private.h" #include "clutter/clutter-stage-view-private.h"
#include "clutter/clutter.h" #include "clutter/clutter.h"
#include "mtk/mtk.h"
/* An epsilon larger than FLT_EPSILON that is useful when comparing coordinates /* An epsilon larger than FLT_EPSILON that is useful when comparing coordinates
* while ignoring floating point precision loss that might happen during * while ignoring floating point precision loss that might happen during
@ -80,11 +81,11 @@ CLUTTER_EXPORT
int64_t clutter_stage_get_frame_counter (ClutterStage *stage); int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_capture_view_into (ClutterStage *stage, void clutter_stage_capture_view_into (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view,
cairo_rectangle_int_t *rect, MtkRectangle *rect,
uint8_t *data, uint8_t *data,
int stride); int stride);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_clear_stage_views (ClutterStage *stage); void clutter_stage_clear_stage_views (ClutterStage *stage);

View File

@ -430,8 +430,8 @@ clutter_pick_stack_pop_transform (ClutterPickStack *pick_stack)
} }
static gboolean static gboolean
get_verts_rectangle (graphene_point3d_t verts[4], get_verts_rectangle (graphene_point3d_t verts[4],
cairo_rectangle_int_t *rect) MtkRectangle *rect)
{ {
if (verts[0].x != verts[2].x || if (verts[0].x != verts[2].x ||
verts[0].y != verts[1].y || verts[0].y != verts[1].y ||
@ -441,7 +441,7 @@ get_verts_rectangle (graphene_point3d_t verts[4],
verts[0].y > verts[3].y) verts[0].y > verts[3].y)
return FALSE; return FALSE;
*rect = (cairo_rectangle_int_t) { *rect = (MtkRectangle) {
.x = ceilf (verts[0].x), .x = ceilf (verts[0].x),
.y = ceilf (verts[0].y), .y = ceilf (verts[0].y),
.width = floor (verts[1].x - ceilf (verts[0].x)), .width = floor (verts[1].x - ceilf (verts[0].x)),
@ -459,7 +459,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
{ {
cairo_region_t *area = NULL; cairo_region_t *area = NULL;
graphene_point3d_t verts[4]; graphene_point3d_t verts[4];
cairo_rectangle_int_t rect; MtkRectangle rect;
int i; int i;
clutter_actor_get_abs_allocation_vertices (pick_rec->actor, clutter_actor_get_abs_allocation_vertices (pick_rec->actor,
@ -495,7 +495,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
continue; continue;
cairo_region_subtract_rectangle (area, cairo_region_subtract_rectangle (area,
&(cairo_rectangle_int_t) { &(MtkRectangle) {
.x = paint_box.x1, .x = paint_box.x1,
.y = paint_box.y1, .y = paint_box.y1,
.width = paint_box.x2 - paint_box.x1, .width = paint_box.x2 - paint_box.x1,

View File

@ -37,6 +37,7 @@
#include "clutter/clutter-settings.h" #include "clutter/clutter-settings.h"
#include "clutter/clutter-stage-manager.h" #include "clutter/clutter-stage-manager.h"
#include "clutter/clutter-stage.h" #include "clutter/clutter-stage.h"
#include "mtk/mtk.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -201,28 +202,28 @@ void _clutter_util_fully_transform_vertices (const graphene_matrix_t *modelvie
int n_vertices); int n_vertices);
CLUTTER_EXPORT CLUTTER_EXPORT
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, void _clutter_util_rect_from_rectangle (const MtkRectangle *src,
graphene_rect_t *dest); graphene_rect_t *dest);
CLUTTER_EXPORT CLUTTER_EXPORT
void _clutter_util_rectangle_int_extents (const graphene_rect_t *src, void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
cairo_rectangle_int_t *dest); MtkRectangle *dest);
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src, void _clutter_util_rectangle_offset (const MtkRectangle *src,
int x, int x,
int y, int y,
cairo_rectangle_int_t *dest); MtkRectangle *dest);
void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1, void _clutter_util_rectangle_union (const MtkRectangle *src1,
const cairo_rectangle_int_t *src2, const MtkRectangle *src2,
cairo_rectangle_int_t *dest); MtkRectangle *dest);
gboolean _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1, gboolean _clutter_util_rectangle_intersection (const MtkRectangle *src1,
const cairo_rectangle_int_t *src2, const MtkRectangle *src2,
cairo_rectangle_int_t *dest); MtkRectangle *dest);
gboolean clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1, gboolean clutter_util_rectangle_equal (const MtkRectangle *src1,
const cairo_rectangle_int_t *src2); const MtkRectangle *src2);
CLUTTER_EXPORT CLUTTER_EXPORT
PangoDirection _clutter_pango_unichar_direction (gunichar ch); PangoDirection _clutter_pango_unichar_direction (gunichar ch);

View File

@ -19,6 +19,7 @@
#include "clutter/clutter-stage-view.h" #include "clutter/clutter-stage-view.h"
#include "clutter/clutter-types.h" #include "clutter/clutter-types.h"
#include "mtk/mtk.h"
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_view_after_paint (ClutterStageView *view, void clutter_stage_view_after_paint (ClutterStageView *view,
@ -46,8 +47,8 @@ void clutter_stage_view_set_projection (ClutterStageView *view,
const graphene_matrix_t *matrix); const graphene_matrix_t *matrix);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_view_add_redraw_clip (ClutterStageView *view, void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
const cairo_rectangle_int_t *clip); const MtkRectangle *clip);
gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view); gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view);
@ -68,11 +69,11 @@ CLUTTER_EXPORT
CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view); CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view, void clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
const cairo_rectangle_int_t *src_rect, const MtkRectangle *src_rect,
int dst_width, int dst_width,
int dst_height, int dst_height,
cairo_rectangle_int_t *dst_rect); MtkRectangle *dst_rect);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_view_schedule_update (ClutterStageView *view); void clutter_stage_view_schedule_update (ClutterStageView *view);

View File

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

View File

@ -21,13 +21,13 @@
#error "Only <clutter/clutter.h> can be included directly." #error "Only <clutter/clutter.h> can be included directly."
#endif #endif
#include <cairo.h>
#include <glib-object.h> #include <glib-object.h>
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "clutter/clutter-macros.h" #include "clutter/clutter-macros.h"
#include "clutter/clutter-frame-clock.h" #include "clutter/clutter-frame-clock.h"
#include "clutter/clutter-types.h" #include "clutter/clutter-types.h"
#include "mtk/mtk.h"
#define CLUTTER_TYPE_STAGE_VIEW (clutter_stage_view_get_type ()) #define CLUTTER_TYPE_STAGE_VIEW (clutter_stage_view_get_type ())
CLUTTER_EXPORT CLUTTER_EXPORT
@ -45,11 +45,11 @@ struct _ClutterStageViewClass
void (* get_offscreen_transformation_matrix) (ClutterStageView *view, void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
graphene_matrix_t *matrix); graphene_matrix_t *matrix);
void (* transform_rect_to_onscreen) (ClutterStageView *view, void (* transform_rect_to_onscreen) (ClutterStageView *view,
const cairo_rectangle_int_t *src_rect, const MtkRectangle *src_rect,
int dst_width, int dst_width,
int dst_height, int dst_height,
cairo_rectangle_int_t *dst_rect); MtkRectangle *dst_rect);
ClutterFrame * (* new_frame) (ClutterStageView *view); ClutterFrame * (* new_frame) (ClutterStageView *view);
@ -60,8 +60,8 @@ CLUTTER_EXPORT
void clutter_stage_view_destroy (ClutterStageView *view); void clutter_stage_view_destroy (ClutterStageView *view);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_view_get_layout (ClutterStageView *view, void clutter_stage_view_get_layout (ClutterStageView *view,
cairo_rectangle_int_t *rect); MtkRectangle *rect);
CLUTTER_EXPORT CLUTTER_EXPORT
CoglFramebuffer *clutter_stage_view_get_framebuffer (ClutterStageView *view); CoglFramebuffer *clutter_stage_view_get_framebuffer (ClutterStageView *view);

View File

@ -79,8 +79,8 @@ _clutter_stage_window_resize (ClutterStageWindow *window,
} }
void void
_clutter_stage_window_get_geometry (ClutterStageWindow *window, _clutter_stage_window_get_geometry (ClutterStageWindow *window,
cairo_rectangle_int_t *geometry) MtkRectangle *geometry)
{ {
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_geometry (window, geometry); CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_geometry (window, geometry);
} }

View File

@ -39,7 +39,7 @@ struct _ClutterStageWindowInterface
gint width, gint width,
gint height); gint height);
void (* get_geometry) (ClutterStageWindow *stage_window, void (* get_geometry) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *geometry); MtkRectangle *geometry);
void (* redraw_view) (ClutterStageWindow *stage_window, void (* redraw_view) (ClutterStageWindow *stage_window,
ClutterStageView *view, ClutterStageView *view,
@ -76,7 +76,7 @@ void _clutter_stage_window_resize (ClutterStageWin
gint height); gint height);
CLUTTER_EXPORT CLUTTER_EXPORT
void _clutter_stage_window_get_geometry (ClutterStageWindow *window, void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
cairo_rectangle_int_t *geometry); MtkRectangle *geometry);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window, void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus); gboolean accept_focus);

View File

@ -208,7 +208,7 @@ clutter_stage_get_preferred_width (ClutterActor *self,
gfloat *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
cairo_rectangle_int_t geom; MtkRectangle geom;
if (priv->impl == NULL) if (priv->impl == NULL)
return; return;
@ -229,7 +229,7 @@ clutter_stage_get_preferred_height (ClutterActor *self,
gfloat *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
cairo_rectangle_int_t geom; MtkRectangle geom;
if (priv->impl == NULL) if (priv->impl == NULL)
return; return;
@ -244,8 +244,8 @@ clutter_stage_get_preferred_height (ClutterActor *self,
} }
static void static void
clutter_stage_add_redraw_clip (ClutterStage *stage, clutter_stage_add_redraw_clip (ClutterStage *stage,
cairo_rectangle_int_t *clip) MtkRectangle *clip)
{ {
GList *l; GList *l;
@ -259,8 +259,8 @@ clutter_stage_add_redraw_clip (ClutterStage *stage,
} }
else else
{ {
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
cairo_rectangle_int_t intersection; MtkRectangle intersection;
clutter_stage_view_get_layout (view, &view_layout); clutter_stage_view_get_layout (view, &view_layout);
if (_clutter_util_rectangle_intersection (&view_layout, clip, if (_clutter_util_rectangle_intersection (&view_layout, clip,
@ -299,7 +299,7 @@ clutter_stage_allocate (ClutterActor *self,
ClutterActorBox alloc = CLUTTER_ACTOR_BOX_INIT_ZERO; ClutterActorBox alloc = CLUTTER_ACTOR_BOX_INIT_ZERO;
float new_width, new_height; float new_width, new_height;
float width, height; float width, height;
cairo_rectangle_int_t window_size; MtkRectangle window_size;
ClutterActorBox children_box; ClutterActorBox children_box;
ClutterLayoutManager *layout_manager = clutter_actor_get_layout_manager (self); ClutterLayoutManager *layout_manager = clutter_actor_get_layout_manager (self);
@ -342,12 +342,12 @@ clutter_stage_allocate (ClutterActor *self,
} }
static void static void
setup_clip_frustum (ClutterStage *stage, setup_clip_frustum (ClutterStage *stage,
const cairo_rectangle_int_t *clip, const MtkRectangle *clip,
graphene_frustum_t *frustum) graphene_frustum_t *frustum)
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
cairo_rectangle_int_t geom; MtkRectangle geom;
graphene_point3d_t camera_position; graphene_point3d_t camera_position;
graphene_point3d_t p[4]; graphene_point3d_t p[4];
graphene_plane_t planes[6]; graphene_plane_t planes[6];
@ -407,7 +407,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
const cairo_region_t *redraw_clip) const cairo_region_t *redraw_clip)
{ {
ClutterPaintContext *paint_context; ClutterPaintContext *paint_context;
cairo_rectangle_int_t clip_rect; MtkRectangle clip_rect;
g_autoptr (GArray) clip_frusta = NULL; g_autoptr (GArray) clip_frusta = NULL;
graphene_frustum_t clip_frustum; graphene_frustum_t clip_frustum;
ClutterPaintNode *root_node; ClutterPaintNode *root_node;
@ -1110,7 +1110,7 @@ clutter_stage_get_view_at (ClutterStage *stage,
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next) for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
{ {
ClutterStageView *view = l->data; ClutterStageView *view = l->data;
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
clutter_stage_view_get_layout (view, &view_layout); clutter_stage_view_get_layout (view, &view_layout);
if (x >= view_layout.x && if (x >= view_layout.x &&
@ -1321,7 +1321,7 @@ clutter_stage_paint (ClutterActor *actor,
if (view && if (view &&
G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME)) G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME))
{ {
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
ClutterFrameClock *frame_clock; ClutterFrameClock *frame_clock;
g_autoptr (GString) string = NULL; g_autoptr (GString) string = NULL;
PangoLayout *layout; PangoLayout *layout;
@ -1642,7 +1642,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
static void static void
clutter_stage_init (ClutterStage *self) clutter_stage_init (ClutterStage *self)
{ {
cairo_rectangle_int_t geom = { 0, }; MtkRectangle geom = { 0, };
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
ClutterStageWindow *impl; ClutterStageWindow *impl;
ClutterBackend *backend; ClutterBackend *backend;
@ -1947,7 +1947,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
GList *l; GList *l;
ClutterStageView *view; ClutterStageView *view;
cairo_region_t *clip; cairo_region_t *clip;
cairo_rectangle_int_t clip_rect; MtkRectangle clip_rect;
CoglFramebuffer *framebuffer; CoglFramebuffer *framebuffer;
float view_scale; float view_scale;
float pixel_width; float pixel_width;
@ -1980,7 +1980,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
clutter_stage_view_get_layout (view, &clip_rect); clutter_stage_view_get_layout (view, &clip_rect);
clip = cairo_region_create_rectangle (&clip_rect); clip = cairo_region_create_rectangle (&clip_rect);
cairo_region_intersect_rectangle (clip, cairo_region_intersect_rectangle (clip,
&(cairo_rectangle_int_t) { &(MtkRectangle) {
.x = x, .x = x,
.y = y, .y = y,
.width = width, .width = width,
@ -2440,7 +2440,7 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
if (clutter_stage_view_is_dirty_viewport (view)) if (clutter_stage_view_is_dirty_viewport (view))
{ {
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
float fb_scale; float fb_scale;
float viewport_offset_x; float viewport_offset_x;
float viewport_offset_y; float viewport_offset_y;
@ -2593,7 +2593,7 @@ clutter_stage_add_to_redraw_clip (ClutterStage *stage,
ClutterStageWindow *stage_window; ClutterStageWindow *stage_window;
ClutterActorBox bounding_box; ClutterActorBox bounding_box;
ClutterActorBox intersection_box; ClutterActorBox intersection_box;
cairo_rectangle_int_t geom, stage_clip; MtkRectangle geom, stage_clip;
if (CLUTTER_ACTOR_IN_DESTRUCTION (CLUTTER_ACTOR (stage))) if (CLUTTER_ACTOR_IN_DESTRUCTION (CLUTTER_ACTOR (stage)))
return; return;
@ -2661,7 +2661,7 @@ clutter_stage_presented (ClutterStage *stage,
/** /**
* clutter_stage_get_capture_final_size: * clutter_stage_get_capture_final_size:
* @stage: a #ClutterStage actor * @stage: a #ClutterStage actor
* @rect: a #cairo_rectangle_int_t * @rect: a rectangle
* @out_width: (out) (optional): the final width * @out_width: (out) (optional): the final width
* @out_height: (out) (optional): the final height * @out_height: (out) (optional): the final height
* @out_scale: (out) (optional): the final scale factor * @out_scale: (out) (optional): the final scale factor
@ -2673,11 +2673,11 @@ clutter_stage_presented (ClutterStage *stage,
* Returns: %TRUE if the size has been retrieved, %FALSE otherwise. * Returns: %TRUE if the size has been retrieved, %FALSE otherwise.
*/ */
gboolean gboolean
clutter_stage_get_capture_final_size (ClutterStage *stage, clutter_stage_get_capture_final_size (ClutterStage *stage,
cairo_rectangle_int_t *rect, MtkRectangle *rect,
int *out_width, int *out_width,
int *out_height, int *out_height,
float *out_scale) float *out_scale)
{ {
float max_scale = 1.0; float max_scale = 1.0;
@ -2733,7 +2733,7 @@ clutter_stage_get_capture_final_size (ClutterStage *stage,
void void
clutter_stage_paint_to_framebuffer (ClutterStage *stage, clutter_stage_paint_to_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer, CoglFramebuffer *framebuffer,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
float scale, float scale,
ClutterPaintFlag paint_flags) ClutterPaintFlag paint_flags)
{ {
@ -2772,7 +2772,7 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
/** /**
* clutter_stage_paint_to_buffer: * clutter_stage_paint_to_buffer:
* @stage: a #ClutterStage actor * @stage: a #ClutterStage actor
* @rect: a #cairo_rectangle_int_t * @rect: a rectangle
* @scale: the scale * @scale: the scale
* @data: (array) (element-type guint8): a pointer to the data * @data: (array) (element-type guint8): a pointer to the data
* @stride: stride of the image surface * @stride: stride of the image surface
@ -2785,14 +2785,14 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
* Returns: %TRUE is the buffer has been paint successfully, %FALSE otherwise. * Returns: %TRUE is the buffer has been paint successfully, %FALSE otherwise.
*/ */
gboolean gboolean
clutter_stage_paint_to_buffer (ClutterStage *stage, clutter_stage_paint_to_buffer (ClutterStage *stage,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
float scale, float scale,
uint8_t *data, uint8_t *data,
int stride, int stride,
CoglPixelFormat format, CoglPixelFormat format,
ClutterPaintFlag paint_flags, ClutterPaintFlag paint_flags,
GError **error) GError **error)
{ {
ClutterBackend *clutter_backend = clutter_get_default_backend (); ClutterBackend *clutter_backend = clutter_get_default_backend ();
CoglContext *cogl_context = CoglContext *cogl_context =
@ -2847,7 +2847,7 @@ clutter_stage_paint_to_buffer (ClutterStage *stage,
/** /**
* clutter_stage_paint_to_content: * clutter_stage_paint_to_content:
* @stage: a #ClutterStage actor * @stage: a #ClutterStage actor
* @rect: a #cairo_rectangle_int_t * @rect: a rectangle
* @scale: the scale * @scale: the scale
* @paint_flags: the #ClutterPaintFlag * @paint_flags: the #ClutterPaintFlag
* @error: the error * @error: the error
@ -2857,11 +2857,11 @@ clutter_stage_paint_to_buffer (ClutterStage *stage,
* Returns: (transfer full): the #ClutterContent or %NULL on error. * Returns: (transfer full): the #ClutterContent or %NULL on error.
*/ */
ClutterContent * ClutterContent *
clutter_stage_paint_to_content (ClutterStage *stage, clutter_stage_paint_to_content (ClutterStage *stage,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
float scale, float scale,
ClutterPaintFlag paint_flags, ClutterPaintFlag paint_flags,
GError **error) GError **error)
{ {
ClutterBackend *clutter_backend = clutter_get_default_backend (); ClutterBackend *clutter_backend = clutter_get_default_backend ();
CoglContext *cogl_context = CoglContext *cogl_context =
@ -2900,17 +2900,17 @@ clutter_stage_paint_to_content (ClutterStage *stage,
} }
void void
clutter_stage_capture_view_into (ClutterStage *stage, clutter_stage_capture_view_into (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view,
cairo_rectangle_int_t *rect, MtkRectangle *rect,
uint8_t *data, uint8_t *data,
int stride) int stride)
{ {
CoglFramebuffer *framebuffer; CoglFramebuffer *framebuffer;
ClutterBackend *backend; ClutterBackend *backend;
CoglContext *context; CoglContext *context;
CoglBitmap *bitmap; CoglBitmap *bitmap;
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
float view_scale; float view_scale;
float texture_width; float texture_width;
float texture_height; float texture_height;
@ -2973,7 +2973,7 @@ clutter_stage_get_views_for_rect (ClutterStage *stage,
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next) for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
{ {
ClutterStageView *view = l->data; ClutterStageView *view = l->data;
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
graphene_rect_t view_rect; graphene_rect_t view_rect;
clutter_stage_view_get_layout (view, &view_layout); clutter_stage_view_get_layout (view, &view_layout);

View File

@ -31,6 +31,7 @@
#include "clutter/clutter-grab.h" #include "clutter/clutter-grab.h"
#include "clutter/clutter-types.h" #include "clutter/clutter-types.h"
#include "clutter/clutter-stage-view.h" #include "clutter/clutter-stage-view.h"
#include "mtk/mtk.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -143,7 +144,7 @@ struct _ClutterFrameInfo
typedef struct _ClutterCapture typedef struct _ClutterCapture
{ {
cairo_surface_t *image; cairo_surface_t *image;
cairo_rectangle_int_t rect; MtkRectangle rect;
} ClutterCapture; } ClutterCapture;
CLUTTER_EXPORT CLUTTER_EXPORT
@ -192,35 +193,35 @@ CLUTTER_EXPORT
void clutter_stage_schedule_update (ClutterStage *stage); void clutter_stage_schedule_update (ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage, gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
cairo_rectangle_int_t *rect, MtkRectangle *rect,
int *out_width, int *out_width,
int *out_height, int *out_height,
float *out_scale); float *out_scale);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_paint_to_framebuffer (ClutterStage *stage, void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer, CoglFramebuffer *framebuffer,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
float scale, float scale,
ClutterPaintFlag paint_flags); ClutterPaintFlag paint_flags);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_stage_paint_to_buffer (ClutterStage *stage, gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
float scale, float scale,
uint8_t *data, uint8_t *data,
int stride, int stride,
CoglPixelFormat format, CoglPixelFormat format,
ClutterPaintFlag paint_flags, ClutterPaintFlag paint_flags,
GError **error); GError **error);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterContent * clutter_stage_paint_to_content (ClutterStage *stage, ClutterContent * clutter_stage_paint_to_content (ClutterStage *stage,
const cairo_rectangle_int_t *rect, const MtkRectangle *rect,
float scale, float scale,
ClutterPaintFlag paint_flags, ClutterPaintFlag paint_flags,
GError **error); GError **error);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage, ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,

View File

@ -122,8 +122,8 @@ clutter_content_iface_init (ClutterContentInterface *iface)
* Use [method@GObject.Object.unref] when done. * Use [method@GObject.Object.unref] when done.
*/ */
ClutterContent * ClutterContent *
clutter_texture_content_new_from_texture (CoglTexture *texture, clutter_texture_content_new_from_texture (CoglTexture *texture,
cairo_rectangle_int_t *clip) MtkRectangle *clip)
{ {
ClutterTextureContent *texture_content; ClutterTextureContent *texture_content;
CoglContext *cogl_context = CoglContext *cogl_context =

View File

@ -32,6 +32,7 @@
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "clutter/clutter-types.h" #include "clutter/clutter-types.h"
#include "mtk/mtk.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -41,8 +42,8 @@ G_DECLARE_FINAL_TYPE (ClutterTextureContent, clutter_texture_content,
CLUTTER, TEXTURE_CONTENT, GObject) CLUTTER, TEXTURE_CONTENT, GObject)
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterContent * clutter_texture_content_new_from_texture (CoglTexture *texture, ClutterContent * clutter_texture_content_new_from_texture (CoglTexture *texture,
cairo_rectangle_int_t *clip); MtkRectangle *clip);
CLUTTER_EXPORT CLUTTER_EXPORT
CoglTexture * clutter_texture_content_get_texture (ClutterTextureContent *texture_content); CoglTexture * clutter_texture_content_get_texture (ClutterTextureContent *texture_content);

View File

@ -120,8 +120,8 @@ _clutter_util_fully_transform_vertices (const graphene_matrix_t *modelview,
} }
void void
_clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, _clutter_util_rect_from_rectangle (const MtkRectangle *src,
graphene_rect_t *dest) graphene_rect_t *dest)
{ {
*dest = (graphene_rect_t) { *dest = (graphene_rect_t) {
.origin = { .origin = {
@ -137,13 +137,13 @@ _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
void void
_clutter_util_rectangle_int_extents (const graphene_rect_t *src, _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
cairo_rectangle_int_t *dest) MtkRectangle *dest)
{ {
graphene_rect_t tmp = *src; graphene_rect_t tmp = *src;
graphene_rect_round_extents (&tmp, &tmp); graphene_rect_round_extents (&tmp, &tmp);
*dest = (cairo_rectangle_int_t) { *dest = (MtkRectangle) {
.x = tmp.origin.x, .x = tmp.origin.x,
.y = tmp.origin.y, .y = tmp.origin.y,
.width = tmp.size.width, .width = tmp.size.width,
@ -152,10 +152,10 @@ _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
} }
void void
_clutter_util_rectangle_offset (const cairo_rectangle_int_t *src, _clutter_util_rectangle_offset (const MtkRectangle *src,
int x, int x,
int y, int y,
cairo_rectangle_int_t *dest) MtkRectangle *dest)
{ {
*dest = *src; *dest = *src;
@ -179,9 +179,9 @@ _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
* This function should really be in Cairo. * This function should really be in Cairo.
*/ */
void void
_clutter_util_rectangle_union (const cairo_rectangle_int_t *src1, _clutter_util_rectangle_union (const MtkRectangle *src1,
const cairo_rectangle_int_t *src2, const MtkRectangle *src2,
cairo_rectangle_int_t *dest) MtkRectangle *dest)
{ {
int dest_x, dest_y; int dest_x, dest_y;
@ -195,9 +195,9 @@ _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
} }
gboolean gboolean
_clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1, _clutter_util_rectangle_intersection (const MtkRectangle *src1,
const cairo_rectangle_int_t *src2, const MtkRectangle *src2,
cairo_rectangle_int_t *dest) MtkRectangle *dest)
{ {
int x1, y1, x2, y2; int x1, y1, x2, y2;
@ -228,8 +228,8 @@ _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
} }
gboolean gboolean
clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1, clutter_util_rectangle_equal (const MtkRectangle *src1,
const cairo_rectangle_int_t *src2) const MtkRectangle *src2)
{ {
return ((src1->x == src2->x) && return ((src1->x == src2->x) &&
(src1->y == src2->y) && (src1->y == src2->y) &&

View File

@ -355,6 +355,7 @@ if have_introspection
namespace: 'Clutter', namespace: 'Clutter',
export_packages: [libmutter_clutter_name], export_packages: [libmutter_clutter_name],
includes: [ includes: [
libmutter_mtk_gir[0],
libmutter_cogl_gir[0], libmutter_cogl_gir[0],
libmutter_cogl_pango_gir[0], libmutter_cogl_pango_gir[0],
'GL-1.0', 'GL-1.0',
@ -379,6 +380,7 @@ if have_introspection
header: 'cally/cally.h', header: 'cally/cally.h',
namespace: 'Cally', namespace: 'Cally',
includes: [ includes: [
libmutter_mtk_gir[0],
libmutter_cogl_gir[0], libmutter_cogl_gir[0],
libmutter_cogl_pango_gir[0], libmutter_cogl_pango_gir[0],
libmutter_clutter_gir[0], libmutter_clutter_gir[0],