summaryrefslogtreecommitdiff
path: root/gdk/win32/gdkgc-win32.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2003-06-28 01:12:51 +0000
committerTor Lillqvist <tml@src.gnome.org>2003-06-28 01:12:51 +0000
commit323bcc614d46abc4eb4095664ee524a1ab25cfce (patch)
tree9b10aacdd96e75242c332b81ee5fef6568685b5a /gdk/win32/gdkgc-win32.c
parent8597f10089e2a7d44ec82cff5230aeef876e8fbc (diff)
downloadgtk+-323bcc614d46abc4eb4095664ee524a1ab25cfce.tar.gz
Fix for #111028, thanks to J. Ali Harlow, who writes: I found that the
2003-06-28 Tor Lillqvist <tml@iki.fi> Fix for #111028, thanks to J. Ali Harlow, who writes: I found that the GdkPixmap->GdkImage reference really isn't important. It's only really there to have somewhere convenient to store the location of the pixel data in the pixmap and as an easy way of accessing the dimensions of that data. I have therefore put together a fix which removes this reference entirely which seems to solve the problem. * gdk/win32/gdkpixmap-win32.h (struct _GdkPixmapImplWin32): Instead of a pointer to a GdkImage, keep a pointer to the pixels directly. * gdk/win32/gdkimage-win32.c (_gdk_win32_setup_pixmap_image): Remove. (_gdk_win32_new_image): New function, replacing the above. Creates a GdkImage without any associated GdkPixmap. (gdk_image_new_bitmap, _gdk_image_new_for_depth): Use it instead. * gdk/win32/gdkprivate-win32.h: Remove from here, too. * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap) * gdk/win32/gdkdrawable-win32.c (blit_from_pixmap) * gdk/win32/gdkgc-win32.c (_gdk_win32_bitmap_to_hrgn) * gdk/win32/gdkmain-win32.c (_gdk_win32_drawable_description): * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_impl_win32_finalize, gdk_pixmap_new, gdk_bitmap_create_from_data, gdk_pixmap_foreign_new) Corresponding changes.
Diffstat (limited to 'gdk/win32/gdkgc-win32.c')
-rw-r--r--gdk/win32/gdkgc-win32.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c
index 1ead0d0712..57c5241e16 100644
--- a/gdk/win32/gdkgc-win32.c
+++ b/gdk/win32/gdkgc-win32.c
@@ -1079,12 +1079,17 @@ _gdk_win32_bitmap_to_hrgn (GdkPixmap *pixmap)
HRGN h;
DWORD maxRects;
RGNDATA *pData;
- GdkImage *image;
+ guchar *bits;
+ gint width, height, bpl;
guchar *p;
gint x, y;
- image = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->image;
- g_assert (image->depth == 1);
+ g_assert (GDK_PIXMAP_OBJECT(pixmap)->depth == 1);
+
+ bits = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->bits;
+ width = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->width;
+ height = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->height;
+ bpl = ((width - 1)/32 + 1)*4;
/* For better performances, we will use the ExtCreateRegion()
* function to create the region. This function take a RGNDATA
@@ -1100,15 +1105,15 @@ _gdk_win32_bitmap_to_hrgn (GdkPixmap *pixmap)
pData->rdh.nCount = pData->rdh.nRgnSize = 0;
SetRect (&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0);
- for (y = 0; y < image->height; y++)
+ for (y = 0; y < height; y++)
{
/* Scan each bitmap row from left to right*/
- p = (guchar *) image->mem + y * image->bpl;
- for (x = 0; x < image->width; x++)
+ p = (guchar *) bits + y * bpl;
+ for (x = 0; x < width; x++)
{
/* Search for a continuous range of "non transparent pixels"*/
gint x0 = x;
- while (x < image->width)
+ while (x < width)
{
if ((((p[x/8])>>(7-(x%8)))&1) == 0)
/* This pixel is "transparent"*/