[mutter] cogl: Remove cogl_texture_new_from_sub_texture



commit 612da58c7213fba74829a9c0ababcf85aef890f8
Author: Fernando Monteiro <fr02monteiro gmail com>
Date:   Sun Oct 3 16:43:52 2021 +0100

    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>

 clutter/clutter/clutter-texture-content.c | 13 ++++++++-----
 cogl/cogl/deprecated/cogl-auto-texture.c  | 13 -------------
 cogl/cogl/deprecated/cogl-auto-texture.h  | 32 -------------------------------
 src/compositor/meta-shaped-texture.c      | 13 ++++++++-----
 4 files changed, 16 insertions(+), 55 deletions(-)
---
diff --git a/clutter/clutter/clutter-texture-content.c b/clutter/clutter/clutter-texture-content.c
index d045fdc6d8..53aea4dc1e 100644
--- a/clutter/clutter/clutter-texture-content.c
+++ b/clutter/clutter/clutter-texture-content.c
@@ -126,6 +126,8 @@ clutter_texture_content_new_from_texture (CoglTexture           *texture,
                                           cairo_rectangle_int_t *clip)
 {
   ClutterTextureContent *texture_content;
+  CoglContext *cogl_context =
+    clutter_backend_get_cogl_context (clutter_get_default_backend ());
 
   g_return_val_if_fail (texture != NULL, NULL);
 
@@ -134,11 +136,12 @@ clutter_texture_content_new_from_texture (CoglTexture           *texture,
   if (clip)
     {
       texture_content->texture =
-        cogl_texture_new_from_sub_texture (texture,
-                                           clip->x,
-                                           clip->y,
-                                           clip->width,
-                                           clip->height);
+        COGL_TEXTURE (cogl_sub_texture_new (cogl_context,
+                                            texture,
+                                            clip->x,
+                                            clip->y,
+                                            clip->width,
+                                            clip->height));
     }
   else
     {
diff --git a/cogl/cogl/deprecated/cogl-auto-texture.c b/cogl/cogl/deprecated/cogl-auto-texture.c
index 99431a5c2c..c146c78056 100644
--- a/cogl/cogl/deprecated/cogl-auto-texture.c
+++ b/cogl/cogl/deprecated/cogl-auto-texture.c
@@ -333,16 +333,3 @@ cogl_texture_new_from_file (const char        *filename,
 
   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));
-}
diff --git a/cogl/cogl/deprecated/cogl-auto-texture.h b/cogl/cogl/deprecated/cogl-auto-texture.h
index 61ac84ed2b..6e9bfa134b 100644
--- a/cogl/cogl/deprecated/cogl-auto-texture.h
+++ b/cogl/cogl/deprecated/cogl-auto-texture.h
@@ -147,38 +147,6 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
                               CoglTextureFlags flags,
                               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
 
 #endif /* __COGL_AUTO_TEXTURE_H__ */
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 1a68f3e1b9..fd3dc73fc7 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -1392,6 +1392,8 @@ meta_shaped_texture_get_image (MetaShapedTexture     *stex,
 {
   cairo_rectangle_int_t *image_clip = NULL;
   CoglTexture *texture;
+  CoglContext *cogl_context =
+    clutter_backend_get_cogl_context (clutter_get_default_backend ());
   cairo_surface_t *surface;
 
   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)
-    texture = cogl_texture_new_from_sub_texture (texture,
-                                                 image_clip->x,
-                                                 image_clip->y,
-                                                 image_clip->width,
-                                                 image_clip->height);
+    texture = COGL_TEXTURE (cogl_sub_texture_new (cogl_context,
+                                                  texture,
+                                                  image_clip->x,
+                                                  image_clip->y,
+                                                  image_clip->width,
+                                                  image_clip->height));
 
   surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                         cogl_texture_get_width (texture),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]