diff --git a/main.c b/main.c index 9acb6a9..5992f50 100644 --- a/main.c +++ b/main.c @@ -58,25 +58,19 @@ void drawTexInto(struct texture tex, struct texture buffer, struct rect texbound i32 stepy = 256 * (float)texheight / outheight; i32 texx = 256 * texbounds.x1; i32 texy = 256 * texbounds.y1; - - i32 bufy = 3 * (bufbounds.x1 + bufbounds.y1 * buffer.width); - i32 bufyinc = 3 * buffer.width; - i32 bufi = bufy; - //log("%f,%f step %f,%f", texx, texy, stepx, stepy); // Buffer is R G B for each pixel, then across then down. If you want X, Y, // it's: 3 * (x + y * width) for(int y = bufbounds.y1; y < bufbounds.y2; y++) { texx = texbounds.x1; - bufi = bufy; for(int x = bufbounds.x1; x < bufbounds.x2; x++) { i32 texi = 3 * ((texx >> 8) + tex.width * (texy >> 8)); + i32 bufi = 3 * (x + y * buffer.width); memcpy(buffer.data + bufi, tex.data + texi, 3); texx += stepx; bufi += 3; } texy += stepy; - bufy += bufyinc; } }