mirror of https://github.com/GNOME/gimp.git
M ChangeLog M app/paint/gimpconvolve.c M app/paint-funcs/paint-funcs.c M
M ChangeLog M app/paint/gimpconvolve.c M app/paint-funcs/paint-funcs.c M app/paint-funcs/paint-funcs.h M app/tools/gimpiscissorstool.c M libgimpbase/gimputils.c M modules/colorsel_cmyk.c M regexrepl/regex.c
This commit is contained in:
parent
21061d2451
commit
60e3301802
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2006-04-20 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/paint-funcs/paint-funcs.[ch]: convolve_region() takes a
|
||||
const matrix parameter.
|
||||
|
||||
* app/paint/gimpconvolve.c
|
||||
* app/tools/gimpiscissorstool.c: use const convolution matrices.
|
||||
|
||||
* libgimpbase/gimputils.c (gimp_utf8_strtrim): avoid another small
|
||||
relocation.
|
||||
|
||||
* modules/colorsel_cmyk.c
|
||||
* regexrepl/regex.c: use const arrays of const strings.
|
||||
|
||||
2006-04-19 Simon Budig <simon@gimp.org>
|
||||
|
||||
* plug-ins/imagemap/imap_main.c: removed unused code
|
||||
|
|
|
@ -2386,7 +2386,7 @@ extract_from_region (PixelRegion *src,
|
|||
void
|
||||
convolve_region (PixelRegion *srcR,
|
||||
PixelRegion *destR,
|
||||
gfloat *matrix,
|
||||
const gfloat *matrix,
|
||||
gint size,
|
||||
gdouble divisor,
|
||||
GimpConvolutionType mode,
|
||||
|
@ -2394,20 +2394,20 @@ convolve_region (PixelRegion *srcR,
|
|||
{
|
||||
/* Convolve the src image using the convolution matrix, writing to dest */
|
||||
/* Convolve is not tile-enabled--use accordingly */
|
||||
guchar *src, *s_row, *s;
|
||||
guchar *dest, *d;
|
||||
gfloat *m;
|
||||
gdouble total [4];
|
||||
gint b, bytes;
|
||||
gint alpha, a_byte;
|
||||
gint length;
|
||||
gint wraparound;
|
||||
gint margin; /* margin imposed by size of conv. matrix */
|
||||
gint i, j;
|
||||
gint x, y;
|
||||
gint offset;
|
||||
gdouble matrixsum = 0.0;
|
||||
gdouble weighted_divisor, mult_alpha;
|
||||
guchar *src, *s_row, *s;
|
||||
guchar *dest, *d;
|
||||
const gfloat *m;
|
||||
gdouble total [4];
|
||||
gint b, bytes;
|
||||
gint alpha, a_byte;
|
||||
gint length;
|
||||
gint wraparound;
|
||||
gint margin; /* margin imposed by size of conv. matrix */
|
||||
gint i, j;
|
||||
gint x, y;
|
||||
gint offset;
|
||||
gdouble matrixsum = 0.0;
|
||||
gdouble weighted_divisor, mult_alpha;
|
||||
|
||||
/* If the mode is NEGATIVE_CONVOL, the offset should be 128 */
|
||||
if (mode == GIMP_NEGATIVE_CONVOL)
|
||||
|
|
|
@ -360,7 +360,7 @@ void extract_from_region (PixelRegion *src,
|
|||
|
||||
void convolve_region (PixelRegion *srcR,
|
||||
PixelRegion *destR,
|
||||
gfloat *matrix,
|
||||
const gfloat *matrix,
|
||||
gint size,
|
||||
gdouble divisor,
|
||||
GimpConvolutionType mode,
|
||||
|
|
|
@ -74,8 +74,10 @@ static gdouble gimp_convolve_sum_matrix (const gfloat *matrix,
|
|||
gint size);
|
||||
|
||||
|
||||
static gint matrix_size;
|
||||
static gdouble matrix_divisor;
|
||||
/* FIXME: this code is not MT-safe */
|
||||
|
||||
static const gint matrix_size = 5;
|
||||
static gdouble matrix_divisor;
|
||||
|
||||
static gfloat matrix[25] =
|
||||
{
|
||||
|
@ -86,7 +88,7 @@ static gfloat matrix[25] =
|
|||
0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
static gfloat blur_matrix[25] =
|
||||
static const gfloat blur_matrix[25] =
|
||||
{
|
||||
0, 0, 0, 0, 0,
|
||||
0, 1, 1, 1, 0,
|
||||
|
@ -95,7 +97,7 @@ static gfloat blur_matrix[25] =
|
|||
0, 0 ,0, 0, 0,
|
||||
};
|
||||
|
||||
static gfloat sharpen_matrix[25] =
|
||||
static const gfloat sharpen_matrix[25] =
|
||||
{
|
||||
0, 0, 0, 0, 0,
|
||||
0, 1, 1, 1, 0,
|
||||
|
@ -388,34 +390,29 @@ static void
|
|||
gimp_convolve_calculate_matrix (GimpConvolveType type,
|
||||
gdouble rate)
|
||||
{
|
||||
gdouble percent;
|
||||
|
||||
/* find percent of tool pressure */
|
||||
percent = MIN (rate / 100.0, 1.0);
|
||||
gdouble percent = MIN (rate / 100.0, 1.0);
|
||||
|
||||
/* get the appropriate convolution matrix and size and divisor */
|
||||
switch (type)
|
||||
{
|
||||
case GIMP_BLUR_CONVOLVE:
|
||||
matrix_size = 5;
|
||||
blur_matrix[12] = MIN_BLUR + percent * (MAX_BLUR - MIN_BLUR);
|
||||
gimp_convolve_copy_matrix (blur_matrix, matrix, matrix_size);
|
||||
matrix[12] = MIN_BLUR + percent * (MAX_BLUR - MIN_BLUR);
|
||||
break;
|
||||
|
||||
case GIMP_SHARPEN_CONVOLVE:
|
||||
matrix_size = 5;
|
||||
sharpen_matrix[12] = MIN_SHARPEN + percent * (MAX_SHARPEN - MIN_SHARPEN);
|
||||
gimp_convolve_copy_matrix (sharpen_matrix, matrix, matrix_size);
|
||||
matrix[12] = MIN_SHARPEN + percent * (MAX_SHARPEN - MIN_SHARPEN);
|
||||
break;
|
||||
|
||||
case GIMP_CUSTOM_CONVOLVE:
|
||||
matrix_size = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
matrix_divisor = gimp_convolve_sum_matrix (matrix, matrix_size);
|
||||
|
||||
if (!matrix_divisor)
|
||||
if (G_UNLIKELY (matrix_divisor == 0.0))
|
||||
matrix_divisor = 1.0;
|
||||
}
|
||||
|
||||
|
@ -425,7 +422,8 @@ gimp_convolve_copy_matrix (const gfloat *src,
|
|||
gint size)
|
||||
{
|
||||
size *= size;
|
||||
while (size --)
|
||||
|
||||
while (size--)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
|
@ -436,7 +434,8 @@ gimp_convolve_sum_matrix (const gfloat *matrix,
|
|||
gdouble sum = 0.0;
|
||||
|
||||
size *= size;
|
||||
while (size --)
|
||||
|
||||
while (size--)
|
||||
sum += *matrix++;
|
||||
|
||||
return sum;
|
||||
|
|
|
@ -237,25 +237,25 @@ static guchar maxgrad_conv1[TILE_WIDTH * TILE_HEIGHT * 4] = "";
|
|||
static guchar maxgrad_conv2[TILE_WIDTH * TILE_HEIGHT * 4] = "";
|
||||
|
||||
|
||||
static gfloat horz_deriv[9] =
|
||||
static const gfloat horz_deriv[9] =
|
||||
{
|
||||
1, 0, -1,
|
||||
2, 0, -2,
|
||||
1, 0, -1,
|
||||
1, 0, -1,
|
||||
2, 0, -2,
|
||||
1, 0, -1,
|
||||
};
|
||||
|
||||
static gfloat vert_deriv[9] =
|
||||
static const gfloat vert_deriv[9] =
|
||||
{
|
||||
1, 2, 1,
|
||||
0, 0, 0,
|
||||
1, 2, 1,
|
||||
0, 0, 0,
|
||||
-1, -2, -1,
|
||||
};
|
||||
|
||||
static gfloat blur_32[9] =
|
||||
static const gfloat blur_32[9] =
|
||||
{
|
||||
1, 1, 1,
|
||||
1, 24, 1,
|
||||
1, 1, 1,
|
||||
1, 1, 1,
|
||||
1, 24, 1,
|
||||
1, 1, 1,
|
||||
};
|
||||
|
||||
static gfloat distance_weights[GRADIENT_SEARCH * GRADIENT_SEARCH];
|
||||
|
@ -1677,6 +1677,10 @@ gradmap_tile_validate (TileManager *tm,
|
|||
{
|
||||
static gboolean first_gradient = TRUE;
|
||||
|
||||
GimpImage *image = tile_manager_get_user_data (tm);
|
||||
GimpPickable *pickable;
|
||||
Tile *srctile;
|
||||
PixelRegion srcPR, destPR;
|
||||
gint x, y;
|
||||
gint dw, dh;
|
||||
gint sw, sh;
|
||||
|
@ -1687,12 +1691,6 @@ gradmap_tile_validate (TileManager *tm,
|
|||
guint8 *tiledata;
|
||||
guint8 *datah, *datav;
|
||||
gint8 hmax, vmax;
|
||||
GimpPickable *pickable;
|
||||
Tile *srctile;
|
||||
PixelRegion srcPR, destPR;
|
||||
GimpImage *image;
|
||||
|
||||
image = (GimpImage *) tile_manager_get_user_data (tm);
|
||||
|
||||
if (first_gradient)
|
||||
{
|
||||
|
|
|
@ -50,8 +50,8 @@ gimp_utf8_strtrim (const gchar *str,
|
|||
gint max_chars)
|
||||
{
|
||||
/* FIXME: should we make this translatable? */
|
||||
static const gchar *ellipsis = "...";
|
||||
static const gint e_len = 3;
|
||||
const gchar ellipsis[] = "...";
|
||||
const gint e_len = sizeof (ellipsis);
|
||||
|
||||
if (str)
|
||||
{
|
||||
|
|
|
@ -142,7 +142,7 @@ colorsel_cmyk_init (ColorselCmyk *module)
|
|||
GtkObject *adj;
|
||||
gint i;
|
||||
|
||||
static const gchar *cmyk_labels[] =
|
||||
static const gchar * const cmyk_labels[] =
|
||||
{
|
||||
/* Cyan */
|
||||
N_("_C"),
|
||||
|
@ -153,7 +153,7 @@ colorsel_cmyk_init (ColorselCmyk *module)
|
|||
/* Key (Black) */
|
||||
N_("_K")
|
||||
};
|
||||
static const gchar *cmyk_tips[] =
|
||||
static const gchar * const cmyk_tips[] =
|
||||
{
|
||||
N_("Cyan"),
|
||||
N_("Magenta"),
|
||||
|
|
|
@ -958,7 +958,7 @@ re_set_syntax (syntax)
|
|||
POSIX doesn't require that we do anything for REG_NOERROR,
|
||||
but why not be nice? */
|
||||
|
||||
static const char *re_error_msgid[] =
|
||||
static const char * const re_error_msgid[] =
|
||||
{
|
||||
"Success", /* REG_NOERROR */
|
||||
"No match", /* REG_NOMATCH */
|
||||
|
|
Loading…
Reference in New Issue