Rename CoglPixelArray to CoglPixelBuffer

This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to switch away from
using the term "Array" which implies a regular, indexable layout which
isn't the case. We also want to strongly imply a relationship between
CoglBuffers and CoglPixelBuffers and be consistent with the
CoglAttributeBuffer and CoglIndexBuffer APIs.
This commit is contained in:
Robert Bragg 2011-03-02 15:19:57 +00:00
parent ce7c06dc03
commit c328e0608f
9 changed files with 72 additions and 72 deletions

View File

@ -70,7 +70,7 @@ cogl_public_h = \
$(srcdir)/cogl-offscreen.h \
$(srcdir)/cogl-primitives.h \
$(srcdir)/cogl-path.h \
$(srcdir)/cogl-pixel-array.h \
$(srcdir)/cogl-pixel-buffer.h \
$(srcdir)/cogl-shader.h \
$(srcdir)/cogl-texture.h \
$(srcdir)/cogl-texture-3d.h \
@ -216,8 +216,8 @@ cogl_sources_c = \
$(srcdir)/cogl-color.c \
$(srcdir)/cogl-buffer-private.h \
$(srcdir)/cogl-buffer.c \
$(srcdir)/cogl-pixel-array-private.h \
$(srcdir)/cogl-pixel-array.c \
$(srcdir)/cogl-pixel-buffer-private.h \
$(srcdir)/cogl-pixel-buffer.c \
$(srcdir)/cogl-vertex-buffer-private.h \
$(srcdir)/cogl-vertex-buffer.c \
$(srcdir)/cogl-index-array-private.h \

View File

@ -43,7 +43,7 @@
#include "cogl-util.h"
#include "cogl-context-private.h"
#include "cogl-handle.h"
#include "cogl-pixel-array-private.h"
#include "cogl-pixel-buffer-private.h"
/*
* GL/GLES compatibility defines for the buffer API:

View File

@ -106,7 +106,7 @@ cogl_index_array_allocate (CoglIndexArray *indices,
* CoglAttributeBuffer (buffer sub-class)
* CoglAttribute (defines meta data for sub-region of buffer)
* CoglPrimitive (object encapsulating a set of attributes)
* CoglPixelArray (buffer sub-class)
* CoglPixelBuffer (buffer sub-class)
* CoglIndexArray (buffer sub-class)
* CoglIndices (defines meta data for sub-region of array)
*

View File

@ -25,8 +25,8 @@
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_PIXEL_ARRAY_PRIVATE_H__
#define __COGL_PIXEL_ARRAY_PRIVATE_H__
#ifndef __COGL_PIXEL_BUFFER_PRIVATE_H__
#define __COGL_PIXEL_BUFFER_PRIVATE_H__
#include "cogl-handle.h"
#include "cogl-buffer-private.h"
@ -35,9 +35,9 @@
G_BEGIN_DECLS
#define COGL_PIXEL_ARRAY(array) ((CoglPixelArray *)(array))
#define COGL_PIXEL_BUFFER(array) ((CoglPixelBuffer *)(array))
struct _CoglPixelArray
struct _CoglPixelBuffer
{
CoglBuffer _parent;
@ -48,8 +48,8 @@ struct _CoglPixelArray
};
GQuark
_cogl_handle_pixel_array_get_type (void);
_cogl_handle_pixel_buffer_get_type (void);
G_END_DECLS
#endif /* __COGL_PIXEL_ARRAY_PRIVATE_H__ */
#endif /* __COGL_PIXEL_BUFFER_PRIVATE_H__ */

View File

