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

View file

@ -547,7 +547,7 @@ cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
here */ here */
g_return_if_fail (value->texture != NULL); 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_cairo = CAIRO_FORMAT_A8;
format_cogl = COGL_PIXEL_FORMAT_A_8; format_cogl = COGL_PIXEL_FORMAT_A_8;

View file

@ -63,13 +63,3 @@ struct _CoglAtlasTextureClass
{ {
CoglTextureClass parent_class; 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,11 +205,11 @@ _cogl_atlas_texture_post_reorganize_cb (void *user_data)
static CoglAtlas * static CoglAtlas *
_cogl_atlas_texture_create_atlas (CoglContext *ctx) _cogl_atlas_texture_create_atlas (CoglContext *ctx)
{ {
CoglAtlas *atlas = _cogl_atlas_new (ctx, COGL_PIXEL_FORMAT_RGBA_8888, CoglAtlas *atlas = cogl_atlas_new (ctx, COGL_PIXEL_FORMAT_RGBA_8888,
0, 0,
_cogl_atlas_texture_update_position_cb); _cogl_atlas_texture_update_position_cb);
_cogl_atlas_add_reorganize_callback (atlas, cogl_atlas_add_reorganize_callback (atlas,
_cogl_atlas_texture_pre_reorganize_cb, _cogl_atlas_texture_pre_reorganize_cb,
_cogl_atlas_texture_post_reorganize_cb, _cogl_atlas_texture_post_reorganize_cb,
atlas); 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 /* We'll prepare to upload using the format of the actual texture of
the atlas texture instead of the format reported by 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 format specified when the texture was created. However we'll
preserve the premult status of the internal format because the preserve the premult status of the internal format because the
images are all stored in the original premult format of the images are all stored in the original premult format of the
@ -651,7 +651,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
* can cause the atlas to be freed */ * can cause the atlas to be freed */
atlas = g_object_ref (l->data); atlas = g_object_ref (l->data);
/* Try to make some space in the atlas for the texture */ /* Try to make some space in the atlas for the texture */
if (_cogl_atlas_reserve_space (atlas, if (cogl_atlas_reserve_space (atlas,
/* Add two pixels for the border */ /* Add two pixels for the border */
width + 2, height + 2, width + 2, height + 2,
atlas_tex)) atlas_tex))
@ -670,7 +670,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
{ {
atlas = _cogl_atlas_texture_create_atlas (ctx); atlas = _cogl_atlas_texture_create_atlas (ctx);
COGL_NOTE (ATLAS, "Created new atlas for textures: %p", atlas); COGL_NOTE (ATLAS, "Created new atlas for textures: %p", atlas);
if (!_cogl_atlas_reserve_space (atlas, if (!cogl_atlas_reserve_space (atlas,
/* Add two pixels for the border */ /* Add two pixels for the border */
width + 2, height + 2, width + 2, height + 2,
atlas_tex)) atlas_tex))
@ -907,7 +907,7 @@ cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp)
} }
void void
_cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx, cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
GHookFunc callback, GHookFunc callback,
void *user_data) void *user_data)
{ {
@ -918,7 +918,7 @@ _cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
} }
void void
_cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx, cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
GHookFunc callback, GHookFunc callback,
void *user_data) void *user_data)
{ {

View file

@ -147,4 +147,20 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
COGL_EXPORT CoglTexture * COGL_EXPORT CoglTexture *
cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp); 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 G_END_DECLS

View file

@ -82,7 +82,7 @@ cogl_atlas_class_init (CoglAtlasClass *class)
} }
CoglAtlas * CoglAtlas *
_cogl_atlas_new (CoglContext *context, cogl_atlas_new (CoglContext *context,
CoglPixelFormat texture_format, CoglPixelFormat texture_format,
CoglAtlasFlags flags, CoglAtlasFlags flags,
CoglAtlasUpdatePositionCallback update_position_cb) CoglAtlasUpdatePositionCallback update_position_cb)
@ -383,7 +383,7 @@ _cogl_atlas_notify_post_reorganize (CoglAtlas *atlas)
} }
gboolean gboolean
_cogl_atlas_reserve_space (CoglAtlas *atlas, cogl_atlas_reserve_space (CoglAtlas *atlas,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
void *user_data) void *user_data)
@ -649,7 +649,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
} }
void void
_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas, cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
GHookFunc pre_callback, GHookFunc pre_callback,
GHookFunc post_callback, GHookFunc post_callback,
void *user_data) void *user_data)

