mirror of https://github.com/GNOME/gimp.git
more cursor support. new cursor fix that rounding error the right way this
* app/clone.c: more cursor support. * app/cursorutil.[ch], cursors/{bad,badmsk}: new cursor * app/paint_core.c: fix that rounding error the right way this time. * app/pixel_processor.c, app/pixel_region.c: Lock the tiles while they are being processed. Only create new threads if the region being processed is large enough to warrant it.
This commit is contained in:
parent
77f3aa47ab
commit
bc0451b4b4
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,12 @@
|
|||
Tue Jul 27 01:21:02 1999 Jay Cox (jay@elan)
|
||||
|
||||
* app/clone.c: more cursor support.
|
||||
* app/cursorutil.[ch], cursors/{bad,badmsk}: new cursor
|
||||
* app/paint_core.c: fix that rounding error the right way this time.
|
||||
* app/pixel_processor.c, app/pixel_region.c: Lock the tiles while
|
||||
they are being processed. Only create new threads if the region
|
||||
being processed is large enough to warrant it.
|
||||
|
||||
1999-07-27 Tuomas Kuosmanen <tigert@gimp.org>
|
||||
|
||||
* pixmaps/zoom_in.xpm
|
||||
|
@ -52,7 +61,7 @@ Mon Jul 26 20:11:01 MEST 1999 Sven Neumann <sven@gimp.org>
|
|||
|
||||
Sun Jul 25 23:37:48 1999 Jay Cox (jaycox@earthlink.net)
|
||||
|
||||
* paint_core.c: fixed longstanding roundoff error in
|
||||
* paint_core.c: fixed long standing roundoff error in
|
||||
paint_core_subsample_mask. A couple of minor code cleanups.
|
||||
|
||||
1999-07-24 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "pixel_processor.h"
|
||||
#include "pixel_region.h"
|
||||
#include "pixel_regionP.h"
|
||||
#include "gimprc.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -47,8 +48,6 @@ typedef void (*p3_func)(void *, PixelRegion * ,PixelRegion *, PixelRegion *);
|
|||
typedef void (*p4_func)(void *, PixelRegion * ,PixelRegion *, PixelRegion *,
|
||||
PixelRegion *);
|
||||
|
||||
typedef struct _PixelRegionIterator PixelRegionIterator;
|
||||
|
||||
struct _PixelProcessor
|
||||
{
|
||||
void *data;
|
||||
|
@ -85,7 +84,13 @@ do_parallel_regions(PixelProcessor *p_s)
|
|||
{
|
||||
for (i = 0; i < p_s->n_regions; i++)
|
||||
if (p_s->r[i])
|
||||
{
|
||||
memcpy(&tr[i], p_s->r[i], sizeof(PixelRegion));
|
||||
IF_THREAD(
|
||||
if (tr[i].tiles)
|
||||
tile_lock(tr[i].curtile);
|
||||
)
|
||||
}
|
||||
IF_THREAD(pthread_mutex_unlock(&p_s->mutex);)
|
||||
ntiles++;
|
||||
switch(p_s->n_regions)
|
||||
|
@ -117,6 +122,15 @@ do_parallel_regions(PixelProcessor *p_s)
|
|||
p_s->n_regions);
|
||||
}
|
||||
IF_THREAD(pthread_mutex_lock(&p_s->mutex);)
|
||||
IF_THREAD(
|
||||
{
|
||||
for (i = 0; i < p_s->n_regions; i++)
|
||||
if (p_s->r[i])
|
||||
{
|
||||
if (tr[i].tiles)
|
||||
tile_release(tr[i].curtile, tr[i].dirty);
|
||||
}
|
||||
})
|
||||
if (p_s->progress_report_func)
|
||||
if (!p_s->progress_report_func(p_s->progress_report_data,
|
||||
p_s->r[0]->x, p_s->r[0]->y,
|
||||
|
@ -142,7 +156,10 @@ pixel_regions_do_parallel(PixelProcessor *p_s)
|
|||
|
||||
/* (p_s->PRI->region_width * p_s->PRI->region_height) /(64*64)); */
|
||||
IF_THREAD(
|
||||
nthreads = MIN(num_processors, 5);
|
||||
nthreads = MIN(num_processors, MAX_THREADS);
|
||||
nthreads = MIN(nthreads, 1 +
|
||||
(p_s->PRI->region_width * p_s->PRI->region_height)
|
||||
/(TILE_WIDTH*TILE_HEIGHT));
|
||||
if (nthreads > 1)
|
||||
{
|
||||
pthread_attr_init (&pthread_attr);
|
||||
|
@ -213,6 +230,7 @@ pixel_regions_real_process_parallel(p_func f, void *data,
|
|||
pixel_processor_free(p_s);
|
||||
return NULL;
|
||||
}
|
||||
IF_THREAD(p_s->PRI->dirty_tiles = 0;)
|
||||
p_s->f = f;
|
||||
p_s->data = data;
|
||||
p_s->n_regions = num_regions;
|
||||
|
|
|
@ -21,35 +21,13 @@
|
|||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "pixel_region.h"
|
||||
#include "pixel_regionP.h"
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h" /* ick. */
|
||||
|
||||
|
||||
typedef struct _PixelRegionHolder PixelRegionHolder;
|
||||
|
||||
struct _PixelRegionHolder
|
||||
{
|
||||
PixelRegion *PR;
|
||||
unsigned char *original_data;
|
||||
int startx, starty;
|
||||
int count;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _PixelRegionIterator PixelRegionIterator;
|
||||
|
||||
struct _PixelRegionIterator
|
||||
{
|
||||
GSList *pixel_regions;
|
||||
int region_width;
|
||||
int region_height;
|
||||
int portion_width;
|
||||
int portion_height;
|
||||
int process_count;
|
||||
};
|
||||
|
||||
/*********************/
|
||||
/* Local Variables */
|
||||
|
||||
|
@ -306,6 +284,7 @@ pixel_regions_register (int num_regions,
|
|||
PRI = (PixelRegionIterator *) g_malloc (sizeof (PixelRegionIterator));
|
||||
PRI->pixel_regions = NULL;
|
||||
PRI->process_count = 0;
|
||||
PRI->dirty_tiles = 1;
|
||||
|
||||
if (num_regions < 1)
|
||||
return FALSE;
|
||||
|
@ -374,7 +353,9 @@ pixel_regions_process (void *PRI_ptr)
|
|||
/* Unref the last referenced tile if the underlying region is a tile manager */
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
tile_release (PRH->PR->curtile, PRH->PR->dirty);
|
||||
/* only set the dirty flag if PRH->dirty_tiles = true */
|
||||
tile_release (PRH->PR->curtile,
|
||||
PRH->PR->dirty * PRI->dirty_tiles);
|
||||
PRH->PR->curtile = NULL;
|
||||
}
|
||||
|
||||
|
|
10
app/clone.c
10
app/clone.c
|
@ -30,6 +30,7 @@
|
|||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -387,6 +388,15 @@ clone_cursor_update (Tool *tool,
|
|||
ctype = GDK_PENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (clone_options->type == IMAGE_CLONE)
|
||||
{
|
||||
if (mevent->state & GDK_CONTROL_MASK)
|
||||
ctype = GDK_CROSSHAIR;
|
||||
else if (!src_drawable_)
|
||||
ctype = GIMP_BAD_CURSOR;
|
||||
}
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp, ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "../cursors/mouse1_selmmsk"
|
||||
#include "../cursors/mouse1_selp"
|
||||
#include "../cursors/mouse1_selpmsk"
|
||||
#include "../cursors/bad"
|
||||
#include "../cursors/badmsk"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -80,6 +82,8 @@ static BM_Cursor gimp_cursors[] =
|
|||
mouse1_selm_x_hot, mouse1_selm_y_hot, NULL},
|
||||
{ mouse1_sel_bits, mouse1_selmsk_bits, mouse1_sel_width, mouse1_sel_height,
|
||||
mouse1_sel_x_hot, mouse1_sel_y_hot, NULL},
|
||||
{ bad_bits, badmsk_bits, bad_width, bad_height,
|
||||
bad_x_hot, bad_y_hot, NULL},
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef enum
|
|||
GIMP_MOUSE1SELP_CURSOR,
|
||||
GIMP_MOUSE1SELM_CURSOR,
|
||||
GIMP_MOUSE1SEL_CURSOR,
|
||||
GIMP_BAD_CURSOR,
|
||||
GIMP_LAST_CURSOR_ENTRY
|
||||
} GimpCursorType;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -387,6 +388,15 @@ clone_cursor_update (Tool *tool,
|
|||
ctype = GDK_PENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (clone_options->type == IMAGE_CLONE)
|
||||
{
|
||||
if (mevent->state & GDK_CONTROL_MASK)
|
||||
ctype = GDK_CROSSHAIR;
|
||||
else if (!src_drawable_)
|
||||
ctype = GIMP_BAD_CURSOR;
|
||||
}
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp, ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -387,6 +388,15 @@ clone_cursor_update (Tool *tool,
|
|||
ctype = GDK_PENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (clone_options->type == IMAGE_CLONE)
|
||||
{
|
||||
if (mevent->state & GDK_CONTROL_MASK)
|
||||
ctype = GDK_CROSSHAIR;
|
||||
else if (!src_drawable_)
|
||||
ctype = GIMP_BAD_CURSOR;
|
||||
}
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp, ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -1052,7 +1052,7 @@ paint_core_subsample_mask (MaskBuf *mask,
|
|||
s = KERNEL_WIDTH;
|
||||
while (s--)
|
||||
{
|
||||
new_val = *d + ((*m * *k++) /255);
|
||||
new_val = *d + ((*m * *k++ + 128) >> 8);
|
||||
*d++ = MINIMUM (new_val, 255);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "pixel_processor.h"
|
||||
#include "pixel_region.h"
|
||||
#include "pixel_regionP.h"
|
||||
#include "gimprc.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -47,8 +48,6 @@ typedef void (*p3_func)(void *, PixelRegion * ,PixelRegion *, PixelRegion *);
|
|||
typedef void (*p4_func)(void *, PixelRegion * ,PixelRegion *, PixelRegion *,
|
||||
PixelRegion *);
|
||||
|
||||
typedef struct _PixelRegionIterator PixelRegionIterator;
|
||||
|
||||
struct _PixelProcessor
|
||||
{
|
||||
void *data;
|
||||
|
@ -85,7 +84,13 @@ do_parallel_regions(PixelProcessor *p_s)
|
|||
{
|
||||
for (i = 0; i < p_s->n_regions; i++)
|
||||
if (p_s->r[i])
|
||||
{
|
||||
memcpy(&tr[i], p_s->r[i], sizeof(PixelRegion));
|
||||
IF_THREAD(
|
||||
if (tr[i].tiles)
|
||||
tile_lock(tr[i].curtile);
|
||||
)
|
||||
}
|
||||
IF_THREAD(pthread_mutex_unlock(&p_s->mutex);)
|
||||
ntiles++;
|
||||
switch(p_s->n_regions)
|
||||
|
@ -117,6 +122,15 @@ do_parallel_regions(PixelProcessor *p_s)
|
|||
p_s->n_regions);
|
||||
}
|
||||
IF_THREAD(pthread_mutex_lock(&p_s->mutex);)
|
||||
IF_THREAD(
|
||||
{
|
||||
for (i = 0; i < p_s->n_regions; i++)
|
||||
if (p_s->r[i])
|
||||
{
|
||||
if (tr[i].tiles)
|
||||
tile_release(tr[i].curtile, tr[i].dirty);
|
||||
}
|
||||
})
|
||||
if (p_s->progress_report_func)
|
||||
if (!p_s->progress_report_func(p_s->progress_report_data,
|
||||
p_s->r[0]->x, p_s->r[0]->y,
|
||||
|
@ -142,7 +156,10 @@ pixel_regions_do_parallel(PixelProcessor *p_s)
|
|||
|
||||
/* (p_s->PRI->region_width * p_s->PRI->region_height) /(64*64)); */
|
||||
IF_THREAD(
|
||||
nthreads = MIN(num_processors, 5);
|
||||
nthreads = MIN(num_processors, MAX_THREADS);
|
||||
nthreads = MIN(nthreads, 1 +
|
||||
(p_s->PRI->region_width * p_s->PRI->region_height)
|
||||
/(TILE_WIDTH*TILE_HEIGHT));
|
||||
if (nthreads > 1)
|
||||
{
|
||||
pthread_attr_init (&pthread_attr);
|
||||
|
@ -213,6 +230,7 @@ pixel_regions_real_process_parallel(p_func f, void *data,
|
|||
pixel_processor_free(p_s);
|
||||
return NULL;
|
||||
}
|
||||
IF_THREAD(p_s->PRI->dirty_tiles = 0;)
|
||||
p_s->f = f;
|
||||
p_s->data = data;
|
||||
p_s->n_regions = num_regions;
|
||||
|
|
|
@ -21,35 +21,13 @@
|
|||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "pixel_region.h"
|
||||
#include "pixel_regionP.h"
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h" /* ick. */
|
||||
|
||||
|
||||
typedef struct _PixelRegionHolder PixelRegionHolder;
|
||||
|
||||
struct _PixelRegionHolder
|
||||
{
|
||||
PixelRegion *PR;
|
||||
unsigned char *original_data;
|
||||
int startx, starty;
|
||||
int count;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _PixelRegionIterator PixelRegionIterator;
|
||||
|
||||
struct _PixelRegionIterator
|
||||
{
|
||||
GSList *pixel_regions;
|
||||
int region_width;
|
||||
int region_height;
|
||||
int portion_width;
|
||||
int portion_height;
|
||||
int process_count;
|
||||
};
|
||||
|
||||
/*********************/
|
||||
/* Local Variables */
|
||||
|
||||
|
@ -306,6 +284,7 @@ pixel_regions_register (int num_regions,
|
|||
PRI = (PixelRegionIterator *) g_malloc (sizeof (PixelRegionIterator));
|
||||
PRI->pixel_regions = NULL;
|
||||
PRI->process_count = 0;
|
||||
PRI->dirty_tiles = 1;
|
||||
|
||||
if (num_regions < 1)
|
||||
return FALSE;
|
||||
|
@ -374,7 +353,9 @@ pixel_regions_process (void *PRI_ptr)
|
|||
/* Unref the last referenced tile if the underlying region is a tile manager */
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
tile_release (PRH->PR->curtile, PRH->PR->dirty);
|
||||
/* only set the dirty flag if PRH->dirty_tiles = true */
|
||||
tile_release (PRH->PR->curtile,
|
||||
PRH->PR->dirty * PRI->dirty_tiles);
|
||||
PRH->PR->curtile = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -387,6 +388,15 @@ clone_cursor_update (Tool *tool,
|
|||
ctype = GDK_PENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (clone_options->type == IMAGE_CLONE)
|
||||
{
|
||||
if (mevent->state & GDK_CONTROL_MASK)
|
||||
ctype = GDK_CROSSHAIR;
|
||||
else if (!src_drawable_)
|
||||
ctype = GIMP_BAD_CURSOR;
|
||||
}
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp, ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -387,6 +388,15 @@ clone_cursor_update (Tool *tool,
|
|||
ctype = GDK_PENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (clone_options->type == IMAGE_CLONE)
|
||||
{
|
||||
if (mevent->state & GDK_CONTROL_MASK)
|
||||
ctype = GDK_CROSSHAIR;
|
||||
else if (!src_drawable_)
|
||||
ctype = GIMP_BAD_CURSOR;
|
||||
}
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp, ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "clone.h"
|
||||
#include "selection.h"
|
||||
#include "tools.h"
|
||||
#include "cursorutil.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -387,6 +388,15 @@ clone_cursor_update (Tool *tool,
|
|||
ctype = GDK_PENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (clone_options->type == IMAGE_CLONE)
|
||||
{
|
||||
if (mevent->state & GDK_CONTROL_MASK)
|
||||
ctype = GDK_CROSSHAIR;
|
||||
else if (!src_drawable_)
|
||||
ctype = GIMP_BAD_CURSOR;
|
||||
}
|
||||
|
||||
gdisplay_install_tool_cursor (gdisp, ctype);
|
||||
}
|
||||
|
||||
|
|
|
@ -1052,7 +1052,7 @@ paint_core_subsample_mask (MaskBuf *mask,
|
|||
s = KERNEL_WIDTH;
|
||||
while (s--)
|
||||
{
|
||||
new_val = *d + ((*m * *k++) /255);
|
||||
new_val = *d + ((*m * *k++ + 128) >> 8);
|
||||
*d++ = MINIMUM (new_val, 255);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "../cursors/mouse1_selmmsk"
|
||||
#include "../cursors/mouse1_selp"
|
||||
#include "../cursors/mouse1_selpmsk"
|
||||
#include "../cursors/bad"
|
||||
#include "../cursors/badmsk"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -80,6 +82,8 @@ static BM_Cursor gimp_cursors[] =
|
|||
mouse1_selm_x_hot, mouse1_selm_y_hot, NULL},
|
||||
{ mouse1_sel_bits, mouse1_selmsk_bits, mouse1_sel_width, mouse1_sel_height,
|
||||
mouse1_sel_x_hot, mouse1_sel_y_hot, NULL},
|
||||
{ bad_bits, badmsk_bits, bad_width, bad_height,
|
||||
bad_x_hot, bad_y_hot, NULL},
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef enum
|
|||
GIMP_MOUSE1SELP_CURSOR,
|
||||
GIMP_MOUSE1SELM_CURSOR,
|
||||
GIMP_MOUSE1SEL_CURSOR,
|
||||
GIMP_BAD_CURSOR,
|
||||
GIMP_LAST_CURSOR_ENTRY
|
||||
} GimpCursorType;
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#define bad_width 16
|
||||
#define bad_height 16
|
||||
#define bad_x_hot 7
|
||||
#define bad_y_hot 7
|
||||
static unsigned char bad_bits[] = {
|
||||
0x00, 0x00, 0xe0, 0x03, 0x10, 0x04, 0x08, 0x08, 0x04, 0x14, 0x02, 0x22,
|
||||
0x02, 0x21, 0x82, 0x20, 0x42, 0x20, 0x22, 0x20, 0x14, 0x10, 0x08, 0x08,
|
||||
0x10, 0x04, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00};
|
|
@ -0,0 +1,8 @@
|
|||
#define badmsk_width 16
|
||||
#define badmsk_height 16
|
||||
#define badmsk_x_hot 7
|
||||
#define badmsk_y_hot 7
|
||||
static unsigned char badmsk_bits[] = {
|
||||
0xc0, 0x01, 0xf0, 0x07, 0xf8, 0x0f, 0x1c, 0x1c, 0x0e, 0x3e, 0x06, 0x37,
|
||||
0x87, 0x73, 0xc7, 0x71, 0xe7, 0x70, 0x76, 0x30, 0x3e, 0x38, 0x1c, 0x1c,
|
||||
0xf8, 0x0f, 0xf0, 0x07, 0xc0, 0x01, 0x00, 0x00};
|
Loading…
Reference in New Issue