cogl: Remove cogl_texture_new_from_sub_texture

This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
This commit is contained in:
Fernando Monteiro 2021-10-03 16:43:52 +01:00 committed by Marge Bot
parent 0c5cf1ec58
commit 612da58c72
4 changed files with 16 additions and 55 deletions

View File

@ -126,6 +126,8 @@ clutter_texture_content_new_from_texture (CoglTexture *texture,
cairo_rectangle_int_t *clip) cairo_rectangle_int_t *clip)
{ {
ClutterTextureContent *texture_content; ClutterTextureContent *texture_content;
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
g_return_val_if_fail (texture != NULL, NULL); g_return_val_if_fail (texture != NULL, NULL);
@ -134,11 +136,12 @@ clutter_texture_content_new_from_texture (CoglTexture *texture,
if (clip) if (clip)
{ {
texture_content->texture = texture_content->texture =
cogl_texture_new_from_sub_texture (texture, COGL_TEXTURE (cogl_sub_texture_new (cogl_context,
texture,
clip->x, clip->x,
clip->y, clip->y,
clip->width, clip->width,
clip->height); clip->height));
} }
else else
{ {

View File

@ -333,16 +333,3 @@ cogl_texture_new_from_file (const char *filename,
return texture; return texture;
} }
CoglTexture *
cogl_texture_new_from_sub_texture (CoglTexture *full_texture,
int sub_x,
int sub_y,
int sub_width,
int sub_height)
{
_COGL_GET_CONTEXT (ctx, NULL);
return COGL_TEXTURE (cogl_sub_texture_new (ctx,
full_texture, sub_x, sub_y,
sub_width, sub_height));
}

View File

@ -147,38 +147,6 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
CoglTextureFlags flags, CoglTextureFlags flags,
CoglPixelFormat internal_format); CoglPixelFormat internal_format);
/**
* cogl_texture_new_from_sub_texture:
* @full_texture: a #CoglTexture pointer
* @sub_x: X coordinate of the top-left of the subregion
* @sub_y: Y coordinate of the top-left of the subregion
* @sub_width: Width in pixels of the subregion
* @sub_height: Height in pixels of the subregion
*
* Creates a new texture which represents a subregion of another
* texture. The GL resources will be shared so that no new texture
* data is actually allocated.
*
* Sub textures have undefined behaviour texture coordinates outside
* of the range [0,1] are used.
*
* The sub texture will keep a reference to the full texture so you do
* not need to keep one separately if you only want to use the sub
* texture.
*
* Return value: (transfer full): A newly created #CoglTexture or
* %NULL on failure
* Since: 1.2
* Deprecated: 1.18: Use cogl_sub_texture_new()
*/
COGL_DEPRECATED_FOR (cogl_sub_texture_new)
COGL_EXPORT CoglTexture *
cogl_texture_new_from_sub_texture (CoglTexture *full_texture,
int sub_x,
int sub_y,
int sub_width,
int sub_height);
G_END_DECLS G_END_DECLS
#endif /* __COGL_AUTO_TEXTURE_H__ */ #endif /* __COGL_AUTO_TEXTURE_H__ */

View File

@ -1392,6 +1392,8 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
{ {
cairo_rectangle_int_t *image_clip = NULL; cairo_rectangle_int_t *image_clip = NULL;
CoglTexture *texture; CoglTexture *texture;
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
cairo_surface_t *surface; cairo_surface_t *surface;
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL); g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
@ -1432,11 +1434,12 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
} }
if (image_clip) if (image_clip)
texture = cogl_texture_new_from_sub_texture (texture, texture = COGL_TEXTURE (cogl_sub_texture_new (cogl_context,
texture,
image_clip->x, image_clip->x,
image_clip->y, image_clip->y,
image_clip->width, image_clip->width,
image_clip->height); image_clip->height));
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
cogl_texture_get_width (texture), cogl_texture_get_width (texture),