From edcd73e9f0e698001b6a9a4dd7c940402ce52f66 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 6 Jul 2006 10:58:44 +0000 Subject: [PATCH] app/base/pixel-region.[ch] code cleanup. 2006-07-06 Sven Neumann * app/base/pixel-region.[ch] * app/base/tile-manager.h: code cleanup. --- ChangeLog | 4 +++- app/base/pixel-region.c | 50 ++++++++++++++++++++--------------------- app/base/pixel-region.h | 8 +++---- app/base/tile-manager.h | 14 ++++++------ 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf6575b968..5d436bcf70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2006-07-06 Sven Neumann - * app/base/temp-buf.[ch]: code cleanup. + * app/base/pixel-region.[ch] + * app/base/temp-buf.[ch] + * app/base/tile-manager.h: code cleanup. 2006-07-05 Sven Neumann diff --git a/app/base/pixel-region.c b/app/base/pixel-region.c index a6fcde27c7..37c9077d4f 100644 --- a/app/base/pixel-region.c +++ b/app/base/pixel-region.c @@ -168,18 +168,18 @@ pixel_region_get_row (PixelRegion *PR, gint boundary; gint b; gint npixels; - gint tilebpp; + gint bpp; end = x + w; pixel_region_get_async (PR, x, y, end, y); - tilebpp = tile_manager_bpp (PR->tiles); - inc = subsample * tilebpp; + bpp = tile_manager_bpp (PR->tiles); + inc = subsample * bpp; if (subsample == 1) { - read_pixel_data (PR->tiles, x, y, end-1, y, data, tilebpp); + read_pixel_data (PR->tiles, x, y, end-1, y, data, bpp); } else { @@ -195,7 +195,7 @@ pixel_region_get_row (PixelRegion *PR, boundary = x + npixels; for ( ; x < boundary; x += subsample) { - for (b = 0; b < tilebpp; b++) + for (b = 0; b < bpp; b++) *data++ = tile_data[b]; tile_data += inc; @@ -206,14 +206,14 @@ pixel_region_get_row (PixelRegion *PR, } void -pixel_region_set_row (PixelRegion *PR, - gint x, - gint y, - gint w, - guchar *data) +pixel_region_set_row (PixelRegion *PR, + gint x, + gint y, + gint w, + const guchar *data) { - gint end; - gint bpp; + gint end; + gint bpp; end = x + w; bpp = tile_manager_bpp (PR->tiles); @@ -234,7 +234,7 @@ pixel_region_get_col (PixelRegion *PR, { Tile *tile; guchar *tile_data; - gint tilebpp; + gint bpp; gint inc; gint end; gint boundary; @@ -244,7 +244,7 @@ pixel_region_get_col (PixelRegion *PR, pixel_region_get_async (PR, x, y, x, end); - tilebpp = tile_manager_bpp (PR->tiles); + bpp = tile_manager_bpp (PR->tiles); while (y < end) { @@ -255,11 +255,11 @@ pixel_region_get_col (PixelRegion *PR, if (boundary > end) /* make sure we don't write past the end */ boundary = end; - inc = subsample * tilebpp * tile_ewidth (tile); + inc = subsample * bpp * tile_ewidth (tile); for ( ; y < boundary; y += subsample) { - for (b = 0; b < tilebpp; b++) + for (b = 0; b < bpp; b++) *data++ = tile_data[b]; tile_data += inc; @@ -271,22 +271,22 @@ pixel_region_get_col (PixelRegion *PR, void -pixel_region_set_col (PixelRegion *PR, - gint x, - gint y, - gint h, - guchar *data) +pixel_region_set_col (PixelRegion *PR, + gint x, + gint y, + gint h, + const guchar *data) { - gint tilebpp; - gint end; + gint bpp; + gint end; end = y + h; pixel_region_get_async (PR, x, y, x, end); - tilebpp = tile_manager_bpp (PR->tiles); + bpp = tile_manager_bpp (PR->tiles); - write_pixel_data (PR->tiles, x, y, x, end-1, data, tilebpp); + write_pixel_data (PR->tiles, x, y, x, end-1, data, bpp); } gboolean diff --git a/app/base/pixel-region.h b/app/base/pixel-region.h index 4a3ce9edc7..cd1335fe46 100644 --- a/app/base/pixel-region.h +++ b/app/base/pixel-region.h @@ -101,7 +101,7 @@ void pixel_region_set_row (PixelRegion *PR, gint x, gint y, gint w, - guchar *data); + const guchar *data); void pixel_region_get_col (PixelRegion *PR, gint x, gint y, @@ -112,11 +112,11 @@ void pixel_region_set_col (PixelRegion *PR, gint x, gint y, gint h, - guchar *data); + const guchar *data); gboolean pixel_region_has_alpha (PixelRegion *PR); -PixelRegionIterator * pixel_regions_register (gint num_regions, - ...); +PixelRegionIterator * pixel_regions_register (gint num_regions, + ...); PixelRegionIterator * pixel_regions_process (PixelRegionIterator *PRI); void pixel_regions_process_stop (PixelRegionIterator *PRI); diff --git a/app/base/tile-manager.h b/app/base/tile-manager.h index d09c687206..9a0be8d562 100644 --- a/app/base/tile-manager.h +++ b/app/base/tile-manager.h @@ -23,9 +23,9 @@ struct _PixelDataHandle { guchar *data; gint width; - gint height; + gint height; gint stride; - gint bpp; + gint bpp; }; /* Creates a new tile manager with the specified @@ -137,9 +137,9 @@ void tile_manager_map_over_tile (TileManager *tm, PixelDataHandle * request_pixel_data (TileManager *tm, gint x1, - gint y1, - gint x2, - gint y2, + gint y1, + gint x2, + gint y2, gboolean wantread, gboolean wantwrite); @@ -164,12 +164,12 @@ void write_pixel_data (TileManager *tm, /* Fill buffer with the pixeldata for the pixel at coordinates x,y * if x,y is outside the area of the tilemanger, nothing is done. */ -void read_pixel_data_1 (TileManager *tm, +void read_pixel_data_1 (TileManager *tm, gint x, gint y, guchar *buffer); -void write_pixel_data_1 (TileManager *tm, +void write_pixel_data_1 (TileManager *tm, gint x, gint y, const guchar *buffer);