app/base/pixel-region.[ch] code cleanup.

2006-07-06  Sven Neumann  <sven@gimp.org>

	* app/base/pixel-region.[ch]
	* app/base/tile-manager.h: code cleanup.
This commit is contained in:
Sven Neumann 2006-07-06 10:58:44 +00:00 committed by Sven Neumann
parent dc4517cd78
commit edcd73e9f0
4 changed files with 39 additions and 37 deletions

View File

@ -1,6 +1,8 @@
2006-07-06 Sven Neumann <sven@gimp.org> 2006-07-06 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org> 2006-07-05 Sven Neumann <sven@gimp.org>

View File

@ -168,18 +168,18 @@ pixel_region_get_row (PixelRegion *PR,
gint boundary; gint boundary;
gint b; gint b;
gint npixels; gint npixels;
gint tilebpp; gint bpp;
end = x + w; end = x + w;
pixel_region_get_async (PR, x, y, end, y); pixel_region_get_async (PR, x, y, end, y);
tilebpp = tile_manager_bpp (PR->tiles); bpp = tile_manager_bpp (PR->tiles);
inc = subsample * tilebpp; inc = subsample * bpp;
if (subsample == 1) 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 else
{ {
@ -195,7 +195,7 @@ pixel_region_get_row (PixelRegion *PR,
boundary = x + npixels; boundary = x + npixels;
for ( ; x < boundary; x += subsample) for ( ; x < boundary; x += subsample)
{ {
for (b = 0; b < tilebpp; b++) for (b = 0; b < bpp; b++)
*data++ = tile_data[b]; *data++ = tile_data[b];
tile_data += inc; tile_data += inc;
@ -206,14 +206,14 @@ pixel_region_get_row (PixelRegion *PR,
} }
void void
pixel_region_set_row (PixelRegion *PR, pixel_region_set_row (PixelRegion *PR,
gint x, gint x,
gint y, gint y,
gint w, gint w,
guchar *data) const guchar *data)
{ {
gint end; gint end;
gint bpp; gint bpp;
end = x + w; end = x + w;
bpp = tile_manager_bpp (PR->tiles); bpp = tile_manager_bpp (PR->tiles);
@ -234,7 +234,7 @@ pixel_region_get_col (PixelRegion *PR,
{ {
Tile *tile; Tile *tile;
guchar *tile_data; guchar *tile_data;
gint tilebpp; gint bpp;
gint inc; gint inc;
gint end; gint end;
gint boundary; gint boundary;
@ -244,7 +244,7 @@ pixel_region_get_col (PixelRegion *PR,
pixel_region_get_async (PR, x, y, x, end); pixel_region_get_async (PR, x, y, x, end);
tilebpp = tile_manager_bpp (PR->tiles); bpp = tile_manager_bpp (PR->tiles);
while (y < end) 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 */ if (boundary > end) /* make sure we don't write past the end */
boundary = end; boundary = end;
inc = subsample * tilebpp * tile_ewidth (tile); inc = subsample * bpp * tile_ewidth (tile);
for ( ; y < boundary; y += subsample) for ( ; y < boundary; y += subsample)
{ {
for (b = 0; b < tilebpp; b++) for (b = 0; b < bpp; b++)
*data++ = tile_data[b]; *data++ = tile_data[b];
tile_data += inc; tile_data += inc;
@ -271,22 +271,22 @@ pixel_region_get_col (PixelRegion *PR,
void void
pixel_region_set_col (PixelRegion *PR, pixel_region_set_col (PixelRegion *PR,
gint x, gint x,
gint y, gint y,
gint h, gint h,
guchar *data) const guchar *data)
{ {
gint tilebpp; gint bpp;
gint end; gint end;
end = y + h; end = y + h;
pixel_region_get_async (PR, x, y, x, end); 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 gboolean

View File

@ -101,7 +101,7 @@ void pixel_region_set_row (PixelRegion *PR,
gint x, gint x,
gint y, gint y,
gint w, gint w,
guchar *data); const guchar *data);
void pixel_region_get_col (PixelRegion *PR, void pixel_region_get_col (PixelRegion *PR,
gint x, gint x,
gint y, gint y,
@ -112,11 +112,11 @@ void pixel_region_set_col (PixelRegion *PR,
gint x, gint x,
gint y, gint y,
gint h, gint h,
guchar *data); const guchar *data);
gboolean pixel_region_has_alpha (PixelRegion *PR); 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); PixelRegionIterator * pixel_regions_process (PixelRegionIterator *PRI);
void pixel_regions_process_stop (PixelRegionIterator *PRI); void pixel_regions_process_stop (PixelRegionIterator *PRI);

View File

@ -23,9 +23,9 @@ struct _PixelDataHandle
{ {
guchar *data; guchar *data;
gint width; gint width;
gint height; gint height;
gint stride; gint stride;
gint bpp; gint bpp;
}; };
/* Creates a new tile manager with the specified /* 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, PixelDataHandle * request_pixel_data (TileManager *tm,
gint x1, gint x1,
gint y1, gint y1,
gint x2, gint x2,
gint y2, gint y2,
gboolean wantread, gboolean wantread,
gboolean wantwrite); gboolean wantwrite);
@ -164,12 +164,12 @@ void write_pixel_data (TileManager *tm,
/* Fill buffer with the pixeldata for the pixel at coordinates x,y /* 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. * 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 x,
gint y, gint y,
guchar *buffer); guchar *buffer);
void write_pixel_data_1 (TileManager *tm, void write_pixel_data_1 (TileManager *tm,
gint x, gint x,
gint y, gint y,
const guchar *buffer); const guchar *buffer);