summaryrefslogtreecommitdiff
path: root/cogl/cogl-sub-texture-private.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2010-02-12 10:08:51 +0000
committerNeil Roberts <neil@linux.intel.com>2010-02-12 16:57:17 +0000
commit8119c184dabdb31d89cde3fdcdd856c915e9400f (patch)
tree5b9cb20b9906370db20aac5e1bdb36ecdb2ca847 /cogl/cogl-sub-texture-private.h
parent395518fb34d5ed1c5555e0c2ce099fdfde20a464 (diff)
downloadcogl-8119c184dabdb31d89cde3fdcdd856c915e9400f.tar.gz
cogl-sub-texture: Optimise taking a sub texture of a sub texture
When creating a Cogl sub-texture, if the full texture is also a sub texture it will now just offset the x and y and reference the full texture instead. This avoids one level of indirection when rendering the texture which reduces the chances of getting rounding errors in the calculations.
Diffstat (limited to 'cogl/cogl-sub-texture-private.h')
-rw-r--r--cogl/cogl-sub-texture-private.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/cogl/cogl-sub-texture-private.h b/cogl/cogl-sub-texture-private.h
index 16513425..40ce6881 100644
--- a/cogl/cogl-sub-texture-private.h
+++ b/cogl/cogl-sub-texture-private.h
@@ -35,9 +35,22 @@ struct _CoglSubTexture
{
CoglTexture _parent;
+ /* This is the texture that was passed in to
+ _cogl_sub_texture_new. If this is also a sub texture then we will
+ use the full texture from that to render instead of making a
+ chain. However we want to preserve the next texture in case the
+ user is expecting us to keep a reference and also so that we can
+ later add a cogl_sub_texture_get_full_texture() function. */
+ CoglHandle next_texture;
+ /* This is the texture that will actually be used to draw. It will
+ point to the end of the chain if a sub texture of a sub texture
+ is created */
CoglHandle full_texture;
- /* The region represented by this sub-texture */
+ /* The region represented by this sub-texture. This is the region of
+ full_texture which won't necessarily be the same as the region
+ passed to _cogl_sub_texture_new if next_texture is actually
+ already a sub texture */
int sub_x;
int sub_y;
int sub_width;
@@ -48,7 +61,7 @@ GQuark
_cogl_handle_sub_texture_get_type (void);
CoglHandle
-_cogl_sub_texture_new (CoglHandle full_texture,
+_cogl_sub_texture_new (CoglHandle next_texture,
int sub_x,
int sub_y,
int sub_width,