diff options
author | Henning Makholm <henning@makholm.net> | 2009-07-01 18:00:00 (EDT) |
---|---|---|
committer | Julien Jorge <julien.jorge@stuff-o-matic.com> | 2013-01-10 16:10:03 (EST) |
commit | 70a9b1ca8750a43e8092807d174a8c49407aa213 (patch) | |
tree | 78e1cbff8e9750d918c4bc8782086fc37306492a /pixels.c | |
parent | c60d2efdeaa61c5e8a930f9635548f5abaf201b3 (diff) | |
download | xcftools-70a9b1ca8750a43e8092807d174a8c49407aa213.zip xcftools-70a9b1ca8750a43e8092807d174a8c49407aa213.tar.gz xcftools-70a9b1ca8750a43e8092807d174a8c49407aa213.tar.bz2 |
Import of release 1.0.5
Diffstat (limited to 'pixels.c')
-rw-r--r-- | pixels.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -361,8 +361,8 @@ getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles, if( isSubrect(want,dim->c) && (want.l - dim->c.l) % TILE_WIDTH == 0 && (want.t - dim->c.t) % TILE_HEIGHT == 0 ) { - unsigned tx = (want.l - dim->c.l) / TILE_WIDTH ; - unsigned ty = (want.t - dim->c.t) / TILE_WIDTH ; + int tx = TILE_NUM(want.l - dim->c.l); + int ty = TILE_NUM(want.t - dim->c.t); if( want.r == TILEXn(*dim,tx+1) && want.b == TILEYn(*dim,ty+1) ) { /* The common case? An entire single tile from the layer */ copyTilePixels(tile,tiles->tileptrs[tx + ty*dim->tilesx],tiles->params); @@ -375,8 +375,10 @@ getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles, unsigned width = want.r-want.l ; rgba *pixvert = tile->pixels ; rgba *pixhoriz ; - unsigned y, ty, l0, l1, lstart, lnum ; - unsigned x, tx, c0, c1, cstart, cnum ; + int y, ty, l0, l1 ; + int x, tx, c0, c1 ; + unsigned lstart, lnum ; + unsigned cstart, cnum ; if( !isSubrect(want,dim->c) ) { if( want.l < dim->c.l ) pixvert += (dim->c.l - want.l), @@ -394,7 +396,7 @@ getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles, fprintf(stderr,"jig0 (%d-%d),(%d-%d)\n",left,right,top,bottom); #endif - for( y=want.t, ty=(want.t-dim->c.t)/TILE_HEIGHT, l0=TILEYn(*dim,ty); + for( y=want.t, ty=TILE_NUM(want.t-dim->c.t), l0=TILEYn(*dim,ty); y<want.b; pixvert += lnum*width, ty++, y=l0=l1 ) { l1 = TILEYn(*dim,ty+1) ; @@ -402,7 +404,7 @@ getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles, lnum = (l1 > want.b ? want.b : l1) - y ; pixhoriz = pixvert ; - for( x=want.l, tx=(want.l-dim->c.l)/TILE_WIDTH, c0=TILEXn(*dim,tx); + for( x=want.l, tx=TILE_NUM(want.l-dim->c.l), c0=TILEXn(*dim,tx); x<want.r; pixhoriz += cnum, tx++, x=c0=c1 ) { c1 = TILEXn(*dim,tx+1); |