forked from AuroraMiddleware/gtk
Copy our gdkprivate.h and gdkx.h to a gdk subdirectory, so that
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and gdkx.h to a gdk subdirectory, so that applications can include these with <gdk/*.h> without trouble. * gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified. (gdk_image_destroy): Plugged resource leak, some GdkImages didn't have their bitmap destroyed. * gdk/win32/gdk.def: Add gdk_root_parent.
This commit is contained in:
parent
45dc3bcf82
commit
330dd2f7c3
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -1,3 +1,17 @@
|
||||
Wed May 19 01:09:34 1999 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
1999-05-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk/win32/makefile.{cygwin,msc}: Copy our gdkprivate.h and
|
||||
gdkx.h to a gdk subdirectory, so that applications can include
|
||||
these with <gdk/*.h> without trouble.
|
||||
|
||||
* gdk/win32/gdkimage.c (gdk_image_new_with_depth): Code simplified.
|
||||
(gdk_image_destroy): Plugged resource leak, some GdkImages didn't
|
||||
have their bitmap destroyed.
|
||||
|
||||
* gdk/win32/gdk.def: Add gdk_root_parent.
|
||||
|
||||
Wed May 12 03:00:56 CDT 1999 Shawn T. Amundson <amundson@gtk.org>
|
||||
|
||||
* configure.in
|
||||
|
@ -75,7 +75,7 @@ gdk_image_new_bitmap (GdkVisual *visual, gpointer data, gint w, gint h)
|
||||
private = g_new(GdkImagePrivate, 1);
|
||||
image = (GdkImage *) private;
|
||||
private->image_put = gdk_image_put_normal;
|
||||
image->type = GDK_IMAGE_NORMAL;
|
||||
image->type = GDK_IMAGE_SHARED;
|
||||
image->visual = visual;
|
||||
image->width = w;
|
||||
image->height = h;
|
||||
@ -151,142 +151,121 @@ gdk_image_new_with_depth (GdkImageType type,
|
||||
UINT iUsage;
|
||||
int i;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_image_new_with_depth: %dx%dx%d\n",
|
||||
width, height, depth));
|
||||
if (type == GDK_IMAGE_FASTEST || type == GDK_IMAGE_NORMAL)
|
||||
type = GDK_IMAGE_SHARED;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDK_IMAGE_FASTEST:
|
||||
image = gdk_image_new_with_depth (GDK_IMAGE_SHARED, visual,
|
||||
width, height, depth);
|
||||
GDK_NOTE (MISC, g_print ("gdk_image_new_with_depth: %dx%dx%d %s\n",
|
||||
width, height, depth,
|
||||
(type == GDK_IMAGE_SHARED ? "shared" :
|
||||
(type == GDK_IMAGE_SHARED_PIXMAP ? "shared_pixmap" :
|
||||
"???"))));
|
||||
|
||||
if (!image)
|
||||
image = gdk_image_new_with_depth (GDK_IMAGE_NORMAL, visual,
|
||||
width, height, depth);
|
||||
break;
|
||||
private = g_new (GdkImagePrivate, 1);
|
||||
image = (GdkImage*) private;
|
||||
|
||||
default:
|
||||
private = g_new (GdkImagePrivate, 1);
|
||||
image = (GdkImage*) private;
|
||||
private->image_put = NULL;
|
||||
|
||||
private->image_put = NULL;
|
||||
|
||||
image->type = type;
|
||||
image->visual = visual;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->depth = depth;
|
||||
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDK_IMAGE_SHARED:
|
||||
case GDK_IMAGE_SHARED_PIXMAP:
|
||||
/* Fall through, Windows images are always shared */
|
||||
case GDK_IMAGE_NORMAL:
|
||||
private->image_put = gdk_image_put_normal;
|
||||
|
||||
bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = width;
|
||||
bmi.bmiHeader.biHeight = -height;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
if (depth == 15)
|
||||
bmi.bmiHeader.biBitCount = 16;
|
||||
else
|
||||
bmi.bmiHeader.biBitCount = depth;
|
||||
#if 1
|
||||
if (depth == 16)
|
||||
bmi.bmiHeader.biCompression = BI_BITFIELDS;
|
||||
else
|
||||
#endif
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter =
|
||||
bmi.bmiHeader.biYPelsPerMeter = 0;
|
||||
bmi.bmiHeader.biClrUsed = 0;
|
||||
bmi.bmiHeader.biClrImportant = 0;
|
||||
|
||||
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR)
|
||||
{
|
||||
iUsage = DIB_PAL_COLORS;
|
||||
for (i = 0; i < 256; i++)
|
||||
bmi.u.bmiIndices[i] = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depth == 1)
|
||||
{
|
||||
bmi.u.bmiColors[0].rgbBlue =
|
||||
bmi.u.bmiColors[0].rgbGreen =
|
||||
bmi.u.bmiColors[0].rgbRed = 0x00;
|
||||
bmi.u.bmiColors[0].rgbReserved = 0x00;
|
||||
|
||||
bmi.u.bmiColors[1].rgbBlue =
|
||||
bmi.u.bmiColors[1].rgbGreen =
|
||||
bmi.u.bmiColors[1].rgbRed = 0xFF;
|
||||
bmi.u.bmiColors[1].rgbReserved = 0x00;
|
||||
|
||||
}
|
||||
#if 1
|
||||
else if (depth == 16)
|
||||
{
|
||||
bmi.u.bmiMasks[0] = visual->red_mask;
|
||||
bmi.u.bmiMasks[1] = visual->green_mask;
|
||||
bmi.u.bmiMasks[2] = visual->blue_mask;
|
||||
}
|
||||
#endif
|
||||
iUsage = DIB_RGB_COLORS;
|
||||
}
|
||||
|
||||
private->ximage =
|
||||
CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, iUsage,
|
||||
&image->mem, NULL, 0);
|
||||
|
||||
if (private->ximage == NULL)
|
||||
{
|
||||
g_warning ("gdk_image_new_with_depth: CreateDIBSection failed");
|
||||
g_free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (depth)
|
||||
{
|
||||
case 1:
|
||||
case 8:
|
||||
image->bpp = 1;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
image->bpp = 2;
|
||||
break;
|
||||
case 24:
|
||||
image->bpp = 3;
|
||||
break;
|
||||
case 32:
|
||||
image->bpp = 4;
|
||||
break;
|
||||
default:
|
||||
g_warning ("gdk_image_new_with_depth: depth = %d", depth);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
image->byte_order = GDK_LSB_FIRST;
|
||||
if (depth == 1)
|
||||
image->bpl = ((width-1)/32 + 1)*4;
|
||||
else
|
||||
image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("... = %#x mem = %#x, bpl = %d\n",
|
||||
private->ximage, image->mem, image->bpl));
|
||||
|
||||
break;
|
||||
|
||||
case GDK_IMAGE_FASTEST:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
image->type = type;
|
||||
image->visual = visual;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->depth = depth;
|
||||
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
private->image_put = gdk_image_put_normal;
|
||||
|
||||
break;
|
||||
bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = width;
|
||||
bmi.bmiHeader.biHeight = -height;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
if (depth == 15)
|
||||
bmi.bmiHeader.biBitCount = 16;
|
||||
else
|
||||
bmi.bmiHeader.biBitCount = depth;
|
||||
#if 1
|
||||
if (depth == 16)
|
||||
bmi.bmiHeader.biCompression = BI_BITFIELDS;
|
||||
else
|
||||
#endif
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter =
|
||||
bmi.bmiHeader.biYPelsPerMeter = 0;
|
||||
bmi.bmiHeader.biClrUsed = 0;
|
||||
bmi.bmiHeader.biClrImportant = 0;
|
||||
|
||||
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR)
|
||||
{
|
||||
iUsage = DIB_PAL_COLORS;
|
||||
for (i = 0; i < 256; i++)
|
||||
bmi.u.bmiIndices[i] = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depth == 1)
|
||||
{
|
||||
bmi.u.bmiColors[0].rgbBlue =
|
||||
bmi.u.bmiColors[0].rgbGreen =
|
||||
bmi.u.bmiColors[0].rgbRed = 0x00;
|
||||
bmi.u.bmiColors[0].rgbReserved = 0x00;
|
||||
|
||||
bmi.u.bmiColors[1].rgbBlue =
|
||||
bmi.u.bmiColors[1].rgbGreen =
|
||||
bmi.u.bmiColors[1].rgbRed = 0xFF;
|
||||
bmi.u.bmiColors[1].rgbReserved = 0x00;
|
||||
|
||||
}
|
||||
#if 1
|
||||
else if (depth == 16)
|
||||
{
|
||||
bmi.u.bmiMasks[0] = visual->red_mask;
|
||||
bmi.u.bmiMasks[1] = visual->green_mask;
|
||||
bmi.u.bmiMasks[2] = visual->blue_mask;
|
||||
}
|
||||
#endif
|
||||
iUsage = DIB_RGB_COLORS;
|
||||
}
|
||||
|
||||
private->ximage =
|
||||
CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, iUsage,
|
||||
&image->mem, NULL, 0);
|
||||
|
||||
if (private->ximage == NULL)
|
||||
{
|
||||
g_warning ("gdk_image_new_with_depth: CreateDIBSection failed");
|
||||
g_free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (depth)
|
||||
{
|
||||
case 1:
|
||||
case 8:
|
||||
image->bpp = 1;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
image->bpp = 2;
|
||||
break;
|
||||
case 24:
|
||||
image->bpp = 3;
|
||||
break;
|
||||
case 32:
|
||||
image->bpp = 4;
|
||||
break;
|
||||
default:
|
||||
g_warning ("gdk_image_new_with_depth: depth = %d", depth);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
image->byte_order = GDK_LSB_FIRST;
|
||||
if (depth == 1)
|
||||
image->bpl = ((width-1)/32 + 1)*4;
|
||||
else
|
||||
image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("... = %#x mem = %#x, bpl = %d\n",
|
||||
private->ximage, image->mem, image->bpl));
|
||||
|
||||
return image;
|
||||
}
|
||||
@ -347,7 +326,7 @@ gdk_image_get (GdkWindow *window,
|
||||
|
||||
private->image_put = gdk_image_put_normal;
|
||||
|
||||
image->type = GDK_IMAGE_NORMAL;
|
||||
image->type = GDK_IMAGE_SHARED;
|
||||
image->visual = gdk_window_get_visual (window);
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
@ -652,18 +631,18 @@ gdk_image_destroy (GdkImage *image)
|
||||
|
||||
switch (image->type)
|
||||
{
|
||||
case GDK_IMAGE_NORMAL:
|
||||
case GDK_IMAGE_SHARED_PIXMAP:
|
||||
break; /* The Windows bitmap has already been
|
||||
* (or will be) deleted when freeing
|
||||
* the corresponding pixmap.
|
||||
*/
|
||||
|
||||
case GDK_IMAGE_SHARED: /* All images are shared in Windows */
|
||||
DeleteObject (private->ximage);
|
||||
case GDK_IMAGE_SHARED:
|
||||
if (!DeleteObject (private->ximage))
|
||||
g_warning ("gdk_image_destroy: DeleteObject failed");
|
||||
break;
|
||||
|
||||
case GDK_IMAGE_FASTEST:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ gdk_image_new_bitmap (GdkVisual *visual, gpointer data, gint w, gint h)
|
||||
private = g_new(GdkImagePrivate, 1);
|
||||
image = (GdkImage *) private;
|
||||
private->image_put = gdk_image_put_normal;
|
||||
image->type = GDK_IMAGE_NORMAL;
|
||||
image->type = GDK_IMAGE_SHARED;
|
||||
image->visual = visual;
|
||||
image->width = w;
|
||||
image->height = h;
|
||||
@ -151,142 +151,121 @@ gdk_image_new_with_depth (GdkImageType type,
|
||||
UINT iUsage;
|
||||
int i;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_image_new_with_depth: %dx%dx%d\n",
|
||||
width, height, depth));
|
||||
if (type == GDK_IMAGE_FASTEST || type == GDK_IMAGE_NORMAL)
|
||||
type = GDK_IMAGE_SHARED;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDK_IMAGE_FASTEST:
|
||||
image = gdk_image_new_with_depth (GDK_IMAGE_SHARED, visual,
|
||||
width, height, depth);
|
||||
GDK_NOTE (MISC, g_print ("gdk_image_new_with_depth: %dx%dx%d %s\n",
|
||||
width, height, depth,
|
||||
(type == GDK_IMAGE_SHARED ? "shared" :
|
||||
(type == GDK_IMAGE_SHARED_PIXMAP ? "shared_pixmap" :
|
||||
"???"))));
|
||||
|
||||
if (!image)
|
||||
image = gdk_image_new_with_depth (GDK_IMAGE_NORMAL, visual,
|
||||
width, height, depth);
|
||||
break;
|
||||
private = g_new (GdkImagePrivate, 1);
|
||||
image = (GdkImage*) private;
|
||||
|
||||
default:
|
||||
private = g_new (GdkImagePrivate, 1);
|
||||
image = (GdkImage*) private;
|
||||
private->image_put = NULL;
|
||||
|
||||
private->image_put = NULL;
|
||||
|
||||
image->type = type;
|
||||
image->visual = visual;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->depth = depth;
|
||||
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDK_IMAGE_SHARED:
|
||||
case GDK_IMAGE_SHARED_PIXMAP:
|
||||
/* Fall through, Windows images are always shared */
|
||||
case GDK_IMAGE_NORMAL:
|
||||
private->image_put = gdk_image_put_normal;
|
||||
|
||||
bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = width;
|
||||
bmi.bmiHeader.biHeight = -height;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
if (depth == 15)
|
||||
bmi.bmiHeader.biBitCount = 16;
|
||||
else
|
||||
bmi.bmiHeader.biBitCount = depth;
|
||||
#if 1
|
||||
if (depth == 16)
|
||||
bmi.bmiHeader.biCompression = BI_BITFIELDS;
|
||||
else
|
||||
#endif
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter =
|
||||
bmi.bmiHeader.biYPelsPerMeter = 0;
|
||||
bmi.bmiHeader.biClrUsed = 0;
|
||||
bmi.bmiHeader.biClrImportant = 0;
|
||||
|
||||
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR)
|
||||
{
|
||||
iUsage = DIB_PAL_COLORS;
|
||||
for (i = 0; i < 256; i++)
|
||||
bmi.u.bmiIndices[i] = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depth == 1)
|
||||
{
|
||||
bmi.u.bmiColors[0].rgbBlue =
|
||||
bmi.u.bmiColors[0].rgbGreen =
|
||||
bmi.u.bmiColors[0].rgbRed = 0x00;
|
||||
bmi.u.bmiColors[0].rgbReserved = 0x00;
|
||||
|
||||
bmi.u.bmiColors[1].rgbBlue =
|
||||
bmi.u.bmiColors[1].rgbGreen =
|
||||
bmi.u.bmiColors[1].rgbRed = 0xFF;
|
||||
bmi.u.bmiColors[1].rgbReserved = 0x00;
|
||||
|
||||
}
|
||||
#if 1
|
||||
else if (depth == 16)
|
||||
{
|
||||
bmi.u.bmiMasks[0] = visual->red_mask;
|
||||
bmi.u.bmiMasks[1] = visual->green_mask;
|
||||
bmi.u.bmiMasks[2] = visual->blue_mask;
|
||||
}
|
||||
#endif
|
||||
iUsage = DIB_RGB_COLORS;
|
||||
}
|
||||
|
||||
private->ximage =
|
||||
CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, iUsage,
|
||||
&image->mem, NULL, 0);
|
||||
|
||||
if (private->ximage == NULL)
|
||||
{
|
||||
g_warning ("gdk_image_new_with_depth: CreateDIBSection failed");
|
||||
g_free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (depth)
|
||||
{
|
||||
case 1:
|
||||
case 8:
|
||||
image->bpp = 1;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
image->bpp = 2;
|
||||
break;
|
||||
case 24:
|
||||
image->bpp = 3;
|
||||
break;
|
||||
case 32:
|
||||
image->bpp = 4;
|
||||
break;
|
||||
default:
|
||||
g_warning ("gdk_image_new_with_depth: depth = %d", depth);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
image->byte_order = GDK_LSB_FIRST;
|
||||
if (depth == 1)
|
||||
image->bpl = ((width-1)/32 + 1)*4;
|
||||
else
|
||||
image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("... = %#x mem = %#x, bpl = %d\n",
|
||||
private->ximage, image->mem, image->bpl));
|
||||
|
||||
break;
|
||||
|
||||
case GDK_IMAGE_FASTEST:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
image->type = type;
|
||||
image->visual = visual;
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
image->depth = depth;
|
||||
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
private->image_put = gdk_image_put_normal;
|
||||
|
||||
break;
|
||||
bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
|
||||
bmi.bmiHeader.biWidth = width;
|
||||
bmi.bmiHeader.biHeight = -height;
|
||||
bmi.bmiHeader.biPlanes = 1;
|
||||
if (depth == 15)
|
||||
bmi.bmiHeader.biBitCount = 16;
|
||||
else
|
||||
bmi.bmiHeader.biBitCount = depth;
|
||||
#if 1
|
||||
if (depth == 16)
|
||||
bmi.bmiHeader.biCompression = BI_BITFIELDS;
|
||||
else
|
||||
#endif
|
||||
bmi.bmiHeader.biCompression = BI_RGB;
|
||||
bmi.bmiHeader.biSizeImage = 0;
|
||||
bmi.bmiHeader.biXPelsPerMeter =
|
||||
bmi.bmiHeader.biYPelsPerMeter = 0;
|
||||
bmi.bmiHeader.biClrUsed = 0;
|
||||
bmi.bmiHeader.biClrImportant = 0;
|
||||
|
||||
if (image->visual->type == GDK_VISUAL_PSEUDO_COLOR)
|
||||
{
|
||||
iUsage = DIB_PAL_COLORS;
|
||||
for (i = 0; i < 256; i++)
|
||||
bmi.u.bmiIndices[i] = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depth == 1)
|
||||
{
|
||||
bmi.u.bmiColors[0].rgbBlue =
|
||||
bmi.u.bmiColors[0].rgbGreen =
|
||||
bmi.u.bmiColors[0].rgbRed = 0x00;
|
||||
bmi.u.bmiColors[0].rgbReserved = 0x00;
|
||||
|
||||
bmi.u.bmiColors[1].rgbBlue =
|
||||
bmi.u.bmiColors[1].rgbGreen =
|
||||
bmi.u.bmiColors[1].rgbRed = 0xFF;
|
||||
bmi.u.bmiColors[1].rgbReserved = 0x00;
|
||||
|
||||
}
|
||||
#if 1
|
||||
else if (depth == 16)
|
||||
{
|
||||
bmi.u.bmiMasks[0] = visual->red_mask;
|
||||
bmi.u.bmiMasks[1] = visual->green_mask;
|
||||
bmi.u.bmiMasks[2] = visual->blue_mask;
|
||||
}
|
||||
#endif
|
||||
iUsage = DIB_RGB_COLORS;
|
||||
}
|
||||
|
||||
private->ximage =
|
||||
CreateDIBSection (gdk_DC, (BITMAPINFO *) &bmi, iUsage,
|
||||
&image->mem, NULL, 0);
|
||||
|
||||
if (private->ximage == NULL)
|
||||
{
|
||||
g_warning ("gdk_image_new_with_depth: CreateDIBSection failed");
|
||||
g_free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (depth)
|
||||
{
|
||||
case 1:
|
||||
case 8:
|
||||
image->bpp = 1;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
image->bpp = 2;
|
||||
break;
|
||||
case 24:
|
||||
image->bpp = 3;
|
||||
break;
|
||||
case 32:
|
||||
image->bpp = 4;
|
||||
break;
|
||||
default:
|
||||
g_warning ("gdk_image_new_with_depth: depth = %d", depth);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
image->byte_order = GDK_LSB_FIRST;
|
||||
if (depth == 1)
|
||||
image->bpl = ((width-1)/32 + 1)*4;
|
||||
else
|
||||
image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("... = %#x mem = %#x, bpl = %d\n",
|
||||
private->ximage, image->mem, image->bpl));
|
||||
|
||||
return image;
|
||||
}
|
||||
@ -347,7 +326,7 @@ gdk_image_get (GdkWindow *window,
|
||||
|
||||
private->image_put = gdk_image_put_normal;
|
||||
|
||||
image->type = GDK_IMAGE_NORMAL;
|
||||
image->type = GDK_IMAGE_SHARED;
|
||||
image->visual = gdk_window_get_visual (window);
|
||||
image->width = width;
|
||||
image->height = height;
|
||||
@ -652,18 +631,18 @@ gdk_image_destroy (GdkImage *image)
|
||||
|
||||
switch (image->type)
|
||||
{
|
||||
case GDK_IMAGE_NORMAL:
|
||||
case GDK_IMAGE_SHARED_PIXMAP:
|
||||
break; /* The Windows bitmap has already been
|
||||
* (or will be) deleted when freeing
|
||||
* the corresponding pixmap.
|
||||
*/
|
||||
|
||||
case GDK_IMAGE_SHARED: /* All images are shared in Windows */
|
||||
DeleteObject (private->ximage);
|
||||
case GDK_IMAGE_SHARED:
|
||||
if (!DeleteObject (private->ximage))
|
||||
g_warning ("gdk_image_destroy: DeleteObject failed");
|
||||
break;
|
||||
|
||||
case GDK_IMAGE_FASTEST:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@ GLIB = ../../../glib
|
||||
CFLAGS = -g -I. -I../.. -I$(WTKIT)/include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" -DNEAR= -DFAR=
|
||||
|
||||
all: \
|
||||
gdk/gdkprivate.h \
|
||||
gdk/gdkx.h \
|
||||
../../config.h \
|
||||
gdk-$(GTK_VER).dll
|
||||
|
||||
@ -58,6 +60,26 @@ gdk_OBJECTS = \
|
||||
gdkwindow.o \
|
||||
gdkxid.o
|
||||
|
||||
# We must have copies of gdkx.h and gdkprivate.h in the gdk
|
||||
# subdirectory, so that application sources which want to be
|
||||
# compilable with both GTk+ 1.2 (where there are no separate backend
|
||||
# gdk directories) and this 1.3 version (where the Win32 backend is in
|
||||
# the directory of *this* file you are reading right now) can use
|
||||
# #include <gdk/gdkprivate.h>.
|
||||
|
||||
# Applications that depend on GTk+ 1.3 or later should include
|
||||
# gdkprivate.h and gdkx.h without the gdk/ prefix. The CFLAGS should
|
||||
# include an -I switch pointing to the backend-specific directory
|
||||
# (*this* directory in the Win32 case).
|
||||
|
||||
gdk/gdkprivate.h : gdkprivate.h
|
||||
-mkdir gdk
|
||||
cp gdkprivate.h gdk
|
||||
|
||||
gdk/gdkx.h : gdkx.h
|
||||
-mkdir gdk
|
||||
cp gdkx.h gdk
|
||||
|
||||
../../config.h : ../../config.h.win32
|
||||
$(CP) ../../config.h.win32 ../../config.h
|
||||
|
||||
|
@ -20,7 +20,7 @@ OPTIMIZE = -Ox
|
||||
# cl -? describes the options
|
||||
CC = cl -G5 -GF $(OPTIMIZE) -W3 -MD -nologo
|
||||
|
||||
LDFLAGS = /link /machine:ix86 # /debug /debugtype:cv
|
||||
LDFLAGS = /link /machine:ix86 # /debug
|
||||
INSTALL = copy
|
||||
TOUCH = copy makefile.msc+nul
|
||||
|
||||
@ -31,6 +31,8 @@ GLIB = ..\..\..\glib
|
||||
CFLAGS = -I. -I..\.. -I$(WTKIT)\include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\"
|
||||
|
||||
all: \
|
||||
gdk\gdkprivate.h \
|
||||
gdk\gdkx.h \
|
||||
..\..\config.h \
|
||||
gdk-$(GTK_VER).dll
|
||||
$(TOUCH) all
|
||||
@ -63,6 +65,26 @@ gdk_OBJECTS = \
|
||||
gdkwindow.obj \
|
||||
gdkxid.obj
|
||||
|
||||
# We must have copies of gdkx.h and gdkprivate.h in the gdk
|
||||
# subdirectory, so that application sources which want to be
|
||||
# compilable with both GTk+ 1.2 (where there are no separate backend
|
||||
# gdk directories) and this 1.3 version (where the Win32 backend is in
|
||||
# the directory of *this* file you are reading right now) can use
|
||||
# #include <gdk/gdkprivate.h>.
|
||||
|
||||
# Applications that depend on GTk+ 1.3 or later should include
|
||||
# gdkprivate.h and gdkx.h without the gdk/ prefix. The CFLAGS should
|
||||
# include an -I switch pointing to the backend-specific directory
|
||||
# (*this* directory in the Win32 case).
|
||||
|
||||
gdk\gdkprivate.h : gdkprivate.h
|
||||
-md gdk
|
||||
copy gdkprivate.h gdk
|
||||
|
||||
gdk\gdkx.h : gdkx.h
|
||||
-md gdk
|
||||
copy gdkx.h gdk
|
||||
|
||||
..\..\config.h : ..\..\config.h.win32
|
||||
copy ..\..\config.h.win32 ..\..\config.h
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user