engrave: Rename variable color_n to num_channels
This commit is contained in:
@ -67,7 +67,7 @@ static void engrave_small (GimpDrawable *drawable,
|
|||||||
static void engrave_sub (gint height,
|
static void engrave_sub (gint height,
|
||||||
gboolean limit,
|
gboolean limit,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gint color_n);
|
gint num_channels);
|
||||||
|
|
||||||
const GimpPlugInInfo PLUG_IN_INFO =
|
const GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
@ -425,7 +425,7 @@ engrave_small (GimpDrawable *drawable,
|
|||||||
GimpPreview *preview)
|
GimpPreview *preview)
|
||||||
{
|
{
|
||||||
GimpPixelRgn src_rgn, dest_rgn;
|
GimpPixelRgn src_rgn, dest_rgn;
|
||||||
gint bpp, color_n;
|
gint bpp, num_channels;
|
||||||
gint x1, y1, x2, y2;
|
gint x1, y1, x2, y2;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint progress, max_progress;
|
gint progress, max_progress;
|
||||||
@ -463,7 +463,7 @@ engrave_small (GimpDrawable *drawable,
|
|||||||
max_progress = width * height;
|
max_progress = width * height;
|
||||||
|
|
||||||
bpp = drawable->bpp;
|
bpp = drawable->bpp;
|
||||||
color_n = (gimp_drawable_is_rgb (drawable->drawable_id)) ? 3 : 1;
|
num_channels = (gimp_drawable_is_rgb (drawable->drawable_id)) ? 3 : 1;
|
||||||
|
|
||||||
area.width = (tile_width / line_height) * line_height;
|
area.width = (tile_width / line_height) * line_height;
|
||||||
area.data = g_new(guchar, (glong) bpp * area.width * area.width);
|
area.data = g_new(guchar, (glong) bpp * area.width * area.width);
|
||||||
@ -478,7 +478,7 @@ engrave_small (GimpDrawable *drawable,
|
|||||||
gimp_pixel_rgn_get_rect (&src_rgn, area.data, area.x, area.y, 1,
|
gimp_pixel_rgn_get_rect (&src_rgn, area.data, area.x, area.y, 1,
|
||||||
area.h);
|
area.h);
|
||||||
|
|
||||||
engrave_sub (line_height, limit, bpp, color_n);
|
engrave_sub (line_height, limit, bpp, num_channels);
|
||||||
|
|
||||||
gimp_pixel_rgn_set_rect (&dest_rgn, area.data,
|
gimp_pixel_rgn_set_rect (&dest_rgn, area.data,
|
||||||
area.x, area.y, 1, area.h);
|
area.x, area.y, 1, area.h);
|
||||||
@ -512,9 +512,9 @@ static void
|
|||||||
engrave_sub (gint height,
|
engrave_sub (gint height,
|
||||||
gint limit,
|
gint limit,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gint color_n)
|
gint num_channels)
|
||||||
{
|
{
|
||||||
glong average[3]; /* color_n <= 3 */
|
glong average[3]; /* num_channels <= 3 */
|
||||||
gint y, h, inten, v;
|
gint y, h, inten, v;
|
||||||
guchar *buf_row, *buf;
|
guchar *buf_row, *buf;
|
||||||
gint row;
|
gint row;
|
||||||
@ -534,7 +534,7 @@ engrave_sub (gint height,
|
|||||||
h = height - (y % height);
|
h = height - (y % height);
|
||||||
h = MIN(h, area.y + area.h - y);
|
h = MIN(h, area.y + area.h - y);
|
||||||
|
|
||||||
for (i = 0; i < color_n; i++)
|
for (i = 0; i < num_channels; i++)
|
||||||
average[i] = 0;
|
average[i] = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ engrave_sub (gint height,
|
|||||||
for (row = 0; row < h; row++)
|
for (row = 0; row < h; row++)
|
||||||
{
|
{
|
||||||
buf = buf_row;
|
buf = buf_row;
|
||||||
for (i = 0; i < color_n; i++)
|
for (i = 0; i < num_channels; i++)
|
||||||
average[i] += buf[i];
|
average[i] += buf[i];
|
||||||
count++;
|
count++;
|
||||||
buf_row += rowstride;
|
buf_row += rowstride;
|
||||||
@ -552,7 +552,7 @@ engrave_sub (gint height,
|
|||||||
|
|
||||||
/* Average */
|
/* Average */
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
for (i = 0; i < color_n; i++)
|
for (i = 0; i < num_channels; i++)
|
||||||
average[i] /= count;
|
average[i] /= count;
|
||||||
|
|
||||||
if (bpp < 3)
|
if (bpp < 3)
|
||||||
@ -576,7 +576,7 @@ engrave_sub (gint height,
|
|||||||
else if (row == height-1)
|
else if (row == height-1)
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < color_n; i++)
|
for (i = 0; i < num_channels; i++)
|
||||||
buf[i] = v;
|
buf[i] = v;
|
||||||
buf_row += rowstride;
|
buf_row += rowstride;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user