Author: dsilvers
Date: Wed Aug 9 14:46:51 2006
New Revision: 2819
URL:
http://svn.semichrome.net?rev=2819&view=rev
Log:
GTK struct bitmap is now a struct, also alter plotters to use a specific call to get the
primary image out.
Added:
branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.h
Modified:
branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.c
branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_plotters.c
Modified: branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.c
URL:
http://svn.semichrome.net/branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bi...
==============================================================================
--- branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.c (original)
+++ branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.c Wed Aug 9 14:46:51 2006
@@ -21,7 +21,9 @@
#include "netsurf/image/bitmap.h"
-struct bitmap;
+struct bitmap {
+ GdkPixbuf *primary;
+};
/**
@@ -35,9 +37,10 @@
struct bitmap *bitmap_create(int width, int height, unsigned int state)
{
- GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8,
- width, height);
- return (struct bitmap *) pixbuf;
+ struct bitmap *bmp = malloc(sizeof(struct bitmap));
+ bmp->primary = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8,
+ width, height);
+ return bmp;
}
@@ -94,7 +97,7 @@
char *bitmap_get_buffer(struct bitmap *bitmap)
{
assert(bitmap);
- return (char *)gdk_pixbuf_get_pixels((GdkPixbuf *) bitmap);
+ return (char *)gdk_pixbuf_get_pixels(bitmap->primary);
}
@@ -108,7 +111,7 @@
size_t bitmap_get_rowstride(struct bitmap *bitmap)
{
assert(bitmap);
- return gdk_pixbuf_get_rowstride((GdkPixbuf *) bitmap);
+ return gdk_pixbuf_get_rowstride(bitmap->primary);
}
@@ -121,7 +124,8 @@
void bitmap_destroy(struct bitmap *bitmap)
{
assert(bitmap);
- g_object_unref((GdkPixbuf *) bitmap);
+ g_object_unref(bitmap->primary);
+ free(bitmap);
}
@@ -159,3 +163,14 @@
void bitmap_set_suspendable(struct bitmap *bitmap, void *private_word,
void (*invalidate)(struct bitmap *bitmap, void *private_word)) {
}
+
+/**
+ * The primary image associated with this bitmap object.
+ *
+ * \param bitmap a bitmap, as returned by bitmap_create()
+ */
+GdkPixbuf *
+gtk_bitmap_get_primary(struct bitmap* bitmap)
+{
+ return bitmap->primary;
+}
Added: branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.h
URL:
http://svn.semichrome.net/branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bi...
==============================================================================
--- branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.h (added)
+++ branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_bitmap.h Wed Aug 9 14:46:51 2006
@@ -1,0 +1,18 @@
+/*
+ * This file is part of NetSurf,
http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ *
http://www.opensource.org/licenses/gpl-license
+ * Copyright 2006 Daniel Silverstone <dsilvers(a)digital-scurf.org>
+ */
+
+#ifndef NS_GTK_BITMAP_H
+#define NS_GTK_BITMAP_H
+
+#include <gdk/gdk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "netsurf/image/bitmap.h"
+
+GdkPixbuf *gtk_bitmap_get_primary(struct bitmap*);
+
+
+#endif /* NS_GTK_BITMAP_H */
Modified: branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_plotters.c
URL:
http://svn.semichrome.net/branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_pl...
==============================================================================
--- branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_plotters.c (original)
+++ branches/dsilvers/gtk-bitmap-pretile/gtk/gtk_plotters.c Wed Aug 9 14:46:51 2006
@@ -26,6 +26,7 @@
#include "netsurf/utils/log.h"
#include "netsurf/desktop/options.h"
#include "netsurf/gtk/options.h"
+#include "netsurf/gtk/gtk_bitmap.h"
static bool nsgtk_plot_clg(colour c);
static bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
@@ -262,7 +263,7 @@
/* XXX: This currently ignores the background colour supplied.
* Does this matter?
*/
- GdkPixbuf *pixbuf = (GdkPixbuf *) bitmap;
+ GdkPixbuf *pixbuf = gtk_bitmap_get_primary(bitmap);
if (width == 0 || height == 0)
return true;