[Cogl] [PATCH 11/11] Remove cogl-auto-texture apis

Robert Bragg robert at sixbynine.org
Thu Jun 27 09:22:18 PDT 2013


From: Robert Bragg <robert at linux.intel.com>

This removes the automagic texture constructors including:
cogl_texture_new_with_size
cogl_texture_new_from_file
cogl_texture_new_from_bitmap
cogl_texture_new_from_data
cogl_texture_gl_new_from_foreign

The same convenience can instead be found by using the more specific
apis such as cogl_texture_2d_new_with_size/from_file but the advantage
should be that it's clearer what kind of texture you will end up with
and what special considerations you must be mindful of with any
particular texture that you allocate. This way applications will also be
less likely to hammer the texture-atlas with very large images that may
not be appropriate for the atlas and also avoid extra work migrating
images out of the atlas when choosing to use mipmapping.

Another nice side affect is that the #CoglTexture api is now just an
interface for handling operations common to all of the different texture
types in Cogl instead of a combination of constructor apis and interface
apis.

The CoglTextureFlags type is also removed by this patch a corresponding
references to the type in the documentation since these flags were only
used with the auto-texture apis.
---
 cogl/Makefile.am         |   1 -
 cogl/cogl-auto-texture.c | 332 -----------------------------------------------
 cogl/cogl-primitive.h    | 136 +++++++++----------
 cogl/cogl-texture.h      | 171 ++----------------------
 cogl/cogl-types.h        |  23 ----
 cogl/cogl.symbols        |   5 -
 6 files changed, 76 insertions(+), 592 deletions(-)
 delete mode 100644 cogl/cogl-auto-texture.c

diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 3c8149f..1161987 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -296,7 +296,6 @@ cogl_sources_c = \
 	$(srcdir)/cogl-texture-driver.h			\
 	$(srcdir)/cogl-sub-texture.c                    \
 	$(srcdir)/cogl-texture.c			\
-	$(srcdir)/cogl-auto-texture.c			\
 	$(srcdir)/cogl-texture-2d.c                     \
 	$(srcdir)/cogl-texture-2d-sliced.c		\
 	$(srcdir)/cogl-texture-3d.c                     \
