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:
parent
1f255be055
commit
b035350ffd
7 changed files with 41 additions and 47 deletions
|
@ -186,7 +186,7 @@ cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache)
|
||||||
static void
|
static void
|
||||||
cogl_pango_glyph_cache_update_position_cb (void *user_data,
|
cogl_pango_glyph_cache_update_position_cb (void *user_data,
|
||||||
CoglTexture *new_texture,
|
CoglTexture *new_texture,
|
||||||
const CoglRectangleMapEntry *rect)
|
const MtkRectangle *rect)
|
||||||
{
|
{
|
||||||
CoglPangoGlyphCacheValue *value = user_data;
|
CoglPangoGlyphCacheValue *value = user_data;
|
||||||
float tex_width, tex_height;
|
float tex_width, tex_height;
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct _CoglAtlasTexture
|
||||||
|
|
||||||
/* The rectangle that was used to add this texture to the
|
/* The rectangle that was used to add this texture to the
|
||||||
atlas. This includes the 1-pixel border */
|
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
|
/* 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
|
an atlas then this will be NULL. A reference is taken on the
|
||||||
|
|
|
@ -78,7 +78,7 @@ cogl_atlas_texture_dispose (GObject *object)
|
||||||
|
|
||||||
static CoglTexture *
|
static CoglTexture *
|
||||||
_cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
|
_cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
|
||||||
const CoglRectangleMapEntry *rectangle)
|
const MtkRectangle *rectangle)
|
||||||
{
|
{
|
||||||
CoglContext *ctx = cogl_texture_get_context (full_texture);
|
CoglContext *ctx = cogl_texture_get_context (full_texture);
|
||||||
/* Create a subtexture for the given rectangle not including the
|
/* Create a subtexture for the given rectangle not including the
|
||||||
|
@ -94,7 +94,7 @@ _cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_update_position_cb (void *user_data,
|
_cogl_atlas_texture_update_position_cb (void *user_data,
|
||||||
CoglTexture *new_texture,
|
CoglTexture *new_texture,
|
||||||
const CoglRectangleMapEntry *rectangle)
|
const MtkRectangle *rectangle)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = user_data;
|
CoglAtlasTexture *atlas_tex = user_data;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ _cogl_atlas_texture_update_position_cb (void *user_data,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_pre_reorganize_foreach_cb
|
_cogl_atlas_texture_pre_reorganize_foreach_cb
|
||||||
(const CoglRectangleMapEntry *entry,
|
(const MtkRectangle *entry,
|
||||||
void *rectangle_data,
|
void *rectangle_data,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ typedef struct
|
||||||
} CoglAtlasTextureGetRectanglesData;
|
} CoglAtlasTextureGetRectanglesData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_get_rectangles_cb (const CoglRectangleMapEntry *entry,
|
_cogl_atlas_texture_get_rectangles_cb (const MtkRectangle *entry,
|
||||||
void *rectangle_data,
|
void *rectangle_data,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,8 +106,8 @@ typedef struct _CoglAtlasRepositionData
|
||||||
/* The current user data for this texture */
|
/* The current user data for this texture */
|
||||||
void *user_data;
|
void *user_data;
|
||||||
/* The old and new positions of the texture */
|
/* The old and new positions of the texture */
|
||||||
CoglRectangleMapEntry old_position;
|
MtkRectangle old_position;
|
||||||
CoglRectangleMapEntry new_position;
|
MtkRectangle new_position;
|
||||||
} CoglAtlasRepositionData;
|
} CoglAtlasRepositionData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -165,7 +165,7 @@ typedef struct _CoglAtlasGetRectanglesData
|
||||||
} CoglAtlasGetRectanglesData;
|
} CoglAtlasGetRectanglesData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_get_rectangles_cb (const CoglRectangleMapEntry *rectangle,
|
_cogl_atlas_get_rectangles_cb (const MtkRectangle *rectangle,
|
||||||
void *rect_data,
|
void *rect_data,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +393,7 @@ cogl_atlas_reserve_space (CoglAtlas *atlas,
|
||||||
CoglTexture *new_tex;
|
CoglTexture *new_tex;
|
||||||
unsigned int map_width = 0, map_height = 0;
|
unsigned int map_width = 0, map_height = 0;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
CoglRectangleMapEntry new_position;
|
MtkRectangle new_position;
|
||||||
|
|
||||||
/* Check if we can fit the rectangle into the existing map */
|
/* Check if we can fit the rectangle into the existing map */
|
||||||
if (atlas->map &&
|
if (atlas->map &&
|
||||||
|
@ -557,7 +557,7 @@ cogl_atlas_reserve_space (CoglAtlas *atlas,
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_atlas_remove (CoglAtlas *atlas,
|
_cogl_atlas_remove (CoglAtlas *atlas,
|
||||||
const CoglRectangleMapEntry *rectangle)
|
const MtkRectangle *rectangle)
|
||||||
{
|
{
|
||||||
_cogl_rectangle_map_remove (atlas->map, rectangle);
|
_cogl_rectangle_map_remove (atlas->map, rectangle);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
typedef void
|
typedef void
|
||||||
(* CoglAtlasUpdatePositionCallback) (void *user_data,
|
(* CoglAtlasUpdatePositionCallback) (void *user_data,
|
||||||
CoglTexture *new_texture,
|
CoglTexture *new_texture,
|
||||||
const CoglRectangleMapEntry *rect);
|
const MtkRectangle *rect);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ cogl_atlas_reserve_space (CoglAtlas *atlas,
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_atlas_remove (CoglAtlas *atlas,
|
_cogl_atlas_remove (CoglAtlas *atlas,
|
||||||
const CoglRectangleMapEntry *rectangle);
|
const MtkRectangle *rectangle);
|
||||||
|
|
||||||
CoglTexture *
|
CoglTexture *
|
||||||
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct _CoglRectangleMapNode
|
||||||
{
|
{
|
||||||
CoglRectangleMapNodeType type;
|
CoglRectangleMapNodeType type;
|
||||||
|
|
||||||
CoglRectangleMapEntry rectangle;
|
MtkRectangle rectangle;
|
||||||
|
|
||||||
unsigned int largest_gap;
|
unsigned int largest_gap;
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
|
||||||
unsigned int width,
|
unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
void *data,
|
void *data,
|
||||||
CoglRectangleMapEntry *rectangle)
|
MtkRectangle *rectangle)
|
||||||
{
|
{
|
||||||
unsigned int rectangle_size = width * height;
|
unsigned int rectangle_size = width * height;
|
||||||
/* Stack of nodes to search in */
|
/* Stack of nodes to search in */
|
||||||
|
@ -380,7 +380,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_rectangle_map_remove (CoglRectangleMap *map,
|
_cogl_rectangle_map_remove (CoglRectangleMap *map,
|
||||||
const CoglRectangleMapEntry *rectangle)
|
const MtkRectangle *rectangle)
|
||||||
{
|
{
|
||||||
CoglRectangleMapNode *node = map->root;
|
CoglRectangleMapNode *node = map->root;
|
||||||
unsigned int rectangle_size = rectangle->width * rectangle->height;
|
unsigned int rectangle_size = rectangle->width * rectangle->height;
|
||||||
|
|
|
@ -31,20 +31,14 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "cogl/cogl-types.h"
|
#include "cogl/cogl-types.h"
|
||||||
|
#include "mtk/mtk.h"
|
||||||
|
|
||||||
typedef struct _CoglRectangleMap CoglRectangleMap;
|
typedef struct _CoglRectangleMap CoglRectangleMap;
|
||||||
typedef struct _CoglRectangleMapEntry CoglRectangleMapEntry;
|
|
||||||
|
|
||||||
typedef void (* CoglRectangleMapCallback) (const CoglRectangleMapEntry *entry,
|
typedef void (* CoglRectangleMapCallback) (const MtkRectangle *entry,
|
||||||
void *rectangle_data,
|
void *rectangle_data,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
struct _CoglRectangleMapEntry
|
|
||||||
{
|
|
||||||
unsigned int x, y;
|
|
||||||
unsigned int width, height;
|
|
||||||
};
|
|
||||||
|
|
||||||
CoglRectangleMap *
|
CoglRectangleMap *
|
||||||
_cogl_rectangle_map_new (unsigned int width,
|
_cogl_rectangle_map_new (unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
|
@ -55,11 +49,11 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
|
||||||
unsigned int width,
|
unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
void *data,
|
void *data,
|
||||||
CoglRectangleMapEntry *rectangle);
|
MtkRectangle *rectangle);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_rectangle_map_remove (CoglRectangleMap *map,
|
_cogl_rectangle_map_remove (CoglRectangleMap *map,
|
||||||
const CoglRectangleMapEntry *rectangle);
|
const MtkRectangle *rectangle);
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
_cogl_rectangle_map_get_width (CoglRectangleMap *map);
|
_cogl_rectangle_map_get_width (CoglRectangleMap *map);
|
||||||
|
|
Loading…
Reference in a new issue