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.
This commit is contained in:
Tor Lillqvist 2003-06-28 01:12:51 +00:00 committed by Tor Lillqvist
parent 8597f10089
commit 323bcc614d
13 changed files with 212 additions and 65 deletions

View File

@ -1,3 +1,32 @@
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.
Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk> Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktreeviewcolumn.c * gtk/gtktreeviewcolumn.c

View File

@ -1,3 +1,32 @@
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.
Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk> Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktreeviewcolumn.c * gtk/gtktreeviewcolumn.c

View File

@ -1,3 +1,32 @@
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.
Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk> Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktreeviewcolumn.c * gtk/gtktreeviewcolumn.c

View File

@ -1,3 +1,32 @@
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.
Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk> Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktreeviewcolumn.c * gtk/gtktreeviewcolumn.c

View File

@ -1,3 +1,32 @@
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.
Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk> Thu Jun 26 21:41:16 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktreeviewcolumn.c * gtk/gtktreeviewcolumn.c

View File

@ -129,7 +129,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkCursorPrivate *private; GdkCursorPrivate *private;
GdkCursor *cursor; GdkCursor *cursor;
GdkPixmapImplWin32 *source_impl, *mask_impl; GdkPixmapImplWin32 *source_impl, *mask_impl;
GdkImage *source_image, *mask_image; guchar *source_bits, *mask_bits;
gint source_bpl, mask_bpl;
HCURSOR hcursor; HCURSOR hcursor;
guchar *p, *q, *xor_mask, *and_mask; guchar *p, *q, *xor_mask, *and_mask;
gint width, height, cursor_width, cursor_height; gint width, height, cursor_width, cursor_height;
@ -158,12 +159,16 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
residue = (1 << ((8-(width%8))%8)) - 1; residue = (1 << ((8-(width%8))%8)) - 1;
source_image = source_impl->image; source_bits = source_impl->bits;
mask_image = mask_impl->image; mask_bits = mask_impl->bits;
g_return_val_if_fail (source_image->depth == 1 && mask_image->depth == 1, g_return_val_if_fail (GDK_PIXMAP_OBJECT (source)->depth == 1
&& GDK_PIXMAP_OBJECT (mask)->depth == 1,
NULL); NULL);
source_bpl = ((width - 1)/32 + 1)*4;
mask_bpl = ((mask_impl->width - 1)/32 + 1)*4;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_CURSOR) if (_gdk_debug_flags & GDK_DEBUG_CURSOR)
{ {
@ -174,7 +179,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
if (iy == 16) if (iy == 16)
break; break;
p = (guchar *) source_image->mem + iy*source_image->bpl; p = source_bits + iy*source_bpl;
for (ix = 0; ix < width; ix++) for (ix = 0; ix < width; ix++)
{ {
if (ix == 79) if (ix == 79)
@ -191,7 +196,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
if (iy == 16) if (iy == 16)
break; break;
p = (guchar *) mask_image->mem + iy*source_image->bpl; p = mask_bits + iy*source_bpl;
for (ix = 0; ix < width; ix++) for (ix = 0; ix < width; ix++)
{ {
if (ix == 79) if (ix == 79)
@ -222,8 +227,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
*/ */
for (iy = 0; iy < height; iy++) for (iy = 0; iy < height; iy++)
{ {
p = (guchar *) source_image->mem + iy*source_image->bpl; p = source_bits + iy*source_bpl;
q = (guchar *) mask_image->mem + iy*mask_image->bpl; q = mask_bits + iy*mask_bpl;
for (ix = 0; ix < ((width-1)/8+1); ix++) for (ix = 0; ix < ((width-1)/8+1); ix++)
if (bg_is_white) if (bg_is_white)
@ -237,7 +242,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
for (iy = 0; iy < height; iy++) for (iy = 0; iy < height; iy++)
{ {
p = (guchar *) source_image->mem + iy*source_image->bpl; p = source_bits + iy*source_bpl;
q = xor_mask + iy*cursor_width/8; q = xor_mask + iy*cursor_width/8;
for (ix = 0; ix < ((width-1)/8+1); ix++) for (ix = 0; ix < ((width-1)/8+1); ix++)
@ -255,7 +260,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
for (iy = 0; iy < height; iy++) for (iy = 0; iy < height; iy++)
{ {
p = (guchar *) mask_image->mem + iy*mask_image->bpl; p = mask_bits + iy*mask_bpl;
q = and_mask + iy*cursor_width/8; q = and_mask + iy*cursor_width/8;
for (ix = 0; ix < ((width-1)/8+1); ix++) for (ix = 0; ix < ((width-1)/8+1); ix++)

View File

@ -1450,13 +1450,13 @@ blit_from_pixmap (gboolean use_fg_bg,
WIN32_GDI_FAILED ("SelectObject"); WIN32_GDI_FAILED ("SelectObject");
else else
{ {
if (src->image->depth <= 8) if (GDK_PIXMAP_OBJECT (src->parent_instance.wrapper)->depth <= 8)
{ {
/* Blitting from a 1, 4 or 8-bit pixmap */ /* Blitting from a 1, 4 or 8-bit pixmap */
if ((oldtable_size = GetDIBColorTable (srcdc, 0, 256, oldtable)) == 0) if ((oldtable_size = GetDIBColorTable (srcdc, 0, 256, oldtable)) == 0)
WIN32_GDI_FAILED ("GetDIBColorTable"); WIN32_GDI_FAILED ("GetDIBColorTable");
else if (src->image->depth == 1) else if (GDK_PIXMAP_OBJECT (src->parent_instance.wrapper)->depth == 1)
{ {
/* Blitting from an 1-bit pixmap */ /* Blitting from an 1-bit pixmap */
@ -1474,7 +1474,7 @@ blit_from_pixmap (gboolean use_fg_bg,
} }
if (GDK_IS_PIXMAP_IMPL_WIN32 (dest) && if (GDK_IS_PIXMAP_IMPL_WIN32 (dest) &&
((GdkPixmapImplWin32 *) dest)->image->depth <= 8) GDK_PIXMAP_OBJECT (dest->wrapper)->depth <= 8)
{ {
/* Destination is also pixmap, get fg and bg from /* Destination is also pixmap, get fg and bg from
* its palette. Either use the foreground and * its palette. Either use the foreground and

View File

@ -1079,12 +1079,17 @@ _gdk_win32_bitmap_to_hrgn (GdkPixmap *pixmap)
HRGN h; HRGN h;
DWORD maxRects; DWORD maxRects;
RGNDATA *pData; RGNDATA *pData;
GdkImage *image; guchar *bits;
gint width, height, bpl;
guchar *p; guchar *p;
gint x, y; gint x, y;
image = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->image; g_assert (GDK_PIXMAP_OBJECT(pixmap)->depth == 1);
g_assert (image->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() /* For better performances, we will use the ExtCreateRegion()
* function to create the region. This function take a RGNDATA * 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; pData->rdh.nCount = pData->rdh.nRgnSize = 0;
SetRect (&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 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*/ /* Scan each bitmap row from left to right*/
p = (guchar *) image->mem + y * image->bpl; p = (guchar *) bits + y * bpl;
for (x = 0; x < image->width; x++) for (x = 0; x < width; x++)
{ {
/* Search for a continuous range of "non transparent pixels"*/ /* Search for a continuous range of "non transparent pixels"*/
gint x0 = x; gint x0 = x;
while (x < image->width) while (x < width)
{ {
if ((((p[x/8])>>(7-(x%8)))&1) == 0) if ((((p[x/8])>>(7-(x%8)))&1) == 0)
/* This pixel is "transparent"*/ /* This pixel is "transparent"*/

View File

@ -104,9 +104,13 @@ _gdk_image_exit (void)
} }
} }
GdkImage * /*
_gdk_win32_setup_pixmap_image (GdkPixmap *pixmap, * Create a GdkImage _without_ an associated GdkPixmap. The caller is
GdkDrawable *drawable, * responsible for creating a GdkPixmap object and making the association.
*/
static GdkImage *
_gdk_win32_new_image (GdkVisual *visual,
gint width, gint width,
gint height, gint height,
gint depth, gint depth,
@ -115,9 +119,9 @@ _gdk_win32_setup_pixmap_image (GdkPixmap *pixmap,
GdkImage *image; GdkImage *image;
image = g_object_new (gdk_image_get_type (), NULL); image = g_object_new (gdk_image_get_type (), NULL);
image->windowing_data = pixmap; image->windowing_data = NULL;
image->type = GDK_IMAGE_SHARED; image->type = GDK_IMAGE_SHARED;
image->visual = gdk_drawable_get_visual (drawable); image->visual = visual;
image->byte_order = GDK_LSB_FIRST; image->byte_order = GDK_LSB_FIRST;
image->width = width; image->width = width;
image->height = height; image->height = height;
@ -143,7 +147,7 @@ _gdk_win32_setup_pixmap_image (GdkPixmap *pixmap,
image->bpp = 4; image->bpp = 4;
break; break;
default: default:
g_warning ("_gdk_win32_setup_pixmap_image: depth=%d", image->depth); g_warning ("_gdk_win32_new_image: depth=%d", image->depth);
g_assert_not_reached (); g_assert_not_reached ();
} }
if (depth == 1) if (depth == 1)
@ -166,6 +170,7 @@ gdk_image_new_bitmap (GdkVisual *visual,
{ {
GdkPixmap *pixmap; GdkPixmap *pixmap;
GdkImage *image; GdkImage *image;
guchar *bits;
gint data_bpl = (w-1)/8 + 1; gint data_bpl = (w-1)/8 + 1;
gint i; gint i;
@ -174,11 +179,13 @@ gdk_image_new_bitmap (GdkVisual *visual,
if (pixmap == NULL) if (pixmap == NULL)
return NULL; return NULL;
image = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->image;
GDK_NOTE (IMAGE, g_print ("gdk_image_new_bitmap: %dx%d=%p\n", GDK_NOTE (IMAGE, g_print ("gdk_image_new_bitmap: %dx%d=%p\n",
w, h, GDK_PIXMAP_HBITMAP (pixmap))); w, h, GDK_PIXMAP_HBITMAP (pixmap)));
bits = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->bits;
image = _gdk_win32_new_image (visual, w, h, 1, bits);
image->windowing_data = pixmap;
if (data_bpl != image->bpl) if (data_bpl != image->bpl)
{ {
for (i = 0; i < h; i++) for (i = 0; i < h; i++)
@ -205,6 +212,8 @@ _gdk_image_new_for_depth (GdkScreen *screen,
gint depth) gint depth)
{ {
GdkPixmap *pixmap; GdkPixmap *pixmap;
GdkImage *image;
guchar *bits;
g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL); g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL);
g_return_val_if_fail (visual || depth != -1, NULL); g_return_val_if_fail (visual || depth != -1, NULL);
@ -221,7 +230,11 @@ _gdk_image_new_for_depth (GdkScreen *screen,
GDK_NOTE (IMAGE, g_print ("_gdk_image_new_for_depth: %dx%dx%d=%p\n", GDK_NOTE (IMAGE, g_print ("_gdk_image_new_for_depth: %dx%dx%d=%p\n",
width, height, depth, GDK_PIXMAP_HBITMAP (pixmap))); width, height, depth, GDK_PIXMAP_HBITMAP (pixmap)));
return GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->image; bits = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->bits;
image = _gdk_win32_new_image (visual, width, height, depth, bits);
image->windowing_data = pixmap;
return image;
} }
GdkImage* GdkImage*

View File

@ -923,17 +923,16 @@ gchar *
_gdk_win32_drawable_description (GdkDrawable *d) _gdk_win32_drawable_description (GdkDrawable *d)
{ {
GdkVisual *v; GdkVisual *v;
gint width, height; gint width, height, depth;
gdk_drawable_get_size (d, &width, &height); gdk_drawable_get_size (d, &width, &height);
depth = gdk_drawable_get_depth (d);
return static_printf return static_printf
("%s:%p:%dx%dx%d", ("%s:%p:%dx%dx%d",
G_OBJECT_TYPE_NAME (d), G_OBJECT_TYPE_NAME (d),
GDK_DRAWABLE_HANDLE (d), GDK_DRAWABLE_HANDLE (d),
width, height, width, height, depth);
(GDK_IS_PIXMAP (d) ? GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (d)->impl)->image->depth
: ((v = gdk_drawable_get_visual (d)) ? v->depth : gdk_visual_get_system ()->depth)));
} }
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */

View File

@ -103,7 +103,6 @@ gdk_pixmap_impl_win32_finalize (GObject *object)
{ {
GdkPixmapImplWin32 *impl = GDK_PIXMAP_IMPL_WIN32 (object); GdkPixmapImplWin32 *impl = GDK_PIXMAP_IMPL_WIN32 (object);
GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_WIN32 (impl)->wrapper); GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_WIN32 (impl)->wrapper);
GdkImage *image = impl->image;
GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_impl_win32_finalize: %p\n", GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_impl_win32_finalize: %p\n",
GDK_PIXMAP_HBITMAP (wrapper))); GDK_PIXMAP_HBITMAP (wrapper)));
@ -113,9 +112,6 @@ gdk_pixmap_impl_win32_finalize (GObject *object)
gdk_win32_handle_table_remove (GDK_PIXMAP_HBITMAP (wrapper)); gdk_win32_handle_table_remove (GDK_PIXMAP_HBITMAP (wrapper));
image->windowing_data = NULL;
g_object_unref (image);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -307,9 +303,7 @@ gdk_pixmap_new (GdkDrawable *drawable,
} }
drawable_impl->handle = hbitmap; drawable_impl->handle = hbitmap;
pixmap_impl->image = _gdk_win32_setup_pixmap_image (pixmap, drawable, pixmap_impl->bits = bits;
width, height,
depth, bits);
gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap); gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap);
@ -359,7 +353,7 @@ gdk_bitmap_create_from_data (GdkDrawable *drawable,
{ {
GdkPixmap *pixmap; GdkPixmap *pixmap;
GdkPixmapImplWin32 *pixmap_impl; GdkPixmapImplWin32 *pixmap_impl;
gint i, j, data_bpl, image_bpl; gint i, j, data_bpl, pixmap_bpl;
guchar *bits; guchar *bits;
g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
@ -378,13 +372,13 @@ gdk_bitmap_create_from_data (GdkDrawable *drawable,
return NULL; return NULL;
pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl); pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
bits = pixmap_impl->image->mem; bits = pixmap_impl->bits;
data_bpl = ((width - 1) / 8 + 1); data_bpl = ((width - 1) / 8 + 1);
image_bpl = pixmap_impl->image->bpl; pixmap_bpl = ((width - 1)/32 + 1)*4;
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
for (j = 0; j < data_bpl; j++) for (j = 0; j < data_bpl; j++)
bits[i*image_bpl + j] = mirror[(guchar) data[i*data_bpl + j]]; bits[i*pixmap_bpl + j] = mirror[(guchar) data[i*data_bpl + j]];
GDK_NOTE (PIXMAP, g_print ("gdk_bitmap_create_from_data: %dx%d=%p\n", GDK_NOTE (PIXMAP, g_print ("gdk_bitmap_create_from_data: %dx%d=%p\n",
width, height, GDK_PIXMAP_HBITMAP (pixmap))); width, height, GDK_PIXMAP_HBITMAP (pixmap)));
@ -481,11 +475,7 @@ gdk_pixmap_foreign_new (GdkNativeWindow anid)
draw_impl->colormap = NULL; draw_impl->colormap = NULL;
pix_impl->width = size.cx; pix_impl->width = size.cx;
pix_impl->height = size.cy; pix_impl->height = size.cy;
pix_impl->image = pix_impl->bits = NULL;
_gdk_win32_setup_pixmap_image (pixmap, _gdk_parent_root,
size.cx, size.cy,
gdk_visual_get_system ()->depth,
NULL);
gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap); gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap);

View File

@ -53,10 +53,7 @@ struct _GdkPixmapImplWin32
gint width; gint width;
gint height; gint height;
guchar *bits;
GdkImage *image; /* A pointer to the GdkImage
* containing the pixels.
*/
guint is_foreign : 1; guint is_foreign : 1;
}; };

View File

@ -337,13 +337,6 @@ GdkImage *_gdk_win32_copy_to_image (GdkDrawable *drawable,
gint width, gint width,
gint height); gint height);
GdkImage *_gdk_win32_setup_pixmap_image (GdkPixmap *pixmap,
GdkDrawable *drawable,
gint width,
gint height,
gint depth,
guchar *bits);
void _gdk_win32_blit (gboolean use_fg_bg, void _gdk_win32_blit (gboolean use_fg_bg,
GdkDrawableImplWin32 *drawable, GdkDrawableImplWin32 *drawable,
GdkGC *gc, GdkGC *gc,