1
0
Fork 0

cogl: Properly export required functions by cogl-pango

Needed for moving cogl-pango out of tree

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3909>
This commit is contained in:
Bilal Elmoussaoui 2024-07-25 22:53:25 +02:00 committed by Marge Bot
parent dfa5238bf9
commit 1f255be055
20 changed files with 100 additions and 97 deletions

View file

@ -169,7 +169,7 @@ cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache)
{
if (cache->using_global_atlas)
{
_cogl_atlas_texture_remove_reorganize_callback (
cogl_atlas_texture_remove_reorganize_callback (
cache->ctx,
cogl_pango_glyph_cache_reorganize_cb, cache);
}
@ -250,7 +250,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
reorganization */
if (!cache->using_global_atlas)
{
_cogl_atlas_texture_add_reorganize_callback
cogl_atlas_texture_add_reorganize_callback
(cache->ctx,
cogl_pango_glyph_cache_reorganize_cb, cache);
cache->using_global_atlas = TRUE;
@ -271,10 +271,10 @@ cogl_pango_glyph_cache_add_to_local_atlas (CoglPangoGlyphCache *cache,
/* Look for an atlas that can reserve the space */
for (l = cache->atlases; l; l = l->next)
if (_cogl_atlas_reserve_space (l->data,
value->draw_width + 1,
value->draw_height + 1,
value))
if (cogl_atlas_reserve_space (l->data,
value->draw_width + 1,
value->draw_height + 1,
value))
{
atlas = l->data;
break;
@ -283,24 +283,24 @@ cogl_pango_glyph_cache_add_to_local_atlas (CoglPangoGlyphCache *cache,
/* If we couldn't find one then start a new atlas */
if (atlas == NULL)
{
atlas = _cogl_atlas_new (context,
COGL_PIXEL_FORMAT_A_8,
COGL_ATLAS_CLEAR_TEXTURE |
COGL_ATLAS_DISABLE_MIGRATION,
cogl_pango_glyph_cache_update_position_cb);
atlas = cogl_atlas_new (context,
COGL_PIXEL_FORMAT_A_8,
COGL_ATLAS_CLEAR_TEXTURE |
COGL_ATLAS_DISABLE_MIGRATION,
cogl_pango_glyph_cache_update_position_cb);
COGL_NOTE (ATLAS, "Created new atlas for glyphs: %p", atlas);
/* If we still can't reserve space then something has gone
seriously wrong so we'll just give up */
if (!_cogl_atlas_reserve_space (atlas,
value->draw_width + 1,
value->draw_height + 1,
value))
if (!cogl_atlas_reserve_space (atlas,
value->draw_width + 1,
value->draw_height + 1,
value))
{
g_object_unref (atlas);
return FALSE;
}
_cogl_atlas_add_reorganize_callback
cogl_atlas_add_reorganize_callback
(atlas, cogl_pango_glyph_cache_reorganize_cb, NULL, cache);
cache->atlases = g_slist_prepend (cache->atlases, atlas);

View file

@ -194,7 +194,7 @@ _cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
entry->texture = g_object_ref (texture);
if (_cogl_texture_get_format (entry->texture) == COGL_PIXEL_FORMAT_A_8)
if (cogl_texture_get_format (entry->texture) == COGL_PIXEL_FORMAT_A_8)
base = get_base_texture_alpha_pipeline (cache);
else
base = get_base_texture_rgba_pipeline (cache);

View file

@ -547,7 +547,7 @@ cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
here */
g_return_if_fail (value->texture != NULL);
if (_cogl_texture_get_format (value->texture) == COGL_PIXEL_FORMAT_A_8)
if (cogl_texture_get_format (value->texture) == COGL_PIXEL_FORMAT_A_8)
{
format_cairo = CAIRO_FORMAT_A8;
format_cogl = COGL_PIXEL_FORMAT_A_8;

View file

@ -63,13 +63,3 @@ struct _CoglAtlasTextureClass
{
CoglTextureClass parent_class;
};
COGL_EXPORT void
_cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data);
COGL_EXPORT void
_cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data);

View file

@ -205,14 +205,14 @@ _cogl_atlas_texture_post_reorganize_cb (void *user_data)
static CoglAtlas *
_cogl_atlas_texture_create_atlas (CoglContext *ctx)
{
CoglAtlas *atlas = _cogl_atlas_new (ctx, COGL_PIXEL_FORMAT_RGBA_8888,
0,
_cogl_atlas_texture_update_position_cb);
CoglAtlas *atlas = cogl_atlas_new (ctx, COGL_PIXEL_FORMAT_RGBA_8888,
0,
_cogl_atlas_texture_update_position_cb);
_cogl_atlas_add_reorganize_callback (atlas,
_cogl_atlas_texture_pre_reorganize_cb,
_cogl_atlas_texture_post_reorganize_cb,
atlas);
cogl_atlas_add_reorganize_callback (atlas,
_cogl_atlas_texture_pre_reorganize_cb,
_cogl_atlas_texture_post_reorganize_cb,
atlas);
ctx->atlases = g_slist_prepend (ctx->atlases, atlas);
return atlas;
@ -500,7 +500,7 @@ _cogl_atlas_texture_convert_bitmap_for_upload (CoglAtlasTexture *atlas_tex,
/* We'll prepare to upload using the format of the actual texture of
the atlas texture instead of the format reported by
_cogl_texture_get_format which would be the original internal
cogl_texture_get_format which would be the original internal
format specified when the texture was created. However we'll
preserve the premult status of the internal format because the
images are all stored in the original premult format of the
@ -651,10 +651,10 @@ allocate_space (CoglAtlasTexture *atlas_tex,
* can cause the atlas to be freed */
atlas = g_object_ref (l->data);
/* Try to make some space in the atlas for the texture */
if (_cogl_atlas_reserve_space (atlas,
/* Add two pixels for the border */
width + 2, height + 2,
atlas_tex))
if (cogl_atlas_reserve_space (atlas,
/* Add two pixels for the border */
width + 2, height + 2,
atlas_tex))
{
/* keep the atlas reference */
break;
@ -670,10 +670,10 @@ allocate_space (CoglAtlasTexture *atlas_tex,
{
atlas = _cogl_atlas_texture_create_atlas (ctx);
COGL_NOTE (ATLAS, "Created new atlas for textures: %p", atlas);
if (!_cogl_atlas_reserve_space (atlas,
/* Add two pixels for the border */
width + 2, height + 2,
atlas_tex))
if (!cogl_atlas_reserve_space (atlas,
/* Add two pixels for the border */
width + 2, height + 2,
atlas_tex))
{
/* Ok, this means we really can't add it to the atlas */
g_object_unref (atlas);
@ -907,9 +907,9 @@ cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp)
}
void
_cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data)
cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data)
{
GHook *hook = g_hook_alloc (&ctx->atlas_reorganize_callbacks);
hook->func = callback;
@ -918,7 +918,7 @@ _cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
}
void
_cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data)
{

View file

@ -147,4 +147,20 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
COGL_EXPORT CoglTexture *
cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp);
/**
* cogl_atlas_texture_add_reorganize_callback: (skip)
*/
COGL_EXPORT void
cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data);
/**
* cogl_atlas_texture_remove_reorganize_callback: (skip)
*/
COGL_EXPORT void
cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
GHookFunc callback,
void *user_data);
G_END_DECLS

View file

@ -82,10 +82,10 @@ cogl_atlas_class_init (CoglAtlasClass *class)
}
CoglAtlas *
_cogl_atlas_new (CoglContext *context,
CoglPixelFormat texture_format,
CoglAtlasFlags flags,
CoglAtlasUpdatePositionCallback update_position_cb)
cogl_atlas_new (CoglContext *context,
CoglPixelFormat texture_format,
CoglAtlasFlags flags,
CoglAtlasUpdatePositionCallback update_position_cb)
{
CoglAtlas *atlas = g_object_new (COGL_TYPE_ATLAS, NULL);
@ -383,10 +383,10 @@ _cogl_atlas_notify_post_reorganize (CoglAtlas *atlas)
}
gboolean
_cogl_atlas_reserve_space (CoglAtlas *atlas,
unsigned int width,
unsigned int height,
void *user_data)
cogl_atlas_reserve_space (CoglAtlas *atlas,
unsigned int width,
unsigned int height,
void *user_data)
{
CoglAtlasGetRectanglesData data;
CoglRectangleMap *new_map;
@ -649,10 +649,10 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
}
void
_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
GHookFunc pre_callback,
GHookFunc post_callback,
void *user_data)
cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
GHookFunc pre_callback,
GHookFunc post_callback,
void *user_data)
{
if (pre_callback)
{

View file

@ -71,16 +71,16 @@ struct _CoglAtlas
};
COGL_EXPORT CoglAtlas *
_cogl_atlas_new (CoglContext *context,
CoglPixelFormat texture_format,
CoglAtlasFlags flags,
CoglAtlasUpdatePositionCallback update_position_cb);
cogl_atlas_new (CoglContext *context,
CoglPixelFormat texture_format,
CoglAtlasFlags flags,
CoglAtlasUpdatePositionCallback update_position_cb);
COGL_EXPORT gboolean
_cogl_atlas_reserve_space (CoglAtlas *atlas,
unsigned int width,
unsigned int height,
void *user_data);
cogl_atlas_reserve_space (CoglAtlas *atlas,
unsigned int width,
unsigned int height,
void *user_data);
void
_cogl_atlas_remove (CoglAtlas *atlas,
@ -95,10 +95,10 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
CoglPixelFormat format);
COGL_EXPORT void
_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
GHookFunc pre_callback,
GHookFunc post_callback,
void *user_data);
cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
GHookFunc pre_callback,
GHookFunc post_callback,
void *user_data);
void
_cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas,

View file

@ -156,8 +156,8 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
/* We can only blit between FBOs if both textures have the same
premult convention and the blit framebuffer extension is
supported. */
if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
(_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
if ((cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
(cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
!cogl_context_has_feature (ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER))
return FALSE;
@ -273,7 +273,7 @@ _cogl_blit_copy_tex_sub_image_end (CoglBlitData *data)
static gboolean
_cogl_blit_get_tex_data_begin (CoglBlitData *data)
{
data->format = _cogl_texture_get_format (data->src_tex);
data->format = cogl_texture_get_format (data->src_tex);
g_return_val_if_fail (cogl_pixel_format_get_n_planes (data->format) == 1,
FALSE);

View file

@ -122,7 +122,7 @@ cogl_offscreen_allocate (CoglFramebuffer *framebuffer,
height = cogl_texture_get_height (offscreen->texture);
cogl_framebuffer_update_size (framebuffer, width, height);
texture_format = _cogl_texture_get_format (offscreen->texture);
texture_format = cogl_texture_get_format (offscreen->texture);
_cogl_framebuffer_set_internal_format (framebuffer, texture_format);
return TRUE;

View file

@ -141,7 +141,7 @@ _cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer)
_cogl_pipeline_layer_get_authority (layer,
COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA);
if (tex_authority->texture &&
_cogl_texture_get_format (tex_authority->texture) & COGL_A_BIT)
cogl_texture_get_format (tex_authority->texture) & COGL_A_BIT)
{
return TRUE;
}
@ -895,5 +895,3 @@ _cogl_pipeline_layer_needs_combine_separate
return FALSE;
}

View file

@ -181,7 +181,7 @@ _cogl_sub_texture_allocate (CoglTexture *tex,
gboolean status = cogl_texture_allocate (sub_tex->full_texture, error);
_cogl_texture_set_allocated (tex,
_cogl_texture_get_format (sub_tex->full_texture),
cogl_texture_get_format (sub_tex->full_texture),
cogl_texture_get_width (tex),
cogl_texture_get_height (tex));
@ -343,7 +343,7 @@ _cogl_sub_texture_get_format (CoglTexture *tex)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
return _cogl_texture_get_format (sub_tex->full_texture);
return cogl_texture_get_format (sub_tex->full_texture);
}
static GLenum
@ -411,7 +411,7 @@ cogl_sub_texture_new (CoglContext *ctx,
"context", ctx,
"width", sub_width,
"height", sub_height,
"format", _cogl_texture_get_format (next_texture),
"format", cogl_texture_get_format (next_texture),
NULL);
/* If the next texture is also a sub texture we can avoid one level

View file

@ -1081,7 +1081,7 @@ _cogl_texture_2d_sliced_set_region (CoglTexture *tex,
gboolean status;
upload_bmp = _cogl_bitmap_convert_for_upload (bmp,
_cogl_texture_get_format (tex),
cogl_texture_get_format (tex),
error);
if (!upload_bmp)
return FALSE;
@ -1270,4 +1270,3 @@ cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
cogl_bitmap_get_format (bmp),
loader);
}

View file

@ -324,9 +324,6 @@ _cogl_texture_set_allocated (CoglTexture *texture,
int width,
int height);
COGL_EXPORT CoglPixelFormat
_cogl_texture_get_format (CoglTexture *texture);
CoglTextureLoader *
_cogl_texture_create_loader (void);

View file

@ -256,7 +256,7 @@ cogl_texture_get_height (CoglTexture *texture)
}
CoglPixelFormat
_cogl_texture_get_format (CoglTexture *texture)
cogl_texture_get_format (CoglTexture *texture)
{
if (!texture->allocated)
cogl_texture_allocate (texture, NULL);
@ -396,7 +396,7 @@ _cogl_texture_set_region_from_bitmap (CoglTexture *texture,
/* Note that we don't prepare the bitmap for upload here because
some backends may be internally using a different format for the
actual GL texture than that reported by
_cogl_texture_get_format. For example the atlas textures are
cogl_texture_get_format. For example the atlas textures are
always stored in an RGBA texture even if the texture format is
advertised as RGB. */
@ -595,7 +595,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture,
* framebuffer's internal format matches the internal format of the
* parent meta_texture instead.
*/
real_format = _cogl_texture_get_format (meta_texture);
real_format = cogl_texture_get_format (meta_texture);
_cogl_framebuffer_set_internal_format (framebuffer, real_format);
bitmap = cogl_bitmap_new_for_data (ctx,
@ -771,7 +771,7 @@ cogl_texture_get_data (CoglTexture *texture,
g_return_val_if_fail (COGL_IS_TEXTURE (texture), 0);
texture_format = _cogl_texture_get_format (texture);
texture_format = cogl_texture_get_format (texture);
/* Default to internal format if none specified */
if (format == COGL_PIXEL_FORMAT_ANY)

View file

@ -470,4 +470,8 @@ cogl_texture_is_get_data_supported (CoglTexture *texture);
COGL_EXPORT void
cogl_texture_set_auto_mipmap (CoglTexture *texture,
gboolean value);
COGL_EXPORT CoglPixelFormat
cogl_texture_get_format (CoglTexture *texture);
G_END_DECLS

View file

@ -575,7 +575,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
upload_bmp =
_cogl_bitmap_convert_for_upload (bmp,
_cogl_texture_get_format (tex),
cogl_texture_get_format (tex),
error);
if (upload_bmp == NULL)
return FALSE;

View file

@ -815,7 +815,7 @@ _cogl_texture_pixmap_x11_get_format (CoglTexture *tex)
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
/* Forward on to the child texture */
return _cogl_texture_get_format (child_tex);
return cogl_texture_get_format (child_tex);
}
static GLenum
@ -1060,4 +1060,3 @@ cogl_texture_pixmap_x11_is_using_tfp_extension (CoglTexturePixmapX11 *tex_pixmap
return !!tex_pixmap->winsys;
}

View file

@ -275,7 +275,7 @@ meta_multi_texture_to_string (MetaMultiTexture *multi_texture)
for (i = 0; i < multi_texture->n_planes; i++)
{
CoglTexture *plane = multi_texture->planes[i];
CoglPixelFormat plane_format = _cogl_texture_get_format (plane);
CoglPixelFormat plane_format = cogl_texture_get_format (plane);
g_string_append_printf (str, " (%p) { .format = %s },\n",
plane,

View file

@ -446,7 +446,7 @@ shm_buffer_attach (MetaWaylandBuffer *buffer,
CoglTexture *cogl_texture = meta_multi_texture_get_plane (*texture, 0);
if (!meta_multi_texture_is_simple (*texture) ||
_cogl_texture_get_format (cogl_texture) == cogl_format)
cogl_texture_get_format (cogl_texture) == cogl_format)
{
buffer->is_y_inverted = TRUE;
return TRUE;
@ -811,7 +811,7 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer,
plane_stride = shm_stride[plane_index];
cogl_texture = meta_multi_texture_get_plane (texture, i);
subformat = _cogl_texture_get_format (cogl_texture);
subformat = cogl_texture_get_format (cogl_texture);
bpp = cogl_pixel_format_get_bytes_per_pixel (subformat, 0);
for (j = 0; j < n_rectangles; j++)