diff --git a/cogl/cogl-auto-texture.c b/cogl/cogl-auto-texture.c
deleted file mode 100644
index 0f546de..0000000
--- a/cogl/cogl-auto-texture.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2007,2008,2009,2011,2012 Intel Corporation.
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *
- * Authors:
- *  Matthew Allum  <mallum at openedhand.com>
- *  Neil Roberts   <neil at linux.intel.com>
- *  Robert Bragg   <robert at linux.intel.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "cogl-texture.h"
-#include "cogl-util.h"
-#include "cogl-texture-2d.h"
-#include "cogl-texture-2d-private.h"
-#include "cogl-primitive-texture.h"
-#include "cogl-texture-2d-sliced-private.h"
-#include "cogl-private.h"
-#include "cogl-object.h"
-#include "cogl-bitmap-private.h"
-#include "cogl-atlas-texture-private.h"
-#include "cogl-error-private.h"
-#include "cogl-texture-rectangle.h"
-#include "cogl-sub-texture.h"
-#include "cogl-texture-2d-gl.h"
-
-static void
-set_auto_mipmap_cb (CoglTexture *sub_texture,
-                    const float *sub_texture_coords,
-                    const float *meta_coords,
-                    void *user_data)
-{
-  cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (sub_texture),
-                                          FALSE);
-}
-
-CoglTexture *
-cogl_texture_new_with_size (CoglContext *ctx,
-                            int width,
-			    int height,
-                            CoglTextureFlags flags,
-			    CoglPixelFormat internal_format)
-{
-  CoglTexture *tex;
-  CoglError *skip_error = NULL;
-
-  if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
-      (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
-       cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
-    {
-      /* First try creating a fast-path non-sliced texture */
-      tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
-                                                         width, height,
-                                                         internal_format));
-
-      /* TODO: instead of allocating storage here it would be better
-       * if we had some api that let us just check that the size is
-       * supported by the hardware so storage could be allocated
-       * lazily when uploading data. */
-      if (!cogl_texture_allocate (tex, &skip_error))
-        {
-          cogl_error_free (skip_error);
-          cogl_object_unref (tex);
-          tex = NULL;
-        }
-    }
-  else
-    tex = NULL;
-
-  if (!tex)
-    {
-      /* If it fails resort to sliced textures */
-      int max_waste = flags & COGL_TEXTURE_NO_SLICING ? -1 : COGL_TEXTURE_MAX_WASTE;
-      tex = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx,
-                                                                width,
-                                                                height,
-                                                                max_waste,
-                                                                internal_format));
-    }
-
-  if (tex &&
-      flags & COGL_TEXTURE_NO_AUTO_MIPMAP)
-    {
-      /* To be able to iterate the slices of a #CoglTexture2DSliced we
-       * need to ensure the texture is allocated... */
-      if (!cogl_texture_allocate (tex, error))
-        return NULL;
-
-      cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
-                                           0, 0, 1, 1,
-                                           COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
-                                           COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
-                                           set_auto_mipmap_cb,
-                                           NULL);
-    }
-
-  return tex;
-}
-
-CoglTexture *
-cogl_texture_new_from_data (CoglContext *ctx,
-                            int width,
-			    int height,
-                            CoglTextureFlags flags,
-			    CoglPixelFormat format,
-			    CoglPixelFormat internal_format,
-			    int rowstride,
-			    const uint8_t *data,
-                            CoglError **error)
-{
-  CoglBitmap *bmp;
-  CoglTexture *tex;
-
-  _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
-  _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
-
-  /* Rowstride from width if not given */
-  if (rowstride == 0)
-    rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
-
-  /* Wrap the data into a bitmap */
-  bmp = cogl_bitmap_new_for_data (ctx,
-                                  width, height,
-                                  format,
-                                  rowstride,
-                                  (uint8_t *) data);
-
-  tex = cogl_texture_new_from_bitmap (bmp, flags, internal_format, error);
-
-  cogl_object_unref (bmp);
-
-  return tex;
-}
-
-static CoglTexture *
-_cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
-                               CoglTextureFlags flags,
-                               CoglPixelFormat internal_format,
-                               CoglBool can_convert_in_place,
-                               CoglError **error)
-{
-  CoglContext *ctx = _cogl_bitmap_get_context (bitmap);
-  CoglAtlasTexture *atlas_tex;
-  CoglTexture *tex;
-  CoglError *internal_error = NULL;
-
-  if (!flags &&
-      !COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS))
-    {
-      /* First try putting the texture in the atlas */
-      if ((atlas_tex = _cogl_atlas_texture_new_from_bitmap (bitmap,
-                                                            internal_format,
-                                                            can_convert_in_place,
-                                                            &internal_error)))
-        return COGL_TEXTURE (atlas_tex);
-
-      cogl_error_free (internal_error);
-      internal_error = NULL;
-    }
-
-  /* If that doesn't work try a fast path 2D texture */
-  if ((_cogl_util_is_pot (bitmap->width) &&
-       _cogl_util_is_pot (bitmap->height)) ||
-      (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
-       cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
-    {
-      tex = COGL_TEXTURE (_cogl_texture_2d_new_from_bitmap (bitmap,
-                                                            internal_format,
-                                                            can_convert_in_place,
-                                                            &internal_error));
-
-      if (!tex)
-        {
-          cogl_error_free (internal_error);
-          internal_error = NULL;
-        }
-    }
-  else
-    tex = NULL;
-
-  if (!tex)
-    {
-      /* Otherwise create a sliced texture */
-      int max_waste = flags & COGL_TEXTURE_NO_SLICING ? -1 : COGL_TEXTURE_MAX_WASTE;
-      tex = COGL_TEXTURE (_cogl_texture_2d_sliced_new_from_bitmap (bitmap,
-                                                             max_waste,
-                                                             internal_format,
-                                                             can_convert_in_place,
-                                                             error));
-    }
-
-  if (tex &&
-      flags & COGL_TEXTURE_NO_AUTO_MIPMAP)
-    {
-      cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
-                                           0, 0, 1, 1,
-                                           COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
-                                           COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
-                                           set_auto_mipmap_cb,
-                                           NULL);
-    }
-
-  return tex;
-}
-
-CoglTexture *
-cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
-                              CoglTextureFlags flags,
-                              CoglPixelFormat internal_format,
-                              CoglError **error)
-{
-  return _cogl_texture_new_from_bitmap (bitmap,
-                                        flags,
-                                        internal_format,
-                                        FALSE, /* can't convert in-place */
-                                        error);
-}
-
-CoglTexture *
-cogl_texture_new_from_file (CoglContext *ctx,
-                            const char *filename,
-                            CoglTextureFlags flags,
-                            CoglPixelFormat internal_format,
-                            CoglError **error)
-{
-  CoglBitmap *bmp;
-  CoglTexture *texture = NULL;
-
-  _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
-
-  bmp = cogl_bitmap_new_from_file (ctx, filename, error);
-  if (bmp == NULL)
-    return NULL;
-
-  texture = _cogl_texture_new_from_bitmap (bmp, flags,
-                                           internal_format,
-                                           TRUE, /* can convert in-place */
-                                           error);
-
-  cogl_object_unref (bmp);
-
-  return texture;
-}
-
-CoglTexture *
-cogl_texture_gl_new_from_foreign (CoglContext *ctx,
-                                  unsigned int gl_handle,
-                                  unsigned int gl_target,
-                                  int width,
-                                  int height,
-                                  int x_pot_waste,
-                                  int y_pot_waste,
-                                  CoglPixelFormat format,
-                                  CoglError **error)
-{
-#ifdef HAVE_COGL_GL
-  if (gl_target == GL_TEXTURE_RECTANGLE_ARB)
-    {
-      CoglTextureRectangle *texture_rectangle;
-      CoglSubTexture *sub_texture;
-
-      if (x_pot_waste != 0 || y_pot_waste != 0)
-        {
-          /* It shouldn't be necessary to have waste in this case since
-           * the texture isn't limited to power of two sizes. */
-          g_warning ("You can't create a foreign GL_TEXTURE_RECTANGLE cogl "
-                     "texture with waste\n");
-          return NULL;
-        }
-
-      texture_rectangle = cogl_texture_rectangle_new_from_foreign (ctx,
-                                                                   gl_handle,
-                                                                   width,
-                                                                   height,
-                                                                   format,
-                                                                   error);
-      if (!texture_rectangle)
-        return NULL;
-
-      /* CoglTextureRectangle textures work with non-normalized
-       * coordinates, but the semantics for this function that people
-       * depend on are that all returned textures work with normalized
-       * coordinates so we wrap with a CoglSubTexture... */
-      sub_texture = cogl_sub_texture_new (ctx,
-                                          COGL_TEXTURE (texture_rectangle),
-                                          0, 0, width, height);
-      return COGL_TEXTURE (sub_texture);
-    }
-#endif
-
-  if (x_pot_waste != 0 || y_pot_waste != 0)
-    return COGL_TEXTURE (_cogl_texture_2d_sliced_new_from_foreign (ctx,
-                                                                   gl_handle,
-                                                                   gl_target,
-                                                                   width,
-                                                                   height,
-                                                                   x_pot_waste,
-                                                                   y_pot_waste,
-                                                                   format,
-                                                                   error));
-  else
-    {
-      return COGL_TEXTURE (cogl_texture_2d_gl_new_from_foreign (ctx,
-                                                                gl_handle,
-                                                                width,
-                                                                height,
-                                                                format,
-                                                                error));
-    }
-}
diff --git a/cogl/cogl-primitive.h b/cogl/cogl-primitive.h
index 7e47c14..983a118 100644
--- a/cogl/cogl-primitive.h
+++ b/cogl/cogl-primitive.h
@@ -268,15 +268,14 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -321,15 +320,14 @@ cogl_primitive_new_p2 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -376,15 +374,14 @@ cogl_primitive_new_p3 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -431,15 +428,14 @@ cogl_primitive_new_p2c4 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -486,15 +482,14 @@ cogl_primitive_new_p3c4 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -541,15 +536,14 @@ cogl_primitive_new_p2t2 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -596,15 +590,14 @@ cogl_primitive_new_p3t2 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
@@ -651,15 +644,14 @@ cogl_primitive_new_p2t2c4 (CoglContext *context,
  * #CoglPrimitive <structfield>n_vertices</structfield> property as if
  * cogl_primitive_set_n_vertices() were called. This property defines
  * the number of vertices to read when drawing.
-
- * <note>The primitive API doesn't support drawing with sliced
- * textures (since switching between slices implies changing state and
- * so that implies multiple primitives need to be submitted). You
- * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
- * might be used while drawing with this API. If your hardware doesn't
- * support non-power of two textures (For example you are using GLES
- * 1.1) then you will need to make sure your assets are resized to a
- * power-of-two size (though they don't have to be square)</note>
+ *
+ * <note>The primitive API doesn't support drawing with high-level
+ * meta texture types such as #CoglTexture2DSliced or
+ * #CoglAtlasTexture so you need to ensure that only low-level
+ * textures that can be directly sampled by a GPU such as
+ * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
+ * associated with the layers of any pipeline used while drawing a
+ * primitive.</note>
  *
  * Return value: A newly allocated #CoglPrimitive with a reference of
  * 1. This can be freed using cogl_object_unref().
diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h
index 74fb252..a3cd0cf 100644
--- a/cogl/cogl-texture.h
+++ b/cogl/cogl-texture.h
@@ -3,7 +3,7 @@
  *
  * An object oriented GL/GLES Abstraction/Utility Layer
  *
- * Copyright (C) 2007,2008,2009,2010 Intel Corporation.
+ * Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Intel Corporation.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,8 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  *
  */
@@ -43,11 +44,15 @@ COGL_BEGIN_DECLS
 
 /**
  * SECTION:cogl-texture
- * @short_description: Functions for creating and manipulating textures
- *
- * Cogl allows creating and manipulating textures using a uniform
- * API that tries to hide all the various complexities of creating,
- * loading and manipulating textures.
+ * @short_description: Common interface for manipulating textures
+ *
+ * Cogl provides several different types of textures such as
+ * #CoglTexture2D, #CoglTexture3D, #CoglTextureRectangle,
+ * #CoglTexture2DSliced, #CoglAtlasTexture, #CoglSubTexture and
+ * #CoglTexturePixmapX11 that each have specific apis for creating
+ * and manipulating them, but there are a number of common operations
+ * that can be applied to any of these texture types which are handled
+ * via this #CoglTexture interface.
  */
 
 #define COGL_TEXTURE(X) ((CoglTexture *)X)
@@ -102,158 +107,6 @@ typedef enum {
 uint32_t cogl_texture_error_domain (void);
 
 /**
- * cogl_texture_new_with_size:
- * @context: A #CoglContext
- * @width: width of texture in pixels.
- * @height: height of texture in pixels.
- * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE
- * @internal_format: the #CoglPixelFormat to use for the GPU storage of the
- *    texture.
- *
- * Creates a new #CoglTexture with the specified dimensions and pixel format.
- *
- * The storage for the texture is not necesarily created before this
- * function returns. The storage can be explicitly allocated using
- * cogl_texture_allocate() or preferably you can let Cogl
- * automatically allocate the storage lazily when uploading data when
- * Cogl may know more about how the texture will be used and can
- * optimize how it is allocated.
- *
- * Return value: A newly created #CoglTexture
- *
- * Since: 0.8
- */
-CoglTexture *
-cogl_texture_new_with_size (CoglContext *ctx,
-                            int width,
-                            int height,
-                            CoglTextureFlags flags,
-                            CoglPixelFormat internal_format);
-
-/**
- * cogl_texture_new_from_file:
- * @context: A #CoglContext
- * @filename: the file to load
- * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE
- * @internal_format: the #CoglPixelFormat to use for the GPU storage of the
- *    texture. If %COGL_PIXEL_FORMAT_ANY is given then a premultiplied
- *    format similar to the format of the source data will be used. The
- *    default blending equations of Cogl expect premultiplied color data;
- *    the main use of passing a non-premultiplied format here is if you
- *    have non-premultiplied source data and are going to adjust the blend
- *    mode (see cogl_material_set_blend()) or use the data for something
- *    other than straight blending.
- * @error: A #CoglError to catch exceptional errors or %NULL
- *
- * Creates a #CoglTexture from an image file.
- *
- * Return value: A newly created #CoglTexture or %NULL on failure
- *
- * Since: 0.8
- */
-CoglTexture *
-cogl_texture_new_from_file (CoglContext *context,
-                            const char *filename,
-                            CoglTextureFlags flags,
-                            CoglPixelFormat internal_format,
-                            CoglError **error);
-
-/**
- * cogl_texture_new_from_data:
- * @context: A #CoglContext
- * @width: width of texture in pixels
- * @height: height of texture in pixels
- * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE
- * @format: the #CoglPixelFormat the buffer is stored in in RAM
- * @internal_format: the #CoglPixelFormat that will be used for storing
- *    the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
- *    premultiplied format similar to the format of the source data will
- *    be used. The default blending equations of Cogl expect premultiplied
- *    color data; the main use of passing a non-premultiplied format here
- *    is if you have non-premultiplied source data and are going to adjust
- *    the blend mode (see cogl_material_set_blend()) or use the data for
- *    something other than straight blending.
- * @rowstride: the memory offset in bytes between the starts of
- *    scanlines in @data
- * @data: pointer the memory region where the source buffer resides
- * @error: A #CoglError to catch exceptional errors or %NULL
- *
- * Creates a new #CoglTexture based on data residing in memory.
- *
- * Return value: A newly created #CoglTexture or %NULL on failure
- *
- * Since: 0.8
- */
-CoglTexture *
-cogl_texture_new_from_data (CoglContext *ctx,
-                            int width,
-                            int height,
-                            CoglTextureFlags flags,
-                            CoglPixelFormat format,
-                            CoglPixelFormat internal_format,
-                            int rowstride,
-                            const uint8_t *data,
-                            CoglError **error);
-
-/**
- * cogl_texture_gl_new_from_foreign:
- * @context: A #CoglContext
- * @gl_handle: opengl handle of foreign texture.
- * @gl_target: opengl target type of foreign texture
- * @width: width of foreign texture
- * @height: height of foreign texture.
- * @x_pot_waste: horizontal waste on the right hand edge of the texture.
- * @y_pot_waste: vertical waste on the bottom edge of the texture.
- * @format: format of the foreign texture.
- * @error: A #CoglError to catch exceptional errors or %NULL
- *
- * Creates a #CoglTexture based on an existing OpenGL texture; the
- * width, height and format are passed along since it is not always
- * possible to query these from OpenGL.
- *
- * The waste arguments allow you to create a Cogl texture that maps to
- * a region smaller than the real OpenGL texture. For instance if your
- * hardware only supports power-of-two textures you may load a
- * non-power-of-two image into a larger power-of-two texture and use
- * the waste arguments to tell Cogl which region should be mapped to
- * the texture coordinate range [0:1].
- *
- * Return value: A newly created #CoglTexture or %NULL on failure
- *
- * Since: 0.8
- */
-CoglTexture *
-cogl_texture_gl_new_from_foreign (CoglContext *context,
-                                  unsigned int gl_handle,
-                                  unsigned int gl_target,
-                                  int width,
-                                  int height,
-                                  int x_pot_waste,
-                                  int y_pot_waste,
-                                  CoglPixelFormat format,
-                                  CoglError **error);
-
-/**
- * cogl_texture_new_from_bitmap:
- * @bitmap: A #CoglBitmap pointer
- * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE
- * @internal_format: the #CoglPixelFormat to use for the GPU storage of the
- * texture
- * @error: A #CoglError to catch exceptional errors or %NULL
- *
- * Creates a #CoglTexture from a #CoglBitmap.
- *
- * Return value: A newly created #CoglTexture or %NULL on failure
- *
- * Since: 1.0
- */
-CoglTexture *
-cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
-                              CoglTextureFlags flags,
-                              CoglPixelFormat internal_format,
-                              CoglError **error);
-
-/**
  * cogl_is_texture:
  * @object: A #CoglObject pointer
  *
diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h
index 943dbc8..384ba96 100644
--- a/cogl/cogl-types.h
+++ b/cogl/cogl-types.h
@@ -384,29 +384,6 @@ struct _CoglColor
 COGL_STRUCT_SIZE_ASSERT (CoglColor, 16);
 
 /**
- * CoglTextureFlags:
- * @COGL_TEXTURE_NONE: No flags specified
- * @COGL_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of
- *   the mipmap pyramid from the base level image whenever it is
- *   updated. The mipmaps are only generated when the texture is
- *   rendered with a mipmap filter so it should be free to leave out
- *   this flag when using other filtering modes
- * @COGL_TEXTURE_NO_SLICING: Disables the slicing of the texture
- * @COGL_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside
- *   the texture atlas used by Cogl
- *
- * Flags to pass to the cogl_texture_new_* family of functions.
- *
- * Since: 1.0
- */
-typedef enum {
-  COGL_TEXTURE_NONE           = 0,
-  COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
-  COGL_TEXTURE_NO_SLICING     = 1 << 1,
-  COGL_TEXTURE_NO_ATLAS       = 1 << 2
-} CoglTextureFlags;
-
-/**
  * COGL_BLEND_STRING_ERROR:
  *
  * #CoglError domain for blend string parser errors
diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols
index 89a2bd8..20109b8 100644
--- a/cogl/cogl.symbols
+++ b/cogl/cogl.symbols
@@ -549,11 +549,6 @@ cogl_texture_get_gl_texture
 cogl_texture_get_height
 cogl_texture_get_width
 cogl_texture_is_sliced
-cogl_texture_new_from_bitmap
-cogl_texture_new_from_data
-cogl_texture_new_from_file
-cogl_texture_new_from_foreign
-cogl_texture_new_with_size
 #ifdef COGL_HAS_X11
 cogl_texture_pixmap_x11_error_domain
 cogl_texture_pixmap_x11_is_using_tfp_extension
-- 
1.8.2.1



More information about the Cogl mailing list