From 996614cfaf582bbfbf86874a95b4a7eef3c50630 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 21 Jan 2010 15:34:19 +0000 Subject: [PATCH] cogl-atlas-texture: Add a debug option to disable the atlas If the user specifies the 'disable-atlas' debug option then no texture will be put in the atlas. --- clutter/cogl/cogl/cogl-atlas-texture.c | 5 +++++ clutter/cogl/cogl/cogl-debug.c | 3 ++- clutter/cogl/cogl/cogl-debug.h | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/clutter/cogl/cogl/cogl-atlas-texture.c b/clutter/cogl/cogl/cogl-atlas-texture.c index 202f1e41a..7d22918f0 100644 --- a/clutter/cogl/cogl/cogl-atlas-texture.c +++ b/clutter/cogl/cogl/cogl-atlas-texture.c @@ -956,6 +956,11 @@ _cogl_atlas_texture_new_from_bitmap (CoglHandle bmp_handle, g_return_val_if_fail (bmp_handle != COGL_INVALID_HANDLE, COGL_INVALID_HANDLE); + /* Don't put textures in the atlas if the user has explicitly + requested to disable it */ + if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_ATLAS)) + return COGL_INVALID_HANDLE; + /* We can't put the texture in the atlas if there are any special flags. This precludes textures with COGL_TEXTURE_NO_ATLAS and COGL_TEXTURE_NO_SLICING from being atlased */ diff --git a/clutter/cogl/cogl/cogl-debug.c b/clutter/cogl/cogl/cogl-debug.c index bba75e560..1ee180569 100644 --- a/clutter/cogl/cogl/cogl-debug.c +++ b/clutter/cogl/cogl/cogl-debug.c @@ -49,7 +49,8 @@ static const GDebugKey cogl_debug_keys[] = { { "matrices", COGL_DEBUG_MATRICES }, { "force-scanline-paths", COGL_DEBUG_FORCE_SCANLINE_PATHS }, { "atlas", COGL_DEBUG_ATLAS }, - { "dump-atlas-image", COGL_DEBUG_DUMP_ATLAS_IMAGE } + { "dump-atlas-image", COGL_DEBUG_DUMP_ATLAS_IMAGE }, + { "disable-atlas", COGL_DEBUG_DISABLE_ATLAS } }; static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys); diff --git a/clutter/cogl/cogl/cogl-debug.h b/clutter/cogl/cogl/cogl-debug.h index 864f50a60..0c6fb4de7 100644 --- a/clutter/cogl/cogl/cogl-debug.h +++ b/clutter/cogl/cogl/cogl-debug.h @@ -47,7 +47,8 @@ typedef enum { COGL_DEBUG_MATRICES = 1 << 15, COGL_DEBUG_FORCE_SCANLINE_PATHS = 1 << 16, COGL_DEBUG_ATLAS = 1 << 17, - COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 18 + COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 18, + COGL_DEBUG_DISABLE_ATLAS = 1 << 19 } CoglDebugFlags; #ifdef COGL_ENABLE_DEBUG