need to cast image->mem away from void* to avoid 'error C2036: 'void *' :

2002-01-04  Hans Breuer  <hans@breuer.org>

	* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
	need to cast image->mem away from void* to avoid
	'error C2036: 'void *' : unknown size'. Doing pointer
	arithmetics on void pointers is a GCCism afaik.

	* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
	_gdk_draw_pixbuf ()

	* gdk/makefile.msc gdk/win32/makefile.msc
        gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h

	* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
	and take care of image->visual possibly NULL.

	* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
	_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
	Again take care of image->visual possibly NULL.

	* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()

	* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
	instead of private field access

	* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
	colormap setting to the gdk-X behaviour
This commit is contained in:
Hans Breuer 2002-01-05 19:07:13 +00:00 committed by Hans Breuer
parent 40cab0a2fb
commit ec81d4a8af
18 changed files with 375 additions and 46 deletions

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1,3 +1,31 @@
2002-01-04 Hans Breuer <hans@breuer.org>
* gdk/gdkdraw.c gdk/gdkpixbuf-drawable.c :
need to cast image->mem away from void* to avoid
'error C2036: 'void *' : unknown size'. Doing pointer
arithmetics on void pointers is a GCCism afaik.
* gdk/gdkpixbuf-render.c : #include "gdkinternals.h" for
_gdk_draw_pixbuf ()
* gdk/makefile.msc gdk/win32/makefile.msc
gdk/gtk/makefile.msc.in : use -FI msvc_recommended_pragmas.h
* gdk/win32/gdkdrawable-win32.c : use _gkd_win32_copy_to_image
and take care of image->visual possibly NULL.
* gdk/win32/gdkimage-win32.c : implement _gdk_image_new_for_depth(),
_gdk_win32_copy_to_image() and _gdk_windowing_bits_for_depth().
Again take care of image->visual possibly NULL.
* gdk/win32/gdkprivate-win32.h : declare _gdk_win32_copy_to_image()
* gdk/win32/gdkevents-win32.c : use gdk_drawable_get_colormap
instead of private field access
* gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new) : adapt
colormap setting to the gdk-X behaviour
2001-01-04 Matthias Clasen <matthiasc@poet.de> 2001-01-04 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkwidget.c: Documentation additions. * gtk/gtkwidget.c: Documentation additions.

View File

@ -1253,7 +1253,7 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
width1, height1); width1, height1);
(*composite_func) (pixbuf->pixels + (src_y + y0) * pixbuf->rowstride + (src_x + x0) * 4, (*composite_func) (pixbuf->pixels + (src_y + y0) * pixbuf->rowstride + (src_x + x0) * 4,
pixbuf->rowstride, pixbuf->rowstride,
image->mem + ys0 * image->bpl + xs0 * image->bpp, (guchar*)image->mem + ys0 * image->bpl + xs0 * image->bpp,
image->bpl, image->bpl,
visual->byte_order, visual->byte_order,
width1, height1); width1, height1);

View File

