diff --git a/cogl/cogl/cogl-atlas-texture.c b/cogl/cogl/cogl-atlas-texture.c index d622f73a4..7b4acfd6a 100644 --- a/cogl/cogl/cogl-atlas-texture.c +++ b/cogl/cogl/cogl-atlas-texture.c @@ -286,9 +286,10 @@ static int _cogl_atlas_texture_get_max_waste (CoglTexture *tex) { CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (atlas_tex->sub_texture); /* Forward on to the sub texture */ - return cogl_texture_get_max_waste (atlas_tex->sub_texture); + return klass->get_max_waste (COGL_TEXTURE (atlas_tex->sub_texture)); } static gboolean @@ -315,9 +316,10 @@ _cogl_atlas_texture_transform_coords_to_gl (CoglTexture *tex, float *t) { CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (atlas_tex->sub_texture); /* Forward on to the sub texture */ - _cogl_texture_transform_coords_to_gl (atlas_tex->sub_texture, s, t); + klass->transform_coords_to_gl (atlas_tex->sub_texture, s, t); } static CoglTransformResult @@ -325,10 +327,10 @@ _cogl_atlas_texture_transform_quad_coords_to_gl (CoglTexture *tex, float *coords) { CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (atlas_tex->sub_texture); /* Forward on to the sub texture */ - return _cogl_texture_transform_quad_coords_to_gl (atlas_tex->sub_texture, - coords); + return klass->transform_quad_coords_to_gl (atlas_tex->sub_texture, coords); } static gboolean @@ -427,13 +429,14 @@ static void _cogl_atlas_texture_ensure_non_quad_rendering (CoglTexture *tex) { CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (atlas_tex->sub_texture); /* Sub textures can't support non-quad rendering so we'll just migrate the texture out */ _cogl_atlas_texture_migrate_out_of_atlas (atlas_tex); /* Forward on to the sub texture */ - _cogl_texture_ensure_non_quad_rendering (atlas_tex->sub_texture); + klass->ensure_non_quad_rendering (atlas_tex->sub_texture); } static gboolean diff --git a/cogl/cogl/cogl-attribute.c b/cogl/cogl/cogl-attribute.c index eb594ad7d..a62070350 100644 --- a/cogl/cogl/cogl-attribute.c +++ b/cogl/cogl/cogl-attribute.c @@ -290,7 +290,7 @@ validate_layer_cb (CoglPipeline *pipeline, /* Give the texture a chance to know that we're rendering non-quad shaped primitives. If the texture is in an atlas it will be migrated */ - _cogl_texture_ensure_non_quad_rendering (texture); + COGL_TEXTURE_GET_CLASS (texture)->ensure_non_quad_rendering (texture); /* We need to ensure the mipmaps are ready before deciding * anything else about the texture because the texture storate diff --git a/cogl/cogl/cogl-primitives.c b/cogl/cogl/cogl-primitives.c index 7f0cf3021..e02475f56 100644 --- a/cogl/cogl/cogl-primitives.c +++ b/cogl/cogl/cogl-primitives.c @@ -328,8 +328,8 @@ validate_tex_coords_cb (CoglPipeline *pipeline, /* Convert the texture coordinates to GL. */ transform_result = - _cogl_texture_transform_quad_coords_to_gl (texture, - out_tex_coords); + COGL_TEXTURE_GET_CLASS (texture)->transform_quad_coords_to_gl (texture, + out_tex_coords); /* If the texture has waste or we are using GL_TEXTURE_RECT we * can't handle texture repeating so we can't use the layer if * repeating is required. diff --git a/cogl/cogl/cogl-sub-texture.c b/cogl/cogl/cogl-sub-texture.c index f02c8f8d3..589ee1ad0 100644 --- a/cogl/cogl/cogl-sub-texture.c +++ b/cogl/cogl/cogl-sub-texture.c @@ -192,8 +192,9 @@ static int _cogl_sub_texture_get_max_waste (CoglTexture *tex) { CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (sub_tex->full_texture); - return cogl_texture_get_max_waste (sub_tex->full_texture); + return klass->get_max_waste (sub_tex->full_texture); } static gboolean @@ -224,6 +225,7 @@ _cogl_sub_texture_transform_coords_to_gl (CoglTexture *tex, float *t) { CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (sub_tex->full_texture); /* This won't work if the sub texture is not the size of the full texture and the coordinates are outside the range [0,1] */ @@ -232,7 +234,7 @@ _cogl_sub_texture_transform_coords_to_gl (CoglTexture *tex, *t = ((*t * cogl_texture_get_height (tex) + sub_tex->sub_y) / cogl_texture_get_height (sub_tex->full_texture)); - _cogl_texture_transform_coords_to_gl (sub_tex->full_texture, s, t); + klass->transform_coords_to_gl (sub_tex->full_texture, s, t); } static CoglTransformResult @@ -240,6 +242,7 @@ _cogl_sub_texture_transform_quad_coords_to_gl (CoglTexture *tex, float *coords) { CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + CoglTextureClass *klass = COGL_TEXTURE_GET_CLASS (sub_tex->full_texture); int i; /* We can't support repeating with this method. In this case @@ -250,8 +253,7 @@ _cogl_sub_texture_transform_quad_coords_to_gl (CoglTexture *tex, _cogl_sub_texture_map_quad (sub_tex, coords); - return _cogl_texture_transform_quad_coords_to_gl (sub_tex->full_texture, - coords); + return klass->transform_quad_coords_to_gl (sub_tex->full_texture, coords); } static gboolean diff --git a/cogl/cogl/cogl-texture-2d-sliced.c b/cogl/cogl/cogl-texture-2d-sliced.c index c9e737265..ec2004ee5 100644 --- a/cogl/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl/cogl-texture-2d-sliced.c @@ -800,7 +800,8 @@ _cogl_texture_2d_sliced_transform_coords_to_gl (CoglTexture *tex, /* Let the child texture further transform the coords */ slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); - _cogl_texture_transform_coords_to_gl (COGL_TEXTURE (slice_tex), s, t); + + COGL_TEXTURE_GET_CLASS (slice_tex)->transform_coords_to_gl (COGL_TEXTURE (slice_tex), s, t); } static CoglTransformResult @@ -905,7 +906,7 @@ _cogl_texture_2d_sliced_ensure_non_quad_rendering (CoglTexture *tex) { CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i); - _cogl_texture_ensure_non_quad_rendering (COGL_TEXTURE (slice_tex)); + COGL_TEXTURE_GET_CLASS (slice_tex)->ensure_non_quad_rendering (COGL_TEXTURE (slice_tex)); } } diff --git a/cogl/cogl/cogl-texture-private.h b/cogl/cogl/cogl-texture-private.h index 34f6a22ff..3405b9d92 100644 --- a/cogl/cogl/cogl-texture-private.h +++ b/cogl/cogl/cogl-texture-private.h @@ -216,20 +216,9 @@ struct _CoglTextureClass gboolean _cogl_texture_can_hardware_repeat (CoglTexture *texture); -void -_cogl_texture_transform_coords_to_gl (CoglTexture *texture, - float *s, - float *t); -CoglTransformResult -_cogl_texture_transform_quad_coords_to_gl (CoglTexture *texture, - float *coords); - void _cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags); -void -_cogl_texture_ensure_non_quad_rendering (CoglTexture *texture); - /* * This determines a CoglPixelFormat according to texture::components * and texture::premultiplied (i.e. the user required components and diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c index 32d72a38d..30f4c2d89 100644 --- a/cogl/cogl/cogl-texture.c +++ b/cogl/cogl/cogl-texture.c @@ -266,14 +266,6 @@ _cogl_texture_get_format (CoglTexture *texture) return COGL_TEXTURE_GET_CLASS (texture)->get_format (texture); } -int -cogl_texture_get_max_waste (CoglTexture *texture) -{ - g_return_val_if_fail (COGL_IS_TEXTURE (texture), 0); - - return COGL_TEXTURE_GET_CLASS (texture)->get_max_waste (texture); -} - int _cogl_texture_get_n_levels (CoglTexture *texture) { @@ -346,24 +338,6 @@ _cogl_texture_can_hardware_repeat (CoglTexture *texture) return COGL_TEXTURE_GET_CLASS (texture)->can_hardware_repeat (texture); } -/* NB: You can't use this with textures comprised of multiple sub textures (use - * cogl_texture_is_sliced() to check) since coordinate transformation for such - * textures will be different for each slice. */ -void -_cogl_texture_transform_coords_to_gl (CoglTexture *texture, - float *s, - float *t) -{ - COGL_TEXTURE_GET_CLASS (texture)->transform_coords_to_gl (texture, s, t); -} - -CoglTransformResult -_cogl_texture_transform_quad_coords_to_gl (CoglTexture *texture, - float *coords) -{ - return COGL_TEXTURE_GET_CLASS (texture)->transform_quad_coords_to_gl (texture, coords); -} - gboolean cogl_texture_get_gl_texture (CoglTexture *texture, GLuint *out_gl_handle, @@ -400,12 +374,6 @@ _cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags) flags); } -void -_cogl_texture_ensure_non_quad_rendering (CoglTexture *texture) -{ - COGL_TEXTURE_GET_CLASS (texture)->ensure_non_quad_rendering (texture); -} - gboolean _cogl_texture_set_region_from_bitmap (CoglTexture *texture, int src_x, @@ -1318,4 +1286,4 @@ cogl_texture_set_max_level_set (CoglTexture *texture, int max_level_set) { texture->max_level_set = max_level_set; -} \ No newline at end of file +} diff --git a/cogl/cogl/cogl-texture.h b/cogl/cogl/cogl-texture.h index e353b1a05..e4bdd9d1e 100644 --- a/cogl/cogl/cogl-texture.h +++ b/cogl/cogl/cogl-texture.h @@ -235,17 +235,6 @@ cogl_texture_get_width (CoglTexture *texture); COGL_EXPORT unsigned int cogl_texture_get_height (CoglTexture *texture); -/** - * cogl_texture_get_max_waste: - * @texture: a #CoglTexture pointer. - * - * Queries the maximum wasted (unused) pixels in one dimension of a GPU side - * texture. - * - * Return value: the maximum waste - */ -COGL_EXPORT int -cogl_texture_get_max_waste (CoglTexture *texture); /** * cogl_texture_is_sliced: diff --git a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c index 23508c71b..20b1ec511 100644 --- a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c +++ b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c @@ -672,7 +672,7 @@ _cogl_texture_pixmap_x11_get_max_waste (CoglTexture *tex) CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); - return cogl_texture_get_max_waste (child_tex); + return COGL_TEXTURE_GET_CLASS (child_tex)->get_max_waste (child_tex); } static void @@ -727,7 +727,7 @@ _cogl_texture_pixmap_x11_transform_coords_to_gl (CoglTexture *tex, CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); /* Forward on to the child texture */ - _cogl_texture_transform_coords_to_gl (child_tex, s, t); + COGL_TEXTURE_GET_CLASS (child_tex)->transform_coords_to_gl (child_tex, s, t); } static CoglTransformResult @@ -738,7 +738,8 @@ _cogl_texture_pixmap_x11_transform_quad_coords_to_gl (CoglTexture *tex, CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); /* Forward on to the child texture */ - return _cogl_texture_transform_quad_coords_to_gl (child_tex, coords); + return COGL_TEXTURE_GET_CLASS (child_tex)->transform_quad_coords_to_gl (child_tex, + coords); } static gboolean @@ -790,7 +791,7 @@ _cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex) CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); /* Forward on to the child texture */ - _cogl_texture_ensure_non_quad_rendering (child_tex); + COGL_TEXTURE_GET_CLASS (child_tex)->ensure_non_quad_rendering (child_tex); } static void