mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
bitmap-pixbuf: Fix the bitmap loader on Quartz
The code for loading a CoglBitmap from a file was missed when
upgrading to the new cogl_bitmap_new_for_data function in commit
d18b59d9e6
so it wouldn't compile. This changes it to use
_cogl_bitmap_new_with_malloc_buffer to allocate the buffer.
https://bugzilla.gnome.org/show_bug.cgi?id=672533
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 5b785dd441a83024333e0a2f2b83d067f891194f)
This commit is contained in:
parent
d2a5d6f361
commit
eaf29af7ee
@ -68,6 +68,9 @@ _cogl_bitmap_from_file (const char *filename,
|
||||
guint8 *out_data;
|
||||
CGColorSpaceRef color_space;
|
||||
CGContextRef bitmap_context;
|
||||
CoglBitmap *bmp;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
g_assert (filename != NULL);
|
||||
g_assert (error == NULL || *error == NULL);
|
||||
@ -123,8 +126,13 @@ _cogl_bitmap_from_file (const char *filename,
|
||||
}
|
||||
|
||||
/* allocate buffer big enough to hold pixel data */
|
||||
rowstride = 4 * width;
|
||||
out_data = g_malloc0 (height * rowstride);
|
||||
bmp = _cogl_bitmap_new_with_malloc_buffer (ctx,
|
||||
width, height,
|
||||
COGL_PIXEL_FORMAT_ARGB_8888);
|
||||
rowstride = cogl_bitmap_get_rowstride (bmp);
|
||||
out_data = _cogl_bitmap_map (bmp,
|
||||
COGL_BUFFER_ACCESS_WRITE,
|
||||
COGL_BUFFER_MAP_HINT_DISCARD);
|
||||
|
||||
/* render to buffer */
|
||||
color_space = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
|
||||
@ -143,13 +151,10 @@ _cogl_bitmap_from_file (const char *filename,
|
||||
CGImageRelease (image);
|
||||
CGContextRelease (bitmap_context);
|
||||
|
||||
_cogl_bitmap_unmap (bmp);
|
||||
|
||||
/* store bitmap info */
|
||||
return _cogl_bitmap_new_from_data (out_data,
|
||||
COGL_PIXEL_FORMAT_ARGB_8888,
|
||||
width, height,
|
||||
rowstride,
|
||||
(CoglBitmapDestroyNotify) g_free,
|
||||
NULL);
|
||||
return bmp;
|
||||
}
|
||||
|
||||
#elif defined(USE_GDKPIXBUF)
|
||||
|
Loading…
Reference in New Issue
Block a user