forked from AuroraMiddleware/gtk
Account for alignment when reading xbm data. (#346721, patch by Dave
2006-07-10 Richard Hult <richard@imendio.com> * gdk/quartz/gdkpixmap-quartz.c: (gdk_bitmap_create_from_data): Account for alignment when reading xbm data. (#346721, patch by Dave Vasilevsky)
This commit is contained in:
parent
451543039a
commit
4904b59030
@ -1,3 +1,9 @@
|
|||||||
|
2006-07-10 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
|
* gdk/quartz/gdkpixmap-quartz.c: (gdk_bitmap_create_from_data):
|
||||||
|
Account for alignment when reading xbm data. (#346721, patch
|
||||||
|
by Dave Vasilevsky)
|
||||||
|
|
||||||
2006-07-09 Richard Hult <richard@imendio.com>
|
2006-07-09 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkgeometry-quartz.c:
|
* gdk/quartz/gdkgeometry-quartz.c:
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2006-07-10 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
|
* gdk/quartz/gdkpixmap-quartz.c: (gdk_bitmap_create_from_data):
|
||||||
|
Account for alignment when reading xbm data. (#346721, patch
|
||||||
|
by Dave Vasilevsky)
|
||||||
|
|
||||||
2006-07-09 Richard Hult <richard@imendio.com>
|
2006-07-09 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkgeometry-quartz.c:
|
* gdk/quartz/gdkgeometry-quartz.c:
|
||||||
|
@ -201,7 +201,7 @@ gdk_bitmap_create_from_data (GdkDrawable *window,
|
|||||||
{
|
{
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
GdkPixmapImplQuartz *impl;
|
GdkPixmapImplQuartz *impl;
|
||||||
int x, y;
|
int x, y, bpl;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, NULL);
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||||
@ -212,19 +212,21 @@ gdk_bitmap_create_from_data (GdkDrawable *window,
|
|||||||
|
|
||||||
g_assert (CGImageGetBytesPerRow (impl->image) == width);
|
g_assert (CGImageGetBytesPerRow (impl->image) == width);
|
||||||
|
|
||||||
|
/* Bytes per line: Each line consumes an integer number of bytes, possibly
|
||||||
|
* ignoring any excess bits. */
|
||||||
|
bpl = (width + 7) / 8;
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
guchar *ptr = impl->data + y * width;
|
guchar *dst = impl->data + y * width;
|
||||||
gint idx;
|
const gchar *src = data + (y * bpl);
|
||||||
|
|
||||||
for (x = 0; x < width; x++)
|
for (x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
if ((data[(y * width + x) / 8] >> x % 8) & 1)
|
if ((src[x / 8] >> x % 8) & 1)
|
||||||
*ptr = 0xff;
|
*dst = 0xff;
|
||||||
else
|
else
|
||||||
*ptr = 0;
|
*dst = 0;
|
||||||
|
|
||||||
ptr++;
|
dst++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user