minor cleanups.
2008-01-28 Sven Neumann <sven@gimp.org> * plug-ins/common/cubism.c: minor cleanups. svn path=/trunk/; revision=24729
This commit is contained in:

committed by
Sven Neumann

parent
bea90af290
commit
d3e1c997c9
@ -1,3 +1,7 @@
|
||||
2008-01-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/cubism.c: minor cleanups.
|
||||
|
||||
2008-01-28 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/base/tile-manager.c
|
||||
|
@ -430,6 +430,7 @@ cubism (GimpDrawable *drawable,
|
||||
for (i = 0; i < bytes; i++)
|
||||
*dest++ = bg_col[i];
|
||||
}
|
||||
|
||||
dest = NULL;
|
||||
}
|
||||
|
||||
@ -440,11 +441,10 @@ cubism (GimpDrawable *drawable,
|
||||
|
||||
randomize_indices (num_tiles, random_indices);
|
||||
|
||||
count = 0;
|
||||
gimp_pixel_rgn_init (&src_rgn, drawable,
|
||||
x1, y1, x2 - x1, y2 - y1, FALSE, FALSE);
|
||||
|
||||
while (count < num_tiles)
|
||||
for (count = 0; count < num_tiles; count++)
|
||||
{
|
||||
i = random_indices[count] / (cols + 1);
|
||||
j = random_indices[count] % (cols + 1);
|
||||
@ -476,11 +476,10 @@ cubism (GimpDrawable *drawable,
|
||||
if (! has_alpha || col[bytes - 1])
|
||||
fill_poly_color (&poly, drawable, preview, col, dest);
|
||||
|
||||
count++;
|
||||
if (! preview)
|
||||
{
|
||||
if ((count % 5) == 0)
|
||||
gimp_progress_update ((double) count / (double) num_tiles);
|
||||
if (count % 8 == 0)
|
||||
gimp_progress_update ((gdouble) count / (gdouble) num_tiles);
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,15 +511,10 @@ calc_alpha_blend (gdouble *vec,
|
||||
|
||||
if (! one_over_dist)
|
||||
return 1.0;
|
||||
else
|
||||
{
|
||||
|
||||
r = (vec[0] * x + vec[1] * y) * one_over_dist;
|
||||
if (r < 0.2)
|
||||
r = 0.2;
|
||||
else if (r > 1.0)
|
||||
r = 1.0;
|
||||
}
|
||||
return r;
|
||||
|
||||
return CLAMP (r, 0.2, 1.0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -611,8 +605,8 @@ fill_poly_color (Polygon *poly,
|
||||
|
||||
if (poly->npts)
|
||||
{
|
||||
gint poly_npts = poly->npts;
|
||||
GimpVector2 *curptr;
|
||||
gint poly_npts = poly->npts;
|
||||
|
||||
xs = (gint) (poly->pts[poly_npts-1].x);
|
||||
ys = (gint) (poly->pts[poly_npts-1].y);
|
||||
@ -685,7 +679,10 @@ fill_poly_color (Polygon *poly,
|
||||
if (val > 0)
|
||||
{
|
||||
xx = (gdouble) j / (gdouble) SUPERSAMPLE + min_x;
|
||||
alpha = (gint) (val * calc_alpha_blend (vec, one_over_dist, xx - sx, yy - sy));
|
||||
alpha = (gint) (val * calc_alpha_blend (vec,
|
||||
one_over_dist,
|
||||
xx - sx,
|
||||
yy - sy));
|
||||
if (preview)
|
||||
{
|
||||
for (b = 0; b < bytes; b++)
|
||||
@ -698,9 +695,9 @@ fill_poly_color (Polygon *poly,
|
||||
|
||||
#ifndef USE_READABLE_BUT_SLOW_CODE
|
||||
{
|
||||
guchar *buf_iter = buf,
|
||||
*col_iter = col,
|
||||
*buf_end = buf+bytes;
|
||||
guchar *buf_iter = buf;
|
||||
guchar *col_iter = col;
|
||||
guchar *buf_end = buf + bytes;
|
||||
|
||||
for(; buf_iter < buf_end; buf_iter++, col_iter++)
|
||||
*buf_iter = ((guint) (*col_iter * alpha)
|
||||
|
Reference in New Issue
Block a user