gimp r26974 - trunk/plug-ins/print
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26974 - trunk/plug-ins/print
- Date: Wed, 17 Sep 2008 15:03:36 +0000 (UTC)
Author: neo
Date: Wed Sep 17 15:03:36 2008
New Revision: 26974
URL: http://svn.gnome.org/viewvc/gimp?rev=26974&view=rev
Log:
somewhat safer use of the colormap
Modified:
trunk/plug-ins/print/print-draw-page.c
Modified: trunk/plug-ins/print/print-draw-page.c
==============================================================================
--- trunk/plug-ins/print/print-draw-page.c (original)
+++ trunk/plug-ins/print/print-draw-page.c Wed Sep 17 15:03:36 2008
@@ -18,6 +18,8 @@
#include "config.h"
+#include <string.h>
+
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@@ -165,23 +167,27 @@
static cairo_surface_t *
print_cairo_surface_from_drawable (gint32 drawable_ID)
{
- GimpDrawable *drawable = gimp_drawable_get (drawable_ID);
+ GimpDrawable *drawable = gimp_drawable_get (drawable_ID);
GimpPixelRgn region;
- GimpImageType image_type = gimp_drawable_type (drawable_ID);
+ GimpImageType image_type = gimp_drawable_type (drawable_ID);
cairo_surface_t *surface;
- const gint width = drawable->width;
- const gint height = drawable->height;
- guchar *cmap = NULL;
+ const gint width = drawable->width;
+ const gint height = drawable->height;
+ guchar cmap[3 * 256] = { 0, };
guchar *pixels;
gint stride;
- guint count = 0;
- guint done = 0;
+ guint count = 0;
+ guint done = 0;
gpointer pr;
if (gimp_drawable_is_indexed (drawable_ID))
{
- cmap = gimp_image_get_colormap (gimp_drawable_get_image (drawable_ID),
- NULL);
+ guchar *colors;
+ gint num_colors;
+
+ colors = gimp_image_get_colormap (gimp_drawable_get_image (drawable_ID),
+ &num_colors);
+ memcpy (cmap, colors, 3 * num_colors);
}
surface = cairo_image_surface_create (gimp_drawable_has_alpha (drawable_ID) ?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]