From a74c26d8d14fd6f703f4887569b70c5dfd2aff5f Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 18 Oct 2010 19:00:50 +0100 Subject: [PATCH] material: add internal layer filter getters This adds internal _cogl_material_get_layer_filters and _cogl_material_get_layer_{min,mag}_filter functions which can be used to query the filters associated with a layer using a layer_index, as opposed to a layer pointer. Accessing layer pointers is considered deprecated so we need to provide layer_index based replacements. --- cogl/cogl-material-private.h | 14 +++++++++++ cogl/cogl-material.c | 45 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/cogl/cogl-material-private.h b/cogl/cogl-material-private.h index 0e7a2557c..a113349fb 100644 --- a/cogl/cogl-material-private.h +++ b/cogl/cogl-material-private.h @@ -873,6 +873,20 @@ _cogl_material_layer_get_filters (CoglMaterialLayer *layer, CoglMaterialFilter *min_filter, CoglMaterialFilter *mag_filter); +void +_cogl_material_get_layer_filters (CoglMaterial *material, + int layer_index, + CoglMaterialFilter *min_filter, + CoglMaterialFilter *mag_filter); + +CoglMaterialFilter +_cogl_material_get_layer_min_filter (CoglMaterial *material, + int layer_index); + +CoglMaterialFilter +_cogl_material_get_layer_mag_filter (CoglMaterial *material, + int layer_index); + void _cogl_material_texture_storage_change_notify (CoglHandle texture); diff --git a/cogl/cogl-material.c b/cogl/cogl-material.c index 3fe547789..e02396d4e 100644 --- a/cogl/cogl-material.c +++ b/cogl/cogl-material.c @@ -5210,6 +5210,51 @@ _cogl_material_layer_get_filters (CoglMaterialLayer *layer, *mag_filter = authority->mag_filter; } +void +_cogl_material_get_layer_filters (CoglMaterial *material, + int layer_index, + CoglMaterialFilter *min_filter, + CoglMaterialFilter *mag_filter) +{ + CoglMaterialLayer *layer; + CoglMaterialLayer *authority; + + g_return_if_fail (cogl_is_material (material)); + + layer = _cogl_material_get_layer (material, layer_index); + + authority = + _cogl_material_layer_get_authority (layer, + COGL_MATERIAL_LAYER_STATE_FILTERS); + + *min_filter = authority->min_filter; + *mag_filter = authority->mag_filter; +} + +CoglMaterialFilter +_cogl_material_get_layer_min_filter (CoglMaterial *material, + int layer_index) +{ + CoglMaterialFilter min_filter; + CoglMaterialFilter mag_filter; + + _cogl_material_get_layer_filters (material, layer_index, + &min_filter, &mag_filter); + return min_filter; +} + +CoglMaterialFilter +_cogl_material_get_layer_mag_filter (CoglMaterial *material, + int layer_index) +{ + CoglMaterialFilter min_filter; + CoglMaterialFilter mag_filter; + + _cogl_material_get_layer_filters (material, layer_index, + &min_filter, &mag_filter); + return mag_filter; +} + void _cogl_material_layer_pre_paint (CoglMaterialLayer *layer) {