From 6203139692515d9656aa4cc169deb2558af813ee Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sat, 23 Aug 2008 21:39:11 +0000 Subject: [PATCH] replaced code that copies pixels from one tile-manager to another by a 2008-08-23 Sven Neumann * app/paint-funcs/scale-region.c (scale): replaced code that copies pixels from one tile-manager to another by a call to copy_region(). svn path=/trunk/; revision=26730 --- ChangeLog | 6 ++++++ app/paint-funcs/scale-region.c | 39 ++++++++++++---------------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index f45b4bf3df..89f0c90d88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-23 Sven Neumann + + * app/paint-funcs/scale-region.c (scale): replaced code that + copies pixels from one tile-manager to another by a call to + copy_region(). + 2008-08-23 Sven Neumann * plug-ins/print/print.c: return with a proper PDB status type diff --git a/app/paint-funcs/scale-region.c b/app/paint-funcs/scale-region.c index 6711109ff4..09e5c989b5 100644 --- a/app/paint-funcs/scale-region.c +++ b/app/paint-funcs/scale-region.c @@ -522,37 +522,25 @@ scale (TileManager *srcTM, /* if scale is 2^n */ if (src_width == dst_width && src_height == dst_height) { - for (row = 0; row < dst_tilerows; row++) + PixelRegion srcPR; + PixelRegion dstPR; + + pixel_region_init (&srcPR, srcTM, 0, 0, src_width, src_height, FALSE); + pixel_region_init (&dstPR, dstTM, 0, 0, src_width, src_height, TRUE); + + copy_region (&srcPR, &dstPR); + + if (progress_callback) { - for (col = 0; col < dst_tilecols; col++) - { - Tile *dst_tile = tile_manager_get_at (dstTM, - col, row, TRUE, TRUE); - guchar *dst_data = tile_data_pointer (dst_tile, 0, 0); - guint dst_bpp = tile_bpp (dst_tile); - guint dst_ewidth = tile_ewidth (dst_tile); - guint dst_eheight = tile_eheight (dst_tile); - guint dst_stride = dst_ewidth * dst_bpp; - gint x0 = col * TILE_WIDTH; - gint y0 = row * TILE_HEIGHT; - gint x1 = x0 + dst_ewidth - 1; - gint y1 = y0 + dst_eheight - 1; - - read_pixel_data (srcTM, x0, y0, x1, y1, dst_data, dst_stride); - - tile_release (dst_tile, TRUE); - - if (progress_callback) - progress_callback (0, max_progress, ((*progress)++), - progress_data); - } + *progress += dst_tilerows * dst_tilecols; + progress_callback (0, max_progress, *progress, progress_data); } return; } if (interpolation == GIMP_INTERPOLATION_LANCZOS ) - kernel_lookup = create_lanczos3_lookup(); + kernel_lookup = create_lanczos3_lookup (); for (row = 0; row < dst_tilerows; row++) { @@ -1085,7 +1073,8 @@ sinc (const gdouble x) /* * allocate and fill lookup table of Lanczos windowed sinc function - * use gfloat since errors due to granularity of array far exceed data precision + * use gfloat since errors due to granularity of array far exceed + * data precision */ gfloat * create_lanczos_lookup (void)