From 97225a96a6f7032273c225e525678d3dc9433cc8 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 3 Jun 2010 15:06:47 +0100 Subject: [PATCH] Add _cogl_texture_2d_externally_modified _cogl_texture_2d_externally_modified is a function specific to the CoglTexture2D texture backend that should be called whenever the contents of the texture are modified without the backend knowing about it. It simply marks the mipmap tree as invalid. --- clutter/cogl/cogl/cogl-texture-2d-private.h | 11 +++++++++++ clutter/cogl/cogl/cogl-texture-2d.c | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/clutter/cogl/cogl/cogl-texture-2d-private.h b/clutter/cogl/cogl/cogl-texture-2d-private.h index fc9db8148..33c71efe0 100644 --- a/clutter/cogl/cogl/cogl-texture-2d-private.h +++ b/clutter/cogl/cogl/cogl-texture-2d-private.h @@ -67,4 +67,15 @@ _cogl_texture_2d_new_from_bitmap (CoglHandle bmp_handle, CoglTextureFlags flags, CoglPixelFormat internal_format); +/* + * _cogl_texture_2d_externally_modified: + * @handle: A handle to a 2D texture + * + * This should be called whenever the texture is modified other than + * by using cogl_texture_set_region. It will cause the mipmaps to be + * invalidated + */ +void +_cogl_texture_2d_externally_modified (CoglHandle handle); + #endif /* __COGL_TEXTURE_2D_H */ diff --git a/clutter/cogl/cogl/cogl-texture-2d.c b/clutter/cogl/cogl/cogl-texture-2d.c index a7bcbf322..3c33a7557 100644 --- a/clutter/cogl/cogl/cogl-texture-2d.c +++ b/clutter/cogl/cogl/cogl-texture-2d.c @@ -320,6 +320,15 @@ _cogl_texture_2d_new_from_bitmap (CoglHandle bmp_handle, return _cogl_texture_2d_handle_new (tex_2d); } +void +_cogl_texture_2d_externally_modified (CoglHandle handle) +{ + if (!cogl_is_texture_2d (handle)) + return; + + COGL_TEXTURE_2D (handle)->mipmaps_dirty = TRUE; +} + static int _cogl_texture_2d_get_max_waste (CoglTexture *tex) {