Also for truecolor drawables use just the pixel field in the foreground

1999-11-18  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.

gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.

(Note that this version of gdkgc-win32.c still is the old gdkgc.c,
it won't compile in the reorganised directory structure.)
This commit is contained in:
Tor Lillqvist 1999-11-18 22:03:24 +00:00 committed by Tor Lillqvist
parent 36a27c6759
commit c00a9a84ea
8 changed files with 121 additions and 12 deletions

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -1,3 +1,17 @@
1999-11-18 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Also for truecolor
drawables use just the pixel field in the foreground and
background GdkColor of the GdkGC.
gdk_gc_set_{fore,back}ground() are called in the GIMP with
GdkColors containing uninitialized (red,green,blue) fields, and
just the pixel field filled in, and furthermore in the
visual-dependent format as returned by gdk_rgb_xpixel_from_rgb().
It thus turns out that we really don't need to have the full
GdkColor for fg and bg in GdkGCWin32Data after all. Will change
it later to have just the pixel values.
Mon Nov 15 17:17:51 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: s/gtk_main_iteration/g_main_iteration/

View File

@ -905,11 +905,14 @@ gdk_gc_predraw (GdkDrawable *drawable,
GdkDrawablePrivate *drawable_private = (GdkDrawablePrivate *) drawable;
GdkColormapPrivate *colormap_private =
(GdkColormapPrivate *) drawable_private->colormap;
GdkVisual *visual;
COLORREF bg;
COLORREF fg;
LOGBRUSH logbrush;
HPEN hpen;
HBRUSH hbr;
guchar r, g, b;
static guint mask[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
g_assert (gc_private->xgc == NULL);
@ -966,8 +969,7 @@ gdk_gc_predraw (GdkDrawable *drawable,
RealizePalette (gc_private->xgc);
fg = PALETTEINDEX (gc_private->foreground.pixel);
}
else if (colormap_private != NULL
&& colormap_private->xcolormap->rc_palette)
else if (colormap_private->xcolormap->rc_palette)
{
int k;
if (SelectPalette (gc_private->xgc,
@ -987,10 +989,15 @@ gdk_gc_predraw (GdkDrawable *drawable,
}
else
{
COLORREF foreground = RGB (gc_private->foreground.red >> 8,
gc_private->foreground.green >> 8,
gc_private->foreground.blue >> 8);
fg = GetNearestColor (gc_private->xgc, foreground);
visual = colormap_private->visual;
r = (gc_private->foreground.pixel & visual->red_mask) >> visual->red_shift;
r = (r * 255) / mask[visual->red_prec];
g = (gc_private->foreground.pixel & visual->green_mask) >> visual->green_shift;
g = (g * 255) / mask[visual->green_prec];
b = (gc_private->foreground.pixel & visual->blue_mask) >> visual->blue_shift;
b = (b * 255) / mask[visual->blue_prec];
fg = GetNearestColor (gc_private->xgc, RGB (r, g, b));
}
logbrush.lbStyle = BS_SOLID;
logbrush.lbColor = fg;
@ -1044,17 +1051,21 @@ gdk_gc_predraw (GdkDrawable *drawable,
/* a bitmap */
bg = PALETTEINDEX (gc_private->background.pixel);
}
else if (colormap_private != NULL
&& colormap_private->xcolormap->rc_palette)
else if (colormap_private->xcolormap->rc_palette)
{
bg = PALETTEINDEX (gc_private->background.pixel);
}
else
{
COLORREF background = RGB (gc_private->background.red >> 8,
gc_private->background.green >> 8,
gc_private->background.blue >> 8);
bg = GetNearestColor (gc_private->xgc, background);
visual = colormap_private->visual;
r = (gc_private->background.pixel & visual->red_mask) >> visual->red_shift;
r = (r * 255) / mask[visual->red_prec];
g = (gc_private->background.pixel & visual->green_mask) >> visual->green_shift;
g = (g * 255) / mask[visual->green_prec];
b = (gc_private->background.pixel & visual->blue_mask) >> visual->blue_shift;
b = (b * 255) / mask[visual->green_prec];
fg = GetNearestColor (gc_private->xgc, RGB (r, g, b));
}
if (SetBkColor (gc_private->xgc, bg) == CLR_INVALID)
g_warning ("gdk_gc_predraw: SetBkColor failed");