i've created a patch to gimppaintcore.c which allows subsampling to be
disabled.
this is very useful for pixel-precise work and watermarks.
however.. i've looked around and i'm having difficulty understanding how to
add an interface to that [ie. put a 'disable subsampling' option in some part
of the preferences dialog, and make the 'disable subsampling' value be stored
in gimprc] . the documentation is unhelpful regarding info on this particular
subject.
if someone would either explain (generally) what sort of changes i'd need to
make, or actually make the changes, i'd appreciate that.
the current patch is attached; note that the conditional check for
disable_subsampling is not there. currently it checks a condition which will
always be true (== meaning that disable subsampling is always ON).
--- old/gimppaintcore.c 2002-11-16 15:20:24.000000000 -0500
+++ new/gimppaintcore.c 2002-11-22 14:59:18.000000000 -0500
@@ -1042,6 +1042,60 @@
}
}
+/* non-subsampling version of gimp_paint_core_subsample_mask
+ called by gimp_paint_core_subsample_mask if necessary
+
+ */
+
+static MaskBuf *
+gimp_paint_core_passthru_mask (GimpPaintCore *core,
+ MaskBuf *brush_mask)
+{
+ gint i;
+ gint j;
+ guchar *data;
+ guchar *src;
+
+ if (brush_mask == core->last_solid_brush &&
+ core->solid_brush &&
+ ! core->cache_invalid)
+ {
+ return core->solid_brush;
+ }
+
+ core->last_solid_brush = brush_mask;
+
+ if (core->solid_brush)
+ mask_buf_free (core->solid_brush);
+
+ core->solid_brush = mask_buf_new (brush_mask->width + 2,
+ brush_mask->height + 2);
+
+ /* get the data and advance one line into it */
+ data = (mask_buf_data (core->solid_brush) +
+ core->solid_brush->width);
+ src = mask_buf_data (brush_mask);
+
+ for (i = 0; i < brush_mask->height; i++)
+ {
+ data++;
+ for (j = 0; j < brush_mask->width; j++)
+ {
+ /* copy data directly */
+ *data++ = (*src++) ;
+ }
+ data++;
+ }
+
+ return core->solid_brush;
+}
+
+
+/* subsample a mask..
+
+ or not, depending on whether 'disable subsampling' is set.
+*/
+
static MaskBuf *
gimp_paint_core_subsample_mask (GimpPaintCore *core,
MaskBuf *mask,
@@ -1059,6 +1113,12 @@
gint new_val;
gint i, j;
gint r, s;
+
+ /* TODO : use actual option disable_subsampling */
+ if (0)
+ {
+ return gimp_paint_core_passthru_mask( core, mask );
+ }
x += (x < 0) ? mask->width : 0;
left = x - floor (x);