From 828509158577d1a1a6b817050e0668053b69d167 Mon Sep 17 00:00:00 2001 From: Fernando Monteiro Date: Fri, 17 Sep 2021 07:36:46 +0100 Subject: [PATCH] cogl: Remove material_set_layer_filters This function is deprecated and must be replaced to the alternative. Part-of: --- cogl/cogl/deprecated/cogl-material-compat.c | 12 ---- cogl/cogl/deprecated/cogl-material-compat.h | 56 ------------------- cogl/tests/conform/test-multitexture.c | 12 ++-- cogl/tests/conform/test-texture-mipmaps.c | 12 ++-- cogl/tests/conform/test-texture-pixmap-x11.c | 10 ++-- .../interactive/test-cogl-multitexture.c | 4 +- .../interactive/test-cogl-tex-polygon.c | 14 ++--- 7 files changed, 26 insertions(+), 94 deletions(-) diff --git a/cogl/cogl/deprecated/cogl-material-compat.c b/cogl/cogl/deprecated/cogl-material-compat.c index ac7923325..609c05977 100644 --- a/cogl/cogl/deprecated/cogl-material-compat.c +++ b/cogl/cogl/deprecated/cogl-material-compat.c @@ -136,18 +136,6 @@ cogl_material_set_layer_matrix (CoglMaterial *material, layer_index, matrix); } -void -cogl_material_set_layer_filters (CoglMaterial *material, - int layer_index, - CoglMaterialFilter min_filter, - CoglMaterialFilter mag_filter) -{ - cogl_pipeline_set_layer_filters (COGL_PIPELINE (material), - layer_index, - min_filter, - mag_filter); -} - gboolean cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, int layer_index, diff --git a/cogl/cogl/deprecated/cogl-material-compat.h b/cogl/cogl/deprecated/cogl-material-compat.h index 04842f546..0a229610f 100644 --- a/cogl/cogl/deprecated/cogl-material-compat.h +++ b/cogl/cogl/deprecated/cogl-material-compat.h @@ -61,44 +61,6 @@ GType cogl_material_get_type (void); #define COGL_MATERIAL(OBJECT) ((CoglMaterial *)OBJECT) -/** - * CoglMaterialFilter: - * @COGL_MATERIAL_FILTER_NEAREST: Measuring in manhatten distance from the, - * current pixel center, use the nearest texture texel - * @COGL_MATERIAL_FILTER_LINEAR: Use the weighted average of the 4 texels - * nearest the current pixel center - * @COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST: Select the mimap level whose - * texel size most closely matches the current pixel, and use the - * %COGL_MATERIAL_FILTER_NEAREST criterion - * @COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST: Select the mimap level whose - * texel size most closely matches the current pixel, and use the - * %COGL_MATERIAL_FILTER_LINEAR criterion - * @COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR: Select the two mimap levels - * whose texel size most closely matches the current pixel, use - * the %COGL_MATERIAL_FILTER_NEAREST criterion on each one and take - * their weighted average - * @COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR: Select the two mimap levels - * whose texel size most closely matches the current pixel, use - * the %COGL_MATERIAL_FILTER_LINEAR criterion on each one and take - * their weighted average - * - * Texture filtering is used whenever the current pixel maps either to more - * than one texture element (texel) or less than one. These filter enums - * correspond to different strategies used to come up with a pixel color, by - * possibly referring to multiple neighbouring texels and taking a weighted - * average or simply using the nearest texel. - */ -typedef enum -{ - COGL_MATERIAL_FILTER_NEAREST = 0x2600, - COGL_MATERIAL_FILTER_LINEAR = 0x2601, - COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST = 0x2700, - COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST = 0x2701, - COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR = 0x2702, - COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR = 0x2703 -} CoglMaterialFilter; -/* NB: these values come from the equivalents in gl.h */ - /** * CoglMaterialWrapMode: * @COGL_MATERIAL_WRAP_MODE_REPEAT: The texture will be repeated. This @@ -593,24 +555,6 @@ cogl_material_set_layer_matrix (CoglMaterial *material, int layer_index, const graphene_matrix_t *matrix); -/** - * cogl_material_set_layer_filters: - * @material: A #CoglMaterial object - * @layer_index: the layer number to change. - * @min_filter: the filter used when scaling a texture down. - * @mag_filter: the filter used when magnifying a texture. - * - * Changes the decimation and interpolation filters used when a texture is - * drawn at other scales than 100%. - * Deprecated: 1.16: Use cogl_pipeline_set_layer_filters() instead - */ -COGL_DEPRECATED_FOR (cogl_pipeline_set_layer_filters) -COGL_EXPORT void -cogl_material_set_layer_filters (CoglMaterial *material, - int layer_index, - CoglMaterialFilter min_filter, - CoglMaterialFilter mag_filter); - /** * cogl_material_set_layer_point_sprite_coords_enabled: * @material: a #CoglHandle to a material. diff --git a/cogl/tests/conform/test-multitexture.c b/cogl/tests/conform/test-multitexture.c index 1d438fd67..2231664be 100644 --- a/cogl/tests/conform/test-multitexture.c +++ b/cogl/tests/conform/test-multitexture.c @@ -127,14 +127,14 @@ on_paint (ClutterActor *actor, /* We'll use nearest filtering mode on the textures, otherwise the edge of the quad can pull in texels from the neighbouring quarters of the texture due to imprecision */ - cogl_material_set_layer_filters (material, 0, - COGL_MATERIAL_FILTER_NEAREST, - COGL_MATERIAL_FILTER_NEAREST); + cogl_pipeline_set_layer_filters (material, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); cogl_material_set_layer (material, 1, tex1); - cogl_material_set_layer_filters (material, 1, - COGL_MATERIAL_FILTER_NEAREST, - COGL_MATERIAL_FILTER_NEAREST); + cogl_pipeline_set_layer_filters (material, 1, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); status = cogl_material_set_layer_combine (material, 1, "RGBA = ADD (PREVIOUS, TEXTURE)", &error); diff --git a/cogl/tests/conform/test-texture-mipmaps.c b/cogl/tests/conform/test-texture-mipmaps.c index 4bab5e829..d3a91292c 100644 --- a/cogl/tests/conform/test-texture-mipmaps.c +++ b/cogl/tests/conform/test-texture-mipmaps.c @@ -60,14 +60,14 @@ on_paint (ClutterActor *actor, /* Render a 1x1 pixel quad without mipmaps */ cogl_set_source (material); - cogl_material_set_layer_filters (material, 0, - COGL_MATERIAL_FILTER_NEAREST, - COGL_MATERIAL_FILTER_NEAREST); + cogl_pipeline_set_layer_filters (material, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); cogl_rectangle (0, 0, 1, 1); /* Then with mipmaps */ - cogl_material_set_layer_filters (material, 0, - COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST, - COGL_MATERIAL_FILTER_NEAREST); + cogl_pipeline_set_layer_filters (material, 0, + COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); cogl_rectangle (1, 0, 2, 1); cogl_object_unref (material); diff --git a/cogl/tests/conform/test-texture-pixmap-x11.c b/cogl/tests/conform/test-texture-pixmap-x11.c index 41555266f..9003148ec 100644 --- a/cogl/tests/conform/test-texture-pixmap-x11.c +++ b/cogl/tests/conform/test-texture-pixmap-x11.c @@ -152,14 +152,14 @@ on_after_paint (ClutterActor *actor, { const CoglMaterialFilter min_filter = COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST; - cogl_material_set_layer_filters (material, 0, + cogl_pipeline_set_layer_filters (material, 0, min_filter, - COGL_MATERIAL_FILTER_NEAREST); + COGL_PIPELINE_FILTER_NEAREST); } else - cogl_material_set_layer_filters (material, 0, - COGL_MATERIAL_FILTER_NEAREST, - COGL_MATERIAL_FILTER_NEAREST); + cogl_pipeline_set_layer_filters (material, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); cogl_set_source (material); cogl_rectangle (0, 0, PIXMAP_WIDTH, PIXMAP_HEIGHT); diff --git a/src/tests/clutter/interactive/test-cogl-multitexture.c b/src/tests/clutter/interactive/test-cogl-multitexture.c index f14f0b7d8..bddc407be 100644 --- a/src/tests/clutter/interactive/test-cogl-multitexture.c +++ b/src/tests/clutter/interactive/test-cogl-multitexture.c @@ -48,12 +48,12 @@ frame_cb (ClutterTimeline *timeline, graphene_matrix_multiply (&state->rot_matrix0, &state->tex_matrix0, &state->tex_matrix0); - cogl_material_set_layer_matrix (state->material0, 2, &state->tex_matrix0); + cogl_pipeline_set_layer_matrix (state->material0, 2, &state->tex_matrix0); graphene_matrix_multiply (&state->rot_matrix1, &state->tex_matrix1, &state->tex_matrix1); - cogl_material_set_layer_matrix (state->material1, 2, &state->tex_matrix1); + cogl_pipeline_set_layer_matrix (state->material1, 2, &state->tex_matrix1); } static void diff --git a/src/tests/clutter/interactive/test-cogl-tex-polygon.c b/src/tests/clutter/interactive/test-cogl-tex-polygon.c index 2479a3d7c..e9c194f4a 100644 --- a/src/tests/clutter/interactive/test-cogl-tex-polygon.c +++ b/src/tests/clutter/interactive/test-cogl-tex-polygon.c @@ -201,17 +201,17 @@ test_coglbox_paint (ClutterActor *self, int tex_height = cogl_texture_get_height (tex_handle); CoglFramebuffer *framebuffer = clutter_paint_context_get_framebuffer (paint_context); - CoglHandle material = cogl_material_new (); + CoglHandle material = cogl_pipeline_new (); - cogl_material_set_layer (material, 0, tex_handle); + cogl_pipeline_set_layer (material, 0, tex_handle); - cogl_material_set_layer_filters (material, 0, + cogl_pipeline_set_layer_filters (material, 0, priv->use_linear_filtering - ? COGL_MATERIAL_FILTER_LINEAR : - COGL_MATERIAL_FILTER_NEAREST, + ? COGL_PIPELINE_FILTER_LINEAR : + COGL_PIPELINE_FILTER_NEAREST, priv->use_linear_filtering - ? COGL_MATERIAL_FILTER_LINEAR : - COGL_MATERIAL_FILTER_NEAREST); + ? COGL_PIPELINE_FILTER_LINEAR : + COGL_PIPELINE_FILTER_NEAREST); cogl_framebuffer_push_matrix (framebuffer); cogl_framebuffer_translate (framebuffer, tex_width / 2, 0, 0);