View file

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

View file

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

View file

@ -122,7 +122,7 @@ cogl_offscreen_allocate (CoglFramebuffer *framebuffer,
height = cogl_texture_get_height (offscreen->texture); height = cogl_texture_get_height (offscreen->texture);
cogl_framebuffer_update_size (framebuffer, width, height); 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); _cogl_framebuffer_set_internal_format (framebuffer, texture_format);
return TRUE; return TRUE;

View file

@ -141,7 +141,7 @@ _cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer)
_cogl_pipeline_layer_get_authority (layer, _cogl_pipeline_layer_get_authority (layer,
COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA); COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA);
if (tex_authority->texture && 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; return TRUE;
} }
@ -895,5 +895,3 @@ _cogl_pipeline_layer_needs_combine_separate
return FALSE; return FALSE;
} }

View file

@ -181,7 +181,7 @@ _cogl_sub_texture_allocate (CoglTexture *tex,
gboolean status = cogl_texture_allocate (sub_tex->full_texture, error); gboolean status = cogl_texture_allocate (sub_tex->full_texture, error);
_cogl_texture_set_allocated (tex, _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_width (tex),
cogl_texture_get_height (tex)); cogl_texture_get_height (tex));
@ -343,7 +343,7 @@ _cogl_sub_texture_get_format (CoglTexture *tex)
{ {
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (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 static GLenum
@ -411,7 +411,7 @@ cogl_sub_texture_new (CoglContext *ctx,
"context", ctx, "context", ctx,
"width", sub_width, "width", sub_width,
"height", sub_height, "height", sub_height,
"format", _cogl_texture_get_format (next_texture), "format", cogl_texture_get_format (next_texture),
NULL); NULL);
/* If the next texture is also a sub texture we can avoid one level /* 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; gboolean status;
upload_bmp = _cogl_bitmap_convert_for_upload (bmp, upload_bmp = _cogl_bitmap_convert_for_upload (bmp,
_cogl_texture_get_format (tex), cogl_texture_get_format (tex),
error); error);
if (!upload_bmp) if (!upload_bmp)
return FALSE; return FALSE;
@ -1270,4 +1270,3 @@ cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
cogl_bitmap_get_format (bmp), cogl_bitmap_get_format (bmp),
loader); loader);
} }

View file

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

View file

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

View file

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

View file

@ -575,7 +575,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
upload_bmp = upload_bmp =
_cogl_bitmap_convert_for_upload (bmp, _cogl_bitmap_convert_for_upload (bmp,
_cogl_texture_get_format (tex), cogl_texture_get_format (tex),
error); error);
if (upload_bmp == NULL) if (upload_bmp == NULL)
return FALSE; 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); CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
/* Forward on to the child texture */ /* Forward on to the child texture */
return _cogl_texture_get_format (child_tex); return cogl_texture_get_format (child_tex);
} }
static GLenum static GLenum
@ -1060,4 +1060,3 @@ cogl_texture_pixmap_x11_is_using_tfp_extension (CoglTexturePixmapX11 *tex_pixmap
return !!tex_pixmap->winsys; 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++) for (i = 0; i < multi_texture->n_planes; i++)
{ {
CoglTexture *plane = multi_texture->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", g_string_append_printf (str, " (%p) { .format = %s },\n",
plane, plane,

View file

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