app: don't pass a PixelRegion to gradient_precalc_shapeburst()
it only needs a rectangle.
This commit is contained in:
@ -121,7 +121,7 @@ static gdouble gradient_calc_shapeburst_dimpled_factor (GeglBuffer *dist_buff
|
|||||||
|
|
||||||
static GeglBuffer * gradient_precalc_shapeburst (GimpImage *image,
|
static GeglBuffer * gradient_precalc_shapeburst (GimpImage *image,
|
||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
PixelRegion *PR,
|
const GeglRectangle *region,
|
||||||
gdouble dist,
|
gdouble dist,
|
||||||
GimpProgress *progress);
|
GimpProgress *progress);
|
||||||
|
|
||||||
@ -138,9 +138,8 @@ static void gradient_fill_region (GimpImage *image,
|
|||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
GeglBuffer *buffer,
|
GeglBuffer *buffer,
|
||||||
|
const GeglRectangle *buffer_region,
|
||||||
PixelRegion *PR,
|
PixelRegion *PR,
|
||||||
gint width,
|
|
||||||
gint height,
|
|
||||||
GimpBlendMode blend_mode,
|
GimpBlendMode blend_mode,
|
||||||
GimpGradientType gradient_type,
|
GimpGradientType gradient_type,
|
||||||
gdouble offset,
|
gdouble offset,
|
||||||
@ -213,8 +212,8 @@ gimp_drawable_blend (GimpDrawable *drawable,
|
|||||||
0, 0, width, height, TRUE);
|
0, 0, width, height, TRUE);
|
||||||
|
|
||||||
gradient_fill_region (image, drawable, context,
|
gradient_fill_region (image, drawable, context,
|
||||||
buffer,
|
buffer, GEGL_RECTANGLE (0, 0, width, height),
|
||||||
&bufPR, width, height,
|
&bufPR,
|
||||||
blend_mode, gradient_type, offset, repeat, reverse,
|
blend_mode, gradient_type, offset, repeat, reverse,
|
||||||
supersample, max_depth, threshold, dither,
|
supersample, max_depth, threshold, dither,
|
||||||
(startx - x), (starty - y),
|
(startx - x), (starty - y),
|
||||||
@ -543,7 +542,7 @@ gradient_calc_shapeburst_dimpled_factor (GeglBuffer *dist_buffer,
|
|||||||
static GeglBuffer *
|
static GeglBuffer *
|
||||||
gradient_precalc_shapeburst (GimpImage *image,
|
gradient_precalc_shapeburst (GimpImage *image,
|
||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
PixelRegion *PR,
|
const GeglRectangle *region,
|
||||||
gdouble dist,
|
gdouble dist,
|
||||||
GimpProgress *progress)
|
GimpProgress *progress)
|
||||||
{
|
{
|
||||||
@ -557,11 +556,13 @@ gradient_precalc_shapeburst (GimpImage *image,
|
|||||||
gimp_progress_set_text (progress, _("Calculating distance map"));
|
gimp_progress_set_text (progress, _("Calculating distance map"));
|
||||||
|
|
||||||
/* allocate the distance map */
|
/* allocate the distance map */
|
||||||
dist_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, PR->w, PR->h),
|
dist_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
|
||||||
|
region->width, region->height),
|
||||||
babl_format ("Y float"));
|
babl_format ("Y float"));
|
||||||
|
|
||||||
/* allocate the selection mask copy */
|
/* allocate the selection mask copy */
|
||||||
temp_buffer = gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0, PR->w, PR->h),
|
temp_buffer = gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
|
||||||
|
region->width, region->height),
|
||||||
gimp_image_get_mask_format (image));
|
gimp_image_get_mask_format (image));
|
||||||
|
|
||||||
mask = gimp_image_get_mask (image);
|
mask = gimp_image_get_mask (image);
|
||||||
@ -594,7 +595,8 @@ gradient_precalc_shapeburst (GimpImage *image,
|
|||||||
/* extract the aplha into the temp mask */
|
/* extract the aplha into the temp mask */
|
||||||
gegl_buffer_set_format (temp_buffer, component_format);
|
gegl_buffer_set_format (temp_buffer, component_format);
|
||||||
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
|
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
|
||||||
GEGL_RECTANGLE (PR->x, PR->y, PR->w, PR->h),
|
GEGL_RECTANGLE (region->x, region->y,
|
||||||
|
region->width, region->height),
|
||||||
temp_buffer,
|
temp_buffer,
|
||||||
GEGL_RECTANGLE (0, 0, 0, 0));
|
GEGL_RECTANGLE (0, 0, 0, 0));
|
||||||
gegl_buffer_set_format (temp_buffer, NULL);
|
gegl_buffer_set_format (temp_buffer, NULL);
|
||||||
@ -820,9 +822,8 @@ gradient_fill_region (GimpImage *image,
|
|||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
GeglBuffer *buffer,
|
GeglBuffer *buffer,
|
||||||
|
const GeglRectangle *buffer_region,
|
||||||
PixelRegion *PR,
|
PixelRegion *PR,
|
||||||
gint width,
|
|
||||||
gint height,
|
|
||||||
GimpBlendMode blend_mode,
|
GimpBlendMode blend_mode,
|
||||||
GimpGradientType gradient_type,
|
GimpGradientType gradient_type,
|
||||||
gdouble offset,
|
gdouble offset,
|
||||||
@ -919,7 +920,8 @@ gradient_fill_region (GimpImage *image,
|
|||||||
case GIMP_GRADIENT_SHAPEBURST_DIMPLED:
|
case GIMP_GRADIENT_SHAPEBURST_DIMPLED:
|
||||||
rbd.dist = sqrt (SQR (ex - sx) + SQR (ey - sy));
|
rbd.dist = sqrt (SQR (ex - sx) + SQR (ey - sy));
|
||||||
rbd.dist_buffer = gradient_precalc_shapeburst (image, drawable,
|
rbd.dist_buffer = gradient_precalc_shapeburst (image, drawable,
|
||||||
PR, rbd.dist, progress);
|
buffer_region,
|
||||||
|
rbd.dist, progress);
|
||||||
gimp_progress_set_text (progress, _("Blending"));
|
gimp_progress_set_text (progress, _("Blending"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -944,11 +946,13 @@ gradient_fill_region (GimpImage *image,
|
|||||||
PutPixelData ppd;
|
PutPixelData ppd;
|
||||||
|
|
||||||
ppd.buffer = buffer;
|
ppd.buffer = buffer;
|
||||||
ppd.row_data = g_malloc (sizeof (float) * 4 * width);
|
ppd.row_data = g_malloc (sizeof (float) * 4 * buffer_region->width);
|
||||||
ppd.width = width;
|
ppd.width = buffer_region->width;
|
||||||
ppd.dither_rand = g_rand_new ();
|
ppd.dither_rand = g_rand_new ();
|
||||||
|
|
||||||
gimp_adaptive_supersample_area (0, 0, (width - 1), (height - 1),
|
gimp_adaptive_supersample_area (0, 0,
|
||||||
|
(buffer_region->width - 1),
|
||||||
|
(buffer_region->height - 1),
|
||||||
max_depth, threshold,
|
max_depth, threshold,
|
||||||
gradient_render_pixel, &rbd,
|
gradient_render_pixel, &rbd,
|
||||||
gradient_put_pixel, &ppd,
|
gradient_put_pixel, &ppd,
|
||||||
|
Reference in New Issue
Block a user