mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
Fix GLES backends after merging the async-textures branch
The changes from the GL version of cogl-texture.c have been mirrored in the GLES version. This adds the cogl_texture_new_from_bitmap function and fixes the build errors.
This commit is contained in:
parent
9ec4c29003
commit
6e2efcd45b
@ -1447,30 +1447,13 @@ cogl_texture_new_from_data (guint width,
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_texture_new_from_file (const gchar *filename,
|
||||
gint max_waste,
|
||||
gboolean auto_mipmap,
|
||||
CoglPixelFormat internal_format,
|
||||
GError **error)
|
||||
cogl_texture_new_from_bitmap (CoglBitmap *bmp,
|
||||
gint max_waste,
|
||||
gboolean auto_mipmap,
|
||||
CoglPixelFormat internal_format)
|
||||
{
|
||||
CoglBitmap bmp;
|
||||
CoglTexture *tex;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
|
||||
|
||||
/* Try loading with imaging backend */
|
||||
if (!_cogl_bitmap_from_file (&bmp, filename, error))
|
||||
{
|
||||
/* Try fallback */
|
||||
if (!_cogl_bitmap_fallback_from_file (&bmp, filename))
|
||||
return COGL_INVALID_HANDLE;
|
||||
else if (error && *error)
|
||||
{
|
||||
g_error_free (*error);
|
||||
*error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create new texture and fill with loaded data */
|
||||
tex = (CoglTexture*) g_malloc ( sizeof (CoglTexture));
|
||||
|
||||
@ -1480,8 +1463,9 @@ cogl_texture_new_from_file (const gchar *filename,
|
||||
tex->is_foreign = FALSE;
|
||||
tex->auto_mipmap = auto_mipmap;
|
||||
|
||||
tex->bitmap = bmp;
|
||||
tex->bitmap = *bmp;
|
||||
tex->bitmap_owner = TRUE;
|
||||
bmp->data = NULL;
|
||||
|
||||
tex->slice_x_spans = NULL;
|
||||
tex->slice_y_spans = NULL;
|
||||
@ -1522,6 +1506,30 @@ cogl_texture_new_from_file (const gchar *filename,
|
||||
return _cogl_texture_handle_new (tex);
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_texture_new_from_file (const gchar *filename,
|
||||
gint max_waste,
|
||||
gboolean auto_mipmap,
|
||||
CoglPixelFormat internal_format,
|
||||
GError **error)
|
||||
{
|
||||
CoglBitmap *bmp;
|
||||
CoglHandle handle;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
|
||||
|
||||
if (!(bmp = cogl_bitmap_new_from_file (filename, error)))
|
||||
return COGL_INVALID_HANDLE;
|
||||
|
||||
handle = cogl_texture_new_from_bitmap (bmp,
|
||||
max_waste,
|
||||
auto_mipmap,
|
||||
internal_format);
|
||||
cogl_bitmap_free (bmp);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_texture_new_from_foreign (GLuint gl_handle,
|
||||
GLenum gl_target,
|
||||
|
Loading…
Reference in New Issue
Block a user