@ -72,7 +72,7 @@ bitmap1 (GdkImage *image,
int bpl; int bpl;
register guint8 data; register guint8 data;
guint8 *o; guint8 *o;
guint8 *srow = image->mem + y1 * image->bpl, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl, *orow = pixels;
d (printf ("bitmap, no alpha\n")); d (printf ("bitmap, no alpha\n"));
@ -128,7 +128,7 @@ bitmap1a (GdkImage *image,
int bpl; int bpl;
register guint8 data; register guint8 data;
guint8 *o; guint8 *o;
guint8 *srow = image->mem + y1 * image->bpl, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl, *orow = pixels;
d (printf ("bitmap, with alpha\n")); d (printf ("bitmap, with alpha\n"));
@ -183,7 +183,7 @@ rgb1 (GdkImage *image,
int bpl; int bpl;
register guint8 data; register guint8 data;
guint8 *o; guint8 *o;
guint8 *srow = image->mem + y1 * image->bpl, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl, *orow = pixels;
d (printf ("1 bits/pixel\n")); d (printf ("1 bits/pixel\n"));
@ -231,7 +231,7 @@ rgb1a (GdkImage *image,
int bpl; int bpl;
register guint8 data; register guint8 data;
guint8 *o; guint8 *o;
guint8 *srow = image->mem + y1 * image->bpl, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl, *orow = pixels;
d (printf ("1 bits/pixel\n")); d (printf ("1 bits/pixel\n"));
@ -279,7 +279,7 @@ rgb8 (GdkImage *image,
int bpl; int bpl;
guint32 mask; guint32 mask;
register guint32 data; register guint32 data;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
register guint8 *s; register guint8 *s;
register guint8 *o; register guint8 *o;
@ -326,7 +326,7 @@ rgb8a (GdkImage *image,
guint32 remap[256]; guint32 remap[256];
register guint8 *s; /* read 2 pixels at once */ register guint8 *s; /* read 2 pixels at once */
register guint32 *o; register guint32 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -387,7 +387,7 @@ rgb565lsb (GdkImage *image,
register guint8 *s; /* read 2 pixels at once */ register guint8 *s; /* read 2 pixels at once */
#endif #endif
register guint16 *o; register guint16 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -490,7 +490,7 @@ rgb565msb (GdkImage *image,
register guint32 *s; /* read 2 pixels at once */ register guint32 *s; /* read 2 pixels at once */
#endif #endif
register guint16 *o; register guint16 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -596,7 +596,7 @@ rgb565alsb (GdkImage *image,
#endif #endif
register guint32 *o; register guint32 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -659,7 +659,7 @@ rgb565amsb (GdkImage *image,
#endif #endif
register guint32 *o; register guint32 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -717,7 +717,7 @@ rgb555lsb (GdkImage *image,
register guint8 *s; /* read 2 pixels at once */ register guint8 *s; /* read 2 pixels at once */
#endif #endif
register guint16 *o; register guint16 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -821,7 +821,7 @@ rgb555msb (GdkImage *image,
register guint32 *s; /* read 2 pixels at once */ register guint32 *s; /* read 2 pixels at once */
#endif #endif
register guint16 *o; register guint16 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -922,7 +922,7 @@ rgb555alsb (GdkImage *image,
#endif #endif
register guint32 *o; register guint32 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -985,7 +985,7 @@ rgb555amsb (GdkImage *image,
#endif #endif
register guint32 *o; register guint32 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -1039,7 +1039,7 @@ rgb888alsb (GdkImage *image,
guint8 *s; /* for byte order swapping */ guint8 *s; /* for byte order swapping */
guint8 *o; guint8 *o;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
bpl = image->bpl; bpl = image->bpl;
@ -1076,7 +1076,7 @@ rgb888lsb (GdkImage *image,
int xx, yy; int xx, yy;
int bpl; int bpl;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
guint8 *o, *s; guint8 *o, *s;
bpl = image->bpl; bpl = image->bpl;
@ -1112,7 +1112,7 @@ rgb888amsb (GdkImage *image,
int xx, yy; int xx, yy;
int bpl; int bpl;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
#ifdef LITTLE #ifdef LITTLE
guint32 *o; guint32 *o;
guint32 *s; guint32 *s;
@ -1166,7 +1166,7 @@ rgb888msb (GdkImage *image,
int xx, yy; int xx, yy;
int bpl; int bpl;
guint8 *srow = image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels; guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
guint8 *s; guint8 *s;
guint8 *o; guint8 *o;

View File

@ -22,6 +22,7 @@
#include <config.h> #include <config.h>
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include "gdkinternals.h" /* _gdk_draw_pixbuf() */
#include "gdk-pixbuf-private.h" #include "gdk-pixbuf-private.h"
#include "gdkpixbuf.h" #include "gdkpixbuf.h"

View File

@ -40,7 +40,8 @@ GDK_PIXBUF_VER=$(GTK_VER)
PERL = perl PERL = perl
!ENDIF !ENDIF
CFLAGS = -I . -I .. $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I ../gdk-pixbuf \ CFLAGS = -FImsvc_recommended_pragmas.h -I . -I .. \
$(GLIB_CFLAGS) $(PANGO_CFLAGS) -I ../gdk-pixbuf \
$(G_DEBUGGING) -DHAVE_CONFIG_H -DGDK_ENABLE_BROKEN -DGDK_VERSION=\"$(GTK_VER)\" $(G_DEBUGGING) -DHAVE_CONFIG_H -DGDK_ENABLE_BROKEN -DGDK_VERSION=\"$(GTK_VER)\"
EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \ EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \
..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib $(PANGOWIN32_LIBS) ..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib $(PANGOWIN32_LIBS)
@ -88,7 +89,6 @@ gdk_public_h_sources = \
gdk.h \ gdk.h \
gdkcolor.h \ gdkcolor.h \
gdkcursor.h \ gdkcursor.h \
gdkcursors.h \
gdkdnd.h \ gdkdnd.h \
gdkdrawable.h \ gdkdrawable.h \
gdkevents.h \ gdkevents.h \

View File

@ -176,6 +176,8 @@ gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
drawable_class->get_visual = gdk_win32_get_visual; drawable_class->get_visual = gdk_win32_get_visual;
drawable_class->get_image = _gdk_win32_get_image; drawable_class->get_image = _gdk_win32_get_image;
drawable_class->_copy_to_image = _gdk_win32_copy_to_image;
} }
static void static void
@ -1026,7 +1028,7 @@ gdk_win32_draw_image (GdkDrawable *drawable,
hdc = gdk_win32_hdc_get (drawable, gc, 0); hdc = gdk_win32_hdc_get (drawable, gc, 0);
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR && if (image->visual && image->visual->type == GDK_VISUAL_PSEUDO_COLOR &&
colormap_private && colormap_private->xcolormap->rc_palette) colormap_private && colormap_private->xcolormap->rc_palette)
{ {
if (!bmi_inited) if (!bmi_inited)

View File

@ -2559,7 +2559,7 @@ gdk_event_translate (GdkEvent *event,
break; break;
} }
colormap = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap; colormap = gdk_drawable_get_colormap (window);
if (colormap) if (colormap)
colormap_private = GDK_COLORMAP_PRIVATE_DATA (colormap); colormap_private = GDK_COLORMAP_PRIVATE_DATA (colormap);
hdc = (HDC) msg->wParam; hdc = (HDC) msg->wParam;

View File

@ -191,14 +191,15 @@ _gdk_windowing_image_init (void)
} }
GdkImage* GdkImage*
gdk_image_new (GdkImageType type, _gdk_image_new_for_depth (GdkImageType type,
GdkVisual *visual, GdkVisual *visual,
gint width, gint width,
gint height) gint height,
gint depth)
{ {
GdkImage *image; GdkImage *image;
GdkImagePrivateWin32 *private; GdkImagePrivateWin32 *private;
Visual *xvisual; Visual *xvisual = NULL;
struct { struct {
BITMAPINFOHEADER bmiHeader; BITMAPINFOHEADER bmiHeader;
union { union {
@ -210,6 +211,12 @@ gdk_image_new (GdkImageType type,
UINT iUsage; UINT iUsage;
int i; int i;
g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL);
g_return_val_if_fail (visual || depth != -1, NULL);
if (visual)
depth = visual->depth;
if (type == GDK_IMAGE_FASTEST || type == GDK_IMAGE_NORMAL) if (type == GDK_IMAGE_FASTEST || type == GDK_IMAGE_NORMAL)
type = GDK_IMAGE_SHARED; type = GDK_IMAGE_SHARED;
@ -225,9 +232,10 @@ gdk_image_new (GdkImageType type,
image->visual = visual; image->visual = visual;
image->width = width; image->width = width;
image->height = height; image->height = height;
image->depth = visual->depth; image->depth = depth;
xvisual = ((GdkVisualPrivate*) visual)->xvisual; if (visual)
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER); bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = width; bmi.bmiHeader.biWidth = width;
@ -247,7 +255,8 @@ gdk_image_new (GdkImageType type,
bmi.bmiHeader.biClrUsed = 0; bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0; bmi.bmiHeader.biClrImportant = 0;
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR) if ( (image->visual && image->visual->type == GDK_VISUAL_PSEUDO_COLOR)
|| (8 == image->depth))
{ {
iUsage = DIB_PAL_COLORS; iUsage = DIB_PAL_COLORS;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -271,9 +280,9 @@ gdk_image_new (GdkImageType type,
} }
else if (image->depth == 16) else if (image->depth == 16)
{ {
bmi.u.bmiMasks[0] = visual->red_mask; bmi.u.bmiMasks[0] = visual ? visual->red_mask : 0x0000F800;
bmi.u.bmiMasks[1] = visual->green_mask; bmi.u.bmiMasks[1] = visual ? visual->green_mask : 0x000007E0;
bmi.u.bmiMasks[2] = visual->blue_mask; bmi.u.bmiMasks[2] = visual ? visual->blue_mask : 0x0000001F;
} }
} }
@ -320,6 +329,16 @@ gdk_image_new (GdkImageType type,
return image; return image;
} }
GdkImage*
gdk_image_new (GdkImageType type,
GdkVisual *visual,
gint width,
gint height)
{
return _gdk_image_new_for_depth (type, visual, width, height, -1);
}
GdkImage* GdkImage*
_gdk_win32_get_image (GdkDrawable *drawable, _gdk_win32_get_image (GdkDrawable *drawable,
gint x, gint x,
@ -401,7 +420,7 @@ _gdk_win32_get_image (GdkDrawable *drawable,
return NULL; return NULL;
} }
image->depth = gdk_visual_get_system ()->depth; image->depth = gdk_visual_get_system ()->depth;
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR) if (image->visual && image->visual->type == GDK_VISUAL_PSEUDO_COLOR)
{ {
iUsage = DIB_PAL_COLORS; iUsage = DIB_PAL_COLORS;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -563,6 +582,87 @@ _gdk_win32_get_image (GdkDrawable *drawable,
return image; return image;
} }
GdkImage*
_gdk_win32_copy_to_image (GdkDrawable *drawable,
GdkImage *image,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height)
{
GdkImagePrivateWin32 *private;
GdkDrawableImplWin32 *impl;
GdkVisual *visual;
GdkGC *gc = NULL;
gboolean ok = TRUE, is_window_impl;
HBITMAP holdbmp = NULL;
HDC src_dc = NULL, dest_dc = NULL;
g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable), NULL);
g_return_val_if_fail (image != NULL || (dest_x == 0 && dest_y == 0), NULL);
visual = gdk_drawable_get_visual (drawable);
impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
is_window_impl = GDK_IS_WINDOW_IMPL_WIN32 (drawable);
if (!image && !is_window_impl)
return _gdk_win32_get_image (drawable, src_x, src_y, width, height);
if (!image)
image = _gdk_image_new_for_depth (GDK_IMAGE_FASTEST, visual, width, height, -1);
private = IMAGE_PRIVATE_DATA (image);
if (is_window_impl)
src_dc = GetDC (impl->handle);
else
{
gc = gdk_gc_new (drawable);
src_dc = gdk_win32_hdc_get (drawable, gc, 0);
}
ok = !!src_dc;
if (ok)
{
dest_dc = CreateCompatibleDC (NULL);
ok = !!dest_dc;
}
if (ok)
{
holdbmp = SelectObject (dest_dc, private->hbitmap);
ok = !!holdbmp;
}
if (ok && !BitBlt (dest_dc, dest_x, dest_y, width, height,
src_dc, src_x, src_y, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
if (is_window_impl)
{
if (src_dc && !ReleaseDC (impl->handle, src_dc))
WIN32_GDI_FAILED ("ReleaseDC");
}
else
{
gdk_win32_hdc_release (drawable, gc, 0);
g_object_unref (gc);
}
if (dest_dc)
{
if (holdbmp)
SelectObject (dest_dc, holdbmp);
if (!DeleteDC (dest_dc))
WIN32_GDI_FAILED ("DeleteDC");
}
g_return_val_if_fail (ok, image);
return image;
}
guint32 guint32
gdk_image_get_pixel (GdkImage *image, gdk_image_get_pixel (GdkImage *image,
gint x, gint x,
@ -677,3 +777,16 @@ gdk_win32_image_destroy (GdkImage *image)
image->windowing_data = NULL; image->windowing_data = NULL;
} }
gint
_gdk_windowing_get_bits_for_depth (gint depth)
{
if ((1 == depth) || (8 == depth) || (16 == depth) ||
(24 == depth) || (32 == depth))
return depth;
else if (15 == depth)
return 16;
else
g_assert_not_reached ();
return 0;
}

View File

@ -134,6 +134,8 @@ gdk_pixmap_new (GdkWindow *window,
GdkDrawableImplWin32 *draw_impl; GdkDrawableImplWin32 *draw_impl;
GdkPixmapImplWin32 *pix_impl; GdkPixmapImplWin32 *pix_impl;
GdkVisual *visual; GdkVisual *visual;
GdkColormap *cmap = NULL;
gint window_depth;
struct { struct {
BITMAPINFOHEADER bmiHeader; BITMAPINFOHEADER bmiHeader;
@ -174,8 +176,9 @@ gdk_pixmap_new (GdkWindow *window,
visual = gdk_drawable_get_visual (window); visual = gdk_drawable_get_visual (window);
window_depth = gdk_drawable_get_depth (GDK_DRAWABLE (window));
if (depth == -1) if (depth == -1)
depth = gdk_drawable_get_depth (GDK_DRAWABLE (window)); depth = window_depth;
GDK_NOTE (MISC, g_print ("gdk_pixmap_new: %dx%dx%d\n", GDK_NOTE (MISC, g_print ("gdk_pixmap_new: %dx%dx%d\n",
width, height, depth)); width, height, depth));
@ -228,15 +231,9 @@ gdk_pixmap_new (GdkWindow *window,
bmi.u.bmiColors[1].rgbRed = 0xFF; bmi.u.bmiColors[1].rgbRed = 0xFF;
bmi.u.bmiColors[1].rgbReserved = 0x00; bmi.u.bmiColors[1].rgbReserved = 0x00;
draw_impl->colormap = NULL; draw_impl->colormap = NULL;
GDK_NOTE (MISC, g_print ("... colormap NULL\n"));
} }
else else
{ {
draw_impl->colormap = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap;
if (draw_impl->colormap == NULL)
draw_impl->colormap = gdk_colormap_get_system ();
GDK_NOTE (MISC, g_print ("... colormap %p\n", draw_impl->colormap));
if (depth == 8) if (depth == 8)
{ {
iUsage = DIB_PAL_COLORS; iUsage = DIB_PAL_COLORS;
@ -267,6 +264,15 @@ gdk_pixmap_new (GdkWindow *window,
} }
ReleaseDC (GDK_WINDOW_HWND (window), hdc); ReleaseDC (GDK_WINDOW_HWND (window), hdc);
if (depth == window_depth)
{
cmap = gdk_drawable_get_colormap (window);
if (cmap)
gdk_drawable_set_colormap (pixmap, cmap);
}
GDK_NOTE (MISC, g_print ("... colormap %p\n", cmap));
GDK_NOTE (MISC, g_print ("... = %#x\n", GDK_NOTE (MISC, g_print ("... = %#x\n",
(guint) GDK_PIXMAP_HBITMAP (pixmap))); (guint) GDK_PIXMAP_HBITMAP (pixmap)));

View File

@ -365,6 +365,15 @@ GdkImage* _gdk_win32_get_image (GdkDrawable *drawable,
gint width, gint width,
gint height); gint height);
GdkImage *_gdk_win32_copy_to_image (GdkDrawable *drawable,
GdkImage *image,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height);
COLORREF _gdk_win32_colormap_color (GdkColormap *colormap, COLORREF _gdk_win32_colormap_color (GdkColormap *colormap,
gulong pixel); gulong pixel);

View File

@ -13,7 +13,8 @@ TOP = ../../..
GTK_VER=1.3 GTK_VER=1.3
CFLAGS = -I. -I.. -I..\.. $(GLIB_CFLAGS) $(PANGO_CFLAGS) \ CFLAGS = -FImsvc_recommended_pragmas.h \
-I. -I.. -I..\.. $(GLIB_CFLAGS) $(PANGO_CFLAGS) \
-I$(WTKIT)\include -I$(GLIB) \ -I$(WTKIT)\include -I$(GLIB) \
$(G_DEBUGGING) -DHAVE_CONFIG_H -DINSIDE_GDK_WIN32 -DGDK_VERSION=\"$(GTK_VER)\" $(G_DEBUGGING) -DHAVE_CONFIG_H -DINSIDE_GDK_WIN32 -DGDK_VERSION=\"$(GTK_VER)\"

View File

@ -25,7 +25,7 @@ GTK_BINARY_VERSION = @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@LT_CURRENT@
PERL = perl PERL = perl
AWK = gawk AWK = gawk
INCLUDES = -I . -I .. -I ../gdk -I ../gdk-pixbuf -DPANGO_ENABLE_BACKEND INCLUDES = -FImsvc_recommended_pragmas.h -I . -I .. -I ../gdk -I ../gdk-pixbuf -DPANGO_ENABLE_BACKEND
DEPCFLAGS = $(PANGO_CFLAGS) $(GLIB_CFLAGS) $(LIBICONV_CFLAGS) \ DEPCFLAGS = $(PANGO_CFLAGS) $(GLIB_CFLAGS) $(LIBICONV_CFLAGS) \
$(INTL_CFLAGS) $(ATK_CFLAGS) $(INTL_CFLAGS) $(ATK_CFLAGS)
LDFLAGS = $(ATK_LIBS) /link /machine:ix86 $(LINKDEBUG) LDFLAGS = $(ATK_LIBS) /link /machine:ix86 $(LINKDEBUG)
@ -133,7 +133,7 @@ gtk_OBJECTS = \
gtkoptionmenu.obj \ gtkoptionmenu.obj \
gtkpaned.obj \ gtkpaned.obj \
gtkpixmap.obj \ gtkpixmap.obj \
gtkplug.obj \ # gtkplug.obj \
gtkpreview.obj \ gtkpreview.obj \
gtkprogress.obj \ gtkprogress.obj \
gtkprogressbar.obj \ gtkprogressbar.obj \
@ -152,7 +152,7 @@ gtk_OBJECTS = \
gtksettings.obj \ gtksettings.obj \
gtksignal.obj \ gtksignal.obj \
gtksizegroup.obj \ gtksizegroup.obj \
gtksocket.obj \ # gtksocket.obj \
gtkspinbutton.obj \ gtkspinbutton.obj \
gtkstyle.obj \ gtkstyle.obj \
gtkstatusbar.obj \ gtkstatusbar.obj \
@ -171,6 +171,7 @@ gtk_OBJECTS = \
gtktexttag.obj \ gtktexttag.obj \
gtktexttagtable.obj \ gtktexttagtable.obj \
gtktexttypes.obj \ gtktexttypes.obj \
gtktextutil.obj \
gtktextview.obj \ gtktextview.obj \
gtkthemes.obj \ gtkthemes.obj \
gtktipsquery.obj \ gtktipsquery.obj \