From 94e06197856c9959580c837985eb114150d402a3 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 28 Jul 2010 13:59:34 +0100 Subject: [PATCH] material: Adds _cogl_material_pre_paint_for_layer This is a counter part for _cogl_material_layer_pre_paint which takes a layer index instead of a direct CoglMaterialLayer pointer. The aim is to phase out code that directly iterates the internal layer pointers of a material since the layer pointers can change if any property of any layer is changed making direct layer pointers very fragile. --- clutter/cogl/cogl/cogl-material-private.h | 9 +++++++++ clutter/cogl/cogl/cogl-material.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/clutter/cogl/cogl/cogl-material-private.h b/clutter/cogl/cogl/cogl-material-private.h index b3820e25d..0e7a2557c 100644 --- a/clutter/cogl/cogl/cogl-material-private.h +++ b/clutter/cogl/cogl/cogl-material-private.h @@ -606,6 +606,15 @@ _cogl_material_layer_has_user_matrix (CoglMaterialLayer *layer); void _cogl_material_layer_pre_paint (CoglMaterialLayer *layerr); +/* + * Calls the pre_paint method on the layer texture if there is + * one. This will determine whether mipmaps are needed based on the + * filter settings. + */ +void +_cogl_material_pre_paint_for_layer (CoglMaterial *material, + int layer_id); + /* * CoglMaterialFlushFlag: * @COGL_MATERIAL_FLUSH_FALLBACK_MASK: The fallback_layers member is set to diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c index f829e08fe..3fe547789 100644 --- a/clutter/cogl/cogl/cogl-material.c +++ b/clutter/cogl/cogl/cogl-material.c @@ -5237,6 +5237,14 @@ _cogl_material_layer_pre_paint (CoglMaterialLayer *layer) } } +void +_cogl_material_pre_paint_for_layer (CoglMaterial *material, + int layer_id) +{ + CoglMaterialLayer *layer = _cogl_material_get_layer (material, layer_id); + _cogl_material_layer_pre_paint (layer); +} + CoglMaterialFilter cogl_material_layer_get_min_filter (CoglMaterialLayer *layer) {