1
0
Fork 0

cogl: Remove material_set_layer_filters

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-09-17 07:36:46 +01:00 committed by Marge Bot
parent 913458381f
commit 8285091585
7 changed files with 26 additions and 94 deletions

View file

@ -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,

View file

@ -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.

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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);