[Cogl] [PATCH] Remove cogl-primitives.h and CoglTextureVertex
Robert Bragg
robert at sixbynine.org
Thu Sep 13 12:00:31 PDT 2012
Yep, this looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Thu, Sep 13, 2012 at 6:27 PM, Neil Roberts <neil at linux.intel.com> wrote:
> This removes the cogl-primitives.h header. The implementations for all
> of the functions that it declared have already been removed in
> 7546ee19.
>
> The CoglTextureVertex type has also been removed because it was only
> used for cogl_polygon which has already been removed.
>
> This patch also fixes some mentions of cogl_rectangle() in the
> documentation and replaces them with
> cogl_framebuffer_draw_rectangle().
> ---
> cogl/Makefile.am | 2 -
> cogl/cogl-clip-stack.c | 1 -
> cogl/cogl-context-private.h | 1 -
> cogl/cogl-meta-texture.h | 32 ++---
> cogl/cogl-primitives.c | 8 --
> cogl/cogl-primitives.h | 190 ----------------------------
> cogl/cogl-snippet.h | 4 +-
> cogl/cogl-sub-texture.h | 4 +-
> cogl/cogl-texture.c | 1 -
> cogl/cogl-types.h | 22 ----
> cogl/cogl.h | 1 -
> cogl/driver/gl/cogl-texture-driver-gl.c | 1 -
> cogl/driver/gles/cogl-texture-driver-gles.c | 1 -
> tests/conform/test-backface-culling.c | 3 -
> tests/conform/test-wrap-modes.c | 8 --
> 15 files changed, 20 insertions(+), 259 deletions(-)
> delete mode 100644 cogl/cogl-primitives.h
>
> diff --git a/cogl/Makefile.am b/cogl/Makefile.am
> index 2cb63de..4fc34ec 100644
> --- a/cogl/Makefile.am
> +++ b/cogl/Makefile.am
> @@ -59,7 +59,6 @@ cogl_1_public_h = \
> $(srcdir)/cogl-color.h \
> $(srcdir)/cogl-matrix.h \
> $(srcdir)/cogl-offscreen.h \
> - $(srcdir)/cogl-primitives.h \
> $(srcdir)/cogl-texture.h \
> $(srcdir)/cogl-types.h \
> $(srcdir)/cogl-clutter.h \
> @@ -213,7 +212,6 @@ cogl_sources_c = \
> $(srcdir)/cogl-bitmap-conversion.c \
> $(srcdir)/cogl-bitmap-packing.h \
> $(srcdir)/cogl-primitives-private.h \
> - $(srcdir)/cogl-primitives.h \
> $(srcdir)/cogl-primitives.c \
> $(srcdir)/cogl-path-private.h \
> $(srcdir)/cogl-path.c \
> diff --git a/cogl/cogl-clip-stack.c b/cogl/cogl-clip-stack.c
> index 8a1d9de..d8dbb3d 100644
> --- a/cogl/cogl-clip-stack.c
> +++ b/cogl/cogl-clip-stack.c
> @@ -31,7 +31,6 @@
> #include <glib.h>
>
> #include "cogl-clip-stack.h"
> -#include "cogl-primitives.h"
> #include "cogl-context-private.h"
> #include "cogl-internal.h"
> #include "cogl-framebuffer-private.h"
> diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
> index 67e2a1d..8e35099 100644
> --- a/cogl/cogl-context-private.h
> +++ b/cogl/cogl-context-private.h
> @@ -34,7 +34,6 @@
> #endif
>
> #include "cogl-display-private.h"
> -#include "cogl-primitives.h"
> #include "cogl-clip-stack.h"
> #include "cogl-matrix-stack.h"
> #include "cogl-pipeline-private.h"
> diff --git a/cogl/cogl-meta-texture.h b/cogl/cogl-meta-texture.h
> index b896cd0..06a3088 100644
> --- a/cogl/cogl-meta-texture.h
> +++ b/cogl/cogl-meta-texture.h
> @@ -57,12 +57,12 @@ G_BEGIN_DECLS
> * For example the GPU is not able to automatically handle repeating a
> * texture that is part of a larger atlas texture but if you use
> * %COGL_PIPELINE_WRAP_MODE_REPEAT with an atlas texture when drawing
> - * with cogl_rectangle() you should see that it "Just Works™" - at
> - * least if you don't use multi-texturing. The reason this works is
> - * because cogl_rectangle() internally understands the #CoglMetaTexture
> - * interface and is able to manually resolve the low-level textures
> - * using this interface and by making multiple draw calls it can
> - * emulate the texture repeat modes.
> + * with cogl_framebuffer_draw_rectangle() you should see that it "Just
> + * Works™" - at least if you don't use multi-texturing. The reason
> + * this works is because cogl_framebuffer_draw_rectangle() internally
> + * understands the #CoglMetaTexture interface and is able to manually
> + * resolve the low-level textures using this interface and by making
> + * multiple draw calls it can emulate the texture repeat modes.
> *
> * Cogl doesn't aim to pretend that meta-textures are just like real
> * textures because it would get extremely complex to try and emulate
> @@ -72,12 +72,13 @@ G_BEGIN_DECLS
> * the developer's responsibility to resolve all textures referenced by
> * a #CoglPipeline to low-level textures before drawing.
> *
> - * If you want to develop custom primitive APIs like cogl_rectangle()
> - * and you want to support drawing with #CoglAtlasTexture<!-- -->s
> - * or #CoglSubTexture<!-- -->s for example, then you will need to use
> - * this #CoglMetaTexture interface to be able to resolve high-level
> - * textures into low-level textures before drawing with Cogl's
> - * low-level drawing APIs such as cogl_draw_attributes().
> + * If you want to develop custom primitive APIs like
> + * cogl_framebuffer_draw_rectangle() and you want to support drawing
> + * with #CoglAtlasTexture<!-- -->s or #CoglSubTexture<!-- -->s for
> + * example, then you will need to use this #CoglMetaTexture interface
> + * to be able to resolve high-level textures into low-level textures
> + * before drawing with Cogl's low-level drawing APIs such as
> + * cogl_draw_attributes().
> *
> * <note>Most developers won't need to use this interface directly
> * but still it is worth understanding the distinction between
> @@ -149,9 +150,10 @@ typedef void (*CoglMetaTextureCallback) (CoglTexture *sub_texture,
> * consistently using this interface which greately simplifies
> * implementing primitives that support all texture types.
> *
> - * For example if you use the cogl_rectangle() API then Cogl will
> - * internally use this API to resolve the low level textures of any
> - * meta textures you have associated with CoglPipeline layers.
> + * For example if you use the cogl_framebuffer_draw_rectangle() API
> + * then Cogl will internally use this API to resolve the low level
> + * textures of any meta textures you have associated with CoglPipeline
> + * layers.
> *
> * <note>The low level drawing APIs such as cogl_draw_attributes()
> * don't understand the #CoglMetaTexture interface and so it is your
> diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
> index ef48d2f..87ca8bc 100644
> --- a/cogl/cogl-primitives.c
> +++ b/cogl/cogl-primitives.c
> @@ -62,14 +62,6 @@ typedef struct _TextureSlicedQuadState
> CoglBool flipped_y;
> } TextureSlicedQuadState;
>
> -typedef struct _TextureSlicedPolygonState
> -{
> - const CoglTextureVertex *vertices;
> - int n_vertices;
> - int stride;
> - CoglAttribute **attributes;
> -} TextureSlicedPolygonState;
> -
> static void
> log_quad_sub_textures_cb (CoglTexture *texture,
> const float *subtexture_coords,
> diff --git a/cogl/cogl-primitives.h b/cogl/cogl-primitives.h
> deleted file mode 100644
> index e1f3617..0000000
> --- a/cogl/cogl-primitives.h
> +++ /dev/null
> @@ -1,190 +0,0 @@
> -/*
> - * Cogl
> - *
> - * An object oriented GL/GLES Abstraction/Utility Layer
> - *
> - * Copyright (C) 2007,2008,2009 Intel Corporation.
> - *
> - * 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/>.
> - *
> - *
> - */
> -
> -#ifndef __COGL_PRIMITIVES_H
> -#define __COGL_PRIMITIVES_H
> -
> -#include <glib.h>
> -
> -G_BEGIN_DECLS
> -
> -/**
> - * SECTION:cogl-primitives
> - * @short_description: Functions that draw various primitive 3D shapes
> - *
> - * The primitives API provides utilities for drawing some
> - * common 3D shapes in a more convenient way than the CoglVertexBuffer
> - * API provides.
> - */
> -
> -/**
> - * cogl_rectangle:
> - * @x_1: X coordinate of the top-left corner
> - * @y_1: Y coordinate of the top-left corner
> - * @x_2: X coordinate of the bottom-right corner
> - * @y_2: Y coordinate of the bottom-right corner
> - *
> - * Fills a rectangle at the given coordinates with the current source material
> - **/
> -void
> -cogl_rectangle (float x_1,
> - float y_1,
> - float x_2,
> - float y_2);
> -
> -/**
> - * cogl_rectangle_with_texture_coords:
> - * @x1: x coordinate upper left on screen.
> - * @y1: y coordinate upper left on screen.
> - * @x2: x coordinate lower right on screen.
> - * @y2: y coordinate lower right on screen.
> - * @tx1: x part of texture coordinate to use for upper left pixel
> - * @ty1: y part of texture coordinate to use for upper left pixel
> - * @tx2: x part of texture coordinate to use for lower right pixel
> - * @ty2: y part of texture coordinate to use for left pixel
> - *
> - * Draw a rectangle using the current material and supply texture coordinates
> - * to be used for the first texture layer of the material. To draw the entire
> - * texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
> - *
> - * Since: 1.0
> - */
> -void
> -cogl_rectangle_with_texture_coords (float x1,
> - float y1,
> - float x2,
> - float y2,
> - float tx1,
> - float ty1,
> - float tx2,
> - float ty2);
> -
> -/**
> - * cogl_rectangle_with_multitexture_coords:
> - * @x1: x coordinate upper left on screen.
> - * @y1: y coordinate upper left on screen.
> - * @x2: x coordinate lower right on screen.
> - * @y2: y coordinate lower right on screen.
> - * @tex_coords: (in) (array) (transfer none): An array containing groups of
> - * 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture
> - * coordinates; one for the upper left texel, and one for the lower right
> - * texel. Each value should be between 0.0 and 1.0, where the coordinate
> - * (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the
> - * bottom right.
> - * @tex_coords_len: The length of the tex_coords array. (e.g. for one layer
> - * and one group of texture coordinates, this would be 4)
> - *
> - * This function draws a rectangle using the current source material to
> - * texture or fill with. As a material may contain multiple texture layers
> - * this interface lets you supply texture coordinates for each layer of the
> - * material.
> - *
> - * The first pair of coordinates are for the first layer (with the smallest
> - * layer index) and if you supply less texture coordinates than there are
> - * layers in the current source material then default texture coordinates
> - * (0.0, 0.0, 1.0, 1.0) are generated.
> - *
> - * Since: 1.0
> - */
> -void
> -cogl_rectangle_with_multitexture_coords (float x1,
> - float y1,
> - float x2,
> - float y2,
> - const float *tex_coords,
> - int tex_coords_len);
> -
> -/**
> - * cogl_rectangles_with_texture_coords:
> - * @verts: (in) (array) (transfer none): an array of vertices
> - * @n_rects: number of rectangles to draw
> - *
> - * Draws a series of rectangles in the same way that
> - * cogl_rectangle_with_texture_coords() does. In some situations it can give a
> - * significant performance boost to use this function rather than
> - * calling cogl_rectangle_with_texture_coords() separately for each rectangle.
> - *
> - * @verts should point to an array of #float<!-- -->s with
> - * @n_rects * 8 elements. Each group of 8 values corresponds to the
> - * parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
> - * meaning as in cogl_rectangle_with_texture_coords().
> - *
> - * Since: 0.8.6
> - */
> -void
> -cogl_rectangles_with_texture_coords (const float *verts,
> - unsigned int n_rects);
> -
> -/**
> - * cogl_rectangles:
> - * @verts: (in) (array) (transfer none): an array of vertices
> - * @n_rects: number of rectangles to draw
> - *
> - * Draws a series of rectangles in the same way that
> - * cogl_rectangle() does. In some situations it can give a
> - * significant performance boost to use this function rather than
> - * calling cogl_rectangle() separately for each rectangle.
> - *
> - * @verts should point to an array of #float<!-- -->s with
> - * @n_rects * 4 elements. Each group of 4 values corresponds to the
> - * parameters x1, y1, x2, and y2, and have the same
> - * meaning as in cogl_rectangle().
> - *
> - * Since: 1.0
> - */
> -void
> -cogl_rectangles (const float *verts,
> - unsigned int n_rects);
> -
> -/**
> - * cogl_polygon:
> - * @vertices: An array of #CoglTextureVertex structs
> - * @n_vertices: The length of the vertices array
> - * @use_color: %TRUE if the color member of #CoglTextureVertex should be used
> - *
> - * Draws a convex polygon using the current source material to fill / texture
> - * with according to the texture coordinates passed.
> - *
> - * If @use_color is %TRUE then the color will be changed for each vertex using
> - * the value specified in the color member of #CoglTextureVertex. This can be
> - * used for example to make the texture fade out by setting the alpha value of
> - * the color.
> - *
> - * All of the texture coordinates must be in the range [0,1] and repeating the
> - * texture is not supported.
> - *
> - * Because of the way this function is implemented it will currently
> - * only work if either the texture is not sliced or the backend is not
> - * OpenGL ES and the minifying and magnifying functions are both set
> - * to COGL_MATERIAL_FILTER_NEAREST.
> - *
> - * Since: 1.0
> - */
> -void
> -cogl_polygon (const CoglTextureVertex *vertices,
> - unsigned int n_vertices,
> - CoglBool use_color);
> -
> -G_END_DECLS
> -
> -#endif /* __COGL_PRIMITIVES_H */
> diff --git a/cogl/cogl-snippet.h b/cogl/cogl-snippet.h
> index f20cc98..b9b97f3 100644
> --- a/cogl/cogl-snippet.h
> +++ b/cogl/cogl-snippet.h
> @@ -301,9 +301,7 @@ G_BEGIN_DECLS
> * cogl_pipeline_set_uniform_1f (pipeline, location, 0.5f);
> *
> * /<!-- -->* Now we can render with the snippet as usual *<!-- -->/
> - * cogl_push_source (pipeline);
> - * cogl_rectangle (0, 0, 10, 10);
> - * cogl_pop_source ();
> + * cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
> * </programlisting>
> */
> typedef struct _CoglSnippet CoglSnippet;
> diff --git a/cogl/cogl-sub-texture.h b/cogl/cogl-sub-texture.h
> index 92bbe4e..914b4c5 100644
> --- a/cogl/cogl-sub-texture.h
> +++ b/cogl/cogl-sub-texture.h
> @@ -69,8 +69,8 @@ typedef struct _CoglSubTexture CoglSubTexture;
> * that hardware can understand natively.
> *
> * <note>Remember: Unless you are using high level drawing APIs such
> - * as cogl_rectangle() or other APIs documented to understand the
> - * #CoglMetaTexture interface then you need to use the
> + * as cogl_framebuffer_draw_rectangle() or other APIs documented to
> + * understand the #CoglMetaTexture interface then you need to use the
> * #CoglMetaTexture interface to resolve a #CoglSubTexture into a
> * low-level texture before drawing.</note>
> *
> diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
> index 25c5282..4c8e2e9 100644
> --- a/cogl/cogl-texture.c
> +++ b/cogl/cogl-texture.c
> @@ -49,7 +49,6 @@
> #include "cogl-context-private.h"
> #include "cogl-object-private.h"
> #include "cogl-object-private.h"
> -#include "cogl-primitives.h"
> #include "cogl-framebuffer-private.h"
> #include "cogl1-context.h"
> #include "cogl-sub-texture.h"
> diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h
> index f22b6f6..26030e9 100644
> --- a/cogl/cogl-types.h
> +++ b/cogl/cogl-types.h
> @@ -146,7 +146,6 @@ typedef struct _CoglEuler CoglEuler;
> typedef int32_t CoglAngle;
>
> typedef struct _CoglColor CoglColor;
> -typedef struct _CoglTextureVertex CoglTextureVertex;
>
> /* Enum declarations */
>
> @@ -458,27 +457,6 @@ struct _CoglColor
> COGL_STRUCT_SIZE_ASSERT (CoglColor, 16);
>
> /**
> - * CoglTextureVertex:
> - * @x: Model x-coordinate
> - * @y: Model y-coordinate
> - * @z: Model z-coordinate
> - * @tx: Texture x-coordinate
> - * @ty: Texture y-coordinate
> - * @color: The color to use at this vertex. This is ignored if
> - * use_color is %FALSE when calling cogl_polygon()
> - *
> - * Used to specify vertex information when calling cogl_polygon()
> - */
> -struct _CoglTextureVertex
> -{
> - float x, y, z;
> - float tx, ty;
> -
> - CoglColor color;
> -};
> -COGL_STRUCT_SIZE_ASSERT (CoglTextureVertex, 36);
> -
> -/**
> * CoglTextureFlags:
> * @COGL_TEXTURE_NONE: No flags specified
> * @COGL_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of
> diff --git a/cogl/cogl.h b/cogl/cogl.h
> index 597f1d5..8291bc2 100644
> --- a/cogl/cogl.h
> +++ b/cogl/cogl.h
> @@ -42,7 +42,6 @@
> #include <cogl/cogl-color.h>
> #include <cogl/cogl-matrix.h>
> #include <cogl/cogl-offscreen.h>
> -#include <cogl/cogl-primitives.h>
> #include <cogl/cogl-texture.h>
> #include <cogl/cogl-types.h>
> #include <cogl/cogl-path.h>
> diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c
> index 2c59177..57c7517 100644
> --- a/cogl/driver/gl/cogl-texture-driver-gl.c
> +++ b/cogl/driver/gl/cogl-texture-driver-gl.c
> @@ -38,7 +38,6 @@
> #include "cogl-pipeline.h"
> #include "cogl-context-private.h"
> #include "cogl-object-private.h"
> -#include "cogl-primitives.h"
> #include "cogl-pipeline-opengl-private.h"
>
> #include <string.h>
> diff --git a/cogl/driver/gles/cogl-texture-driver-gles.c b/cogl/driver/gles/cogl-texture-driver-gles.c
> index e19721c..bd8f748 100644
> --- a/cogl/driver/gles/cogl-texture-driver-gles.c
> +++ b/cogl/driver/gles/cogl-texture-driver-gles.c
> @@ -39,7 +39,6 @@
> #include "cogl-pipeline-opengl-private.h"
> #include "cogl-context-private.h"
> #include "cogl-object-private.h"
> -#include "cogl-primitives.h"
>
> #include <string.h>
> #include <stdlib.h>
> diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
> index 1ee13b3..e952680 100644
> --- a/tests/conform/test-backface-culling.c
> +++ b/tests/conform/test-backface-culling.c
> @@ -71,7 +71,6 @@ paint_test_backface_culling (TestState *state,
> for (draw_num = 0; draw_num < 8; draw_num++)
> {
> float x1 = 0, x2, y1 = 0, y2 = (float)(TEXTURE_RENDER_SIZE);
> - CoglTextureVertex verts[4];
> CoglPipeline *pipeline;
>
> cogl_framebuffer_push_matrix (framebuffer);
> @@ -83,8 +82,6 @@ paint_test_backface_culling (TestState *state,
> cogl_pipeline_set_front_face_winding (pipeline, FRONT_WINDING (draw_num));
> cogl_pipeline_set_cull_face_mode (pipeline, CULL_FACE_MODE (draw_num));
>
> - memset (verts, 0, sizeof (verts));
> -
> x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
>
> /* Draw a front-facing texture */
> diff --git a/tests/conform/test-wrap-modes.c b/tests/conform/test-wrap-modes.c
> index 903f0b8..8bc5a3e 100644
> --- a/tests/conform/test-wrap-modes.c
> +++ b/tests/conform/test-wrap-modes.c
> @@ -105,14 +105,6 @@ draw_tests (TestState *state)
> }
> }
>
> -static const CoglTextureVertex vertices[4] =
> - {
> - { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
> - { 0.0f, TEX_SIZE * 2, 0.0f, 0.0f, 2.0f },
> - { TEX_SIZE * 2, TEX_SIZE * 2, 0.0f, 2.0f, 2.0f },
> - { TEX_SIZE * 2, 0.0f, 0.0f, 2.0f, 0.0f }
> - };
> -
> static void
> validate_set (TestState *state, int offset)
> {
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list