{
struct yagl_onscreen_image_gl_texture_2d *image = (struct yagl_onscreen_image_gl_texture_2d *)ref;
- yagl_object_release(image->texture_obj);
-
yagl_image_cleanup(&image->base);
yagl_free(image);
{
struct yagl_client_image *client_image;
struct yagl_onscreen_image_gl_texture_2d *image;
- struct yagl_object *texture_obj = NULL;
image = yagl_malloc0(sizeof(*image));
client_image = iface->wrap_texture(iface,
ctx->client_ctx,
- texture,
- &texture_obj);
+ texture);
if (!client_image) {
yagl_set_error(EGL_BAD_PARAMETER);
image->base.update = &yagl_onscreen_image_gl_texture_2d_update;
- image->texture_obj = texture_obj;
-
return image;
fail:
- if (texture_obj) {
- yagl_object_release(texture_obj);
- }
-
yagl_free(image);
return NULL;
struct yagl_onscreen_image_gl_texture_2d
{
struct yagl_image base;
-
- struct yagl_object *texture_obj;
};
struct yagl_onscreen_image_gl_texture_2d
{
struct yagl_gles_image *image = (struct yagl_gles_image*)ref;
- if (image->own_tex) {
+ if (image->texture_obj) {
+ yagl_gles_texture_release(image->texture_obj);
+ } else {
yagl_host_glDeleteObjects(&image->tex_global_name, 1);
}
image->base.update = &yagl_gles_image_update;
image->tex_global_name = tex_global_name;
- image->own_tex = 1;
return image;
}
struct yagl_gles_image *yagl_gles_image_wrap_tex(struct yagl_client_context *ctx,
- yagl_object_name tex_local_name,
- struct yagl_object **obj)
+ yagl_object_name tex_local_name)
{
struct yagl_gles_texture *texture_obj;
struct yagl_gles_image *image;
image->base.update = &yagl_gles_image_update;
image->tex_global_name = texture_obj->global_name;
- image->own_tex = 0;
-
- *obj = &texture_obj->base;
+ image->texture_obj = texture_obj;
return image;
#include "yagl_types.h"
#include "yagl_client_image.h"
+struct yagl_gles_texture;
struct yagl_client_context;
struct yagl_gles_image
yagl_object_name tex_global_name;
- int own_tex;
+ /*
+ * Non-NULL if the image wraps this texture object
+ */
+ struct yagl_gles_texture *texture_obj;
};
struct yagl_gles_image *yagl_gles_image_create(yagl_object_name tex_global_name);
struct yagl_gles_image *yagl_gles_image_wrap_tex(struct yagl_client_context *ctx,
- yagl_object_name tex_local_name,
- struct yagl_object **obj);
+ yagl_object_name tex_local_name);
/*
* Passing NULL won't hurt, this is for convenience.
static struct yagl_client_image
*yagl_gles1_wrap_texture(struct yagl_client_interface *iface,
struct yagl_client_context *ctx,
- yagl_object_name tex_local_name,
- struct yagl_object **texture_obj)
+ yagl_object_name tex_local_name)
{
- return &yagl_gles_image_wrap_tex(ctx,tex_local_name, texture_obj)->base;
+ return &yagl_gles_image_wrap_tex(ctx,tex_local_name)->base;
}
static void yagl_gles1_release_tex_image(struct yagl_client_interface *iface,
static struct yagl_client_image
*yagl_gles2_wrap_texture(struct yagl_client_interface *iface,
struct yagl_client_context *ctx,
- yagl_object_name tex_local_name,
- struct yagl_object **texture_obj)
+ yagl_object_name tex_local_name)
{
- return &yagl_gles_image_wrap_tex(ctx, tex_local_name, texture_obj)->base;
+ return &yagl_gles_image_wrap_tex(ctx, tex_local_name)->base;
}
static void yagl_gles2_release_tex_image(struct yagl_client_interface *iface,
struct yagl_client_context;
struct yagl_client_image;
struct yagl_sharegroup;
-struct yagl_object;
struct yagl_client_interface
{
struct yagl_client_image
*(*wrap_texture)(struct yagl_client_interface */*iface*/,
struct yagl_client_context */*ctx*/,
- yagl_object_name /*tex_local_name*/,
- struct yagl_object **/*obj*/);
+ yagl_object_name /*tex_local_name*/);
void (*release_tex_image)(struct yagl_client_interface */*iface*/,
void */*cookie*/);