1
0
Fork 0

cogl: Replace RectangleMapEntry with MtkRectangle

Avoids exposing the former in the next commit even if MtkRectangle
uses signed integers compared to RectangleMapEntry. But as
those rectangles are defined inside of Cogl, it should be okay
I guess?

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3909>
This commit is contained in:
Bilal Elmoussaoui 2024-07-26 18:42:54 +02:00 committed by Marge Bot
parent 1f255be055
commit b035350ffd
7 changed files with 41 additions and 47 deletions

View file

@ -184,9 +184,9 @@ cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache)
}
static void
cogl_pango_glyph_cache_update_position_cb (void *user_data,
CoglTexture *new_texture,
const CoglRectangleMapEntry *rect)
cogl_pango_glyph_cache_update_position_cb (void *user_data,
CoglTexture *new_texture,
const MtkRectangle *rect)
{
CoglPangoGlyphCacheValue *value = user_data;
float tex_width, tex_height;

View file

@ -46,7 +46,7 @@ struct _CoglAtlasTexture
/* The rectangle that was used to add this texture to the
atlas. This includes the 1-pixel border */
CoglRectangleMapEntry rectangle;
MtkRectangle rectangle;
/* The atlas that this texture is in. If the texture is no longer in
an atlas then this will be NULL. A reference is taken on the

View file

@ -77,8 +77,8 @@ cogl_atlas_texture_dispose (GObject *object)
}
static CoglTexture *
_cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
const CoglRectangleMapEntry *rectangle)
_cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
const MtkRectangle *rectangle)
{
CoglContext *ctx = cogl_texture_get_context (full_texture);
/* Create a subtexture for the given rectangle not including the
@ -92,9 +92,9 @@ _cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
}
static void
_cogl_atlas_texture_update_position_cb (void *user_data,
CoglTexture *new_texture,
const CoglRectangleMapEntry *rectangle)
_cogl_atlas_texture_update_position_cb (void *user_data,
CoglTexture *new_texture,
const MtkRectangle *rectangle)
{
CoglAtlasTexture *atlas_tex = user_data;
@ -110,7 +110,7 @@ _cogl_atlas_texture_update_position_cb (void *user_data,
static void
_cogl_atlas_texture_pre_reorganize_foreach_cb
(const CoglRectangleMapEntry *entry,
(const MtkRectangle *entry,
void *rectangle_data,
void *user_data)
{
@ -154,7 +154,7 @@ typedef struct
} CoglAtlasTextureGetRectanglesData;
static void
_cogl_atlas_texture_get_rectangles_cb (const CoglRectangleMapEntry *entry,
_cogl_atlas_texture_get_rectangles_cb (const MtkRectangle *entry,
void *rectangle_data,
void *user_data)
{

View file

@ -106,8 +106,8 @@ typedef struct _CoglAtlasRepositionData
/* The current user data for this texture */
void *user_data;
/* The old and new positions of the texture */
CoglRectangleMapEntry old_position;
CoglRectangleMapEntry new_position;
MtkRectangle old_position;
MtkRectangle new_position;
} CoglAtlasRepositionData;
static void
@ -165,9 +165,9 @@ typedef struct _CoglAtlasGetRectanglesData
} CoglAtlasGetRectanglesData;
static void
_cogl_atlas_get_rectangles_cb (const CoglRectangleMapEntry *rectangle,
void *rect_data,
void *user_data)
_cogl_atlas_get_rectangles_cb (const MtkRectangle *rectangle,
void *rect_data,
void *user_data)
{
CoglAtlasGetRectanglesData *data = user_data;
@ -393,7 +393,7 @@ cogl_atlas_reserve_space (CoglAtlas *atlas,
CoglTexture *new_tex;
unsigned int map_width = 0, map_height = 0;
gboolean ret;
CoglRectangleMapEntry new_position;
MtkRectangle new_position;
/* Check if we can fit the rectangle into the existing map */
if (atlas->map &&
@ -556,8 +556,8 @@ cogl_atlas_reserve_space (CoglAtlas *atlas,
}
void
_cogl_atlas_remove (CoglAtlas *atlas,
const CoglRectangleMapEntry *rectangle)
_cogl_atlas_remove (CoglAtlas *atlas,
const MtkRectangle *rectangle)
{
_cogl_rectangle_map_remove (atlas->map, rectangle);

View file

@ -32,9 +32,9 @@
#include "cogl/cogl-texture.h"
typedef void
(* CoglAtlasUpdatePositionCallback) (void *user_data,
CoglTexture *new_texture,
const CoglRectangleMapEntry *rect);
(* CoglAtlasUpdatePositionCallback) (void *user_data,
CoglTexture *new_texture,
const MtkRectangle *rect);
typedef enum
{
@ -83,8 +83,8 @@ cogl_atlas_reserve_space (CoglAtlas *atlas,
void *user_data);
void
_cogl_atlas_remove (CoglAtlas *atlas,
const CoglRectangleMapEntry *rectangle);
_cogl_atlas_remove (CoglAtlas *atlas,
const MtkRectangle *rectangle);
CoglTexture *
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,

View file

@ -79,7 +79,7 @@ struct _CoglRectangleMapNode
{
CoglRectangleMapNodeType type;
CoglRectangleMapEntry rectangle;
MtkRectangle rectangle;
unsigned int largest_gap;
@ -261,10 +261,10 @@ _cogl_rectangle_map_node_split_vertically (CoglRectangleMapNode *node,
gboolean
_cogl_rectangle_map_add (CoglRectangleMap *map,
unsigned int width,
unsigned int height,
void *data,
CoglRectangleMapEntry *rectangle)
unsigned int width,
unsigned int height,
void *data,
MtkRectangle *rectangle)
{
unsigned int rectangle_size = width * height;
/* Stack of nodes to search in */
@ -379,8 +379,8 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
}
void
_cogl_rectangle_map_remove (CoglRectangleMap *map,
const CoglRectangleMapEntry *rectangle)
_cogl_rectangle_map_remove (CoglRectangleMap *map,
const MtkRectangle *rectangle)
{
CoglRectangleMapNode *node = map->root;
unsigned int rectangle_size = rectangle->width * rectangle->height;

View file

@ -31,19 +31,13 @@
#include <glib.h>
#include "cogl/cogl-types.h"
#include "mtk/mtk.h"
typedef struct _CoglRectangleMap CoglRectangleMap;
typedef struct _CoglRectangleMapEntry CoglRectangleMapEntry;
typedef void (* CoglRectangleMapCallback) (const CoglRectangleMapEntry *entry,
void *rectangle_data,
void *user_data);
struct _CoglRectangleMapEntry
{
unsigned int x, y;
unsigned int width, height;
};
typedef void (* CoglRectangleMapCallback) (const MtkRectangle *entry,
void *rectangle_data,
void *user_data);
CoglRectangleMap *
_cogl_rectangle_map_new (unsigned int width,
@ -52,14 +46,14 @@ _cogl_rectangle_map_new (unsigned int width,
gboolean
_cogl_rectangle_map_add (CoglRectangleMap *map,
unsigned int width,
unsigned int height,
void *data,
CoglRectangleMapEntry *rectangle);
unsigned int width,
unsigned int height,
void *data,
MtkRectangle *rectangle);
void
_cogl_rectangle_map_remove (CoglRectangleMap *map,
const CoglRectangleMapEntry *rectangle);
_cogl_rectangle_map_remove (CoglRectangleMap *map,
const MtkRectangle *rectangle);
unsigned int
_cogl_rectangle_map_get_width (CoglRectangleMap *map);