mirror of https://github.com/GNOME/gimp.git
Use MAX when combining multiple blobs, instead of previous technique. This
Fri Nov 27 17:34:57 1998 Owen Taylor <otaylor@redhat.com> * app/ink.c: Use MAX when combining multiple blobs, instead of previous technique. This gives _much_ better results.
This commit is contained in:
parent
583bea6c30
commit
25ba123167
16
app/ink.c
16
app/ink.c
|
@ -74,9 +74,13 @@ struct _BrushWidget
|
||||||
|
|
||||||
/* undo blocks variables */
|
/* undo blocks variables */
|
||||||
static TileManager * undo_tiles = NULL;
|
static TileManager * undo_tiles = NULL;
|
||||||
|
|
||||||
|
/* Tiles used to render the stroke at 1 byte/pp */
|
||||||
static TileManager * canvas_tiles = NULL;
|
static TileManager * canvas_tiles = NULL;
|
||||||
|
|
||||||
/* paint buffer */
|
/* Flat buffer that is used to used to render the dirty region
|
||||||
|
* for composition onto the destination drawable
|
||||||
|
*/
|
||||||
static TempBuf * canvas_buf = NULL;
|
static TempBuf * canvas_buf = NULL;
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
|
@ -794,7 +798,7 @@ fill_run (guchar *dest,
|
||||||
{
|
{
|
||||||
while (w--)
|
while (w--)
|
||||||
{
|
{
|
||||||
*dest += ((256 - *dest) * alpha) >> 8;
|
*dest = MAX(*dest, alpha);
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,9 +897,7 @@ render_blob_line (Blob *blob, guchar *dest,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the pixel */
|
dest[cur_x] = MAX(dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
|
||||||
dest[cur_x] +=
|
|
||||||
((256 - dest[cur_x]) * pixel * 255) / (256 * SUBSAMPLE * SUBSAMPLE);
|
|
||||||
|
|
||||||
last_x = cur_x + 1;
|
last_x = cur_x + 1;
|
||||||
}
|
}
|
||||||
|
@ -999,6 +1001,10 @@ ink_paste (InkTool *ink_tool,
|
||||||
canvas_buf->width, canvas_buf->height);
|
canvas_buf->width, canvas_buf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This routine a) updates the representation of the stroke
|
||||||
|
* in the canvas tiles, then renders the dirty bit of it
|
||||||
|
* into canvas_buf.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
ink_to_canvas_tiles (InkTool *ink_tool,
|
ink_to_canvas_tiles (InkTool *ink_tool,
|
||||||
Blob *blob,
|
Blob *blob,
|
||||||
|
|
|
@ -74,9 +74,13 @@ struct _BrushWidget
|
||||||
|
|
||||||
/* undo blocks variables */
|
/* undo blocks variables */
|
||||||
static TileManager * undo_tiles = NULL;
|
static TileManager * undo_tiles = NULL;
|
||||||
|
|
||||||
|
/* Tiles used to render the stroke at 1 byte/pp */
|
||||||
static TileManager * canvas_tiles = NULL;
|
static TileManager * canvas_tiles = NULL;
|
||||||
|
|
||||||
/* paint buffer */
|
/* Flat buffer that is used to used to render the dirty region
|
||||||
|
* for composition onto the destination drawable
|
||||||
|
*/
|
||||||
static TempBuf * canvas_buf = NULL;
|
static TempBuf * canvas_buf = NULL;
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
|
@ -794,7 +798,7 @@ fill_run (guchar *dest,
|
||||||
{
|
{
|
||||||
while (w--)
|
while (w--)
|
||||||
{
|
{
|
||||||
*dest += ((256 - *dest) * alpha) >> 8;
|
*dest = MAX(*dest, alpha);
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,9 +897,7 @@ render_blob_line (Blob *blob, guchar *dest,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the pixel */
|
dest[cur_x] = MAX(dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
|
||||||
dest[cur_x] +=
|
|
||||||
((256 - dest[cur_x]) * pixel * 255) / (256 * SUBSAMPLE * SUBSAMPLE);
|
|
||||||
|
|
||||||
last_x = cur_x + 1;
|
last_x = cur_x + 1;
|
||||||
}
|
}
|
||||||
|
@ -999,6 +1001,10 @@ ink_paste (InkTool *ink_tool,
|
||||||
canvas_buf->width, canvas_buf->height);
|
canvas_buf->width, canvas_buf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This routine a) updates the representation of the stroke
|
||||||
|
* in the canvas tiles, then renders the dirty bit of it
|
||||||
|
* into canvas_buf.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
ink_to_canvas_tiles (InkTool *ink_tool,
|
ink_to_canvas_tiles (InkTool *ink_tool,
|
||||||
Blob *blob,
|
Blob *blob,
|
||||||
|
|
|
@ -74,9 +74,13 @@ struct _BrushWidget
|
||||||
|
|
||||||
/* undo blocks variables */
|
/* undo blocks variables */
|
||||||
static TileManager * undo_tiles = NULL;
|
static TileManager * undo_tiles = NULL;
|
||||||
|
|
||||||
|
/* Tiles used to render the stroke at 1 byte/pp */
|
||||||
static TileManager * canvas_tiles = NULL;
|
static TileManager * canvas_tiles = NULL;
|
||||||
|
|
||||||
/* paint buffer */
|
/* Flat buffer that is used to used to render the dirty region
|
||||||
|
* for composition onto the destination drawable
|
||||||
|
*/
|
||||||
static TempBuf * canvas_buf = NULL;
|
static TempBuf * canvas_buf = NULL;
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
|
@ -794,7 +798,7 @@ fill_run (guchar *dest,
|
||||||
{
|
{
|
||||||
while (w--)
|
while (w--)
|
||||||
{
|
{
|
||||||
*dest += ((256 - *dest) * alpha) >> 8;
|
*dest = MAX(*dest, alpha);
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,9 +897,7 @@ render_blob_line (Blob *blob, guchar *dest,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the pixel */
|
dest[cur_x] = MAX(dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
|
||||||
dest[cur_x] +=
|
|
||||||
((256 - dest[cur_x]) * pixel * 255) / (256 * SUBSAMPLE * SUBSAMPLE);
|
|
||||||
|
|
||||||
last_x = cur_x + 1;
|
last_x = cur_x + 1;
|
||||||
}
|
}
|
||||||
|
@ -999,6 +1001,10 @@ ink_paste (InkTool *ink_tool,
|
||||||
canvas_buf->width, canvas_buf->height);
|
canvas_buf->width, canvas_buf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This routine a) updates the representation of the stroke
|
||||||
|
* in the canvas tiles, then renders the dirty bit of it
|
||||||
|
* into canvas_buf.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
ink_to_canvas_tiles (InkTool *ink_tool,
|
ink_to_canvas_tiles (InkTool *ink_tool,
|
||||||
Blob *blob,
|
Blob *blob,
|
||||||
|
|
|
@ -74,9 +74,13 @@ struct _BrushWidget
|
||||||
|
|
||||||
/* undo blocks variables */
|
/* undo blocks variables */
|
||||||
static TileManager * undo_tiles = NULL;
|
static TileManager * undo_tiles = NULL;
|
||||||
|
|
||||||
|
/* Tiles used to render the stroke at 1 byte/pp */
|
||||||
static TileManager * canvas_tiles = NULL;
|
static TileManager * canvas_tiles = NULL;
|
||||||
|
|
||||||
/* paint buffer */
|
/* Flat buffer that is used to used to render the dirty region
|
||||||
|
* for composition onto the destination drawable
|
||||||
|
*/
|
||||||
static TempBuf * canvas_buf = NULL;
|
static TempBuf * canvas_buf = NULL;
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
|
@ -794,7 +798,7 @@ fill_run (guchar *dest,
|
||||||
{
|
{
|
||||||
while (w--)
|
while (w--)
|
||||||
{
|
{
|
||||||
*dest += ((256 - *dest) * alpha) >> 8;
|
*dest = MAX(*dest, alpha);
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,9 +897,7 @@ render_blob_line (Blob *blob, guchar *dest,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the pixel */
|
dest[cur_x] = MAX(dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
|
||||||
dest[cur_x] +=
|
|
||||||
((256 - dest[cur_x]) * pixel * 255) / (256 * SUBSAMPLE * SUBSAMPLE);
|
|
||||||
|
|
||||||
last_x = cur_x + 1;
|
last_x = cur_x + 1;
|
||||||
}
|
}
|
||||||
|
@ -999,6 +1001,10 @@ ink_paste (InkTool *ink_tool,
|
||||||
canvas_buf->width, canvas_buf->height);
|
canvas_buf->width, canvas_buf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This routine a) updates the representation of the stroke
|
||||||
|
* in the canvas tiles, then renders the dirty bit of it
|
||||||
|
* into canvas_buf.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
ink_to_canvas_tiles (InkTool *ink_tool,
|
ink_to_canvas_tiles (InkTool *ink_tool,
|
||||||
Blob *blob,
|
Blob *blob,
|
||||||
|
|
Loading…
Reference in New Issue