@ -26,7 +26,7 @@
*/
/* For an overview of the functionality implemented here, please see
* cogl-pixel-array.h, which contains the gtk-doc section overview for the
* cogl-buffer-array.h, which contains the gtk-doc section overview for the
* Pixel Buffers API.
*/
@ -43,8 +43,8 @@
#include "cogl-util.h"
#include "cogl-context-private.h"
#include "cogl-object.h"
#include "cogl-pixel-array-private.h"
#include "cogl-pixel-array.h"
#include "cogl-pixel-buffer-private.h"
#include "cogl-pixel-buffer.h"
/*
* GL/GLES compatibility defines for the buffer API:
@ -72,15 +72,15 @@
#endif
static void
_cogl_pixel_array_free (CoglPixelArray *buffer);
_cogl_pixel_buffer_free (CoglPixelBuffer *buffer);
COGL_BUFFER_DEFINE (PixelArray, pixel_array)
COGL_BUFFER_DEFINE (PixelBuffer, pixel_buffer)
static CoglPixelArray *
_cogl_pixel_array_new (unsigned int size)
static CoglPixelBuffer *
_cogl_pixel_buffer_new (unsigned int size)
{
CoglPixelArray *pixel_array = g_slice_new0 (CoglPixelArray);
CoglBuffer *buffer = COGL_BUFFER (pixel_array);
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
gboolean use_malloc;
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
@ -99,50 +99,50 @@ _cogl_pixel_array_new (unsigned int size)
COGL_BUFFER_UPDATE_HINT_STATIC);
/* return COGL_INVALID_HANDLE; */
return _cogl_pixel_array_object_new (pixel_array);
return _cogl_pixel_buffer_object_new (pixel_buffer);
}
CoglPixelArray *
cogl_pixel_array_new_with_size (unsigned int width,
unsigned int height,
CoglPixelFormat format,
unsigned int *rowstride)
CoglPixelBuffer *
cogl_pixel_buffer_new_with_size (unsigned int width,
unsigned int height,
CoglPixelFormat format,
unsigned int *rowstride)
{
CoglPixelArray *buffer;
CoglPixelArray *pixel_array;
CoglPixelBuffer *buffer;
CoglPixelBuffer *pixel_buffer;
unsigned int stride;
/* creating a buffer to store "any" format does not make sense */
if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY))
return COGL_INVALID_HANDLE;
/* for now we fallback to cogl_pixel_array_new, later, we could ask
/* for now we fallback to cogl_pixel_buffer_new, later, we could ask
* libdrm a tiled buffer for instance */
stride = width * _cogl_get_format_bpp (format);
if (rowstride)
*rowstride = stride;
buffer = _cogl_pixel_array_new (height * stride);
buffer = _cogl_pixel_buffer_new (height * stride);
if (G_UNLIKELY (buffer == COGL_INVALID_HANDLE))
return COGL_INVALID_HANDLE;
pixel_array = COGL_PIXEL_ARRAY (buffer);
pixel_array->width = width;
pixel_array->height = height;
pixel_array->format = format;
pixel_array->stride = stride;
pixel_buffer = COGL_PIXEL_BUFFER (buffer);
pixel_buffer->width = width;
pixel_buffer->height = height;
pixel_buffer->format = format;
pixel_buffer->stride = stride;
return buffer;
}
static void
_cogl_pixel_array_free (CoglPixelArray *buffer)
_cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* parent's destructor */
_cogl_buffer_fini (COGL_BUFFER (buffer));
g_slice_free (CoglPixelArray, buffer);
g_slice_free (CoglPixelBuffer, buffer);
}

View File

