Commit 588e9d1d authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Implement copy_to_image instead of get_image

2002-01-25  Alex Larsson  <alexl@redhat.com>

	* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
	Implement copy_to_image instead of get_image

	* gdk/linux-fb/gdkimage-fb.c:
	Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
	_gdk_fb_copy_to_image.
	Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>

	* gdk/linux-fb/gdkmain-fb.c:
	Make ENABLE_FB_MANAGER region larger.

	* gdk/linux-fb/gdkprivate-fb.h:
	Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
parent 54b6e6f7
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
2002-01-25 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_drawable_impl_fb_class_init):
Implement copy_to_image instead of get_image
* gdk/linux-fb/gdkimage-fb.c:
Implement _gdk_image_new_for_depth, _gdk_windowing_get_bits_for_depth and
_gdk_fb_copy_to_image.
Based in part on patch from Mathieu Lacage <mathieu_lacage@realmagic.fr>
* gdk/linux-fb/gdkmain-fb.c:
Make ENABLE_FB_MANAGER region larger.
* gdk/linux-fb/gdkprivate-fb.h:
Change _gdk_fb_get_image to _gdk_fb_copy_to_image.
2002-01-25 Sven Neumann <sven@gimp.org>
* gtk/gtkwindow.c (gtk_window_get_size): changed the comment so
......
......@@ -221,7 +221,7 @@ gdk_drawable_impl_fb_class_init (GdkDrawableFBClass *klass)
drawable_class->get_depth = gdk_fb_get_depth;
drawable_class->get_visual = gdk_fb_get_visual;
drawable_class->get_image = _gdk_fb_get_image;
drawable_class->_copy_to_image = _gdk_fb_copy_to_image;
}
static void
......
......@@ -103,6 +103,41 @@ gdk_image_get_type (void)
return object_type;
}
GdkImage*
_gdk_image_new_for_depth (GdkImageType type,
GdkVisual *visual,
gint width,
gint height,
gint depth)
{
GdkImage *image;
GdkImagePrivateFB *private;
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;
image = g_object_new (gdk_image_get_type (), NULL);
private = GDK_IMAGE_PRIVATE_DATA (image);
image->type = 0;
image->visual = visual;
image->width = width;
image->height = height;
image->depth = depth;
image->byte_order = 0;
image->bits_per_pixel = image->depth;
image->bpp = image->depth/8;
image->bpl = (width * image->depth + 7) / 8;
image->mem = g_malloc (image->bpl * height);
return image;
}
GdkImage *
gdk_image_new_bitmap(GdkVisual *visual,
gpointer data,
......@@ -141,35 +176,19 @@ gdk_image_new (GdkImageType type,
gint width,
gint height)
{
GdkImage *image;
GdkImagePrivateFB *private;
image = g_object_new (gdk_image_get_type (), NULL);
private = GDK_IMAGE_PRIVATE_DATA (image);
image->type = 0;
image->visual = visual;
image->width = width;
image->height = height;
image->depth = visual->depth;
image->byte_order = 0;
image->bits_per_pixel = image->depth;
image->bpp = image->depth/8;
image->bpl = (width * image->depth + 7) / 8;
image->mem = g_malloc (image->bpl * height);
return image;
return _gdk_image_new_for_depth (type, visual, width, height, -1);
}
GdkImage*
_gdk_fb_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
_gdk_fb_copy_to_image (GdkDrawable *drawable,
GdkImage *image,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height)
{
GdkImage *image;
GdkImagePrivateFB *private;
GdkPixmapFBData fbd;
GdkRegion *region = NULL;
......@@ -177,28 +196,35 @@ _gdk_fb_get_image (GdkDrawable *drawable,
g_return_val_if_fail (drawable != NULL, NULL);
image = g_object_new (gdk_image_get_type (), NULL);
if (image == NULL)
{
image = g_object_new (gdk_image_get_type (), NULL);
image->type = GDK_IMAGE_NORMAL;
image->visual = gdk_drawable_get_visual (drawable);
image->width = width;
image->height = height;
image->bits_per_pixel = GDK_DRAWABLE_FBDATA (drawable)->depth;
image->depth = image->bits_per_pixel;
if (image->bits_per_pixel <= 8)
image->bpp = 1;
else if (image->bits_per_pixel <= 16)
image->bpp = 2;
else if (image->bits_per_pixel <= 24)
image->bpp = 3;
else
image->bpp = 4;
image->byte_order = 1;
image->bpl = (image->width * image->depth + 7) / 8; /* Packed pixels */
image->mem = g_malloc (image->bpl * image->height);
dest_x = 0;
dest_y = 0;
}
private = GDK_IMAGE_PRIVATE_DATA (image);
image->type = GDK_IMAGE_NORMAL;
image->visual = gdk_drawable_get_visual (drawable);
image->width = width;
image->height = height;
image->bits_per_pixel = GDK_DRAWABLE_FBDATA (drawable)->depth;
image->depth = image->bits_per_pixel;
if (image->bits_per_pixel <= 8)
image->bpp = 1;
else if (image->bits_per_pixel <= 16)
image->bpp = 2;
else if (image->bits_per_pixel <= 24)
image->bpp = 3;
else
image->bpp = 4;
image->byte_order = 1;
image->bpl = (image->width * image->depth + 7) / 8; /* Packed pixels */
image->mem = g_malloc (image->bpl * image->height);
/* Fake its existence as a pixmap */
memset (&fbd, 0, sizeof(fbd));
......@@ -224,8 +250,8 @@ _gdk_fb_get_image (GdkDrawable *drawable,
gdk_fb_draw_drawable_2 ((GdkPixmap *)&fbd,
_gdk_fb_screen_gc,
drawable,
x, y,
0, 0,
src_x, src_y,
dest_x, dest_y,
width, height,
TRUE, TRUE);
......@@ -314,3 +340,19 @@ void
_gdk_image_exit(void)
{
}
/* copy/pasted from gdkimage-win32.c */
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;
}
......@@ -567,6 +567,7 @@ gdk_fb_manager_callback (GIOChannel *gioc,
static void
gdk_fb_manager_connect (GdkFBDisplay *display)
{
#ifdef ENABLE_FB_MANAGER
int fd;
struct sockaddr_un addr;
struct msghdr msg = {0};
......@@ -581,7 +582,6 @@ gdk_fb_manager_connect (GdkFBDisplay *display)
display->manager_blocked = FALSE;
display->manager_fd = -1;
#ifdef ENABLE_FB_MANAGER
fd = socket (PF_UNIX, SOCK_STREAM, 0);
g_print ("socket: %d\n", fd);
......
......@@ -308,11 +308,14 @@ GdkGC * _gdk_fb_gc_new (GdkDrawable *drawable,
void _gdk_fb_gc_calc_state (GdkGC *gc,
GdkGCValuesMask changed);
GdkImage *_gdk_fb_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
GdkImage *_gdk_fb_copy_to_image (GdkDrawable *drawable,
GdkImage *image,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height);
void gdk_fb_drawable_clear (GdkDrawable *drawable);
void gdk_fb_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment