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:
parent
ce7c06dc03
commit
c328e0608f
@ -70,7 +70,7 @@ cogl_public_h = \
|
|||||||
$(srcdir)/cogl-offscreen.h \
|
$(srcdir)/cogl-offscreen.h \
|
||||||
$(srcdir)/cogl-primitives.h \
|
$(srcdir)/cogl-primitives.h \
|
||||||
$(srcdir)/cogl-path.h \
|
$(srcdir)/cogl-path.h \
|
||||||
$(srcdir)/cogl-pixel-array.h \
|
$(srcdir)/cogl-pixel-buffer.h \
|
||||||
$(srcdir)/cogl-shader.h \
|
$(srcdir)/cogl-shader.h \
|
||||||
$(srcdir)/cogl-texture.h \
|
$(srcdir)/cogl-texture.h \
|
||||||
$(srcdir)/cogl-texture-3d.h \
|
$(srcdir)/cogl-texture-3d.h \
|
||||||
@ -216,8 +216,8 @@ cogl_sources_c = \
|
|||||||
$(srcdir)/cogl-color.c \
|
$(srcdir)/cogl-color.c \
|
||||||
$(srcdir)/cogl-buffer-private.h \
|
$(srcdir)/cogl-buffer-private.h \
|
||||||
$(srcdir)/cogl-buffer.c \
|
$(srcdir)/cogl-buffer.c \
|
||||||
$(srcdir)/cogl-pixel-array-private.h \
|
$(srcdir)/cogl-pixel-buffer-private.h \
|
||||||
$(srcdir)/cogl-pixel-array.c \
|
$(srcdir)/cogl-pixel-buffer.c \
|
||||||
$(srcdir)/cogl-vertex-buffer-private.h \
|
$(srcdir)/cogl-vertex-buffer-private.h \
|
||||||
$(srcdir)/cogl-vertex-buffer.c \
|
$(srcdir)/cogl-vertex-buffer.c \
|
||||||
$(srcdir)/cogl-index-array-private.h \
|
$(srcdir)/cogl-index-array-private.h \
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.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:
|
* GL/GLES compatibility defines for the buffer API:
|
||||||
|
@ -106,7 +106,7 @@ cogl_index_array_allocate (CoglIndexArray *indices,
|
|||||||
* CoglAttributeBuffer (buffer sub-class)
|
* CoglAttributeBuffer (buffer sub-class)
|
||||||
* CoglAttribute (defines meta data for sub-region of buffer)
|
* CoglAttribute (defines meta data for sub-region of buffer)
|
||||||
* CoglPrimitive (object encapsulating a set of attributes)
|
* CoglPrimitive (object encapsulating a set of attributes)
|
||||||
* CoglPixelArray (buffer sub-class)
|
* CoglPixelBuffer (buffer sub-class)
|
||||||
* CoglIndexArray (buffer sub-class)
|
* CoglIndexArray (buffer sub-class)
|
||||||
* CoglIndices (defines meta data for sub-region of array)
|
* CoglIndices (defines meta data for sub-region of array)
|
||||||
*
|
*
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
* Robert Bragg <robert@linux.intel.com>
|
* Robert Bragg <robert@linux.intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __COGL_PIXEL_ARRAY_PRIVATE_H__
|
#ifndef __COGL_PIXEL_BUFFER_PRIVATE_H__
|
||||||
#define __COGL_PIXEL_ARRAY_PRIVATE_H__
|
#define __COGL_PIXEL_BUFFER_PRIVATE_H__
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-handle.h"
|
||||||
#include "cogl-buffer-private.h"
|
#include "cogl-buffer-private.h"
|
||||||
@ -35,9 +35,9 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define COGL_PIXEL_ARRAY(array) ((CoglPixelArray *)(array))
|
#define COGL_PIXEL_BUFFER(array) ((CoglPixelBuffer *)(array))
|
||||||
|
|
||||||
struct _CoglPixelArray
|
struct _CoglPixelBuffer
|
||||||
{
|
{
|
||||||
CoglBuffer _parent;
|
CoglBuffer _parent;
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ struct _CoglPixelArray
|
|||||||
};
|
};
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
_cogl_handle_pixel_array_get_type (void);
|
_cogl_handle_pixel_buffer_get_type (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __COGL_PIXEL_ARRAY_PRIVATE_H__ */
|
#endif /* __COGL_PIXEL_BUFFER_PRIVATE_H__ */
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* For an overview of the functionality implemented here, please see
|
/* 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.
|
* Pixel Buffers API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -43,8 +43,8 @@
|
|||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-object.h"
|
#include "cogl-object.h"
|
||||||
#include "cogl-pixel-array-private.h"
|
#include "cogl-pixel-buffer-private.h"
|
||||||
#include "cogl-pixel-array.h"
|
#include "cogl-pixel-buffer.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GL/GLES compatibility defines for the buffer API:
|
* GL/GLES compatibility defines for the buffer API:
|
||||||
@ -72,15 +72,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
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 *
|
static CoglPixelBuffer *
|
||||||
_cogl_pixel_array_new (unsigned int size)
|
_cogl_pixel_buffer_new (unsigned int size)
|
||||||
{
|
{
|
||||||
CoglPixelArray *pixel_array = g_slice_new0 (CoglPixelArray);
|
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
|
||||||
CoglBuffer *buffer = COGL_BUFFER (pixel_array);
|
CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
|
||||||
gboolean use_malloc;
|
gboolean use_malloc;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
||||||
@ -99,50 +99,50 @@ _cogl_pixel_array_new (unsigned int size)
|
|||||||
COGL_BUFFER_UPDATE_HINT_STATIC);
|
COGL_BUFFER_UPDATE_HINT_STATIC);
|
||||||
|
|
||||||
/* return COGL_INVALID_HANDLE; */
|
/* return COGL_INVALID_HANDLE; */
|
||||||
return _cogl_pixel_array_object_new (pixel_array);
|
return _cogl_pixel_buffer_object_new (pixel_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPixelArray *
|
CoglPixelBuffer *
|
||||||
cogl_pixel_array_new_with_size (unsigned int width,
|
cogl_pixel_buffer_new_with_size (unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
unsigned int *rowstride)
|
unsigned int *rowstride)
|
||||||
{
|
{
|
||||||
CoglPixelArray *buffer;
|
CoglPixelBuffer *buffer;
|
||||||
CoglPixelArray *pixel_array;
|
CoglPixelBuffer *pixel_buffer;
|
||||||
unsigned int stride;
|
unsigned int stride;
|
||||||
|
|
||||||
/* creating a buffer to store "any" format does not make sense */
|
/* creating a buffer to store "any" format does not make sense */
|
||||||
if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY))
|
if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY))
|
||||||
return COGL_INVALID_HANDLE;
|
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 */
|
* libdrm a tiled buffer for instance */
|
||||||
stride = width * _cogl_get_format_bpp (format);
|
stride = width * _cogl_get_format_bpp (format);
|
||||||
if (rowstride)
|
if (rowstride)
|
||||||
*rowstride = stride;
|
*rowstride = stride;
|
||||||
|
|
||||||
buffer = _cogl_pixel_array_new (height * stride);
|
buffer = _cogl_pixel_buffer_new (height * stride);
|
||||||
if (G_UNLIKELY (buffer == COGL_INVALID_HANDLE))
|
if (G_UNLIKELY (buffer == COGL_INVALID_HANDLE))
|
||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
pixel_array = COGL_PIXEL_ARRAY (buffer);
|
pixel_buffer = COGL_PIXEL_BUFFER (buffer);
|
||||||
pixel_array->width = width;
|
pixel_buffer->width = width;
|
||||||
pixel_array->height = height;
|
pixel_buffer->height = height;
|
||||||
pixel_array->format = format;
|
pixel_buffer->format = format;
|
||||||
pixel_array->stride = stride;
|
pixel_buffer->stride = stride;
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_pixel_array_free (CoglPixelArray *buffer)
|
_cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
/* parent's destructor */
|
/* parent's destructor */
|
||||||
_cogl_buffer_fini (COGL_BUFFER (buffer));
|
_cogl_buffer_fini (COGL_BUFFER (buffer));
|
||||||
|
|
||||||
g_slice_free (CoglPixelArray, buffer);
|
g_slice_free (CoglPixelBuffer, buffer);
|
||||||
}
|
}
|
||||||
|
|
@ -29,31 +29,31 @@
|
|||||||
#error "Only <cogl/cogl.h> can be included directly."
|
#error "Only <cogl/cogl.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __COGL_PIXEL_ARRAY_H__
|
#ifndef __COGL_PIXEL_BUFFER_H__
|
||||||
#define __COGL_PIXEL_ARRAY_H__
|
#define __COGL_PIXEL_BUFFER_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <cogl/cogl-types.h>
|
#include <cogl/cogl-types.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
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
|
* 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
|
* ABI changes it will hopefully be clearer to them what's going on if
|
||||||
* any of the symbols dissapear at a later date.
|
* any of the symbols dissapear at a later date.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define cogl_pixel_array_new cogl_pixel_array_new_EXP
|
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
|
||||||
#define cogl_pixel_array_new_with_size cogl_pixel_array_new_with_size_EXP
|
#define cogl_pixel_buffer_new_with_size cogl_pixel_buffer_new_with_size_EXP
|
||||||
#define cogl_is_pixel_array cogl_is_pixel_array_EXP
|
#define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP
|
||||||
#if 0
|
#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
|
#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
|
* @width: width of the pixel array in pixels
|
||||||
* @height: height of the pixel array in pixels
|
* @height: height of the pixel array in pixels
|
||||||
* @format: the format of the pixels the array will store
|
* @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
|
* 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>
|
* 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
|
* %NULL on failure
|
||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
CoglPixelArray *
|
CoglPixelBuffer *
|
||||||
cogl_pixel_array_new_with_size (unsigned int width,
|
cogl_pixel_buffer_new_with_size (unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
unsigned int *stride);
|
unsigned int *stride);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_pixel_array:
|
* cogl_is_pixel_buffer:
|
||||||
* @object: a #CoglObject to test
|
* @object: a #CoglObject to test
|
||||||
*
|
*
|
||||||
* Checks whether @handle is a pixel array.
|
* Checks whether @handle is a pixel array.
|
||||||
@ -93,11 +93,11 @@ cogl_pixel_array_new_with_size (unsigned int width,
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_is_pixel_array (void *object);
|
cogl_is_pixel_buffer (void *object);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* cogl_pixel_array_set_region:
|
* cogl_pixel_buffer_set_region:
|
||||||
* @array: the #CoglHandle of a pixel array
|
* @array: the #CoglHandle of a pixel array
|
||||||
* @data: pixel data to upload to @array
|
* @data: pixel data to upload to @array
|
||||||
* @src_width: width in pixels of the region to update
|
* @src_width: width in pixels of the region to update
|
||||||
@ -117,7 +117,7 @@ cogl_is_pixel_array (void *object);
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_pixel_array_set_region (CoglHandle array,
|
cogl_pixel_buffer_set_region (CoglHandle array,
|
||||||
guint8 *data,
|
guint8 *data,
|
||||||
unsigned int src_width,
|
unsigned int src_width,
|
||||||
unsigned int src_height,
|
unsigned int src_height,
|
||||||
@ -128,4 +128,4 @@ cogl_pixel_array_set_region (CoglHandle array,
|
|||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __COGL_PIXEL_ARRAY_H__ */
|
#endif /* __COGL_PIXEL_BUFFER_H__ */
|
@ -37,7 +37,7 @@
|
|||||||
#include "cogl-bitmap.h"
|
#include "cogl-bitmap.h"
|
||||||
#include "cogl-bitmap-private.h"
|
#include "cogl-bitmap-private.h"
|
||||||
#include "cogl-buffer-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-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-texture-driver.h"
|
#include "cogl-texture-driver.h"
|
||||||
@ -574,7 +574,7 @@ cogl_texture_new_from_buffer_EXP (CoglHandle buffer,
|
|||||||
{
|
{
|
||||||
CoglHandle texture;
|
CoglHandle texture;
|
||||||
CoglBuffer *cogl_buffer;
|
CoglBuffer *cogl_buffer;
|
||||||
CoglPixelArray *pixel_array;
|
CoglPixelBuffer *pixel_buffer;
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
|
|
||||||
g_return_val_if_fail (cogl_is_buffer (buffer), COGL_INVALID_HANDLE);
|
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;
|
return COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
cogl_buffer = COGL_BUFFER (buffer);
|
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 */
|
/* Rowstride from CoglBuffer or even width * bpp if not given */
|
||||||
if (rowstride == 0)
|
if (rowstride == 0)
|
||||||
rowstride = pixel_array->stride;
|
rowstride = pixel_buffer->stride;
|
||||||
if (rowstride == 0)
|
if (rowstride == 0)
|
||||||
rowstride = width * _cogl_get_format_bpp (format);
|
rowstride = width * _cogl_get_format_bpp (format);
|
||||||
|
|
||||||
/* use the CoglBuffer height and width as last resort */
|
/* use the CoglBuffer height and width as last resort */
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
width = pixel_array->width;
|
width = pixel_buffer->width;
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
height = pixel_array->height;
|
height = pixel_buffer->height;
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
{
|
{
|
||||||
/* no width or height specified, neither at creation time (because the
|
/* 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 */
|
* function */
|
||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ typedef struct _CoglFramebuffer CoglFramebuffer;
|
|||||||
#include <cogl/cogl-display.h>
|
#include <cogl/cogl-display.h>
|
||||||
#include <cogl/cogl-context.h>
|
#include <cogl/cogl-context.h>
|
||||||
#include <cogl/cogl-buffer.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-vector.h>
|
||||||
#include <cogl/cogl-euler.h>
|
#include <cogl/cogl-euler.h>
|
||||||
#include <cogl/cogl-quaternion.h>
|
#include <cogl/cogl-quaternion.h>
|
||||||
|
@ -74,7 +74,7 @@ IGNORE_HFILES=\
|
|||||||
cogl-pipeline-progend-glsl-private.h \
|
cogl-pipeline-progend-glsl-private.h \
|
||||||
cogl-pipeline-vertend-fixed-private.h \
|
cogl-pipeline-vertend-fixed-private.h \
|
||||||
cogl-pipeline-vertend-glsl-private.h \
|
cogl-pipeline-vertend-glsl-private.h \
|
||||||
cogl-pixel-array-private.h \
|
cogl-pixel-buffer-private.h \
|
||||||
cogl-primitive-private.h \
|
cogl-primitive-private.h \
|
||||||
cogl-primitives-private.h \
|
cogl-primitives-private.h \
|
||||||
cogl-private.h \
|
cogl-private.h \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user