[mutter] tests/interactive: Replace cogl_texture_new_from_file
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests/interactive: Replace cogl_texture_new_from_file
- Date: Wed, 1 Jun 2022 11:14:57 +0000 (UTC)
commit 8f6469f6cb5b04f2ce5af5c19e855e1f251d76c4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Mar 31 12:32:07 2022 -0300
tests/interactive: Replace cogl_texture_new_from_file
The interactive tests are the last users use this deprecated API, so
port them to the appropriate alternatives - either CoglTexture2D or
CoglTexture2DSliced.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2355>
.../clutter/interactive/test-cogl-multitexture.c | 26 +++++-----------------
.../clutter/interactive/test-cogl-offscreen.c | 8 +++----
.../clutter/interactive/test-cogl-shader-glsl.c | 5 +----
.../clutter/interactive/test-cogl-tex-polygon.c | 15 +++++--------
src/tests/clutter/interactive/test-cogl-tex-tile.c | 10 +++++----
5 files changed, 23 insertions(+), 41 deletions(-)
---
diff --git a/src/tests/clutter/interactive/test-cogl-multitexture.c
b/src/tests/clutter/interactive/test-cogl-multitexture.c
index 5d825b7666..c32f0516ba 100644
--- a/src/tests/clutter/interactive/test-cogl-multitexture.c
+++ b/src/tests/clutter/interactive/test-cogl-multitexture.c
@@ -124,6 +124,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
0, 0, 1, 1,
0, 0, 1, 1
};
+ CoglContext *ctx;
clutter_test_init (&argc, &argv);
@@ -150,35 +151,20 @@ test_cogl_multitexture_main (int argc, char *argv[])
files[2] = g_build_filename (TESTS_DATADIR, "light0.png", NULL);
files[3] = NULL;
- state->alpha_tex =
- cogl_texture_new_from_file (files[0],
- COGL_TEXTURE_NO_SLICING,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+ state->alpha_tex = cogl_texture_2d_new_from_file (ctx, files[0], &error);
if (!state->alpha_tex)
g_critical ("Failed to load redhand_alpha.png: %s", error->message);
- state->redhand_tex =
- cogl_texture_new_from_file (files[1],
- COGL_TEXTURE_NO_SLICING,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ state->redhand_tex = cogl_texture_2d_new_from_file (ctx, files[1], &error);
if (!state->redhand_tex)
g_critical ("Failed to load redhand.png: %s", error->message);
- state->light_tex0 =
- cogl_texture_new_from_file (files[2],
- COGL_TEXTURE_NO_SLICING,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ state->light_tex0 = cogl_texture_2d_new_from_file (ctx, files[2], &error);
if (!state->light_tex0)
g_critical ("Failed to load light0.png: %s", error->message);
- state->light_tex1 =
- cogl_texture_new_from_file (files[2],
- COGL_TEXTURE_NO_SLICING,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ state->light_tex1 = cogl_texture_2d_new_from_file (ctx, files[2], &error);
if (!state->light_tex1)
g_critical ("Failed to load light0.png: %s", error->message);
diff --git a/src/tests/clutter/interactive/test-cogl-offscreen.c
b/src/tests/clutter/interactive/test-cogl-offscreen.c
index 967a23b36c..3cd366da62 100644
--- a/src/tests/clutter/interactive/test-cogl-offscreen.c
+++ b/src/tests/clutter/interactive/test-cogl-offscreen.c
@@ -226,16 +226,16 @@ test_coglbox_map (ClutterActor *actor)
static void
test_coglbox_init (TestCoglbox *self)
{
+ g_autoptr (GError) error = NULL;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
gchar *file;
printf ("Loading redhand.png\n");
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
- self->texhand_id = cogl_texture_new_from_file (file,
- COGL_TEXTURE_NONE,
- COGL_PIXEL_FORMAT_ANY,
- NULL);
+ self->texhand_id = cogl_texture_2d_new_from_file (ctx, file, &error);
+ if (error)
+ g_warning ("Error loading redhand.png: %s", error->message);
g_free (file);
printf ("Creating texture with size\n");
diff --git a/src/tests/clutter/interactive/test-cogl-shader-glsl.c
b/src/tests/clutter/interactive/test-cogl-shader-glsl.c
index 67bc169489..e4ca1e360d 100644
--- a/src/tests/clutter/interactive/test-cogl-shader-glsl.c
+++ b/src/tests/clutter/interactive/test-cogl-shader-glsl.c
@@ -323,10 +323,7 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
error = NULL;
- redhand = cogl_texture_new_from_file (file,
- COGL_TEXTURE_NO_ATLAS,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ redhand = cogl_texture_2d_new_from_file (ctx, file, &error);
if (redhand == NULL)
g_error ("image load failed: %s", error->message);
diff --git a/src/tests/clutter/interactive/test-cogl-tex-polygon.c
b/src/tests/clutter/interactive/test-cogl-tex-polygon.c
index 65f7c3763c..86e72086d4 100644
--- a/src/tests/clutter/interactive/test-cogl-tex-polygon.c
+++ b/src/tests/clutter/interactive/test-cogl-tex-polygon.c
@@ -227,6 +227,8 @@ test_coglbox_dispose (GObject *object)
static void
test_coglbox_init (TestCoglbox *self)
{
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
GError *error = NULL;
gchar *file;
@@ -235,10 +237,9 @@ test_coglbox_init (TestCoglbox *self)
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
self->sliced_tex =
- cogl_texture_new_from_file (file,
- COGL_TEXTURE_NONE,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ cogl_texture_2d_sliced_new_from_file (ctx, file,
+ COGL_TEXTURE_MAX_WASTE,
+ &error);
if (self->sliced_tex == NULL)
{
if (error)
@@ -251,11 +252,7 @@ test_coglbox_init (TestCoglbox *self)
g_warning ("Texture loading failed: <unknown>");
}
- self->not_sliced_tex =
- cogl_texture_new_from_file (file,
- COGL_TEXTURE_NO_SLICING,
- COGL_PIXEL_FORMAT_ANY,
- &error);
+ self->not_sliced_tex = cogl_texture_2d_new_from_file (ctx, file, &error);
if (self->not_sliced_tex == NULL)
{
if (error)
diff --git a/src/tests/clutter/interactive/test-cogl-tex-tile.c
b/src/tests/clutter/interactive/test-cogl-tex-tile.c
index bbd5b7ed4d..b79fd5b679 100644
--- a/src/tests/clutter/interactive/test-cogl-tex-tile.c
+++ b/src/tests/clutter/interactive/test-cogl-tex-tile.c
@@ -100,13 +100,15 @@ test_coglbox_dispose (GObject *object)
static void
test_coglbox_init (TestCoglbox *self)
{
+ g_autoptr (GError) error = NULL;
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
gchar *file;
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
- self->cogl_tex_id = cogl_texture_new_from_file (file,
- COGL_TEXTURE_NONE,
- COGL_PIXEL_FORMAT_ANY,
- NULL);
+ self->cogl_tex_id = cogl_texture_2d_new_from_file (ctx, file, &error);
+ if (error)
+ g_warning ("Error loading redhand.png: %s", error->message);
g_free (file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]