Make _cogl_bitmap_get_{width,height,format,rowstride} public
This are now marked as public experimental Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
3700cc26a5
commit
1397a2da19
@ -528,11 +528,11 @@ _cogl_atlas_texture_prepare_for_upload (CoglAtlasTexture *atlas_tex,
|
|||||||
|
|
||||||
override_bmp =
|
override_bmp =
|
||||||
_cogl_bitmap_new_shared (converted_bmp,
|
_cogl_bitmap_new_shared (converted_bmp,
|
||||||
_cogl_bitmap_get_format (converted_bmp) &
|
cogl_bitmap_get_format (converted_bmp) &
|
||||||
~COGL_PREMULT_BIT,
|
~COGL_PREMULT_BIT,
|
||||||
_cogl_bitmap_get_width (converted_bmp),
|
cogl_bitmap_get_width (converted_bmp),
|
||||||
_cogl_bitmap_get_height (converted_bmp),
|
cogl_bitmap_get_height (converted_bmp),
|
||||||
_cogl_bitmap_get_rowstride (converted_bmp));
|
cogl_bitmap_get_rowstride (converted_bmp));
|
||||||
|
|
||||||
cogl_object_unref (converted_bmp);
|
cogl_object_unref (converted_bmp);
|
||||||
|
|
||||||
@ -739,9 +739,9 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
|
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
|
||||||
|
|
||||||
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);
|
||||||
bmp_format = _cogl_bitmap_get_format (bmp);
|
bmp_format = cogl_bitmap_get_format (bmp);
|
||||||
|
|
||||||
internal_format = _cogl_texture_determine_internal_format (bmp_format,
|
internal_format = _cogl_texture_determine_internal_format (bmp_format,
|
||||||
internal_format);
|
internal_format);
|
||||||
|
@ -360,15 +360,15 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
|
|||||||
gboolean use_16;
|
gboolean use_16;
|
||||||
gboolean need_premult;
|
gboolean need_premult;
|
||||||
|
|
||||||
src_format = _cogl_bitmap_get_format (src_bmp);
|
src_format = cogl_bitmap_get_format (src_bmp);
|
||||||
src_rowstride = _cogl_bitmap_get_rowstride (src_bmp);
|
src_rowstride = cogl_bitmap_get_rowstride (src_bmp);
|
||||||
dst_format = _cogl_bitmap_get_format (dst_bmp);
|
dst_format = cogl_bitmap_get_format (dst_bmp);
|
||||||
dst_rowstride = _cogl_bitmap_get_rowstride (dst_bmp);
|
dst_rowstride = cogl_bitmap_get_rowstride (dst_bmp);
|
||||||
width = _cogl_bitmap_get_width (src_bmp);
|
width = cogl_bitmap_get_width (src_bmp);
|
||||||
height = _cogl_bitmap_get_height (src_bmp);
|
height = cogl_bitmap_get_height (src_bmp);
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (width == _cogl_bitmap_get_width (dst_bmp), FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (width == cogl_bitmap_get_width (dst_bmp), FALSE);
|
||||||
_COGL_RETURN_VAL_IF_FAIL (height == _cogl_bitmap_get_height (dst_bmp), FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (height == cogl_bitmap_get_height (dst_bmp), FALSE);
|
||||||
|
|
||||||
need_premult
|
need_premult
|
||||||
= ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) &&
|
= ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) &&
|
||||||
@ -476,8 +476,8 @@ _cogl_bitmap_convert (CoglBitmap *src_bmp,
|
|||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
width = _cogl_bitmap_get_width (src_bmp);
|
width = cogl_bitmap_get_width (src_bmp);
|
||||||
height = _cogl_bitmap_get_height (src_bmp);
|
height = cogl_bitmap_get_height (src_bmp);
|
||||||
dst_bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format);
|
dst_bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format);
|
||||||
dst_rowstride = (sizeof (guint8) * dst_bpp * width + 3) & ~3;
|
dst_rowstride = (sizeof (guint8) * dst_bpp * width + 3) & ~3;
|
||||||
|
|
||||||
@ -510,10 +510,10 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp)
|
|||||||
int width, height;
|
int width, height;
|
||||||
int rowstride;
|
int rowstride;
|
||||||
|
|
||||||
format = _cogl_bitmap_get_format (bmp);
|
format = cogl_bitmap_get_format (bmp);
|
||||||
width = _cogl_bitmap_get_width (bmp);
|
width = cogl_bitmap_get_width (bmp);
|
||||||
height = _cogl_bitmap_get_height (bmp);
|
height = cogl_bitmap_get_height (bmp);
|
||||||
rowstride = _cogl_bitmap_get_rowstride (bmp);
|
rowstride = cogl_bitmap_get_rowstride (bmp);
|
||||||
|
|
||||||
if ((data = _cogl_bitmap_map (bmp,
|
if ((data = _cogl_bitmap_map (bmp,
|
||||||
COGL_BUFFER_ACCESS_READ |
|
COGL_BUFFER_ACCESS_READ |
|
||||||
@ -576,10 +576,10 @@ _cogl_bitmap_premult (CoglBitmap *bmp)
|
|||||||
int width, height;
|
int width, height;
|
||||||
int rowstride;
|
int rowstride;
|
||||||
|
|
||||||
format = _cogl_bitmap_get_format (bmp);
|
format = cogl_bitmap_get_format (bmp);
|
||||||
width = _cogl_bitmap_get_width (bmp);
|
width = cogl_bitmap_get_width (bmp);
|
||||||
height = _cogl_bitmap_get_height (bmp);
|
height = cogl_bitmap_get_height (bmp);
|
||||||
rowstride = _cogl_bitmap_get_rowstride (bmp);
|
rowstride = cogl_bitmap_get_rowstride (bmp);
|
||||||
|
|
||||||
if ((data = _cogl_bitmap_map (bmp,
|
if ((data = _cogl_bitmap_map (bmp,
|
||||||
COGL_BUFFER_ACCESS_READ |
|
COGL_BUFFER_ACCESS_READ |
|
||||||
|
@ -124,22 +124,10 @@ _cogl_bitmap_get_size_from_file (const char *filename,
|
|||||||
int *width,
|
int *width,
|
||||||
int *height);
|
int *height);
|
||||||
|
|
||||||
CoglPixelFormat
|
|
||||||
_cogl_bitmap_get_format (CoglBitmap *bitmap);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_bitmap_set_format (CoglBitmap *bitmap,
|
_cogl_bitmap_set_format (CoglBitmap *bitmap,
|
||||||
CoglPixelFormat format);
|
CoglPixelFormat format);
|
||||||
|
|
||||||
int
|
|
||||||
_cogl_bitmap_get_width (CoglBitmap *bitmap);
|
|
||||||
|
|
||||||
int
|
|
||||||
_cogl_bitmap_get_height (CoglBitmap *bitmap);
|
|
||||||
|
|
||||||
int
|
|
||||||
_cogl_bitmap_get_rowstride (CoglBitmap *bitmap);
|
|
||||||
|
|
||||||
/* Maps the bitmap so that the pixels can be accessed directly or if
|
/* Maps the bitmap so that the pixels can be accessed directly or if
|
||||||
the bitmap is just a memory bitmap then it just returns the pointer
|
the bitmap is just a memory bitmap then it just returns the pointer
|
||||||
to memory. Note that the bitmap isn't guaranteed to allocated to
|
to memory. Note that the bitmap isn't guaranteed to allocated to
|
||||||
|
@ -104,10 +104,10 @@ CoglBitmap *
|
|||||||
_cogl_bitmap_copy (CoglBitmap *src_bmp)
|
_cogl_bitmap_copy (CoglBitmap *src_bmp)
|
||||||
{
|
{
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
CoglPixelFormat src_format = _cogl_bitmap_get_format (src_bmp);
|
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (src_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (src_format);
|
||||||
int width = _cogl_bitmap_get_width (src_bmp);
|
int width = cogl_bitmap_get_width (src_bmp);
|
||||||
int height = _cogl_bitmap_get_height (src_bmp);
|
int height = cogl_bitmap_get_height (src_bmp);
|
||||||
int dst_rowstride = width * bpp;
|
int dst_rowstride = width * bpp;
|
||||||
|
|
||||||
/* Round the rowstride up to the next nearest multiple of 4 bytes */
|
/* Round the rowstride up to the next nearest multiple of 4 bytes */
|
||||||
@ -300,7 +300,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglPixelFormat
|
CoglPixelFormat
|
||||||
_cogl_bitmap_get_format (CoglBitmap *bitmap)
|
cogl_bitmap_get_format (CoglBitmap *bitmap)
|
||||||
{
|
{
|
||||||
return bitmap->format;
|
return bitmap->format;
|
||||||
}
|
}
|
||||||
@ -313,29 +313,29 @@ _cogl_bitmap_set_format (CoglBitmap *bitmap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_cogl_bitmap_get_width (CoglBitmap *bitmap)
|
cogl_bitmap_get_width (CoglBitmap *bitmap)
|
||||||
{
|
{
|
||||||
return bitmap->width;
|
return bitmap->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
cogl_bitmap_get_height (CoglBitmap *bitmap)
|
||||||
|
{
|
||||||
|
return bitmap->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
cogl_bitmap_get_rowstride (CoglBitmap *bitmap)
|
||||||
|
{
|
||||||
|
return bitmap->rowstride;
|
||||||
|
}
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
cogl_bitmap_error_quark (void)
|
cogl_bitmap_error_quark (void)
|
||||||
{
|
{
|
||||||
return g_quark_from_static_string ("cogl-bitmap-error-quark");
|
return g_quark_from_static_string ("cogl-bitmap-error-quark");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
_cogl_bitmap_get_height (CoglBitmap *bitmap)
|
|
||||||
{
|
|
||||||
return bitmap->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
_cogl_bitmap_get_rowstride (CoglBitmap *bitmap)
|
|
||||||
{
|
|
||||||
return bitmap->rowstride;
|
|
||||||
}
|
|
||||||
|
|
||||||
guint8 *
|
guint8 *
|
||||||
_cogl_bitmap_map (CoglBitmap *bitmap,
|
_cogl_bitmap_map (CoglBitmap *bitmap,
|
||||||
CoglBufferAccess access,
|
CoglBufferAccess access,
|
||||||
|
@ -128,7 +128,53 @@ cogl_bitmap_new_with_size (CoglContext *context,
|
|||||||
unsigned int height,
|
unsigned int height,
|
||||||
CoglPixelFormat format);
|
CoglPixelFormat format);
|
||||||
|
|
||||||
#endif
|
/**
|
||||||
|
* cogl_bitmap_get_format:
|
||||||
|
* @bitmap: A #CoglBitmap
|
||||||
|
*
|
||||||
|
* Return value: the #CoglPixelFormat that the data for the bitmap is in.
|
||||||
|
* Since: 1.10
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
CoglPixelFormat
|
||||||
|
cogl_bitmap_get_format (CoglBitmap *bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_bitmap_get_width:
|
||||||
|
* @bitmap: A #CoglBitmap
|
||||||
|
*
|
||||||
|
* Return value: the width of the bitmap
|
||||||
|
* Since: 1.10
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
cogl_bitmap_get_width (CoglBitmap *bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_bitmap_get_height:
|
||||||
|
* @bitmap: A #CoglBitmap
|
||||||
|
*
|
||||||
|
* Return value: the height of the bitmap
|
||||||
|
* Since: 1.10
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
cogl_bitmap_get_height (CoglBitmap *bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_bitmap_get_rowstride:
|
||||||
|
* @bitmap: A #CoglBitmap
|
||||||
|
*
|
||||||
|
* Return value: the rowstride of the bitmap. This is the number of
|
||||||
|
* bytes between the address of start of one row to the address of the
|
||||||
|
* next row in the image.
|
||||||
|
* Since: 1.10
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
cogl_bitmap_get_rowstride (CoglBitmap *bitmap);
|
||||||
|
|
||||||
|
#endif /* COGL_ENABLE_EXPERIMENTAL_API */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_bitmap_get_size_from_file:
|
* cogl_bitmap_get_size_from_file:
|
||||||
|
@ -1879,7 +1879,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
|
|||||||
if (source != COGL_READ_PIXELS_COLOR_BUFFER)
|
if (source != COGL_READ_PIXELS_COLOR_BUFFER)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
format = _cogl_bitmap_get_format (bitmap);
|
format = cogl_bitmap_get_format (bitmap);
|
||||||
|
|
||||||
if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE &&
|
if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE &&
|
||||||
format != COGL_PIXEL_FORMAT_RGBA_8888)
|
format != COGL_PIXEL_FORMAT_RGBA_8888)
|
||||||
@ -1960,8 +1960,8 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|||||||
|
|
||||||
ctx = cogl_framebuffer_get_context (framebuffer);
|
ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
|
|
||||||
width = _cogl_bitmap_get_width (bitmap);
|
width = cogl_bitmap_get_width (bitmap);
|
||||||
height = _cogl_bitmap_get_height (bitmap);
|
height = cogl_bitmap_get_height (bitmap);
|
||||||
|
|
||||||
if (width == 1 && height == 1 && !framebuffer->clear_clip_dirty)
|
if (width == 1 && height == 1 && !framebuffer->clear_clip_dirty)
|
||||||
{
|
{
|
||||||
@ -1998,7 +1998,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|||||||
if (!cogl_is_offscreen (framebuffer))
|
if (!cogl_is_offscreen (framebuffer))
|
||||||
y = framebuffer_height - y - height;
|
y = framebuffer_height - y - height;
|
||||||
|
|
||||||
format = _cogl_bitmap_get_format (bitmap);
|
format = cogl_bitmap_get_format (bitmap);
|
||||||
|
|
||||||
required_format = ctx->texture_driver->pixel_format_to_gl (format,
|
required_format = ctx->texture_driver->pixel_format_to_gl (format,
|
||||||
&gl_intformat,
|
&gl_intformat,
|
||||||
@ -2028,7 +2028,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|||||||
because GLES does not support setting GL_ROW_LENGTH */
|
because GLES does not support setting GL_ROW_LENGTH */
|
||||||
if ((ctx->driver != COGL_DRIVER_GL &&
|
if ((ctx->driver != COGL_DRIVER_GL &&
|
||||||
(gl_format != GL_RGBA || gl_type != GL_UNSIGNED_BYTE ||
|
(gl_format != GL_RGBA || gl_type != GL_UNSIGNED_BYTE ||
|
||||||
_cogl_bitmap_get_rowstride (bitmap) != 4 * width)) ||
|
cogl_bitmap_get_rowstride (bitmap) != 4 * width)) ||
|
||||||
(required_format & ~COGL_PREMULT_BIT) != (format & ~COGL_PREMULT_BIT))
|
(required_format & ~COGL_PREMULT_BIT) != (format & ~COGL_PREMULT_BIT))
|
||||||
{
|
{
|
||||||
CoglBitmap *tmp_bmp;
|
CoglBitmap *tmp_bmp;
|
||||||
@ -2081,7 +2081,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|||||||
gboolean succeeded = FALSE;
|
gboolean succeeded = FALSE;
|
||||||
guint8 *pixels;
|
guint8 *pixels;
|
||||||
|
|
||||||
rowstride = _cogl_bitmap_get_rowstride (bitmap);
|
rowstride = cogl_bitmap_get_rowstride (bitmap);
|
||||||
|
|
||||||
/* We match the premultiplied state of the target buffer to the
|
/* We match the premultiplied state of the target buffer to the
|
||||||
* premultiplied state of the framebuffer so that it will get
|
* premultiplied state of the framebuffer so that it will get
|
||||||
@ -2141,7 +2141,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|||||||
int rowstride;
|
int rowstride;
|
||||||
guint8 *pixels;
|
guint8 *pixels;
|
||||||
|
|
||||||
rowstride = _cogl_bitmap_get_rowstride (bitmap);
|
rowstride = cogl_bitmap_get_rowstride (bitmap);
|
||||||
pixels = _cogl_bitmap_map (bitmap,
|
pixels = _cogl_bitmap_map (bitmap,
|
||||||
COGL_BUFFER_ACCESS_READ |
|
COGL_BUFFER_ACCESS_READ |
|
||||||
COGL_BUFFER_ACCESS_WRITE,
|
COGL_BUFFER_ACCESS_WRITE,
|
||||||
|
@ -1810,7 +1810,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal,
|
|||||||
if (journal->fast_read_pixel_count > 50)
|
if (journal->fast_read_pixel_count > 50)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
format = _cogl_bitmap_get_format (bitmap);
|
format = cogl_bitmap_get_format (bitmap);
|
||||||
|
|
||||||
if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE &&
|
if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE &&
|
||||||
format != COGL_PIXEL_FORMAT_RGBA_8888)
|
format != COGL_PIXEL_FORMAT_RGBA_8888)
|
||||||
|
@ -187,8 +187,8 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
|
|||||||
|
|
||||||
if (need_x || need_y)
|
if (need_x || need_y)
|
||||||
{
|
{
|
||||||
int bmp_rowstride = _cogl_bitmap_get_rowstride (source_bmp);
|
int bmp_rowstride = cogl_bitmap_get_rowstride (source_bmp);
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
guint8 *bmp_data;
|
guint8 *bmp_data;
|
||||||
const guint8 *src;
|
const guint8 *src;
|
||||||
@ -318,7 +318,7 @@ _cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
guint8 *waste_buf;
|
guint8 *waste_buf;
|
||||||
CoglPixelFormat bmp_format;
|
CoglPixelFormat bmp_format;
|
||||||
|
|
||||||
bmp_format = _cogl_bitmap_get_format (bmp);
|
bmp_format = cogl_bitmap_get_format (bmp);
|
||||||
|
|
||||||
waste_buf = _cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds,
|
waste_buf = _cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds,
|
||||||
bmp_format);
|
bmp_format);
|
||||||
@ -406,7 +406,7 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
|
|||||||
guint8 *waste_buf;
|
guint8 *waste_buf;
|
||||||
CoglPixelFormat source_format;
|
CoglPixelFormat source_format;
|
||||||
|
|
||||||
source_format = _cogl_bitmap_get_format (source_bmp);
|
source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
|
|
||||||
waste_buf =
|
waste_buf =
|
||||||
_cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds, source_format);
|
_cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds, source_format);
|
||||||
@ -884,8 +884,8 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
|
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
|
||||||
|
|
||||||
width = _cogl_bitmap_get_width (bmp);
|
width = cogl_bitmap_get_width (bmp);
|
||||||
height = _cogl_bitmap_get_height (bmp);
|
height = cogl_bitmap_get_height (bmp);
|
||||||
|
|
||||||
/* Create new texture and fill with loaded data */
|
/* Create new texture and fill with loaded data */
|
||||||
tex_2ds = g_new0 (CoglTexture2DSliced, 1);
|
tex_2ds = g_new0 (CoglTexture2DSliced, 1);
|
||||||
|
@ -228,11 +228,11 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
_COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE);
|
_COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE);
|
||||||
|
|
||||||
internal_format =
|
internal_format =
|
||||||
_cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp),
|
_cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp),
|
||||||
internal_format);
|
internal_format);
|
||||||
|
|
||||||
if (!_cogl_texture_2d_can_create (_cogl_bitmap_get_width (bmp),
|
if (!_cogl_texture_2d_can_create (cogl_bitmap_get_width (bmp),
|
||||||
_cogl_bitmap_get_height (bmp),
|
cogl_bitmap_get_height (bmp),
|
||||||
internal_format))
|
internal_format))
|
||||||
{
|
{
|
||||||
g_set_error (error, COGL_TEXTURE_ERROR,
|
g_set_error (error, COGL_TEXTURE_ERROR,
|
||||||
@ -256,8 +256,8 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tex_2d = _cogl_texture_2d_create_base (_cogl_bitmap_get_width (bmp),
|
tex_2d = _cogl_texture_2d_create_base (cogl_bitmap_get_width (bmp),
|
||||||
_cogl_bitmap_get_height (bmp),
|
cogl_bitmap_get_height (bmp),
|
||||||
flags,
|
flags,
|
||||||
internal_format);
|
internal_format);
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
(data = _cogl_bitmap_map (dst_bmp,
|
(data = _cogl_bitmap_map (dst_bmp,
|
||||||
COGL_BUFFER_ACCESS_READ, 0)))
|
COGL_BUFFER_ACCESS_READ, 0)))
|
||||||
{
|
{
|
||||||
CoglPixelFormat format = _cogl_bitmap_get_format (dst_bmp);
|
CoglPixelFormat format = cogl_bitmap_get_format (dst_bmp);
|
||||||
tex_2d->first_pixel.gl_format = gl_format;
|
tex_2d->first_pixel.gl_format = gl_format;
|
||||||
tex_2d->first_pixel.gl_type = gl_type;
|
tex_2d->first_pixel.gl_type = gl_type;
|
||||||
memcpy (tex_2d->first_pixel.data, data,
|
memcpy (tex_2d->first_pixel.data, data,
|
||||||
@ -770,11 +770,11 @@ _cogl_texture_2d_set_region (CoglTexture *tex,
|
|||||||
(data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ, 0)))
|
(data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ, 0)))
|
||||||
{
|
{
|
||||||
CoglPixelFormat bpp =
|
CoglPixelFormat bpp =
|
||||||
_cogl_pixel_format_get_bytes_per_pixel (_cogl_bitmap_get_format (bmp));
|
_cogl_pixel_format_get_bytes_per_pixel (cogl_bitmap_get_format (bmp));
|
||||||
tex_2d->first_pixel.gl_format = gl_format;
|
tex_2d->first_pixel.gl_format = gl_format;
|
||||||
tex_2d->first_pixel.gl_type = gl_type;
|
tex_2d->first_pixel.gl_type = gl_type;
|
||||||
memcpy (tex_2d->first_pixel.data,
|
memcpy (tex_2d->first_pixel.data,
|
||||||
data + _cogl_bitmap_get_rowstride (bmp) * src_y + bpp * src_x,
|
data + cogl_bitmap_get_rowstride (bmp) * src_y + bpp * src_x,
|
||||||
bpp);
|
bpp);
|
||||||
|
|
||||||
_cogl_bitmap_unmap (bmp);
|
_cogl_bitmap_unmap (bmp);
|
||||||
|
@ -249,8 +249,8 @@ _cogl_texture_3d_new_from_bitmap (CoglContext *ctx,
|
|||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
bmp_width = _cogl_bitmap_get_width (bmp);
|
bmp_width = cogl_bitmap_get_width (bmp);
|
||||||
bmp_format = _cogl_bitmap_get_format (bmp);
|
bmp_format = cogl_bitmap_get_format (bmp);
|
||||||
|
|
||||||
internal_format = _cogl_texture_determine_internal_format (bmp_format,
|
internal_format = _cogl_texture_determine_internal_format (bmp_format,
|
||||||
internal_format);
|
internal_format);
|
||||||
@ -285,7 +285,7 @@ _cogl_texture_3d_new_from_bitmap (CoglContext *ctx,
|
|||||||
(data = _cogl_bitmap_map (dst_bmp,
|
(data = _cogl_bitmap_map (dst_bmp,
|
||||||
COGL_BUFFER_ACCESS_READ, 0)))
|
COGL_BUFFER_ACCESS_READ, 0)))
|
||||||
{
|
{
|
||||||
CoglPixelFormat format = _cogl_bitmap_get_format (dst_bmp);
|
CoglPixelFormat format = cogl_bitmap_get_format (dst_bmp);
|
||||||
tex_3d->first_pixel.gl_format = gl_format;
|
tex_3d->first_pixel.gl_format = gl_format;
|
||||||
tex_3d->first_pixel.gl_type = gl_type;
|
tex_3d->first_pixel.gl_type = gl_type;
|
||||||
memcpy (tex_3d->first_pixel.data, data,
|
memcpy (tex_3d->first_pixel.data, data,
|
||||||
|
@ -230,11 +230,11 @@ _cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
|
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
|
||||||
|
|
||||||
internal_format =
|
internal_format =
|
||||||
_cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp),
|
_cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp),
|
||||||
internal_format);
|
internal_format);
|
||||||
|
|
||||||
if (!_cogl_texture_rectangle_can_create (_cogl_bitmap_get_width (bmp),
|
if (!_cogl_texture_rectangle_can_create (cogl_bitmap_get_width (bmp),
|
||||||
_cogl_bitmap_get_height (bmp),
|
cogl_bitmap_get_height (bmp),
|
||||||
internal_format,
|
internal_format,
|
||||||
NULL))
|
NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -249,8 +249,8 @@ _cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
if (dst_bmp == NULL)
|
if (dst_bmp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tex_rect = _cogl_texture_rectangle_create_base (_cogl_bitmap_get_width (bmp),
|
tex_rect = _cogl_texture_rectangle_create_base (cogl_bitmap_get_width (bmp),
|
||||||
_cogl_bitmap_get_height (bmp),
|
cogl_bitmap_get_height (bmp),
|
||||||
internal_format);
|
internal_format);
|
||||||
|
|
||||||
ctx->texture_driver->gen (GL_TEXTURE_RECTANGLE_ARB, 1, &tex_rect->gl_texture);
|
ctx->texture_driver->gen (GL_TEXTURE_RECTANGLE_ARB, 1, &tex_rect->gl_texture);
|
||||||
|
@ -177,7 +177,7 @@ _cogl_texture_prepare_for_upload (CoglBitmap *src_bmp,
|
|||||||
GLenum *out_glformat,
|
GLenum *out_glformat,
|
||||||
GLenum *out_gltype)
|
GLenum *out_gltype)
|
||||||
{
|
{
|
||||||
CoglPixelFormat src_format = _cogl_bitmap_get_format (src_bmp);
|
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NULL);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
@ -397,7 +397,7 @@ cogl_texture_new_from_file (const char *filename,
|
|||||||
if (bmp == NULL)
|
if (bmp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
src_format = _cogl_bitmap_get_format (bmp);
|
src_format = cogl_bitmap_get_format (bmp);
|
||||||
|
|
||||||
/* We know that the bitmap data is solely owned by this function so
|
/* We know that the bitmap data is solely owned by this function so
|
||||||
we can do the premult conversion in place. This avoids having to
|
we can do the premult conversion in place. This avoids having to
|
||||||
@ -621,9 +621,9 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture,
|
|||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
_COGL_RETURN_VAL_IF_FAIL ((_cogl_bitmap_get_width (bmp) - src_x)
|
_COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_width (bmp) - src_x)
|
||||||
>= dst_width, FALSE);
|
>= dst_width, FALSE);
|
||||||
_COGL_RETURN_VAL_IF_FAIL ((_cogl_bitmap_get_height (bmp) - src_y)
|
_COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_height (bmp) - src_y)
|
||||||
>= dst_height, FALSE);
|
>= dst_height, FALSE);
|
||||||
|
|
||||||
/* Shortcut out early if the image is empty */
|
/* Shortcut out early if the image is empty */
|
||||||
@ -819,9 +819,9 @@ _cogl_texture_draw_and_read (CoglTexture *texture,
|
|||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
float viewport[4];
|
float viewport[4];
|
||||||
CoglBitmap *alpha_bmp;
|
CoglBitmap *alpha_bmp;
|
||||||
int target_width = _cogl_bitmap_get_width (target_bmp);
|
int target_width = cogl_bitmap_get_width (target_bmp);
|
||||||
int target_height = _cogl_bitmap_get_height (target_bmp);
|
int target_height = cogl_bitmap_get_height (target_bmp);
|
||||||
int target_rowstride = _cogl_bitmap_get_rowstride (target_bmp);
|
int target_rowstride = cogl_bitmap_get_rowstride (target_bmp);
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
@ -1057,9 +1057,9 @@ texture_get_cb (CoglTexture *texture,
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
CoglTextureGetData *tg_data = user_data;
|
CoglTextureGetData *tg_data = user_data;
|
||||||
CoglPixelFormat format = _cogl_bitmap_get_format (tg_data->target_bmp);
|
CoglPixelFormat format = cogl_bitmap_get_format (tg_data->target_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
|
||||||
unsigned int rowstride = _cogl_bitmap_get_rowstride (tg_data->target_bmp);
|
unsigned int rowstride = cogl_bitmap_get_rowstride (tg_data->target_bmp);
|
||||||
int subtexture_width = cogl_texture_get_width (texture);
|
int subtexture_width = cogl_texture_get_width (texture);
|
||||||
int subtexture_height = cogl_texture_get_height (texture);
|
int subtexture_height = cogl_texture_get_height (texture);
|
||||||
|
|
||||||
@ -1248,7 +1248,7 @@ cogl_texture_get_data (CoglTexture *texture,
|
|||||||
if (new_bmp == NULL)
|
if (new_bmp == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
new_bmp_rowstride = _cogl_bitmap_get_rowstride (new_bmp);
|
new_bmp_rowstride = cogl_bitmap_get_rowstride (new_bmp);
|
||||||
new_bmp_data = _cogl_bitmap_map (new_bmp, COGL_BUFFER_ACCESS_WRITE,
|
new_bmp_data = _cogl_bitmap_map (new_bmp, COGL_BUFFER_ACCESS_WRITE,
|
||||||
COGL_BUFFER_MAP_HINT_DISCARD);
|
COGL_BUFFER_MAP_HINT_DISCARD);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -165,7 +165,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||||||
data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0);
|
data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0);
|
||||||
|
|
||||||
/* Setup gl alignment to match rowstride and top-left corner */
|
/* Setup gl alignment to match rowstride and top-left corner */
|
||||||
prep_gl_for_pixels_upload_full (_cogl_bitmap_get_rowstride (source_bmp),
|
prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp),
|
||||||
0,
|
0,
|
||||||
src_x,
|
src_x,
|
||||||
src_y,
|
src_y,
|
||||||
@ -193,7 +193,7 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
|
|||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -201,15 +201,15 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
|
|||||||
data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0);
|
data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0);
|
||||||
|
|
||||||
/* Setup gl alignment to match rowstride and top-left corner */
|
/* Setup gl alignment to match rowstride and top-left corner */
|
||||||
prep_gl_for_pixels_upload_full (_cogl_bitmap_get_rowstride (source_bmp),
|
prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp),
|
||||||
0, 0, 0, bpp);
|
0, 0, 0, bpp);
|
||||||
|
|
||||||
_cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign);
|
_cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign);
|
||||||
|
|
||||||
GE( ctx, glTexImage2D (gl_target, 0,
|
GE( ctx, glTexImage2D (gl_target, 0,
|
||||||
internal_gl_format,
|
internal_gl_format,
|
||||||
_cogl_bitmap_get_width (source_bmp),
|
cogl_bitmap_get_width (source_bmp),
|
||||||
_cogl_bitmap_get_height (source_bmp),
|
cogl_bitmap_get_height (source_bmp),
|
||||||
0,
|
0,
|
||||||
source_gl_format,
|
source_gl_format,
|
||||||
source_gl_type,
|
source_gl_type,
|
||||||
@ -230,7 +230,7 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
|
|||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -238,8 +238,8 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
|
|||||||
data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0);
|
data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0);
|
||||||
|
|
||||||
/* Setup gl alignment to match rowstride and top-left corner */
|
/* Setup gl alignment to match rowstride and top-left corner */
|
||||||
prep_gl_for_pixels_upload_full (_cogl_bitmap_get_rowstride (source_bmp),
|
prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp),
|
||||||
(_cogl_bitmap_get_height (source_bmp) /
|
(cogl_bitmap_get_height (source_bmp) /
|
||||||
depth),
|
depth),
|
||||||
0, 0, bpp);
|
0, 0, bpp);
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
|
|||||||
GE( ctx, glTexImage3D (gl_target,
|
GE( ctx, glTexImage3D (gl_target,
|
||||||
0, /* level */
|
0, /* level */
|
||||||
internal_gl_format,
|
internal_gl_format,
|
||||||
_cogl_bitmap_get_width (source_bmp),
|
cogl_bitmap_get_width (source_bmp),
|
||||||
height,
|
height,
|
||||||
depth,
|
depth,
|
||||||
0,
|
0,
|
||||||
|
@ -100,10 +100,10 @@ _cogl_texture_driver_prep_gl_for_pixels_download (int pixels_rowstride,
|
|||||||
static CoglBitmap *
|
static CoglBitmap *
|
||||||
prepare_bitmap_alignment_for_upload (CoglBitmap *src_bmp)
|
prepare_bitmap_alignment_for_upload (CoglBitmap *src_bmp)
|
||||||
{
|
{
|
||||||
CoglPixelFormat format = _cogl_bitmap_get_format (src_bmp);
|
CoglPixelFormat format = cogl_bitmap_get_format (src_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
|
||||||
int src_rowstride = _cogl_bitmap_get_rowstride (src_bmp);
|
int src_rowstride = cogl_bitmap_get_rowstride (src_bmp);
|
||||||
int width = _cogl_bitmap_get_width (src_bmp);
|
int width = cogl_bitmap_get_width (src_bmp);
|
||||||
int alignment = 1;
|
int alignment = 1;
|
||||||
|
|
||||||
if (src_rowstride == 0)
|
if (src_rowstride == 0)
|
||||||
@ -138,7 +138,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
CoglBitmap *slice_bmp;
|
CoglBitmap *slice_bmp;
|
||||||
int rowstride;
|
int rowstride;
|
||||||
@ -148,8 +148,8 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||||||
/* If we are copying a sub region of the source bitmap then we need
|
/* If we are copying a sub region of the source bitmap then we need
|
||||||
to copy it because GLES does not support GL_UNPACK_ROW_LENGTH */
|
to copy it because GLES does not support GL_UNPACK_ROW_LENGTH */
|
||||||
if (src_x != 0 || src_y != 0 ||
|
if (src_x != 0 || src_y != 0 ||
|
||||||
width != _cogl_bitmap_get_width (source_bmp) ||
|
width != cogl_bitmap_get_width (source_bmp) ||
|
||||||
height != _cogl_bitmap_get_height (source_bmp))
|
height != cogl_bitmap_get_height (source_bmp))
|
||||||
{
|
{
|
||||||
rowstride = bpp * width;
|
rowstride = bpp * width;
|
||||||
rowstride = (rowstride + 3) & ~3;
|
rowstride = (rowstride + 3) & ~3;
|
||||||
@ -169,7 +169,7 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
slice_bmp = prepare_bitmap_alignment_for_upload (source_bmp);
|
slice_bmp = prepare_bitmap_alignment_for_upload (source_bmp);
|
||||||
rowstride = _cogl_bitmap_get_rowstride (slice_bmp);
|
rowstride = cogl_bitmap_get_rowstride (slice_bmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup gl alignment to match rowstride and top-left corner */
|
/* Setup gl alignment to match rowstride and top-left corner */
|
||||||
@ -200,18 +200,18 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
|
|||||||
GLuint source_gl_format,
|
GLuint source_gl_format,
|
||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
int rowstride;
|
int rowstride;
|
||||||
int bmp_width = _cogl_bitmap_get_width (source_bmp);
|
int bmp_width = cogl_bitmap_get_width (source_bmp);
|
||||||
int bmp_height = _cogl_bitmap_get_height (source_bmp);
|
int bmp_height = cogl_bitmap_get_height (source_bmp);
|
||||||
CoglBitmap *bmp;
|
CoglBitmap *bmp;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
bmp = prepare_bitmap_alignment_for_upload (source_bmp);
|
bmp = prepare_bitmap_alignment_for_upload (source_bmp);
|
||||||
rowstride = _cogl_bitmap_get_rowstride (bmp);
|
rowstride = cogl_bitmap_get_rowstride (bmp);
|
||||||
|
|
||||||
/* Setup gl alignment to match rowstride and top-left corner */
|
/* Setup gl alignment to match rowstride and top-left corner */
|
||||||
_cogl_texture_driver_prep_gl_for_pixels_upload (rowstride, bpp);
|
_cogl_texture_driver_prep_gl_for_pixels_upload (rowstride, bpp);
|
||||||
@ -244,11 +244,11 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
|
|||||||
GLuint source_gl_format,
|
GLuint source_gl_format,
|
||||||
GLuint source_gl_type)
|
GLuint source_gl_type)
|
||||||
{
|
{
|
||||||
CoglPixelFormat source_format = _cogl_bitmap_get_format (source_bmp);
|
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
|
||||||
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
|
||||||
int rowstride = _cogl_bitmap_get_rowstride (source_bmp);
|
int rowstride = cogl_bitmap_get_rowstride (source_bmp);
|
||||||
int bmp_width = _cogl_bitmap_get_width (source_bmp);
|
int bmp_width = cogl_bitmap_get_width (source_bmp);
|
||||||
int bmp_height = _cogl_bitmap_get_height (source_bmp);
|
int bmp_height = cogl_bitmap_get_height (source_bmp);
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
@ -282,7 +282,7 @@ _cogl_texture_driver_upload_to_gl_3d (GLenum gl_target,
|
|||||||
NULL) );
|
NULL) );
|
||||||
|
|
||||||
bmp = _cogl_bitmap_new_from_data (g_malloc (bpp * bmp_width * height),
|
bmp = _cogl_bitmap_new_from_data (g_malloc (bpp * bmp_width * height),
|
||||||
_cogl_bitmap_get_format (source_bmp),
|
cogl_bitmap_get_format (source_bmp),
|
||||||
bmp_width,
|
bmp_width,
|
||||||
height,
|
height,
|
||||||
bpp * bmp_width,
|
bpp * bmp_width,
|
||||||
|
Loading…
Reference in New Issue
Block a user