@ -29,31 +29,31 @@
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef __COGL_PIXEL_ARRAY_H__
#define __COGL_PIXEL_ARRAY_H__
#ifndef __COGL_PIXEL_BUFFER_H__
#define __COGL_PIXEL_BUFFER_H__
#include <glib.h>
#include <cogl/cogl-types.h>
G_BEGIN_DECLS
/* All of the cogl-pixel-array API is currently experimental so we
/* All of the cogl-pixel-buffer API is currently experimental so we
* suffix the actual symbols with _EXP so if somone is monitoring for
* ABI changes it will hopefully be clearer to them what's going on if
* any of the symbols dissapear at a later date.
*/
#define cogl_pixel_array_new cogl_pixel_array_new_EXP
#define cogl_pixel_array_new_with_size cogl_pixel_array_new_with_size_EXP
#define cogl_is_pixel_array cogl_is_pixel_array_EXP
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
#define cogl_pixel_buffer_new_with_size cogl_pixel_buffer_new_with_size_EXP
#define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP
#if 0
#define cogl_pixel_array_set_region cogl_pixel_array_set_region_EXP
#define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP
#endif
typedef struct _CoglPixelArray CoglPixelArray;
typedef struct _CoglPixelBuffer CoglPixelBuffer;
/**
* cogl_pixel_array_new_with_size:
* cogl_pixel_buffer_new_with_size:
* @width: width of the pixel array in pixels
* @height: height of the pixel array in pixels
* @format: the format of the pixels the array will store
@ -68,20 +68,20 @@ typedef struct _CoglPixelArray CoglPixelArray;
* arrays are likely to have a stride larger than width * bytes_per_pixel. The
* user must take the stride into account when writing into it.</note>
*
* Return value: a #CoglPixelArray representing the newly created array or
* Return value: a #CoglPixelBuffer representing the newly created array or
* %NULL on failure
*
* Since: 1.2
* Stability: Unstable
*/
CoglPixelArray *
cogl_pixel_array_new_with_size (unsigned int width,
unsigned int height,
CoglPixelFormat format,
unsigned int *stride);
CoglPixelBuffer *
cogl_pixel_buffer_new_with_size (unsigned int width,
unsigned int height,
CoglPixelFormat format,
unsigned int *stride);
/**
* cogl_is_pixel_array:
* cogl_is_pixel_buffer:
* @object: a #CoglObject to test
*
* Checks whether @handle is a pixel array.
@ -93,11 +93,11 @@ cogl_pixel_array_new_with_size (unsigned int width,
* Stability: Unstable
*/
gboolean
cogl_is_pixel_array (void *object);
cogl_is_pixel_buffer (void *object);
#if 0
/*
* cogl_pixel_array_set_region:
* cogl_pixel_buffer_set_region:
* @array: the #CoglHandle of a pixel array
* @data: pixel data to upload to @array
* @src_width: width in pixels of the region to update
@ -117,15 +117,15 @@ cogl_is_pixel_array (void *object);
* Stability: Unstable
*/
gboolean
cogl_pixel_array_set_region (CoglHandle array,
guint8 *data,
unsigned int src_width,
unsigned int src_height,
unsigned int src_rowstride,
unsigned int dst_x,
unsigned int dst_y);
cogl_pixel_buffer_set_region (CoglHandle array,
guint8 *data,
unsigned int src_width,
unsigned int src_height,
unsigned int src_rowstride,
unsigned int dst_x,
unsigned int dst_y);
#endif
G_END_DECLS
#endif /* __COGL_PIXEL_ARRAY_H__ */
#endif /* __COGL_PIXEL_BUFFER_H__ */

View File

@ -37,7 +37,7 @@
#include "cogl-bitmap.h"
#include "cogl-bitmap-private.h"
#include "cogl-buffer-private.h"
#include "cogl-pixel-array-private.h"
#include "cogl-pixel-buffer-private.h"
#include "cogl-private.h"
#include "cogl-texture-private.h"
#include "cogl-texture-driver.h"
@ -574,7 +574,7 @@ cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
{
CoglHandle texture;
CoglBuffer *cogl_buffer;
CoglPixelArray *pixel_array;
CoglPixelBuffer *pixel_buffer;
CoglBitmap *bmp;
g_return_val_if_fail (cogl_is_buffer (buffer), COGL_INVALID_HANDLE);
@ -583,23 +583,23 @@ cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
return COGL_INVALID_HANDLE;
cogl_buffer = COGL_BUFFER (buffer);
pixel_array = COGL_PIXEL_ARRAY (buffer);
pixel_buffer = COGL_PIXEL_BUFFER (buffer);
/* Rowstride from CoglBuffer or even width * bpp if not given */
if (rowstride == 0)
rowstride = pixel_array->stride;
rowstride = pixel_buffer->stride;
if (rowstride == 0)
rowstride = width * _cogl_get_format_bpp (format);
/* use the CoglBuffer height and width as last resort */
if (width == 0)
width = pixel_array->width;
width = pixel_buffer->width;
if (height == 0)
height = pixel_array->height;
height = pixel_buffer->height;
if (width == 0 || height == 0)
{
/* no width or height specified, neither at creation time (because the
* array was created by cogl_pixel_array_new()) nor when calling this
* array was created by cogl_pixel_buffer_new()) nor when calling this
* function */
return COGL_INVALID_HANDLE;
}

View File

@ -75,7 +75,7 @@ typedef struct _CoglFramebuffer CoglFramebuffer;
#include <cogl/cogl-display.h>
#include <cogl/cogl-context.h>
#include <cogl/cogl-buffer.h>
#include <cogl/cogl-pixel-array.h>
#include <cogl/cogl-pixel-buffer.h>
#include <cogl/cogl-vector.h>
#include <cogl/cogl-euler.h>
#include <cogl/cogl-quaternion.h>

View File

@ -74,7 +74,7 @@ IGNORE_HFILES=\
cogl-pipeline-progend-glsl-private.h \
cogl-pipeline-vertend-fixed-private.h \
cogl-pipeline-vertend-glsl-private.h \
cogl-pixel-array-private.h \
cogl-pixel-buffer-private.h \
cogl-primitive-private.h \
cogl-primitives-private.h \
cogl-private.h \