From b25e6c5b05df6b292171f67a1d3315ca579437d8 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist <tml@novell.com> Date: Thu, 13 Oct 2005 07:08:49 +0000 Subject: [PATCH] Set visual depth to 24 for 32 bits-per-pixel devices on Win32. This allows 2005-10-13 Tor Lillqvist <tml@novell.com> Set visual depth to 24 for 32 bits-per-pixel devices on Win32. This allows gdk_drawable_real_draw_pixbuf() to use the optimized composite_0888() function rather than the slower image dithering functions to draw pixbufs (#313993, John Ehresman) * gdk/win32/gdkimage-win32.c (_gdk_win32_new_image): Use _gdk_windowing_get_bits_for_depth() to initialize GdkImage::bits_per_pixel. (_gdk_windowing_get_bits_for_depth): Return 32 bits for depth 24. * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new): Use _gdk_windowing_get_bits_for_depth() to initialize BITMAPINFOHEADER::biBitCount. * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Set GdkVisual::depth to 24 even if GetDeviceCaps(BITSPIXEL) returns 32. --- ChangeLog | 20 ++++++++++++++++++++ ChangeLog.pre-2-10 | 20 ++++++++++++++++++++ gdk/win32/gdkimage-win32.c | 6 ++---- gdk/win32/gdkpixmap-win32.c | 2 +- gdk/win32/gdkvisual-win32.c | 1 + 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fd9db0df3..5eaa44f32a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2005-10-13 Tor Lillqvist <tml@novell.com> + + Set visual depth to 24 for 32 bits-per-pixel devices on + Win32. This allows gdk_drawable_real_draw_pixbuf() to use the + optimized composite_0888() function rather than the slower image + dithering functions to draw pixbufs (#313993, John Ehresman) + + * gdk/win32/gdkimage-win32.c (_gdk_win32_new_image): Use + _gdk_windowing_get_bits_for_depth() to initialize + GdkImage::bits_per_pixel. + (_gdk_windowing_get_bits_for_depth): Return 32 bits for depth 24. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new): Use + _gdk_windowing_get_bits_for_depth() to initialize + BITMAPINFOHEADER::biBitCount. + + * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Set + GdkVisual::depth to 24 even if GetDeviceCaps(BITSPIXEL) returns + 32. + 2005-10-12 Stefan Kost <ensonic@users.sf.net> * demos/gtk-demo/appwindow.c: (about_cb): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6fd9db0df3..5eaa44f32a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,23 @@ +2005-10-13 Tor Lillqvist <tml@novell.com> + + Set visual depth to 24 for 32 bits-per-pixel devices on + Win32. This allows gdk_drawable_real_draw_pixbuf() to use the + optimized composite_0888() function rather than the slower image + dithering functions to draw pixbufs (#313993, John Ehresman) + + * gdk/win32/gdkimage-win32.c (_gdk_win32_new_image): Use + _gdk_windowing_get_bits_for_depth() to initialize + GdkImage::bits_per_pixel. + (_gdk_windowing_get_bits_for_depth): Return 32 bits for depth 24. + + * gdk/win32/gdkpixmap-win32.c (gdk_pixmap_new): Use + _gdk_windowing_get_bits_for_depth() to initialize + BITMAPINFOHEADER::biBitCount. + + * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Set + GdkVisual::depth to 24 even if GetDeviceCaps(BITSPIXEL) returns + 32. + 2005-10-12 Stefan Kost <ensonic@users.sf.net> * demos/gtk-demo/appwindow.c: (about_cb): diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c index 7ed740db06..576bba7e60 100644 --- a/gdk/win32/gdkimage-win32.c +++ b/gdk/win32/gdkimage-win32.c @@ -127,6 +127,7 @@ _gdk_win32_new_image (GdkVisual *visual, image->width = width; image->height = height; image->depth = depth; + image->bits_per_pixel = _gdk_windowing_get_bits_for_depth (gdk_display_get_default (), depth); switch (depth) { case 1: @@ -142,7 +143,7 @@ _gdk_win32_new_image (GdkVisual *visual, image->bpp = 2; break; case 24: - image->bpp = 3; + image->bpp = image->bits_per_pixel / 8; break; case 32: image->bpp = 4; @@ -157,7 +158,6 @@ _gdk_win32_new_image (GdkVisual *visual, image->bpl = ((width - 1)/8 + 1)*4; else image->bpl = ((width*image->bpp - 1)/4 + 1)*4; - image->bits_per_pixel = image->depth; image->mem = bits; return image; @@ -423,8 +423,6 @@ _gdk_windowing_get_bits_for_depth (GdkDisplay *display, return 16; case 24: - return 24; - case 32: return 32; } diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c index 5d20d17967..362ef0759b 100644 --- a/gdk/win32/gdkpixmap-win32.c +++ b/gdk/win32/gdkpixmap-win32.c @@ -209,7 +209,7 @@ gdk_pixmap_new (GdkDrawable *drawable, case 1: case 24: case 32: - bmi.bmiHeader.biBitCount = depth; + bmi.bmiHeader.biBitCount = _gdk_windowing_get_bits_for_depth (gdk_display_get_default (), depth); break; case 4: diff --git a/gdk/win32/gdkvisual-win32.c b/gdk/win32/gdkvisual-win32.c index 0007c47d6a..ad821a3be9 100644 --- a/gdk/win32/gdkvisual-win32.c +++ b/gdk/win32/gdkvisual-win32.c @@ -246,6 +246,7 @@ _gdk_visual_init (void) } else if (bitspixel == 24 || bitspixel == 32) { + bitspixel = 24; system_visual->type = GDK_VISUAL_TRUE_COLOR; system_visual->red_mask = 0x00FF0000; system_visual->green_mask = 0x0000FF00; -- GitLab