mirror of
https://github.com/brl/mutter.git
synced 2025-05-05 14:44:56 +00:00
Removes all remaining use of CoglHandle
Removing CoglHandle has been an on going goal for quite a long time now and finally this patch removes the last remaining uses of the CoglHandle type and the cogl_handle_ apis. Since the big remaining users of CoglHandle were the cogl_program_ and cogl_shader_ apis which have replaced with the CoglSnippets api this patch removes both of these apis. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 6ed3aaf4be21d605a1ed3176b3ea825933f85cf0) Since the original patch was done after removing deprecated API this back ported patch doesn't affect deprecated API and so actually this cherry-pick doesn't remove all remaining use of CoglHandle as it did for the master branch of Cogl.
This commit is contained in:
parent
097d282b32
commit
09642a83b5
@ -173,7 +173,7 @@ cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_pango_glyph_cache_update_position_cb (void *user_data,
|
cogl_pango_glyph_cache_update_position_cb (void *user_data,
|
||||||
CoglHandle new_texture,
|
CoglTexture *new_texture,
|
||||||
const CoglRectangleMapEntry *rect)
|
const CoglRectangleMapEntry *rect)
|
||||||
{
|
{
|
||||||
CoglPangoGlyphCacheValue *value = user_data;
|
CoglPangoGlyphCacheValue *value = user_data;
|
||||||
@ -204,7 +204,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
|
|||||||
PangoGlyph glyph,
|
PangoGlyph glyph,
|
||||||
CoglPangoGlyphCacheValue *value)
|
CoglPangoGlyphCacheValue *value)
|
||||||
{
|
{
|
||||||
CoglTexture *texture;
|
CoglAtlasTexture *texture;
|
||||||
|
|
||||||
if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS))
|
if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -222,7 +222,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
|
|||||||
if (texture == NULL)
|
if (texture == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
value->texture = texture;
|
value->texture = COGL_TEXTURE (texture);
|
||||||
value->tx1 = 0;
|
value->tx1 = 0;
|
||||||
value->ty1 = 0;
|
value->ty1 = 0;
|
||||||
value->tx2 = 1;
|
value->tx2 = 1;
|
||||||
|
@ -54,7 +54,7 @@ struct _CoglPangoPipelineCacheEntry
|
|||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
|
|
||||||
/* This will only take a weak reference */
|
/* This will only take a weak reference */
|
||||||
CoglHandle pipeline;
|
CoglPipeline *pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -173,7 +173,7 @@ pipeline_destroy_notify_cb (void *user_data)
|
|||||||
|
|
||||||
CoglPipeline *
|
CoglPipeline *
|
||||||
_cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
|
_cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
|
||||||
CoglHandle texture)
|
CoglTexture *texture)
|
||||||
{
|
{
|
||||||
CoglPangoPipelineCacheEntry *entry;
|
CoglPangoPipelineCacheEntry *entry;
|
||||||
PipelineDestroyNotifyData *destroy_data;
|
PipelineDestroyNotifyData *destroy_data;
|
||||||
@ -216,7 +216,7 @@ _cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
|
|||||||
destroy_data = g_slice_new (PipelineDestroyNotifyData);
|
destroy_data = g_slice_new (PipelineDestroyNotifyData);
|
||||||
destroy_data->cache = cache;
|
destroy_data->cache = cache;
|
||||||
destroy_data->texture = texture;
|
destroy_data->texture = texture;
|
||||||
cogl_object_set_user_data (entry->pipeline,
|
cogl_object_set_user_data (COGL_OBJECT (entry->pipeline),
|
||||||
&pipeline_destroy_notify_key,
|
&pipeline_destroy_notify_key,
|
||||||
destroy_data,
|
destroy_data,
|
||||||
pipeline_destroy_notify_cb);
|
pipeline_destroy_notify_cb);
|
||||||
|
@ -43,7 +43,7 @@ _cogl_pango_pipeline_cache_new (gboolean use_mipmapping);
|
|||||||
to unref it */
|
to unref it */
|
||||||
CoglPipeline *
|
CoglPipeline *
|
||||||
_cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
|
_cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache,
|
||||||
CoglHandle texture);
|
CoglTexture *texture);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pango_pipeline_cache_free (CoglPangoPipelineCache *cache);
|
_cogl_pango_pipeline_cache_free (CoglPangoPipelineCache *cache);
|
||||||
|
@ -183,7 +183,6 @@ cogl_sources_c = \
|
|||||||
$(srcdir)/cogl-debug-options.h \
|
$(srcdir)/cogl-debug-options.h \
|
||||||
$(srcdir)/cogl-gpu-info.c \
|
$(srcdir)/cogl-gpu-info.c \
|
||||||
$(srcdir)/cogl-gpu-info-private.h \
|
$(srcdir)/cogl-gpu-info-private.h \
|
||||||
$(srcdir)/cogl-handle.h \
|
|
||||||
$(srcdir)/cogl-context-private.h \
|
$(srcdir)/cogl-context-private.h \
|
||||||
$(srcdir)/cogl-context.c \
|
$(srcdir)/cogl-context.c \
|
||||||
$(srcdir)/cogl-renderer-private.h \
|
$(srcdir)/cogl-renderer-private.h \
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef __COGL_ATLAS_TEXTURE_H
|
#ifndef __COGL_ATLAS_TEXTURE_H
|
||||||
#define __COGL_ATLAS_TEXTURE_H
|
#define __COGL_ATLAS_TEXTURE_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-rectangle-map.h"
|
#include "cogl-rectangle-map.h"
|
||||||
#include "cogl-atlas.h"
|
#include "cogl-atlas.h"
|
||||||
@ -51,16 +51,18 @@ struct _CoglAtlasTexture
|
|||||||
atlas by the texture (but not vice versa so there is no cycle) */
|
atlas by the texture (but not vice versa so there is no cycle) */
|
||||||
CoglAtlas *atlas;
|
CoglAtlas *atlas;
|
||||||
|
|
||||||
/* A CoglSubTexture representing the region for easy rendering */
|
/* Either a CoglSubTexture representing the atlas region for easy
|
||||||
CoglHandle sub_texture;
|
* rendering or if the texture has been migrated out of the atlas it
|
||||||
|
* may be some other texture type such as CoglTexture2D */
|
||||||
|
CoglTexture *sub_texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglHandle
|
CoglAtlasTexture *
|
||||||
_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format);
|
CoglPixelFormat internal_format);
|
||||||
|
|
||||||
CoglHandle
|
CoglAtlasTexture *
|
||||||
_cogl_atlas_texture_new_with_size (unsigned int width,
|
_cogl_atlas_texture_new_with_size (unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "cogl-texture-2d-private.h"
|
#include "cogl-texture-2d-private.h"
|
||||||
#include "cogl-sub-texture-private.h"
|
#include "cogl-sub-texture-private.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-texture-driver.h"
|
#include "cogl-texture-driver.h"
|
||||||
#include "cogl-rectangle-map.h"
|
#include "cogl-rectangle-map.h"
|
||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
@ -53,8 +53,8 @@ COGL_TEXTURE_INTERNAL_DEFINE (AtlasTexture, atlas_texture);
|
|||||||
|
|
||||||
static const CoglTextureVtable cogl_atlas_texture_vtable;
|
static const CoglTextureVtable cogl_atlas_texture_vtable;
|
||||||
|
|
||||||
static CoglHandle
|
static CoglSubTexture *
|
||||||
_cogl_atlas_texture_create_sub_texture (CoglHandle full_texture,
|
_cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture,
|
||||||
const CoglRectangleMapEntry *rectangle)
|
const CoglRectangleMapEntry *rectangle)
|
||||||
{
|
{
|
||||||
/* Create a subtexture for the given rectangle not including the
|
/* Create a subtexture for the given rectangle not including the
|
||||||
@ -70,16 +70,16 @@ _cogl_atlas_texture_create_sub_texture (CoglHandle full_texture,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_atlas_texture_update_position_cb (gpointer user_data,
|
_cogl_atlas_texture_update_position_cb (gpointer user_data,
|
||||||
CoglHandle new_texture,
|
CoglTexture *new_texture,
|
||||||
const CoglRectangleMapEntry *rectangle)
|
const CoglRectangleMapEntry *rectangle)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = user_data;
|
CoglAtlasTexture *atlas_tex = user_data;
|
||||||
|
|
||||||
/* Update the sub texture */
|
/* Update the sub texture */
|
||||||
if (atlas_tex->sub_texture)
|
if (atlas_tex->sub_texture)
|
||||||
cogl_handle_unref (atlas_tex->sub_texture);
|
cogl_object_unref (atlas_tex->sub_texture);
|
||||||
atlas_tex->sub_texture =
|
atlas_tex->sub_texture = COGL_TEXTURE (
|
||||||
_cogl_atlas_texture_create_sub_texture (new_texture, rectangle);
|
_cogl_atlas_texture_create_sub_texture (new_texture, rectangle));
|
||||||
|
|
||||||
/* Update the position */
|
/* Update the position */
|
||||||
atlas_tex->rectangle = *rectangle;
|
atlas_tex->rectangle = *rectangle;
|
||||||
@ -95,7 +95,7 @@ _cogl_atlas_texture_pre_reorganize_foreach_cb
|
|||||||
|
|
||||||
/* Keep a reference to the texture because we don't want it to be
|
/* Keep a reference to the texture because we don't want it to be
|
||||||
destroyed during the reorganization */
|
destroyed during the reorganization */
|
||||||
cogl_handle_ref (atlas_tex);
|
cogl_object_ref (atlas_tex);
|
||||||
|
|
||||||
/* Notify cogl-pipeline.c that the texture's underlying GL texture
|
/* Notify cogl-pipeline.c that the texture's underlying GL texture
|
||||||
* storage is changing so it knows it may need to bind a new texture
|
* storage is changing so it knows it may need to bind a new texture
|
||||||
@ -197,7 +197,7 @@ _cogl_atlas_texture_create_atlas (void)
|
|||||||
|
|
||||||
CoglAtlas *atlas;
|
CoglAtlas *atlas;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
atlas = _cogl_atlas_new (COGL_PIXEL_FORMAT_RGBA_8888,
|
atlas = _cogl_atlas_new (COGL_PIXEL_FORMAT_RGBA_8888,
|
||||||
0,
|
0,
|
||||||
@ -232,9 +232,10 @@ _cogl_atlas_texture_foreach_sub_texture_in_region (
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
||||||
|
CoglMetaTexture *meta_texture = COGL_META_TEXTURE (atlas_tex->sub_texture);
|
||||||
|
|
||||||
/* Forward on to the sub texture */
|
/* Forward on to the sub texture */
|
||||||
cogl_meta_texture_foreach_in_region (atlas_tex->sub_texture,
|
cogl_meta_texture_foreach_in_region (meta_texture,
|
||||||
virtual_tx_1,
|
virtual_tx_1,
|
||||||
virtual_ty_1,
|
virtual_ty_1,
|
||||||
virtual_tx_2,
|
virtual_tx_2,
|
||||||
@ -278,7 +279,7 @@ _cogl_atlas_texture_free (CoglAtlasTexture *atlas_tex)
|
|||||||
{
|
{
|
||||||
_cogl_atlas_texture_remove_from_atlas (atlas_tex);
|
_cogl_atlas_texture_remove_from_atlas (atlas_tex);
|
||||||
|
|
||||||
cogl_handle_unref (atlas_tex->sub_texture);
|
cogl_object_unref (atlas_tex->sub_texture);
|
||||||
|
|
||||||
/* Chain up */
|
/* Chain up */
|
||||||
_cogl_texture_free (COGL_TEXTURE (atlas_tex));
|
_cogl_texture_free (COGL_TEXTURE (atlas_tex));
|
||||||
@ -363,7 +364,7 @@ _cogl_atlas_texture_migrate_out_of_atlas (CoglAtlasTexture *atlas_tex)
|
|||||||
/* Make sure this texture is not in the atlas */
|
/* Make sure this texture is not in the atlas */
|
||||||
if (atlas_tex->atlas)
|
if (atlas_tex->atlas)
|
||||||
{
|
{
|
||||||
CoglHandle sub_texture;
|
CoglTexture *standalone_tex;
|
||||||
|
|
||||||
COGL_NOTE (ATLAS, "Migrating texture out of the atlas");
|
COGL_NOTE (ATLAS, "Migrating texture out of the atlas");
|
||||||
|
|
||||||
@ -377,7 +378,7 @@ _cogl_atlas_texture_migrate_out_of_atlas (CoglAtlasTexture *atlas_tex)
|
|||||||
*/
|
*/
|
||||||
cogl_flush ();
|
cogl_flush ();
|
||||||
|
|
||||||
sub_texture =
|
standalone_tex =
|
||||||
_cogl_atlas_copy_rectangle (atlas_tex->atlas,
|
_cogl_atlas_copy_rectangle (atlas_tex->atlas,
|
||||||
atlas_tex->rectangle.x + 1,
|
atlas_tex->rectangle.x + 1,
|
||||||
atlas_tex->rectangle.y + 1,
|
atlas_tex->rectangle.y + 1,
|
||||||
@ -395,8 +396,8 @@ _cogl_atlas_texture_migrate_out_of_atlas (CoglAtlasTexture *atlas_tex)
|
|||||||
the copy can involve rendering which might cause the texture
|
the copy can involve rendering which might cause the texture
|
||||||
to be used if it is used from a layer that is left in a
|
to be used if it is used from a layer that is left in a
|
||||||
texture unit */
|
texture unit */
|
||||||
cogl_handle_unref (atlas_tex->sub_texture);
|
cogl_object_unref (atlas_tex->sub_texture);
|
||||||
atlas_tex->sub_texture = sub_texture;
|
atlas_tex->sub_texture = standalone_tex;
|
||||||
|
|
||||||
_cogl_atlas_texture_remove_from_atlas (atlas_tex);
|
_cogl_atlas_texture_remove_from_atlas (atlas_tex);
|
||||||
}
|
}
|
||||||
@ -632,7 +633,7 @@ _cogl_atlas_texture_can_use_format (CoglPixelFormat format)
|
|||||||
format == COGL_PIXEL_FORMAT_RGBA_8888);
|
format == COGL_PIXEL_FORMAT_RGBA_8888);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglAtlasTexture *
|
||||||
_cogl_atlas_texture_new_with_size (unsigned int width,
|
_cogl_atlas_texture_new_with_size (unsigned int width,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
@ -642,28 +643,28 @@ _cogl_atlas_texture_new_with_size (unsigned int width,
|
|||||||
CoglAtlas *atlas;
|
CoglAtlas *atlas;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
/* Don't put textures in the atlas if the user has explicitly
|
/* Don't put textures in the atlas if the user has explicitly
|
||||||
requested to disable it */
|
requested to disable it */
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS)))
|
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS)))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* We can't put the texture in the atlas if there are any special
|
/* We can't put the texture in the atlas if there are any special
|
||||||
flags. This precludes textures with COGL_TEXTURE_NO_ATLAS and
|
flags. This precludes textures with COGL_TEXTURE_NO_ATLAS and
|
||||||
COGL_TEXTURE_NO_SLICING from being atlased */
|
COGL_TEXTURE_NO_SLICING from being atlased */
|
||||||
if (flags)
|
if (flags)
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* We can't atlas zero-sized textures because it breaks the atlas
|
/* We can't atlas zero-sized textures because it breaks the atlas
|
||||||
data structure */
|
data structure */
|
||||||
if (width < 1 || height < 1)
|
if (width < 1 || height < 1)
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* If we can't use FBOs then it will be too slow to migrate textures
|
/* If we can't use FBOs then it will be too slow to migrate textures
|
||||||
and we shouldn't use the atlas */
|
and we shouldn't use the atlas */
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
|
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
COGL_NOTE (ATLAS, "Adding texture of size %ix%i", width, height);
|
COGL_NOTE (ATLAS, "Adding texture of size %ix%i", width, height);
|
||||||
|
|
||||||
@ -673,7 +674,7 @@ _cogl_atlas_texture_new_with_size (unsigned int width,
|
|||||||
COGL_NOTE (ATLAS, "Texture can not be added because the "
|
COGL_NOTE (ATLAS, "Texture can not be added because the "
|
||||||
"format is unsupported");
|
"format is unsupported");
|
||||||
|
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to allocate the texture now because we need the pointer
|
/* We need to allocate the texture now because we need the pointer
|
||||||
@ -686,7 +687,7 @@ _cogl_atlas_texture_new_with_size (unsigned int width,
|
|||||||
_cogl_texture_init (COGL_TEXTURE (atlas_tex),
|
_cogl_texture_init (COGL_TEXTURE (atlas_tex),
|
||||||
&cogl_atlas_texture_vtable);
|
&cogl_atlas_texture_vtable);
|
||||||
|
|
||||||
atlas_tex->sub_texture = COGL_INVALID_HANDLE;
|
atlas_tex->sub_texture = NULL;
|
||||||
|
|
||||||
/* Look for an existing atlas that can hold the texture */
|
/* Look for an existing atlas that can hold the texture */
|
||||||
for (l = ctx->atlases; l; l = l->next)
|
for (l = ctx->atlases; l; l = l->next)
|
||||||
@ -713,29 +714,28 @@ _cogl_atlas_texture_new_with_size (unsigned int width,
|
|||||||
/* Ok, this means we really can't add it to the atlas */
|
/* Ok, this means we really can't add it to the atlas */
|
||||||
cogl_object_unref (atlas);
|
cogl_object_unref (atlas);
|
||||||
g_free (atlas_tex);
|
g_free (atlas_tex);
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
atlas_tex->format = internal_format;
|
atlas_tex->format = internal_format;
|
||||||
atlas_tex->atlas = atlas;
|
atlas_tex->atlas = atlas;
|
||||||
|
|
||||||
return _cogl_atlas_texture_handle_new (atlas_tex);
|
return _cogl_atlas_texture_object_new (atlas_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglAtlasTexture *
|
||||||
_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
{
|
{
|
||||||
CoglHandle atlas_tex_handle;
|
|
||||||
CoglAtlasTexture *atlas_tex;
|
CoglAtlasTexture *atlas_tex;
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
int bmp_width;
|
int bmp_width;
|
||||||
int bmp_height;
|
int bmp_height;
|
||||||
CoglPixelFormat bmp_format;
|
CoglPixelFormat bmp_format;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
|
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
|
||||||
|
|
||||||
bmp_width = cogl_bitmap_get_width (bmp);
|
bmp_width = cogl_bitmap_get_width (bmp);
|
||||||
bmp_height = cogl_bitmap_get_height (bmp);
|
bmp_height = cogl_bitmap_get_height (bmp);
|
||||||
@ -744,21 +744,19 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
internal_format = _cogl_texture_determine_internal_format (bmp_format,
|
internal_format = _cogl_texture_determine_internal_format (bmp_format,
|
||||||
internal_format);
|
internal_format);
|
||||||
|
|
||||||
atlas_tex_handle = _cogl_atlas_texture_new_with_size (bmp_width, bmp_height,
|
atlas_tex = _cogl_atlas_texture_new_with_size (bmp_width, bmp_height,
|
||||||
flags, internal_format);
|
flags, internal_format);
|
||||||
|
|
||||||
if (atlas_tex_handle == COGL_INVALID_HANDLE)
|
if (atlas_tex == NULL)
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
atlas_tex = atlas_tex_handle;
|
|
||||||
|
|
||||||
dst_bmp = _cogl_atlas_texture_prepare_for_upload (atlas_tex,
|
dst_bmp = _cogl_atlas_texture_prepare_for_upload (atlas_tex,
|
||||||
bmp);
|
bmp);
|
||||||
|
|
||||||
if (dst_bmp == NULL)
|
if (dst_bmp == NULL)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (atlas_tex_handle);
|
cogl_object_unref (atlas_tex);
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Defer to set_region so that we can share the code for copying the
|
/* Defer to set_region so that we can share the code for copying the
|
||||||
@ -774,7 +772,7 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
cogl_object_unref (dst_bmp);
|
cogl_object_unref (dst_bmp);
|
||||||
|
|
||||||
return atlas_tex_handle;
|
return atlas_tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -70,7 +70,7 @@ _cogl_atlas_free (CoglAtlas *atlas)
|
|||||||
COGL_NOTE (ATLAS, "%p: Atlas destroyed", atlas);
|
COGL_NOTE (ATLAS, "%p: Atlas destroyed", atlas);
|
||||||
|
|
||||||
if (atlas->texture)
|
if (atlas->texture)
|
||||||
cogl_handle_unref (atlas->texture);
|
cogl_object_unref (atlas->texture);
|
||||||
if (atlas->map)
|
if (atlas->map)
|
||||||
_cogl_rectangle_map_free (atlas->map);
|
_cogl_rectangle_map_free (atlas->map);
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ static void
|
|||||||
_cogl_atlas_migrate (CoglAtlas *atlas,
|
_cogl_atlas_migrate (CoglAtlas *atlas,
|
||||||
unsigned int n_textures,
|
unsigned int n_textures,
|
||||||
CoglAtlasRepositionData *textures,
|
CoglAtlasRepositionData *textures,
|
||||||
CoglHandle old_texture,
|
CoglTexture *old_texture,
|
||||||
CoglHandle new_texture,
|
CoglTexture *new_texture,
|
||||||
void *skip_user_data)
|
void *skip_user_data)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -269,14 +269,14 @@ _cogl_atlas_create_map (CoglPixelFormat format,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglTexture2D *
|
||||||
_cogl_atlas_create_texture (CoglAtlas *atlas,
|
_cogl_atlas_create_texture (CoglAtlas *atlas,
|
||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
CoglHandle tex;
|
CoglTexture2D *tex;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
if ((atlas->flags & COGL_ATLAS_CLEAR_TEXTURE))
|
if ((atlas->flags & COGL_ATLAS_CLEAR_TEXTURE))
|
||||||
{
|
{
|
||||||
@ -345,7 +345,7 @@ _cogl_atlas_reserve_space (CoglAtlas *atlas,
|
|||||||
{
|
{
|
||||||
CoglAtlasGetRectanglesData data;
|
CoglAtlasGetRectanglesData data;
|
||||||
CoglRectangleMap *new_map;
|
CoglRectangleMap *new_map;
|
||||||
CoglHandle new_tex;
|
CoglTexture2D *new_tex;
|
||||||
unsigned int map_width, map_height;
|
unsigned int map_width, map_height;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
CoglRectangleMapEntry new_position;
|
CoglRectangleMapEntry new_position;
|
||||||
@ -442,7 +442,7 @@ _cogl_atlas_reserve_space (CoglAtlas *atlas,
|
|||||||
else if ((new_tex = _cogl_atlas_create_texture
|
else if ((new_tex = _cogl_atlas_create_texture
|
||||||
(atlas,
|
(atlas,
|
||||||
_cogl_rectangle_map_get_width (new_map),
|
_cogl_rectangle_map_get_width (new_map),
|
||||||
_cogl_rectangle_map_get_height (new_map))) == COGL_INVALID_HANDLE)
|
_cogl_rectangle_map_get_height (new_map))) == NULL)
|
||||||
{
|
{
|
||||||
COGL_NOTE (ATLAS, "%p: Could not create a CoglTexture2D", atlas);
|
COGL_NOTE (ATLAS, "%p: Could not create a CoglTexture2D", atlas);
|
||||||
_cogl_rectangle_map_free (new_map);
|
_cogl_rectangle_map_free (new_map);
|
||||||
@ -472,20 +472,20 @@ _cogl_atlas_reserve_space (CoglAtlas *atlas,
|
|||||||
data.n_textures,
|
data.n_textures,
|
||||||
data.textures,
|
data.textures,
|
||||||
atlas->texture,
|
atlas->texture,
|
||||||
new_tex,
|
COGL_TEXTURE (new_tex),
|
||||||
user_data);
|
user_data);
|
||||||
_cogl_rectangle_map_free (atlas->map);
|
_cogl_rectangle_map_free (atlas->map);
|
||||||
cogl_handle_unref (atlas->texture);
|
cogl_object_unref (atlas->texture);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* We know there's only one texture so we can just directly
|
/* We know there's only one texture so we can just directly
|
||||||
update the rectangle from its new position */
|
update the rectangle from its new position */
|
||||||
atlas->update_position_cb (data.textures[0].user_data,
|
atlas->update_position_cb (data.textures[0].user_data,
|
||||||
new_tex,
|
COGL_TEXTURE (new_tex),
|
||||||
&data.textures[0].new_position);
|
&data.textures[0].new_position);
|
||||||
|
|
||||||
atlas->map = new_map;
|
atlas->map = new_map;
|
||||||
atlas->texture = new_tex;
|
atlas->texture = COGL_TEXTURE (new_tex);
|
||||||
|
|
||||||
waste = (_cogl_rectangle_map_get_remaining_space (atlas->map) *
|
waste = (_cogl_rectangle_map_get_remaining_space (atlas->map) *
|
||||||
100 / (_cogl_rectangle_map_get_width (atlas->map) *
|
100 / (_cogl_rectangle_map_get_width (atlas->map) *
|
||||||
@ -528,7 +528,7 @@ _cogl_atlas_remove (CoglAtlas *atlas,
|
|||||||
_cogl_rectangle_map_get_height (atlas->map)));
|
_cogl_rectangle_map_get_height (atlas->map)));
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglHandle
|
CoglTexture *
|
||||||
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
||||||
unsigned int x,
|
unsigned int x,
|
||||||
unsigned int y,
|
unsigned int y,
|
||||||
@ -537,7 +537,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
|||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat format)
|
CoglPixelFormat format)
|
||||||
{
|
{
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
CoglBlitData blit_data;
|
CoglBlitData blit_data;
|
||||||
|
|
||||||
/* Create a new texture at the right size */
|
/* Create a new texture at the right size */
|
||||||
|
@ -26,10 +26,11 @@
|
|||||||
|
|
||||||
#include "cogl-rectangle-map.h"
|
#include "cogl-rectangle-map.h"
|
||||||
#include "cogl-object-private.h"
|
#include "cogl-object-private.h"
|
||||||
|
#include "cogl-texture.h"
|
||||||
|
|
||||||
typedef void
|
typedef void
|
||||||
(* CoglAtlasUpdatePositionCallback) (void *user_data,
|
(* CoglAtlasUpdatePositionCallback) (void *user_data,
|
||||||
CoglHandle new_texture,
|
CoglTexture *new_texture,
|
||||||
const CoglRectangleMapEntry *rect);
|
const CoglRectangleMapEntry *rect);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -48,7 +49,7 @@ struct _CoglAtlas
|
|||||||
|
|
||||||
CoglRectangleMap *map;
|
CoglRectangleMap *map;
|
||||||
|
|
||||||
CoglHandle texture;
|
CoglTexture *texture;
|
||||||
CoglPixelFormat texture_format;
|
CoglPixelFormat texture_format;
|
||||||
CoglAtlasFlags flags;
|
CoglAtlasFlags flags;
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ void
|
|||||||
_cogl_atlas_remove (CoglAtlas *atlas,
|
_cogl_atlas_remove (CoglAtlas *atlas,
|
||||||
const CoglRectangleMapEntry *rectangle);
|
const CoglRectangleMapEntry *rectangle);
|
||||||
|
|
||||||
CoglHandle
|
CoglTexture *
|
||||||
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
_cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
||||||
unsigned int x,
|
unsigned int x,
|
||||||
unsigned int y,
|
unsigned int y,
|
||||||
|
@ -77,7 +77,7 @@ cogl_attribute_buffer_new (CoglContext *context,
|
|||||||
*
|
*
|
||||||
* Gets whether the given object references a #CoglAttributeBuffer.
|
* Gets whether the given object references a #CoglAttributeBuffer.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the handle references a #CoglAttributeBuffer,
|
* Returns: %TRUE if @object references a #CoglAttributeBuffer,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
|
@ -210,7 +210,7 @@ cogl_attribute_set_buffer (CoglAttribute *attribute,
|
|||||||
*
|
*
|
||||||
* Gets whether the given object references a #CoglAttribute.
|
* Gets whether the given object references a #CoglAttribute.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the handle references a #CoglAttribute,
|
* Return value: %TRUE if the @object references a #CoglAttribute,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-buffer.h"
|
#include "cogl-buffer.h"
|
||||||
#include "cogl-bitmap.h"
|
#include "cogl-bitmap.h"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
struct _CoglBitmap
|
struct _CoglBitmap
|
||||||
{
|
{
|
||||||
CoglHandleObject _parent;
|
CoglObject _parent;
|
||||||
|
|
||||||
/* Pointer back to the context that this bitmap was created with */
|
/* Pointer back to the context that this bitmap was created with */
|
||||||
CoglContext *context;
|
CoglContext *context;
|
||||||
@ -256,7 +256,7 @@ CoglBitmap *
|
|||||||
cogl_bitmap_new_from_file (const char *filename,
|
cogl_bitmap_new_from_file (const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
|
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
return _cogl_bitmap_from_file (filename, error);
|
return _cogl_bitmap_from_file (filename, error);
|
||||||
}
|
}
|
||||||
|
@ -239,17 +239,17 @@ cogl_bitmap_get_size_from_file (const char *filename,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_bitmap:
|
* cogl_is_bitmap:
|
||||||
* @handle: a #CoglHandle for a bitmap
|
* @object: a #CoglObject pointer
|
||||||
*
|
*
|
||||||
* Checks whether @handle is a #CoglHandle for a bitmap
|
* Checks whether @object is a #CoglBitmap
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the passed handle represents a bitmap,
|
* Return value: %TRUE if the passed @object represents a bitmap,
|
||||||
* and %FALSE otherwise
|
* and %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_is_bitmap (CoglHandle handle);
|
cogl_is_bitmap (void *object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* COGL_BITMAP_ERROR:
|
* COGL_BITMAP_ERROR:
|
||||||
|
@ -43,38 +43,37 @@ static const CoglBlitMode *_cogl_blit_default_mode = NULL;
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cogl_blit_texture_render_begin (CoglBlitData *data)
|
_cogl_blit_texture_render_begin (CoglBlitData *data)
|
||||||
{
|
{
|
||||||
CoglHandle fbo;
|
CoglOffscreen *offscreen;
|
||||||
|
CoglFramebuffer *fb;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
unsigned int dst_width, dst_height;
|
unsigned int dst_width, dst_height;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
fbo = _cogl_offscreen_new_to_texture_full
|
offscreen = _cogl_offscreen_new_to_texture_full
|
||||||
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
||||||
|
|
||||||
if (fbo == COGL_INVALID_HANDLE)
|
if (offscreen == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!cogl_framebuffer_allocate (fbo, NULL))
|
fb = COGL_FRAMEBUFFER (offscreen);
|
||||||
|
if (!cogl_framebuffer_allocate (fb, NULL))
|
||||||
{
|
{
|
||||||
cogl_handle_unref (fbo);
|
cogl_object_unref (fb);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_push_framebuffer (fbo);
|
cogl_push_framebuffer (fb);
|
||||||
cogl_handle_unref (fbo);
|
cogl_object_unref (fb);
|
||||||
|
|
||||||
dst_width = cogl_texture_get_width (data->dst_tex);
|
dst_width = cogl_texture_get_width (data->dst_tex);
|
||||||
dst_height = cogl_texture_get_height (data->dst_tex);
|
dst_height = cogl_texture_get_height (data->dst_tex);
|
||||||
|
|
||||||
/* Set up an orthographic projection so we can use pixel
|
/* Set up an orthographic projection so we can use pixel
|
||||||
coordinates to render to the texture */
|
coordinates to render to the texture */
|
||||||
cogl_ortho (0, /* left */
|
cogl_framebuffer_orthographic (fb,
|
||||||
dst_width, /* right */
|
0, 0, dst_width, dst_height,
|
||||||
dst_height, /* bottom */
|
-1 /* near */, 1 /* far */);
|
||||||
0, /* top */
|
|
||||||
-1, /* near */
|
|
||||||
1 /* far */);
|
|
||||||
|
|
||||||
/* We cache a pipeline used for migrating on to the context so
|
/* We cache a pipeline used for migrating on to the context so
|
||||||
that it doesn't have to continuously regenerate a shader
|
that it doesn't have to continuously regenerate a shader
|
||||||
@ -146,8 +145,8 @@ _cogl_blit_texture_render_end (CoglBlitData *data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cogl_blit_framebuffer_begin (CoglBlitData *data)
|
_cogl_blit_framebuffer_begin (CoglBlitData *data)
|
||||||
{
|
{
|
||||||
CoglHandle dst_fbo, src_fbo;
|
CoglOffscreen *dst_offscreen = NULL, *src_offscreen = NULL;
|
||||||
gboolean ret;
|
CoglFramebuffer *dst_fb, *src_fb;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
@ -158,39 +157,39 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
|
|||||||
!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT))
|
!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
dst_fbo = _cogl_offscreen_new_to_texture_full
|
dst_offscreen = _cogl_offscreen_new_to_texture_full
|
||||||
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
||||||
|
if (dst_offscreen == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (dst_fbo == COGL_INVALID_HANDLE)
|
dst_fb = COGL_FRAMEBUFFER (dst_offscreen);
|
||||||
ret = FALSE;
|
if (!cogl_framebuffer_allocate (dst_fb, NULL))
|
||||||
else
|
goto ERROR;
|
||||||
{
|
|
||||||
if (!cogl_framebuffer_allocate (dst_fbo, NULL))
|
src_offscreen= _cogl_offscreen_new_to_texture_full
|
||||||
ret = FALSE;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
src_fbo = _cogl_offscreen_new_to_texture_full
|
|
||||||
(data->src_tex,
|
(data->src_tex,
|
||||||
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL,
|
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL,
|
||||||
0 /* level */);
|
0 /* level */);
|
||||||
|
|
||||||
if (src_fbo == COGL_INVALID_HANDLE)
|
if (src_offscreen == NULL)
|
||||||
ret = FALSE;
|
goto ERROR;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!cogl_framebuffer_allocate (src_fbo, NULL))
|
|
||||||
ret = FALSE;
|
|
||||||
else
|
|
||||||
_cogl_push_framebuffers (dst_fbo, src_fbo);
|
|
||||||
|
|
||||||
cogl_handle_unref (src_fbo);
|
src_fb = COGL_FRAMEBUFFER (src_offscreen);
|
||||||
}
|
if (!cogl_framebuffer_allocate (src_fb, NULL))
|
||||||
}
|
goto ERROR;
|
||||||
|
|
||||||
cogl_handle_unref (dst_fbo);
|
_cogl_push_framebuffers (dst_fb, src_fb);
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return TRUE;
|
||||||
|
|
||||||
|
ERROR:
|
||||||
|
|
||||||
|
if (dst_offscreen)
|
||||||
|
cogl_object_unref (dst_offscreen);
|
||||||
|
if (src_offscreen)
|
||||||
|
cogl_object_unref (src_offscreen);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -216,7 +215,8 @@ _cogl_blit_framebuffer_end (CoglBlitData *data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
|
_cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
|
||||||
{
|
{
|
||||||
CoglHandle fbo;
|
CoglOffscreen *offscreen;
|
||||||
|
CoglFramebuffer *fb;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
@ -224,20 +224,21 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
|
|||||||
if (!cogl_is_texture_2d (data->dst_tex))
|
if (!cogl_is_texture_2d (data->dst_tex))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
fbo = _cogl_offscreen_new_to_texture_full
|
offscreen = _cogl_offscreen_new_to_texture_full
|
||||||
(data->src_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
(data->src_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
||||||
|
|
||||||
if (fbo == COGL_INVALID_HANDLE)
|
if (offscreen == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!cogl_framebuffer_allocate (fbo, NULL))
|
fb = COGL_FRAMEBUFFER (offscreen);
|
||||||
|
if (!cogl_framebuffer_allocate (fb, NULL))
|
||||||
{
|
{
|
||||||
cogl_handle_unref (fbo);
|
cogl_object_unref (fb);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_push_framebuffer (fbo);
|
cogl_push_framebuffer (fb);
|
||||||
cogl_handle_unref (fbo);
|
cogl_object_unref (fb);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -251,7 +252,7 @@ _cogl_blit_copy_tex_sub_image_blit (CoglBlitData *data,
|
|||||||
unsigned int width,
|
unsigned int width,
|
||||||
unsigned int height)
|
unsigned int height)
|
||||||
{
|
{
|
||||||
_cogl_texture_2d_copy_from_framebuffer (data->dst_tex,
|
_cogl_texture_2d_copy_from_framebuffer (COGL_TEXTURE_2D (data->dst_tex),
|
||||||
dst_x, dst_y,
|
dst_x, dst_y,
|
||||||
src_x, src_y,
|
src_x, src_y,
|
||||||
width, height);
|
width, height);
|
||||||
@ -334,8 +335,8 @@ _cogl_blit_modes[] =
|
|||||||
|
|
||||||
void
|
void
|
||||||
_cogl_blit_begin (CoglBlitData *data,
|
_cogl_blit_begin (CoglBlitData *data,
|
||||||
CoglHandle dst_tex,
|
CoglTexture *dst_tex,
|
||||||
CoglHandle src_tex)
|
CoglTexture *src_tex)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
#define __COGL_BLIT_H
|
#define __COGL_BLIT_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
|
#include "cogl-texture.h"
|
||||||
|
|
||||||
/* This structures and functions are used when a series of blits needs
|
/* This structures and functions are used when a series of blits needs
|
||||||
to be performed between two textures. In this case there are
|
to be performed between two textures. In this case there are
|
||||||
@ -55,7 +56,7 @@ typedef struct
|
|||||||
|
|
||||||
struct _CoglBlitData
|
struct _CoglBlitData
|
||||||
{
|
{
|
||||||
CoglHandle src_tex, dst_tex;
|
CoglTexture *src_tex, *dst_tex;
|
||||||
|
|
||||||
unsigned int src_width;
|
unsigned int src_width;
|
||||||
unsigned int src_height;
|
unsigned int src_height;
|
||||||
@ -71,8 +72,8 @@ struct _CoglBlitData
|
|||||||
|
|
||||||
void
|
void
|
||||||
_cogl_blit_begin (CoglBlitData *data,
|
_cogl_blit_begin (CoglBlitData *data,
|
||||||
CoglHandle dst_tex,
|
CoglTexture *dst_tex,
|
||||||
CoglHandle src_tex);
|
CoglTexture *src_tex);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_blit (CoglBlitData *data,
|
_cogl_blit (CoglBlitData *data,
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-pixel-buffer-private.h"
|
#include "cogl-pixel-buffer-private.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -71,7 +71,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* XXX:
|
/* XXX:
|
||||||
* The CoglHandle macros don't support any form of inheritance, so for
|
* The CoglObject macros don't support any form of inheritance, so for
|
||||||
* now we implement the CoglObject support for the CoglBuffer
|
* now we implement the CoglObject support for the CoglBuffer
|
||||||
* abstract class manually.
|
* abstract class manually.
|
||||||
*/
|
*/
|
||||||
@ -87,7 +87,7 @@ _cogl_buffer_register_buffer_type (const CoglObjectClass *klass)
|
|||||||
gboolean
|
gboolean
|
||||||
cogl_is_buffer (void *object)
|
cogl_is_buffer (void *object)
|
||||||
{
|
{
|
||||||
const CoglHandleObject *obj = object;
|
const CoglObject *obj = object;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (object == NULL)
|
if (object == NULL)
|
||||||
|
@ -193,7 +193,7 @@ _cogl_clip_state_save_clip_stack (CoglClipState *clip_state)
|
|||||||
void
|
void
|
||||||
_cogl_clip_state_restore_clip_stack (CoglClipState *clip_state)
|
_cogl_clip_state_restore_clip_stack (CoglClipState *clip_state)
|
||||||
{
|
{
|
||||||
CoglHandle stack;
|
CoglClipStack *stack;
|
||||||
|
|
||||||
_COGL_RETURN_IF_FAIL (clip_state->stacks != NULL);
|
_COGL_RETURN_IF_FAIL (clip_state->stacks != NULL);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ struct _CoglContext
|
|||||||
|
|
||||||
/* Framebuffers */
|
/* Framebuffers */
|
||||||
GSList *framebuffer_stack;
|
GSList *framebuffer_stack;
|
||||||
CoglHandle window_buffer;
|
CoglFramebuffer *window_buffer;
|
||||||
unsigned long current_draw_buffer_state_flushed;
|
unsigned long current_draw_buffer_state_flushed;
|
||||||
unsigned long current_draw_buffer_changes;
|
unsigned long current_draw_buffer_changes;
|
||||||
CoglFramebuffer *current_draw_buffer;
|
CoglFramebuffer *current_draw_buffer;
|
||||||
@ -183,9 +183,9 @@ struct _CoglContext
|
|||||||
|
|
||||||
/* Pre-generated VBOs containing indices to generate GL_TRIANGLES
|
/* Pre-generated VBOs containing indices to generate GL_TRIANGLES
|
||||||
out of a vertex array of quads */
|
out of a vertex array of quads */
|
||||||
CoglHandle quad_buffer_indices_byte;
|
CoglIndices *quad_buffer_indices_byte;
|
||||||
unsigned int quad_buffer_indices_len;
|
unsigned int quad_buffer_indices_len;
|
||||||
CoglHandle quad_buffer_indices;
|
CoglIndices *quad_buffer_indices;
|
||||||
|
|
||||||
CoglIndices *rectangle_byte_indices;
|
CoglIndices *rectangle_byte_indices;
|
||||||
CoglIndices *rectangle_short_indices;
|
CoglIndices *rectangle_short_indices;
|
||||||
|
@ -332,8 +332,6 @@ cogl_context_new (CoglDisplay *display,
|
|||||||
context->max_texture_units = -1;
|
context->max_texture_units = -1;
|
||||||
context->max_activateable_texture_units = -1;
|
context->max_activateable_texture_units = -1;
|
||||||
|
|
||||||
context->current_program = COGL_INVALID_HANDLE;
|
|
||||||
|
|
||||||
context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED;
|
context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED;
|
||||||
context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED;
|
context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED;
|
||||||
context->current_gl_program = 0;
|
context->current_gl_program = 0;
|
||||||
@ -375,16 +373,16 @@ cogl_context_new (CoglDisplay *display,
|
|||||||
|
|
||||||
context->in_begin_gl_block = FALSE;
|
context->in_begin_gl_block = FALSE;
|
||||||
|
|
||||||
context->quad_buffer_indices_byte = COGL_INVALID_HANDLE;
|
context->quad_buffer_indices_byte = NULL;
|
||||||
context->quad_buffer_indices = COGL_INVALID_HANDLE;
|
context->quad_buffer_indices = NULL;
|
||||||
context->quad_buffer_indices_len = 0;
|
context->quad_buffer_indices_len = 0;
|
||||||
|
|
||||||
context->rectangle_byte_indices = NULL;
|
context->rectangle_byte_indices = NULL;
|
||||||
context->rectangle_short_indices = NULL;
|
context->rectangle_short_indices = NULL;
|
||||||
context->rectangle_short_indices_len = 0;
|
context->rectangle_short_indices_len = 0;
|
||||||
|
|
||||||
context->texture_download_pipeline = COGL_INVALID_HANDLE;
|
context->texture_download_pipeline = NULL;
|
||||||
context->blit_texture_pipeline = COGL_INVALID_HANDLE;
|
context->blit_texture_pipeline = NULL;
|
||||||
|
|
||||||
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
|
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
|
||||||
if (context->driver != COGL_DRIVER_GLES2)
|
if (context->driver != COGL_DRIVER_GLES2)
|
||||||
@ -473,14 +471,14 @@ _cogl_context_free (CoglContext *context)
|
|||||||
cogl_object_unref (context->default_gl_texture_rect_tex);
|
cogl_object_unref (context->default_gl_texture_rect_tex);
|
||||||
|
|
||||||
if (context->opaque_color_pipeline)
|
if (context->opaque_color_pipeline)
|
||||||
cogl_handle_unref (context->opaque_color_pipeline);
|
cogl_object_unref (context->opaque_color_pipeline);
|
||||||
if (context->blended_color_pipeline)
|
if (context->blended_color_pipeline)
|
||||||
cogl_handle_unref (context->blended_color_pipeline);
|
cogl_object_unref (context->blended_color_pipeline);
|
||||||
if (context->texture_pipeline)
|
if (context->texture_pipeline)
|
||||||
cogl_handle_unref (context->texture_pipeline);
|
cogl_object_unref (context->texture_pipeline);
|
||||||
|
|
||||||
if (context->blit_texture_pipeline)
|
if (context->blit_texture_pipeline)
|
||||||
cogl_handle_unref (context->blit_texture_pipeline);
|
cogl_object_unref (context->blit_texture_pipeline);
|
||||||
|
|
||||||
if (context->journal_flush_attributes_array)
|
if (context->journal_flush_attributes_array)
|
||||||
g_array_free (context->journal_flush_attributes_array, TRUE);
|
g_array_free (context->journal_flush_attributes_array, TRUE);
|
||||||
@ -491,9 +489,9 @@ _cogl_context_free (CoglContext *context)
|
|||||||
g_array_free (context->polygon_vertices, TRUE);
|
g_array_free (context->polygon_vertices, TRUE);
|
||||||
|
|
||||||
if (context->quad_buffer_indices_byte)
|
if (context->quad_buffer_indices_byte)
|
||||||
cogl_handle_unref (context->quad_buffer_indices_byte);
|
cogl_object_unref (context->quad_buffer_indices_byte);
|
||||||
if (context->quad_buffer_indices)
|
if (context->quad_buffer_indices)
|
||||||
cogl_handle_unref (context->quad_buffer_indices);
|
cogl_object_unref (context->quad_buffer_indices);
|
||||||
|
|
||||||
if (context->rectangle_byte_indices)
|
if (context->rectangle_byte_indices)
|
||||||
cogl_object_unref (context->rectangle_byte_indices);
|
cogl_object_unref (context->rectangle_byte_indices);
|
||||||
@ -501,14 +499,14 @@ _cogl_context_free (CoglContext *context)
|
|||||||
cogl_object_unref (context->rectangle_short_indices);
|
cogl_object_unref (context->rectangle_short_indices);
|
||||||
|
|
||||||
if (context->default_pipeline)
|
if (context->default_pipeline)
|
||||||
cogl_handle_unref (context->default_pipeline);
|
cogl_object_unref (context->default_pipeline);
|
||||||
|
|
||||||
if (context->dummy_layer_dependant)
|
if (context->dummy_layer_dependant)
|
||||||
cogl_handle_unref (context->dummy_layer_dependant);
|
cogl_object_unref (context->dummy_layer_dependant);
|
||||||
if (context->default_layer_n)
|
if (context->default_layer_n)
|
||||||
cogl_handle_unref (context->default_layer_n);
|
cogl_object_unref (context->default_layer_n);
|
||||||
if (context->default_layer_0)
|
if (context->default_layer_0)
|
||||||
cogl_handle_unref (context->default_layer_0);
|
cogl_object_unref (context->default_layer_0);
|
||||||
|
|
||||||
if (context->current_clip_stack_valid)
|
if (context->current_clip_stack_valid)
|
||||||
_cogl_clip_stack_unref (context->current_clip_stack);
|
_cogl_clip_stack_unref (context->current_clip_stack);
|
||||||
|
@ -147,7 +147,7 @@ cogl_android_set_native_window (ANativeWindow *window);
|
|||||||
*
|
*
|
||||||
* Gets whether the given object references an existing context object.
|
* Gets whether the given object references an existing context object.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the handle references a #CoglContext,
|
* Return value: %TRUE if the @object references a #CoglContext,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.10
|
* Since: 1.10
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OPT (HANDLE,
|
OPT (OBJECT,
|
||||||
N_("Cogl Tracing"),
|
N_("Cogl Tracing"),
|
||||||
"ref-counts",
|
"ref-counts",
|
||||||
N_("CoglObject references"),
|
N_("CoglObject references"),
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
* used since they don't affect the behaviour of Cogl they
|
* used since they don't affect the behaviour of Cogl they
|
||||||
* simply print out verbose information */
|
* simply print out verbose information */
|
||||||
static const GDebugKey cogl_log_debug_keys[] = {
|
static const GDebugKey cogl_log_debug_keys[] = {
|
||||||
{ "handle", COGL_DEBUG_HANDLE },
|
{ "object", COGL_DEBUG_OBJECT },
|
||||||
{ "slicing", COGL_DEBUG_SLICING },
|
{ "slicing", COGL_DEBUG_SLICING },
|
||||||
{ "atlas", COGL_DEBUG_ATLAS },
|
{ "atlas", COGL_DEBUG_ATLAS },
|
||||||
{ "blend-strings", COGL_DEBUG_BLEND_STRINGS },
|
{ "blend-strings", COGL_DEBUG_BLEND_STRINGS },
|
||||||
|
@ -38,7 +38,7 @@ typedef enum {
|
|||||||
COGL_DEBUG_DRAW,
|
COGL_DEBUG_DRAW,
|
||||||
COGL_DEBUG_PANGO,
|
COGL_DEBUG_PANGO,
|
||||||
COGL_DEBUG_RECTANGLES,
|
COGL_DEBUG_RECTANGLES,
|
||||||
COGL_DEBUG_HANDLE,
|
COGL_DEBUG_OBJECT,
|
||||||
COGL_DEBUG_BLEND_STRINGS,
|
COGL_DEBUG_BLEND_STRINGS,
|
||||||
COGL_DEBUG_DISABLE_BATCHING,
|
COGL_DEBUG_DISABLE_BATCHING,
|
||||||
COGL_DEBUG_DISABLE_VBOS,
|
COGL_DEBUG_DISABLE_VBOS,
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
/*** BEGIN file-header ***/
|
/*** BEGIN file-header ***/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cogl-enum-types.h"
|
#include "cogl-enum-types.h"
|
||||||
/*** END file-header ***/
|
/*** END file-header ***/
|
||||||
|
|
||||||
|
@ -726,20 +726,20 @@ _cogl_offscreen_new_to_texture_full (CoglTexture *texture,
|
|||||||
int level_width;
|
int level_width;
|
||||||
int level_height;
|
int level_height;
|
||||||
int i;
|
int i;
|
||||||
CoglHandle ret;
|
CoglOffscreen *ret;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
|
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Make texture is a valid texture object */
|
/* Make texture is a valid texture object */
|
||||||
if (!cogl_is_texture (texture))
|
if (!cogl_is_texture (texture))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* The texture must not be sliced */
|
/* The texture must not be sliced */
|
||||||
if (cogl_texture_is_sliced (texture))
|
if (cogl_texture_is_sliced (texture))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Calculate the size of the texture at this mipmap level to ensure
|
/* Calculate the size of the texture at this mipmap level to ensure
|
||||||
that it's a valid level */
|
that it's a valid level */
|
||||||
@ -754,7 +754,7 @@ _cogl_offscreen_new_to_texture_full (CoglTexture *texture,
|
|||||||
{
|
{
|
||||||
g_warning ("Invalid texture level passed to "
|
g_warning ("Invalid texture level passed to "
|
||||||
"_cogl_offscreen_new_to_texture_full");
|
"_cogl_offscreen_new_to_texture_full");
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level_width > 1)
|
if (level_width > 1)
|
||||||
@ -811,7 +811,7 @@ _cogl_offscreen_free (CoglOffscreen *offscreen)
|
|||||||
|
|
||||||
GE (ctx, glDeleteFramebuffers (1, &offscreen->fbo_handle));
|
GE (ctx, glDeleteFramebuffers (1, &offscreen->fbo_handle));
|
||||||
|
|
||||||
if (offscreen->texture != COGL_INVALID_HANDLE)
|
if (offscreen->texture != NULL)
|
||||||
cogl_object_unref (offscreen->texture);
|
cogl_object_unref (offscreen->texture);
|
||||||
|
|
||||||
g_free (offscreen);
|
g_free (offscreen);
|
||||||
@ -1096,7 +1096,7 @@ _cogl_create_framebuffer_stack (void)
|
|||||||
CoglFramebufferStackEntry *entry;
|
CoglFramebufferStackEntry *entry;
|
||||||
GSList *stack = NULL;
|
GSList *stack = NULL;
|
||||||
|
|
||||||
entry = create_stack_entry (COGL_INVALID_HANDLE, COGL_INVALID_HANDLE);
|
entry = create_stack_entry (NULL, NULL);
|
||||||
|
|
||||||
return g_slist_prepend (stack, entry);
|
return g_slist_prepend (stack, entry);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ cogl_index_buffer_new (CoglContext *context,
|
|||||||
*
|
*
|
||||||
* Gets whether the given object references a #CoglIndexBuffer.
|
* Gets whether the given object references a #CoglIndexBuffer.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the handle references a #CoglIndexBuffer,
|
* Returns: %TRUE if the @object references a #CoglIndexBuffer,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define __COGL_JOURNAL_PRIVATE_H
|
#define __COGL_JOURNAL_PRIVATE_H
|
||||||
|
|
||||||
#include "cogl-texture.h"
|
#include "cogl-texture.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-clip-stack.h"
|
#include "cogl-clip-stack.h"
|
||||||
|
|
||||||
#define COGL_JOURNAL_VBO_POOL_SIZE 8
|
#define COGL_JOURNAL_VBO_POOL_SIZE 8
|
||||||
|
@ -1597,7 +1597,7 @@ _cogl_journal_log_quad (CoglJournal *journal,
|
|||||||
entry->clip_stack = _cogl_clip_stack_ref (clip_stack);
|
entry->clip_stack = _cogl_clip_stack_ref (clip_stack);
|
||||||
|
|
||||||
if (G_UNLIKELY (final_pipeline != pipeline))
|
if (G_UNLIKELY (final_pipeline != pipeline))
|
||||||
cogl_handle_unref (final_pipeline);
|
cogl_object_unref (final_pipeline);
|
||||||
|
|
||||||
cogl_framebuffer_get_modelview_matrix (framebuffer,
|
cogl_framebuffer_get_modelview_matrix (framebuffer,
|
||||||
&entry->model_view);
|
&entry->model_view);
|
||||||
|
@ -90,23 +90,23 @@ struct _CoglObject
|
|||||||
#ifdef COGL_OBJECT_DEBUG
|
#ifdef COGL_OBJECT_DEBUG
|
||||||
|
|
||||||
#define _COGL_OBJECT_DEBUG_NEW(type_name, obj) \
|
#define _COGL_OBJECT_DEBUG_NEW(type_name, obj) \
|
||||||
COGL_NOTE (HANDLE, "COGL " G_STRINGIFY (type_name) " NEW %p %i", \
|
COGL_NOTE (OBJECT, "COGL " G_STRINGIFY (type_name) " NEW %p %i", \
|
||||||
(obj), (obj)->ref_count)
|
(obj), (obj)->ref_count)
|
||||||
|
|
||||||
#define _COGL_OBJECT_DEBUG_REF(type_name, object) G_STMT_START { \
|
#define _COGL_OBJECT_DEBUG_REF(type_name, object) G_STMT_START { \
|
||||||
CoglObject *__obj = (CoglObject *)object; \
|
CoglObject *__obj = (CoglObject *)object; \
|
||||||
COGL_NOTE (HANDLE, "COGL %s REF %p %i", \
|
COGL_NOTE (OBJECT, "COGL %s REF %p %i", \
|
||||||
(__obj)->klass->name, \
|
(__obj)->klass->name, \
|
||||||
(__obj), (__obj)->ref_count); } G_STMT_END
|
(__obj), (__obj)->ref_count); } G_STMT_END
|
||||||
|
|
||||||
#define _COGL_OBJECT_DEBUG_UNREF(type_name, object) G_STMT_START { \
|
#define _COGL_OBJECT_DEBUG_UNREF(type_name, object) G_STMT_START { \
|
||||||
CoglObject *__obj = (CoglObject *)object; \
|
CoglObject *__obj = (CoglObject *)object; \
|
||||||
COGL_NOTE (HANDLE, "COGL %s UNREF %p %i", \
|
COGL_NOTE (OBJECT, "COGL %s UNREF %p %i", \
|
||||||
(__obj)->klass->name, \
|
(__obj)->klass->name, \
|
||||||
(__obj), (__obj)->ref_count - 1); } G_STMT_END
|
(__obj), (__obj)->ref_count - 1); } G_STMT_END
|
||||||
|
|
||||||
#define COGL_OBJECT_DEBUG_FREE(obj) \
|
#define COGL_OBJECT_DEBUG_FREE(obj) \
|
||||||
COGL_NOTE (HANDLE, "COGL %s FREE %p", \
|
COGL_NOTE (OBJECT, "COGL %s FREE %p", \
|
||||||
(obj)->klass->name, (obj))
|
(obj)->klass->name, (obj))
|
||||||
|
|
||||||
#else /* !COGL_OBJECT_DEBUG */
|
#else /* !COGL_OBJECT_DEBUG */
|
||||||
@ -118,12 +118,6 @@ struct _CoglObject
|
|||||||
|
|
||||||
#endif /* COGL_OBJECT_DEBUG */
|
#endif /* COGL_OBJECT_DEBUG */
|
||||||
|
|
||||||
/* For temporary compatability */
|
|
||||||
#define _COGL_HANDLE_DEBUG_NEW _COGL_OBJECT_DEBUG_NEW
|
|
||||||
#define _COGL_HANDLE_DEBUG_REF _COGL_OBJECT_DEBUG_REF
|
|
||||||
#define _COGL_HANDLE_DEBUG_UNREF _COGL_OBJECT_DEBUG_UNREF
|
|
||||||
#define COGL_HANDLE_DEBUG_FREE COGL_OBJECT_DEBUG_FREE
|
|
||||||
|
|
||||||
#define COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \
|
#define COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \
|
||||||
\
|
\
|
||||||
CoglObjectClass _cogl_##type_name##_class; \
|
CoglObjectClass _cogl_##type_name##_class; \
|
||||||
@ -272,9 +266,6 @@ _cogl_##type_name##_handle_new (CoglHandle handle) \
|
|||||||
return _cogl_##type_name##_object_new (handle); \
|
return _cogl_##type_name##_object_new (handle); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COGL_HANDLE_INTERNAL_DEFINE(TypeName, type_name) \
|
|
||||||
COGL_HANDLE_INTERNAL_DEFINE_WITH_CODE (TypeName, type_name, (void) 0)
|
|
||||||
|
|
||||||
#define COGL_HANDLE_DEFINE(TypeName, type_name) \
|
#define COGL_HANDLE_DEFINE(TypeName, type_name) \
|
||||||
COGL_HANDLE_DEFINE_WITH_CODE (TypeName, type_name, (void) 0)
|
COGL_HANDLE_DEFINE_WITH_CODE (TypeName, type_name, (void) 0)
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
|
|||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
||||||
|
|
||||||
if (framebuffer->context->window_buffer == onscreen)
|
if (framebuffer->context->window_buffer == COGL_FRAMEBUFFER (onscreen))
|
||||||
framebuffer->context->window_buffer = NULL;
|
framebuffer->context->window_buffer = NULL;
|
||||||
|
|
||||||
winsys->onscreen_deinit (onscreen);
|
winsys->onscreen_deinit (onscreen);
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
|
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-blend-string.h"
|
#include "cogl-blend-string.h"
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
|
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-blend-string.h"
|
#include "cogl-blend-string.h"
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-pipeline-private.h"
|
#include "cogl-pipeline-private.h"
|
||||||
#include "cogl-pipeline-layer-private.h"
|
#include "cogl-pipeline-layer-private.h"
|
||||||
#include "cogl-shader-private.h"
|
|
||||||
#include "cogl-blend-string.h"
|
#include "cogl-blend-string.h"
|
||||||
#include "cogl-snippet-private.h"
|
#include "cogl-snippet-private.h"
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pipeline_set_layer_point_sprite_coords_enabled:
|
* cogl_pipeline_set_layer_point_sprite_coords_enabled:
|
||||||
* @pipeline: a #CoglHandle to a pipeline.
|
* @pipeline: A #CoglPipeline object
|
||||||
* @layer_index: the layer number to change.
|
* @layer_index: the layer number to change.
|
||||||
* @enable: whether to enable point sprite coord generation.
|
* @enable: whether to enable point sprite coord generation.
|
||||||
* @error: A return location for a GError, or NULL to ignore errors.
|
* @error: A return location for a GError, or NULL to ignore errors.
|
||||||
@ -441,7 +441,7 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pipeline_get_layer_point_sprite_coords_enabled:
|
* cogl_pipeline_get_layer_point_sprite_coords_enabled:
|
||||||
* @pipeline: a #CoglHandle to a pipeline.
|
* @pipeline: A #CoglPipeline object
|
||||||
* @layer_index: the layer number to check.
|
* @layer_index: the layer number to check.
|
||||||
*
|
*
|
||||||
* Gets whether point sprite coordinate generation is enabled for this
|
* Gets whether point sprite coordinate generation is enabled for this
|
||||||
|
@ -141,9 +141,6 @@ _cogl_bind_gl_texture_transient (GLenum gl_target,
|
|||||||
void
|
void
|
||||||
_cogl_delete_gl_texture (GLuint gl_texture);
|
_cogl_delete_gl_texture (GLuint gl_texture);
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_gl_use_program_wrapper (CoglHandle program);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pipeline_flush_gl_state (CoglPipeline *pipeline,
|
_cogl_pipeline_flush_gl_state (CoglPipeline *pipeline,
|
||||||
gboolean skip_gl_state,
|
gboolean skip_gl_state,
|
||||||
|
@ -872,9 +872,9 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cogl_handle_ref (layer);
|
cogl_object_ref (layer);
|
||||||
if (unit->layer != COGL_INVALID_HANDLE)
|
if (unit->layer != NULL)
|
||||||
cogl_handle_unref (unit->layer);
|
cogl_object_unref (unit->layer);
|
||||||
|
|
||||||
unit->layer = layer;
|
unit->layer = layer;
|
||||||
unit->layer_changes_since_flush = 0;
|
unit->layer_changes_since_flush = 0;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-program-private.h"
|
#include "cogl-program-private.h"
|
||||||
#include "cogl-pipeline-fragend-glsl-private.h"
|
#include "cogl-pipeline-fragend-glsl-private.h"
|
||||||
#include "cogl-pipeline-vertend-glsl-private.h"
|
#include "cogl-pipeline-vertend-glsl-private.h"
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-program-private.h"
|
#include "cogl-program-private.h"
|
||||||
|
|
||||||
const CoglPipelineVertend _cogl_pipeline_fixed_vertend;
|
const CoglPipelineVertend _cogl_pipeline_fixed_vertend;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-program-private.h"
|
#include "cogl-program-private.h"
|
||||||
#include "cogl-pipeline-vertend-glsl-private.h"
|
#include "cogl-pipeline-vertend-glsl-private.h"
|
||||||
#include "cogl-pipeline-state-private.h"
|
#include "cogl-pipeline-state-private.h"
|
||||||
|
@ -1906,7 +1906,7 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data)
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglHandle texture;
|
CoglTexture *texture;
|
||||||
} CoglPipelineOverrideLayerState;
|
} CoglPipelineOverrideLayerState;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -95,18 +95,18 @@ cogl_pipeline_copy (CoglPipeline *source);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_pipeline:
|
* cogl_is_pipeline:
|
||||||
* @handle: A CoglHandle
|
* @object: A #CoglObject
|
||||||
*
|
*
|
||||||
* Gets whether the given handle references an existing pipeline object.
|
* Gets whether the given @object references an existing pipeline object.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the handle references a #CoglPipeline,
|
* Return value: %TRUE if the @object references a #CoglPipeline,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 2.0
|
* Since: 2.0
|
||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_is_pipeline (CoglHandle handle);
|
cogl_is_pipeline (void *object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglPipelineLayerCallback:
|
* CoglPipelineLayerCallback:
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#ifndef __COGL_PIXEL_BUFFER_PRIVATE_H__
|
#ifndef __COGL_PIXEL_BUFFER_PRIVATE_H__
|
||||||
#define __COGL_PIXEL_BUFFER_PRIVATE_H__
|
#define __COGL_PIXEL_BUFFER_PRIVATE_H__
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-buffer-private.h"
|
#include "cogl-buffer-private.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -81,9 +81,9 @@ cogl_pixel_buffer_new (CoglContext *context,
|
|||||||
* cogl_is_pixel_buffer:
|
* cogl_is_pixel_buffer:
|
||||||
* @object: a #CoglObject to test
|
* @object: a #CoglObject to test
|
||||||
*
|
*
|
||||||
* Checks whether @handle is a pixel array.
|
* Checks whether @object is a pixel buffer.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the @handle is a pixel array, and %FALSE
|
* Return value: %TRUE if the @object is a pixel buffer, and %FALSE
|
||||||
* otherwise
|
* otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
@ -95,7 +95,7 @@ cogl_is_pixel_buffer (void *object);
|
|||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* cogl_pixel_buffer_set_region:
|
* cogl_pixel_buffer_set_region:
|
||||||
* @array: the #CoglHandle of a pixel array
|
* @buffer: A #CoglPixelBuffer object
|
||||||
* @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
|
||||||
* @src_height: height in pixels of the region to update
|
* @src_height: height in pixels of the region to update
|
||||||
@ -114,7 +114,7 @@ cogl_is_pixel_buffer (void *object);
|
|||||||
* Stability: Unstable
|
* Stability: Unstable
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cogl_pixel_buffer_set_region (CoglHandle array,
|
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,
|
||||||
|
@ -827,7 +827,7 @@ cogl_primitive_copy (CoglPrimitive *primitive);
|
|||||||
*
|
*
|
||||||
* Gets whether the given object references a #CoglPrimitive.
|
* Gets whether the given object references a #CoglPrimitive.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the handle references a #CoglPrimitive,
|
* Returns: %TRUE if the @object references a #CoglPrimitive,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef __COGL_PROGRAM_H
|
#ifndef __COGL_PROGRAM_H
|
||||||
#define __COGL_PROGRAM_H
|
#define __COGL_PROGRAM_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-shader-private.h"
|
#include "cogl-shader-private.h"
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
|
|
||||||
#include "cogl-shader-private.h"
|
#include "cogl-shader-private.h"
|
||||||
#include "cogl-program-private.h"
|
#include "cogl-program-private.h"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef __COGL_SHADER_H
|
#ifndef __COGL_SHADER_H
|
||||||
#define __COGL_SHADER_H
|
#define __COGL_SHADER_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-shader.h"
|
#include "cogl-shader.h"
|
||||||
#include "cogl-gl-header.h"
|
#include "cogl-gl-header.h"
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "cogl-shader-boilerplate.h"
|
#include "cogl-shader-boilerplate.h"
|
||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -601,11 +601,11 @@ cogl_snippet_get_hook (CoglSnippet *snippet);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_snippet:
|
* cogl_is_snippet:
|
||||||
* @handle: A CoglHandle
|
* @object: A #CoglObject pointer
|
||||||
*
|
*
|
||||||
* Gets whether the given handle references an existing snippet object.
|
* Gets whether the given @object references an existing snippet object.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the handle references a #CoglSnippet,
|
* Return value: %TRUE if the @object references a #CoglSnippet,
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.10
|
* Since: 1.10
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef __COGL_SPANS_PRIVATE_H
|
#ifndef __COGL_SPANS_PRIVATE_H
|
||||||
#define __COGL_SPANS_PRIVATE_H
|
#define __COGL_SPANS_PRIVATE_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-pipeline-layer-state.h"
|
#include "cogl-pipeline-layer-state.h"
|
||||||
|
|
||||||
typedef struct _CoglSpan
|
typedef struct _CoglSpan
|
||||||
|
@ -253,7 +253,7 @@ cogl_sub_texture_new (CoglContext *ctx,
|
|||||||
sub_tex->sub_width = sub_width;
|
sub_tex->sub_width = sub_width;
|
||||||
sub_tex->sub_height = sub_height;
|
sub_tex->sub_height = sub_height;
|
||||||
|
|
||||||
return _cogl_sub_texture_handle_new (sub_tex);
|
return _cogl_sub_texture_object_new (sub_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture *
|
CoglTexture *
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef __COGL_TEXTURE_2D_H
|
#ifndef __COGL_TEXTURE_2D_H
|
||||||
#define __COGL_TEXTURE_2D_H
|
#define __COGL_TEXTURE_2D_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-pipeline-private.h"
|
#include "cogl-pipeline-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-texture-2d.h"
|
#include "cogl-texture-2d.h"
|
||||||
@ -68,18 +68,18 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* _cogl_texture_2d_externally_modified:
|
* _cogl_texture_2d_externally_modified:
|
||||||
* @handle: A handle to a 2D texture
|
* @texture: A #CoglTexture2D object
|
||||||
*
|
*
|
||||||
* This should be called whenever the texture is modified other than
|
* This should be called whenever the texture is modified other than
|
||||||
* by using cogl_texture_set_region. It will cause the mipmaps to be
|
* by using cogl_texture_set_region. It will cause the mipmaps to be
|
||||||
* invalidated
|
* invalidated
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_cogl_texture_2d_externally_modified (CoglHandle handle);
|
_cogl_texture_2d_externally_modified (CoglTexture *texture);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _cogl_texture_2d_copy_from_framebuffer:
|
* _cogl_texture_2d_copy_from_framebuffer:
|
||||||
* @handle: A handle to a 2D texture
|
* @texture: A #CoglTexture2D pointer
|
||||||
* @dst_x: X-position to store the image within the texture
|
* @dst_x: X-position to store the image within the texture
|
||||||
* @dst_y: Y-position to store the image within the texture
|
* @dst_y: Y-position to store the image within the texture
|
||||||
* @src_x: X-position to within the framebuffer to read from
|
* @src_x: X-position to within the framebuffer to read from
|
||||||
@ -91,7 +91,7 @@ _cogl_texture_2d_externally_modified (CoglHandle handle);
|
|||||||
* texture.
|
* texture.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_cogl_texture_2d_copy_from_framebuffer (CoglHandle handle,
|
_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *texture,
|
||||||
int dst_x,
|
int dst_x,
|
||||||
int dst_y,
|
int dst_y,
|
||||||
int src_x,
|
int src_x,
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "cogl-texture-2d-sliced-private.h"
|
#include "cogl-texture-2d-sliced-private.h"
|
||||||
#include "cogl-texture-driver.h"
|
#include "cogl-texture-driver.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-spans.h"
|
#include "cogl-spans.h"
|
||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
@ -790,7 +790,7 @@ _cogl_texture_2d_sliced_slices_free (CoglTexture2DSliced *tex_2ds)
|
|||||||
{
|
{
|
||||||
CoglTexture2D *slice_tex =
|
CoglTexture2D *slice_tex =
|
||||||
g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
|
g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
|
||||||
cogl_handle_unref (slice_tex);
|
cogl_object_unref (slice_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_array_free (tex_2ds->slice_textures, TRUE);
|
g_array_free (tex_2ds->slice_textures, TRUE);
|
||||||
@ -867,7 +867,7 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _cogl_texture_2d_sliced_handle_new (tex_2ds);
|
return _cogl_texture_2d_sliced_object_new (tex_2ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture2DSliced *
|
CoglTexture2DSliced *
|
||||||
@ -935,7 +935,7 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
cogl_primitive_texture_set_auto_mipmap (slice_tex, FALSE);
|
cogl_primitive_texture_set_auto_mipmap (slice_tex, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _cogl_texture_2d_sliced_handle_new (tex_2ds);
|
return _cogl_texture_2d_sliced_object_new (tex_2ds);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
cogl_object_unref (dst_bmp);
|
cogl_object_unref (dst_bmp);
|
||||||
@ -1030,7 +1030,7 @@ _cogl_texture_2d_sliced_new_from_foreign (GLuint gl_handle,
|
|||||||
|
|
||||||
g_array_append_val (tex_2ds->slice_textures, tex_2d);
|
g_array_append_val (tex_2ds->slice_textures, tex_2d);
|
||||||
|
|
||||||
return _cogl_texture_2d_sliced_handle_new (tex_2ds);
|
return _cogl_texture_2d_sliced_object_new (tex_2ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "cogl-texture-2d-private.h"
|
#include "cogl-texture-2d-private.h"
|
||||||
#include "cogl-texture-driver.h"
|
#include "cogl-texture-driver.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
@ -218,7 +218,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
GE( ctx, glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat,
|
GE( ctx, glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat,
|
||||||
width, height, 0, gl_format, gl_type, NULL) );
|
width, height, 0, gl_format, gl_type, NULL) );
|
||||||
|
|
||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_object_new (tex_2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
@ -234,7 +234,7 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
guint8 *data;
|
guint8 *data;
|
||||||
CoglContext *ctx;
|
CoglContext *ctx;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE);
|
_COGL_RETURN_VAL_IF_FAIL (bmp != NULL, NULL);
|
||||||
|
|
||||||
ctx = _cogl_bitmap_get_context (bmp);
|
ctx = _cogl_bitmap_get_context (bmp);
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
cogl_object_unref (dst_bmp);
|
cogl_object_unref (dst_bmp);
|
||||||
|
|
||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_object_new (tex_2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
@ -314,7 +314,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
CoglHandle tex;
|
CoglTexture2D *tex_2d;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
|
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
|
||||||
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
|
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
|
||||||
@ -330,13 +330,13 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
rowstride,
|
rowstride,
|
||||||
(guint8 *) data);
|
(guint8 *) data);
|
||||||
|
|
||||||
tex = cogl_texture_2d_new_from_bitmap (bmp,
|
tex_2d = cogl_texture_2d_new_from_bitmap (bmp,
|
||||||
internal_format,
|
internal_format,
|
||||||
error);
|
error);
|
||||||
|
|
||||||
cogl_object_unref (bmp);
|
cogl_object_unref (bmp);
|
||||||
|
|
||||||
return tex;
|
return tex_2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture2D *
|
CoglTexture2D *
|
||||||
@ -357,11 +357,11 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
|
|
||||||
if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D))
|
if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Make sure it is a valid GL texture object */
|
/* Make sure it is a valid GL texture object */
|
||||||
if (!ctx->glIsTexture (gl_handle))
|
if (!ctx->glIsTexture (gl_handle))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Make sure binding succeeds */
|
/* Make sure binding succeeds */
|
||||||
while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR)
|
while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR)
|
||||||
@ -369,7 +369,7 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
|
|
||||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D, gl_handle, TRUE);
|
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D, gl_handle, TRUE);
|
||||||
if (ctx->glGetError () != GL_NO_ERROR)
|
if (ctx->glGetError () != GL_NO_ERROR)
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Obtain texture parameters
|
/* Obtain texture parameters
|
||||||
(only level 0 we are interested in) */
|
(only level 0 we are interested in) */
|
||||||
@ -396,7 +396,7 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
if (!ctx->driver_vtable->pixel_format_from_gl_internal (ctx,
|
if (!ctx->driver_vtable->pixel_format_from_gl_internal (ctx,
|
||||||
gl_int_format,
|
gl_int_format,
|
||||||
&format))
|
&format))
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -419,11 +419,11 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
|
|
||||||
/* Validate width and height */
|
/* Validate width and height */
|
||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Compressed texture images not supported */
|
/* Compressed texture images not supported */
|
||||||
if (gl_compressed == GL_TRUE)
|
if (gl_compressed == GL_TRUE)
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
/* Note: previously this code would query the texture object for
|
/* Note: previously this code would query the texture object for
|
||||||
whether it has GL_GENERATE_MIPMAP enabled to determine whether to
|
whether it has GL_GENERATE_MIPMAP enabled to determine whether to
|
||||||
@ -454,7 +454,7 @@ cogl_texture_2d_new_from_foreign (CoglContext *ctx,
|
|||||||
tex_2d->min_filter = GL_FALSE;
|
tex_2d->min_filter = GL_FALSE;
|
||||||
tex_2d->mag_filter = GL_FALSE;
|
tex_2d->mag_filter = GL_FALSE;
|
||||||
|
|
||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_object_new (tex_2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
||||||
@ -500,7 +500,7 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_object_new (tex_2d);
|
||||||
}
|
}
|
||||||
#endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */
|
#endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */
|
||||||
|
|
||||||
@ -574,16 +574,16 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
|||||||
#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */
|
#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_texture_2d_externally_modified (CoglHandle handle)
|
_cogl_texture_2d_externally_modified (CoglTexture *texture)
|
||||||
{
|
{
|
||||||
if (!cogl_is_texture_2d (handle))
|
if (!cogl_is_texture_2d (texture))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COGL_TEXTURE_2D (handle)->mipmaps_dirty = TRUE;
|
COGL_TEXTURE_2D (texture)->mipmaps_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_texture_2d_copy_from_framebuffer (CoglHandle handle,
|
_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *tex_2d,
|
||||||
int dst_x,
|
int dst_x,
|
||||||
int dst_y,
|
int dst_y,
|
||||||
int src_x,
|
int src_x,
|
||||||
@ -591,13 +591,9 @@ _cogl_texture_2d_copy_from_framebuffer (CoglHandle handle,
|
|||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d;
|
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
_COGL_RETURN_IF_FAIL (cogl_is_texture_2d (handle));
|
_COGL_RETURN_IF_FAIL (cogl_is_texture_2d (tex_2d));
|
||||||
|
|
||||||
tex_2d = COGL_TEXTURE_2D (handle);
|
|
||||||
|
|
||||||
/* Make sure the current framebuffers are bound, though we don't need to
|
/* Make sure the current framebuffers are bound, though we don't need to
|
||||||
* flush the clip state here since we aren't going to draw to the
|
* flush the clip state here since we aren't going to draw to the
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#ifndef __COGL_TEXTURE_3D_PRIVATE_H
|
#ifndef __COGL_TEXTURE_3D_PRIVATE_H
|
||||||
#define __COGL_TEXTURE_3D_PRIVATE_H
|
#define __COGL_TEXTURE_3D_PRIVATE_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-pipeline-private.h"
|
#include "cogl-pipeline-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-texture-3d.h"
|
#include "cogl-texture-3d.h"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "cogl-texture-3d.h"
|
#include "cogl-texture-3d.h"
|
||||||
#include "cogl-texture-driver.h"
|
#include "cogl-texture-driver.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-private.h"
|
#include "cogl-pipeline-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
@ -241,7 +241,7 @@ cogl_texture_3d_new_with_size (CoglContext *ctx,
|
|||||||
GE( ctx, glTexImage3D (GL_TEXTURE_3D, 0, gl_intformat,
|
GE( ctx, glTexImage3D (GL_TEXTURE_3D, 0, gl_intformat,
|
||||||
width, height, depth, 0, gl_format, gl_type, NULL) );
|
width, height, depth, 0, gl_format, gl_type, NULL) );
|
||||||
|
|
||||||
return _cogl_texture_3d_handle_new (tex_3d);
|
return _cogl_texture_3d_object_new (tex_3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture3D *
|
CoglTexture3D *
|
||||||
@ -325,7 +325,7 @@ cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
cogl_object_unref (dst_bmp);
|
cogl_object_unref (dst_bmp);
|
||||||
|
|
||||||
return _cogl_texture_3d_handle_new (tex_3d);
|
return _cogl_texture_3d_object_new (tex_3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture3D *
|
CoglTexture3D *
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define __COGL_TEXTURE_PRIVATE_H
|
#define __COGL_TEXTURE_PRIVATE_H
|
||||||
|
|
||||||
#include "cogl-bitmap-private.h"
|
#include "cogl-bitmap-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-pipeline-private.h"
|
#include "cogl-pipeline-private.h"
|
||||||
#include "cogl-spans.h"
|
#include "cogl-spans.h"
|
||||||
#include "cogl-meta-texture.h"
|
#include "cogl-meta-texture.h"
|
||||||
@ -181,12 +181,12 @@ void
|
|||||||
_cogl_texture_register_texture_type (const CoglObjectClass *klass);
|
_cogl_texture_register_texture_type (const CoglObjectClass *klass);
|
||||||
|
|
||||||
#define COGL_TEXTURE_DEFINE(TypeName, type_name) \
|
#define COGL_TEXTURE_DEFINE(TypeName, type_name) \
|
||||||
COGL_HANDLE_DEFINE_WITH_CODE \
|
COGL_OBJECT_DEFINE_WITH_CODE \
|
||||||
(TypeName, type_name, \
|
(TypeName, type_name, \
|
||||||
_cogl_texture_register_texture_type (&_cogl_##type_name##_class))
|
_cogl_texture_register_texture_type (&_cogl_##type_name##_class))
|
||||||
|
|
||||||
#define COGL_TEXTURE_INTERNAL_DEFINE(TypeName, type_name) \
|
#define COGL_TEXTURE_INTERNAL_DEFINE(TypeName, type_name) \
|
||||||
COGL_HANDLE_INTERNAL_DEFINE_WITH_CODE \
|
COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE \
|
||||||
(TypeName, type_name, \
|
(TypeName, type_name, \
|
||||||
_cogl_texture_register_texture_type (&_cogl_##type_name##_class))
|
_cogl_texture_register_texture_type (&_cogl_##type_name##_class))
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "cogl-texture-rectangle-private.h"
|
#include "cogl-texture-rectangle-private.h"
|
||||||
#include "cogl-texture-driver.h"
|
#include "cogl-texture-driver.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-journal-private.h"
|
#include "cogl-journal-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ _cogl_texture_rectangle_new_from_foreign (GLuint gl_handle,
|
|||||||
tex_rect->min_filter = GL_FALSE;
|
tex_rect->min_filter = GL_FALSE;
|
||||||
tex_rect->mag_filter = GL_FALSE;
|
tex_rect->mag_filter = GL_FALSE;
|
||||||
|
|
||||||
return _cogl_texture_rectangle_handle_new (tex_rect);
|
return _cogl_texture_rectangle_object_new (tex_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include "cogl-atlas-texture-private.h"
|
#include "cogl-atlas-texture-private.h"
|
||||||
#include "cogl-pipeline.h"
|
#include "cogl-pipeline.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-object-private.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-primitives.h"
|
#include "cogl-primitives.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
@ -66,8 +66,8 @@ cogl_texture_error_quark (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX:
|
/* XXX:
|
||||||
* The CoglHandle macros don't support any form of inheritance, so for
|
* The CoglObject macros don't support any form of inheritance, so for
|
||||||
* now we implement the CoglHandle support for the CoglTexture
|
* now we implement the CoglObject support for the CoglTexture
|
||||||
* abstract class manually.
|
* abstract class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ cogl_texture_new_with_size (unsigned int width,
|
|||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
/* First try creating a fast-path non-sliced texture */
|
/* First try creating a fast-path non-sliced texture */
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
||||||
@ -392,14 +392,14 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
CoglTextureFlags flags,
|
CoglTextureFlags flags,
|
||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglAtlasTexture *atlas_tex;
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
|
|
||||||
/* First try putting the texture in the atlas */
|
/* First try putting the texture in the atlas */
|
||||||
if ((tex = _cogl_atlas_texture_new_from_bitmap (bitmap,
|
if ((atlas_tex = _cogl_atlas_texture_new_from_bitmap (bitmap,
|
||||||
flags,
|
flags,
|
||||||
internal_format)))
|
internal_format)))
|
||||||
return tex;
|
return COGL_TEXTURE (atlas_tex);
|
||||||
|
|
||||||
/* If that doesn't work try a fast path 2D texture */
|
/* If that doesn't work try a fast path 2D texture */
|
||||||
if ((tex_2d = cogl_texture_2d_new_from_bitmap (bitmap,
|
if ((tex_2d = cogl_texture_2d_new_from_bitmap (bitmap,
|
||||||
@ -467,7 +467,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
CoglTextureRectangle *texture_rectangle;
|
CoglTextureRectangle *texture_rectangle;
|
||||||
CoglSubTexture *sub_texture;
|
CoglSubTexture *sub_texture;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
if (x_pot_waste != 0 || y_pot_waste != 0)
|
if (x_pot_waste != 0 || y_pot_waste != 0)
|
||||||
{
|
{
|
||||||
@ -475,7 +475,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
* the texture isn't limited to power of two sizes. */
|
* the texture isn't limited to power of two sizes. */
|
||||||
g_warning ("You can't create a foreign GL_TEXTURE_RECTANGLE cogl "
|
g_warning ("You can't create a foreign GL_TEXTURE_RECTANGLE cogl "
|
||||||
"texture with waste\n");
|
"texture with waste\n");
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_rectangle = _cogl_texture_rectangle_new_from_foreign (gl_handle,
|
texture_rectangle = _cogl_texture_rectangle_new_from_foreign (gl_handle,
|
||||||
@ -503,7 +503,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
format));
|
format));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
return COGL_TEXTURE (cogl_texture_2d_new_from_foreign (ctx,
|
return COGL_TEXTURE (cogl_texture_2d_new_from_foreign (ctx,
|
||||||
gl_handle,
|
gl_handle,
|
||||||
width,
|
width,
|
||||||
|
@ -239,7 +239,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
*
|
*
|
||||||
* Gets whether the given object references a texture object.
|
* Gets whether the given object references a texture object.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the handle references a texture, and
|
* Return value: %TRUE if the @object references a texture, and
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -60,7 +60,7 @@ typedef struct { \
|
|||||||
* Type used for storing references to cogl objects, the CoglHandle is
|
* Type used for storing references to cogl objects, the CoglHandle is
|
||||||
* a fully opaque type without any public data members.
|
* a fully opaque type without any public data members.
|
||||||
*/
|
*/
|
||||||
typedef gpointer CoglHandle;
|
typedef void * CoglHandle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* COGL_INVALID_HANDLE:
|
* COGL_INVALID_HANDLE:
|
||||||
@ -99,7 +99,7 @@ cogl_handle_unref (CoglHandle handle);
|
|||||||
* cogl_object_ref: (skip)
|
* cogl_object_ref: (skip)
|
||||||
* @object: a #CoglObject
|
* @object: a #CoglObject
|
||||||
*
|
*
|
||||||
* Increases the reference count of @handle by 1
|
* Increases the reference count of @object by 1
|
||||||
*
|
*
|
||||||
* Returns: the @object, with its reference count increased
|
* Returns: the @object, with its reference count increased
|
||||||
*/
|
*/
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#ifndef __COGL_VERTEX_BUFFER_H
|
#ifndef __COGL_VERTEX_BUFFER_H
|
||||||
#define __COGL_VERTEX_BUFFER_H
|
#define __COGL_VERTEX_BUFFER_H
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
|
|
||||||
#include "cogl-primitive.h"
|
#include "cogl-primitive.h"
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-vertex-buffer-private.h"
|
#include "cogl-vertex-buffer-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-pipeline.h"
|
#include "cogl-pipeline.h"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <cogl-xlib.h>
|
#include <cogl-xlib.h>
|
||||||
|
|
||||||
#include <cogl-internal.h>
|
#include <cogl-internal.h>
|
||||||
#include <cogl-handle.h>
|
#include <cogl-object-private.h>
|
||||||
#include <cogl-context-private.h>
|
#include <cogl-context-private.h>
|
||||||
#include <cogl-framebuffer-private.h>
|
#include <cogl-framebuffer-private.h>
|
||||||
#include <cogl-display-private.h>
|
#include <cogl-display-private.h>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-pipeline.h"
|
#include "cogl-pipeline.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-primitives.h"
|
#include "cogl-primitives.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "cogl-pipeline.h"
|
#include "cogl-pipeline.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-primitives.h"
|
#include "cogl-primitives.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-texture-private.h"
|
#include "cogl-texture-private.h"
|
||||||
#include "cogl-texture-pixmap-x11.h"
|
#include "cogl-texture-pixmap-x11.h"
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ struct _CoglTexturePixmapX11
|
|||||||
CoglTexture _parent;
|
CoglTexture _parent;
|
||||||
|
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
|
|
||||||
unsigned int depth;
|
unsigned int depth;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
#include "cogl-display-private.h"
|
#include "cogl-display-private.h"
|
||||||
#include "cogl-renderer-private.h"
|
#include "cogl-renderer-private.h"
|
||||||
#include "cogl-handle.h"
|
#include "cogl-object-private.h"
|
||||||
#include "cogl-winsys-private.h"
|
#include "cogl-winsys-private.h"
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
#include "cogl-pipeline-opengl-private.h"
|
||||||
#include "cogl-xlib.h"
|
#include "cogl-xlib.h"
|
||||||
@ -290,7 +290,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
|
|||||||
tex_pixmap->pixmap = pixmap;
|
tex_pixmap->pixmap = pixmap;
|
||||||
tex_pixmap->image = NULL;
|
tex_pixmap->image = NULL;
|
||||||
tex_pixmap->shm_info.shmid = -1;
|
tex_pixmap->shm_info.shmid = -1;
|
||||||
tex_pixmap->tex = COGL_INVALID_HANDLE;
|
tex_pixmap->tex = NULL;
|
||||||
tex_pixmap->damage_owned = FALSE;
|
tex_pixmap->damage_owned = FALSE;
|
||||||
tex_pixmap->damage = 0;
|
tex_pixmap->damage = 0;
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
|
|||||||
if (!tex_pixmap->use_winsys_texture)
|
if (!tex_pixmap->use_winsys_texture)
|
||||||
tex_pixmap->winsys = NULL;
|
tex_pixmap->winsys = NULL;
|
||||||
|
|
||||||
return _cogl_texture_pixmap_x11_handle_new (tex_pixmap);
|
return _cogl_texture_pixmap_x11_object_new (tex_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tries to allocate enough shared mem to handle a full size
|
/* Tries to allocate enough shared mem to handle a full size
|
||||||
@ -495,7 +495,7 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
/* We lazily create the texture the first time it is needed in case
|
/* We lazily create the texture the first time it is needed in case
|
||||||
this texture can be entirely handled using the GLX texture
|
this texture can be entirely handled using the GLX texture
|
||||||
instead */
|
instead */
|
||||||
if (tex_pixmap->tex == COGL_INVALID_HANDLE)
|
if (tex_pixmap->tex == NULL)
|
||||||
{
|
{
|
||||||
CoglPixelFormat texture_format;
|
CoglPixelFormat texture_format;
|
||||||
|
|
||||||
@ -638,10 +638,10 @@ _cogl_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
_cogl_texture_pixmap_x11_update_image_texture (tex_pixmap);
|
_cogl_texture_pixmap_x11_update_image_texture (tex_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglTexture *
|
||||||
_cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
_cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
||||||
{
|
{
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* We try getting the texture twice, once without flushing the
|
/* We try getting the texture twice, once without flushing the
|
||||||
@ -672,7 +672,7 @@ _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
|
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -697,9 +697,7 @@ _cogl_texture_pixmap_x11_get_data (CoglTexture *tex,
|
|||||||
guint8 *data)
|
guint8 *data)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
return cogl_texture_get_data (child_tex, format, rowstride, data);
|
return cogl_texture_get_data (child_tex, format, rowstride, data);
|
||||||
@ -743,7 +741,7 @@ _cogl_texture_pixmap_x11_foreach_sub_texture_in_region
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
|
|
||||||
@ -793,9 +791,7 @@ static int
|
|||||||
_cogl_texture_pixmap_x11_get_max_waste (CoglTexture *tex)
|
_cogl_texture_pixmap_x11_get_max_waste (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
return cogl_texture_get_max_waste (child_tex);
|
return cogl_texture_get_max_waste (child_tex);
|
||||||
}
|
}
|
||||||
@ -804,9 +800,7 @@ static gboolean
|
|||||||
_cogl_texture_pixmap_x11_is_sliced (CoglTexture *tex)
|
_cogl_texture_pixmap_x11_is_sliced (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
return cogl_texture_is_sliced (child_tex);
|
return cogl_texture_is_sliced (child_tex);
|
||||||
}
|
}
|
||||||
@ -815,9 +809,7 @@ static gboolean
|
|||||||
_cogl_texture_pixmap_x11_can_hardware_repeat (CoglTexture *tex)
|
_cogl_texture_pixmap_x11_can_hardware_repeat (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
return _cogl_texture_can_hardware_repeat (child_tex);
|
return _cogl_texture_can_hardware_repeat (child_tex);
|
||||||
}
|
}
|
||||||
@ -828,9 +820,7 @@ _cogl_texture_pixmap_x11_transform_coords_to_gl (CoglTexture *tex,
|
|||||||
float *t)
|
float *t)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
_cogl_texture_transform_coords_to_gl (child_tex, s, t);
|
_cogl_texture_transform_coords_to_gl (child_tex, s, t);
|
||||||
@ -841,9 +831,7 @@ _cogl_texture_pixmap_x11_transform_quad_coords_to_gl (CoglTexture *tex,
|
|||||||
float *coords)
|
float *coords)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
return _cogl_texture_transform_quad_coords_to_gl (child_tex, coords);
|
return _cogl_texture_transform_quad_coords_to_gl (child_tex, coords);
|
||||||
@ -855,9 +843,7 @@ _cogl_texture_pixmap_x11_get_gl_texture (CoglTexture *tex,
|
|||||||
GLenum *out_gl_target)
|
GLenum *out_gl_target)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
return cogl_texture_get_gl_texture (child_tex,
|
return cogl_texture_get_gl_texture (child_tex,
|
||||||
@ -871,9 +857,7 @@ _cogl_texture_pixmap_x11_set_filters (CoglTexture *tex,
|
|||||||
GLenum mag_filter)
|
GLenum mag_filter)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
_cogl_texture_set_filters (child_tex, min_filter, mag_filter);
|
_cogl_texture_set_filters (child_tex, min_filter, mag_filter);
|
||||||
@ -884,7 +868,7 @@ _cogl_texture_pixmap_x11_pre_paint (CoglTexture *tex,
|
|||||||
CoglTexturePrePaintFlags flags)
|
CoglTexturePrePaintFlags flags)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex;
|
||||||
|
|
||||||
_cogl_texture_pixmap_x11_update (tex_pixmap,
|
_cogl_texture_pixmap_x11_update (tex_pixmap,
|
||||||
!!(flags & COGL_TEXTURE_NEEDS_MIPMAP));
|
!!(flags & COGL_TEXTURE_NEEDS_MIPMAP));
|
||||||
@ -898,9 +882,7 @@ static void
|
|||||||
_cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex)
|
_cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
_cogl_texture_ensure_non_quad_rendering (child_tex);
|
_cogl_texture_ensure_non_quad_rendering (child_tex);
|
||||||
@ -913,9 +895,7 @@ _cogl_texture_pixmap_x11_set_wrap_mode_parameters (CoglTexture *tex,
|
|||||||
GLenum wrap_mode_p)
|
GLenum wrap_mode_p)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
_cogl_texture_set_wrap_mode_parameters (child_tex,
|
_cogl_texture_set_wrap_mode_parameters (child_tex,
|
||||||
@ -928,9 +908,7 @@ static CoglPixelFormat
|
|||||||
_cogl_texture_pixmap_x11_get_format (CoglTexture *tex)
|
_cogl_texture_pixmap_x11_get_format (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
/* Forward on to the child texture */
|
/* Forward on to the child texture */
|
||||||
return cogl_texture_get_format (child_tex);
|
return cogl_texture_get_format (child_tex);
|
||||||
@ -940,9 +918,7 @@ static GLenum
|
|||||||
_cogl_texture_pixmap_x11_get_gl_format (CoglTexture *tex)
|
_cogl_texture_pixmap_x11_get_gl_format (CoglTexture *tex)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
|
||||||
CoglHandle child_tex;
|
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
||||||
|
|
||||||
child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
|
|
||||||
|
|
||||||
return _cogl_texture_get_gl_format (child_tex);
|
return _cogl_texture_get_gl_format (child_tex);
|
||||||
}
|
}
|
||||||
@ -993,7 +969,7 @@ _cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tex_pixmap->tex)
|
if (tex_pixmap->tex)
|
||||||
cogl_handle_unref (tex_pixmap->tex);
|
cogl_object_unref (tex_pixmap->tex);
|
||||||
|
|
||||||
if (tex_pixmap->winsys)
|
if (tex_pixmap->winsys)
|
||||||
{
|
{
|
||||||
|
@ -680,7 +680,7 @@ _cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglTexture *
|
||||||
_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapEGL *egl_tex_pixmap = tex_pixmap->winsys;
|
CoglTexturePixmapEGL *egl_tex_pixmap = tex_pixmap->winsys;
|
||||||
|
@ -88,7 +88,7 @@ typedef struct _CoglTexturePixmapGLX
|
|||||||
gboolean has_mipmap_space;
|
gboolean has_mipmap_space;
|
||||||
gboolean can_mipmap;
|
gboolean can_mipmap;
|
||||||
|
|
||||||
CoglHandle glx_tex;
|
CoglTexture *glx_tex;
|
||||||
|
|
||||||
gboolean bind_tex_image_queued;
|
gboolean bind_tex_image_queued;
|
||||||
gboolean pixmap_bound;
|
gboolean pixmap_bound;
|
||||||
@ -1715,7 +1715,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
glx_tex_pixmap->can_mipmap = FALSE;
|
glx_tex_pixmap->can_mipmap = FALSE;
|
||||||
glx_tex_pixmap->has_mipmap_space = FALSE;
|
glx_tex_pixmap->has_mipmap_space = FALSE;
|
||||||
|
|
||||||
glx_tex_pixmap->glx_tex = COGL_INVALID_HANDLE;
|
glx_tex_pixmap->glx_tex = NULL;
|
||||||
|
|
||||||
glx_tex_pixmap->bind_tex_image_queued = TRUE;
|
glx_tex_pixmap->bind_tex_image_queued = TRUE;
|
||||||
glx_tex_pixmap->pixmap_bound = FALSE;
|
glx_tex_pixmap->pixmap_bound = FALSE;
|
||||||
@ -1793,7 +1793,7 @@ _cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
free_glx_pixmap (ctx, glx_tex_pixmap);
|
free_glx_pixmap (ctx, glx_tex_pixmap);
|
||||||
|
|
||||||
if (glx_tex_pixmap->glx_tex)
|
if (glx_tex_pixmap->glx_tex)
|
||||||
cogl_handle_unref (glx_tex_pixmap->glx_tex);
|
cogl_object_unref (glx_tex_pixmap->glx_tex);
|
||||||
|
|
||||||
tex_pixmap->winsys = NULL;
|
tex_pixmap->winsys = NULL;
|
||||||
g_free (glx_tex_pixmap);
|
g_free (glx_tex_pixmap);
|
||||||
@ -1817,7 +1817,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
glx_renderer = ctx->display->renderer->winsys;
|
glx_renderer = ctx->display->renderer->winsys;
|
||||||
|
|
||||||
/* Lazily create a texture to hold the pixmap */
|
/* Lazily create a texture to hold the pixmap */
|
||||||
if (glx_tex_pixmap->glx_tex == COGL_INVALID_HANDLE)
|
if (glx_tex_pixmap->glx_tex == NULL)
|
||||||
{
|
{
|
||||||
CoglPixelFormat texture_format;
|
CoglPixelFormat texture_format;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -1828,12 +1828,12 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
|
|
||||||
if (should_use_rectangle (ctx))
|
if (should_use_rectangle (ctx))
|
||||||
{
|
{
|
||||||
glx_tex_pixmap->glx_tex =
|
glx_tex_pixmap->glx_tex = COGL_TEXTURE (
|
||||||
cogl_texture_rectangle_new_with_size (ctx,
|
cogl_texture_rectangle_new_with_size (ctx,
|
||||||
tex_pixmap->width,
|
tex_pixmap->width,
|
||||||
tex_pixmap->height,
|
tex_pixmap->height,
|
||||||
texture_format,
|
texture_format,
|
||||||
&error);
|
&error));
|
||||||
|
|
||||||
if (glx_tex_pixmap->glx_tex)
|
if (glx_tex_pixmap->glx_tex)
|
||||||
COGL_NOTE (TEXTURE_PIXMAP, "Created a texture rectangle for %p",
|
COGL_NOTE (TEXTURE_PIXMAP, "Created a texture rectangle for %p",
|
||||||
@ -1850,12 +1850,12 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glx_tex_pixmap->glx_tex =
|
glx_tex_pixmap->glx_tex = COGL_TEXTURE (
|
||||||
cogl_texture_2d_new_with_size (ctx,
|
cogl_texture_2d_new_with_size (ctx,
|
||||||
tex_pixmap->width,
|
tex_pixmap->width,
|
||||||
tex_pixmap->height,
|
tex_pixmap->height,
|
||||||
texture_format,
|
texture_format,
|
||||||
NULL);
|
NULL));
|
||||||
|
|
||||||
if (glx_tex_pixmap->glx_tex)
|
if (glx_tex_pixmap->glx_tex)
|
||||||
COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p",
|
COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p",
|
||||||
@ -1895,7 +1895,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||||||
"with mipmap support failed", tex_pixmap);
|
"with mipmap support failed", tex_pixmap);
|
||||||
|
|
||||||
if (glx_tex_pixmap->glx_tex)
|
if (glx_tex_pixmap->glx_tex)
|
||||||
cogl_handle_unref (glx_tex_pixmap->glx_tex);
|
cogl_object_unref (glx_tex_pixmap->glx_tex);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1953,7 +1953,7 @@ _cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap)
|
|||||||
glx_tex_pixmap->bind_tex_image_queued = TRUE;
|
glx_tex_pixmap->bind_tex_image_queued = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglTexture *
|
||||||
_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
||||||
{
|
{
|
||||||
CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys;
|
CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys;
|
||||||
|
@ -154,7 +154,7 @@ typedef struct _CoglWinsysVtable
|
|||||||
void
|
void
|
||||||
(*texture_pixmap_x11_damage_notify) (CoglTexturePixmapX11 *tex_pixmap);
|
(*texture_pixmap_x11_damage_notify) (CoglTexturePixmapX11 *tex_pixmap);
|
||||||
|
|
||||||
CoglHandle
|
CoglTexture *
|
||||||
(*texture_pixmap_x11_get_texture) (CoglTexturePixmapX11 *tex_pixmap);
|
(*texture_pixmap_x11_get_texture) (CoglTexturePixmapX11 *tex_pixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ IGNORE_HFILES=\
|
|||||||
cogl-debug.h \
|
cogl-debug.h \
|
||||||
cogl-defines.h \
|
cogl-defines.h \
|
||||||
cogl-deprecated.h \
|
cogl-deprecated.h \
|
||||||
cogl-handle.h \
|
|
||||||
cogl-internal.h \
|
cogl-internal.h \
|
||||||
cogl-matrix-mesa.h \
|
cogl-matrix-mesa.h \
|
||||||
cogl-matrix-stack.h \
|
cogl-matrix-stack.h \
|
||||||
|
@ -98,7 +98,6 @@ IGNORE_HFILES=\
|
|||||||
cogl-debug.h \
|
cogl-debug.h \
|
||||||
cogl-defines.h \
|
cogl-defines.h \
|
||||||
cogl-deprecated.h \
|
cogl-deprecated.h \
|
||||||
cogl-handle.h \
|
|
||||||
cogl-internal.h \
|
cogl-internal.h \
|
||||||
cogl-matrix-mesa.h \
|
cogl-matrix-mesa.h \
|
||||||
cogl-matrix-stack.h \
|
cogl-matrix-stack.h \
|
||||||
|
@ -17,8 +17,8 @@ main (int argc, char **argv)
|
|||||||
{0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
|
{0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
|
||||||
};
|
};
|
||||||
CoglPrimitive *triangle;
|
CoglPrimitive *triangle;
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
CoglHandle offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglFramebuffer *offscreen_fb;
|
CoglFramebuffer *offscreen_fb;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ test_invalid_texture_layers (TestState *state, int x, int y)
|
|||||||
/* explicitly create a layer with an invalid handle. This may be desireable
|
/* explicitly create a layer with an invalid handle. This may be desireable
|
||||||
* if the user also sets a texture combine string that e.g. refers to a
|
* if the user also sets a texture combine string that e.g. refers to a
|
||||||
* constant color. */
|
* constant color. */
|
||||||
cogl_material_set_layer (material, 0, COGL_INVALID_HANDLE);
|
cogl_material_set_layer (material, 0, NULL);
|
||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ test_invalid_texture_layers_with_constant_colors (TestState *state,
|
|||||||
CoglColor constant_color;
|
CoglColor constant_color;
|
||||||
|
|
||||||
/* explicitly create a layer with an invalid handle */
|
/* explicitly create a layer with an invalid handle */
|
||||||
cogl_material_set_layer (material, 0, COGL_INVALID_HANDLE);
|
cogl_material_set_layer (material, 0, NULL);
|
||||||
|
|
||||||
/* ignore the fallback texture on the layer and use a constant color
|
/* ignore the fallback texture on the layer and use a constant color
|
||||||
instead */
|
instead */
|
||||||
|
@ -78,7 +78,7 @@ create_source_rect (void)
|
|||||||
|
|
||||||
#else /* GL_TEXTURE_RECTANGLE_ARB */
|
#else /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
|
||||||
return COGL_INVALID_HANDLE;
|
return NULL;
|
||||||
|
|
||||||
#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ draw_frame (TestState *state)
|
|||||||
CoglHandle tex_2d = create_source_2d ();
|
CoglHandle tex_2d = create_source_2d ();
|
||||||
CoglHandle material_2d = cogl_material_new ();
|
CoglHandle material_2d = cogl_material_new ();
|
||||||
|
|
||||||
g_assert (tex_rect != COGL_INVALID_HANDLE);
|
g_assert (tex_rect != NULL);
|
||||||
|
|
||||||
cogl_material_set_layer (material_rect, 0, tex_rect);
|
cogl_material_set_layer (material_rect, 0, tex_rect);
|
||||||
cogl_material_set_layer_filters (material_rect, 0,
|
cogl_material_set_layer_filters (material_rect, 0,
|
||||||
|
@ -88,15 +88,15 @@ test_utils_init (TestFlags flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CoglHandle offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglHandle tex = cogl_texture_2d_new_with_size (ctx,
|
CoglTexture2D *tex = cogl_texture_2d_new_with_size (ctx,
|
||||||
FB_WIDTH, FB_HEIGHT,
|
FB_WIDTH, FB_HEIGHT,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
if (!tex)
|
if (!tex)
|
||||||
g_critical ("Failed to allocate texture: %s", error->message);
|
g_critical ("Failed to allocate texture: %s", error->message);
|
||||||
|
|
||||||
offscreen = cogl_offscreen_new_to_texture (tex);
|
offscreen = cogl_offscreen_new_to_texture (COGL_TEXTURE (tex));
|
||||||
fb = COGL_FRAMEBUFFER (offscreen);
|
fb = COGL_FRAMEBUFFER (offscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user