pixel-buffer: Replace CoglHandle with CoglPixelBuffer *

One more file converted to stop using CoglHandle re:a8c8cbee513
This commit is contained in:
Robert Bragg 2010-07-03 20:24:36 +01:00
parent baacf2e707
commit 90931e261f
4 changed files with 28 additions and 25 deletions

View File

@ -29,7 +29,8 @@
#include <glib.h> #include <glib.h>
#include "cogl-handle.h" #include "cogl.h"
#include "cogl-object.h"
#include "cogl-buffer.h" #include "cogl-buffer.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -69,7 +70,7 @@ typedef enum _CoglBufferFlags
struct _CoglBuffer struct _CoglBuffer
{ {
CoglHandleObject _parent; CoglObject _parent;
const CoglBufferVtable *vtable; const CoglBufferVtable *vtable;
CoglBufferFlags flags; CoglBufferFlags flags;

View File

@ -51,7 +51,7 @@ typedef enum _CoglPixelBufferFlags
COGL_PIXEL_BUFFER_FLAG_STORE_CREATED = 1 << 0, COGL_PIXEL_BUFFER_FLAG_STORE_CREATED = 1 << 0,
} CoglPixelBufferFlags; } CoglPixelBufferFlags;
typedef struct _CoglPixelBuffer struct _CoglPixelBuffer
{ {
CoglBuffer _parent; CoglBuffer _parent;
@ -63,7 +63,7 @@ typedef struct _CoglPixelBuffer
unsigned int height; unsigned int height;
unsigned int stride; unsigned int stride;
} CoglPixelBuffer; };
GQuark GQuark
_cogl_handle_pixel_buffer_get_type (void); _cogl_handle_pixel_buffer_get_type (void);

View File

@ -41,7 +41,7 @@
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-util.h" #include "cogl-util.h"
#include "cogl-context.h" #include "cogl-context.h"
#include "cogl-handle.h" #include "cogl-object.h"
#include "cogl-pixel-buffer-private.h" #include "cogl-pixel-buffer-private.h"
#include "cogl-pixel-buffer.h" #include "cogl-pixel-buffer.h"
@ -84,9 +84,9 @@ cogl_pixel_buffer_vtable;
static const CoglBufferVtable static const CoglBufferVtable
cogl_malloc_pixel_buffer_vtable; cogl_malloc_pixel_buffer_vtable;
COGL_HANDLE_DEFINE (PixelBuffer, pixel_buffer) COGL_OBJECT_DEFINE (PixelBuffer, pixel_buffer)
CoglHandle CoglPixelBuffer *
cogl_pixel_buffer_new (unsigned int size) cogl_pixel_buffer_new (unsigned int size)
{ {
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer); CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
@ -124,16 +124,16 @@ cogl_pixel_buffer_new (unsigned int size)
pixel_buffer->flags = COGL_PIXEL_BUFFER_FLAG_NONE; pixel_buffer->flags = COGL_PIXEL_BUFFER_FLAG_NONE;
/* return COGL_INVALID_HANDLE; */ /* return COGL_INVALID_HANDLE; */
return _cogl_pixel_buffer_handle_new (pixel_buffer); return _cogl_pixel_buffer_object_new (pixel_buffer);
} }
CoglHandle CoglPixelBuffer *
cogl_pixel_buffer_new_for_size (unsigned int width, cogl_pixel_buffer_new_for_size (unsigned int width,
unsigned int height, unsigned int height,
CoglPixelFormat format, CoglPixelFormat format,
unsigned int *rowstride) unsigned int *rowstride)
{ {
CoglHandle buffer; CoglPixelBuffer *buffer;
CoglPixelBuffer *pixel_buffer; CoglPixelBuffer *pixel_buffer;
unsigned int stride; unsigned int stride;
@ -264,13 +264,13 @@ _cogl_pixel_buffer_set_data (CoglBuffer *buffer,
#if 0 #if 0
gboolean gboolean
cogl_pixel_buffer_set_region (CoglHandle buffer, cogl_pixel_buffer_set_region (CoglPixelBuffer *buffer,
guint8 *data, guint8 *data,
unsigned int src_width, unsigned int src_width,
unsigned int src_height, unsigned int src_height,
unsigned int src_rowstride, unsigned int src_rowstride,
unsigned int dst_x, unsigned int dst_x,
unsigned int dst_y) unsigned int dst_y)
{ {
if (!cogl_is_pixel_buffer (buffer)) if (!cogl_is_pixel_buffer (buffer))
return FALSE; return FALSE;

View File

@ -49,6 +49,8 @@ G_BEGIN_DECLS
#define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP #define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP
#endif #endif
typedef struct _CoglPixelBuffer CoglPixelBuffer;
/** /**
* cogl_pixel_buffer_new: * cogl_pixel_buffer_new:
* @size: size of the buffer in bytes * @size: size of the buffer in bytes
@ -56,13 +58,13 @@ G_BEGIN_DECLS
* Creates a new buffer to store pixel data. You can create a new texture from * Creates a new buffer to store pixel data. You can create a new texture from
* this buffer using cogl_texture_new_from_buffer(). * this buffer using cogl_texture_new_from_buffer().
* *
* Return value: a #CoglHandle representing the newly created buffer or * Return value: a #CoglPixelBuffer representing the newly created buffer or
* %COGL_INVALID_HANDLE on failure * %NULL on failure
* *
* Since: 1.2 * Since: 1.2
* Stability: Unstable * Stability: Unstable
*/ */
CoglHandle CoglPixelBuffer *
cogl_pixel_buffer_new (unsigned int size); cogl_pixel_buffer_new (unsigned int size);
/** /**
@ -81,13 +83,13 @@ cogl_pixel_buffer_new (unsigned int size);
* buffers are likely to have a stride larger than width * bytes_per_pixel. The * buffers 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 #CoglHandle representing the newly created buffer or * Return value: a #CoglPixelBuffer representing the newly created buffer or
* %COGL_INVALID_HANDLE on failure * %NULL on failure
* *
* Since: 1.2 * Since: 1.2
* Stability: Unstable * Stability: Unstable
*/ */
CoglHandle CoglPixelBuffer *
cogl_pixel_buffer_new_for_size (unsigned int width, cogl_pixel_buffer_new_for_size (unsigned int width,
unsigned int height, unsigned int height,
CoglPixelFormat format, CoglPixelFormat format,
@ -95,7 +97,7 @@ cogl_pixel_buffer_new_for_size (unsigned int width,
/** /**
* cogl_is_pixel_buffer: * cogl_is_pixel_buffer:
* @handle: a #CoglHandle to test * @object: a #CoglObject to test
* *
* Checks whether @handle is a pixel buffer. * Checks whether @handle is a pixel buffer.
* *
@ -106,7 +108,7 @@ cogl_pixel_buffer_new_for_size (unsigned int width,
* Stability: Unstable * Stability: Unstable
*/ */
gboolean gboolean
cogl_is_pixel_buffer (CoglHandle handle); cogl_is_pixel_buffer (void *object);
#if 0 #if 0
/* /*