- int px1 = j*psize;
- int py1 = i*psize;
- int px2 = min(px1+psize,totalWidth);
- int py2 = min(py1+psize,totalHeight);
- int ix1 = max(px1,sx1);
- int iy1 = max(py1,sy1);
- int ix2 = min(px2,sx2);
- int iy2 = min(py2,sy2);
- if(ix1 >= ix2 || iy1 >= iy2) continue; // no intersection
-
- int pdx1 = dx1 + (int) (xscale*(ix1-sx1));
- int pdy1 = dy1 + (int) (yscale*(iy1-sy1));
- int pdx2 = dx2 - (int) (xscale*(sx2-ix2));
- int pdy2 = dy2 - (int) (yscale*(sy2-iy2));
-
- //System.out.println("" + i + "," + j + " is good... drawing from " + (ix1-px1) + "," + (iy1-py1) + " " + (ix2-px1) + "," + (iy2-py1) + " to " + pdx1 + "," + pdy1 + " to " + pdx2 + "," + pdy2);
-
- pics[i][j].draw(pdx1,pdy1,pdx2,pdy2,ix1-px1,iy1-py1,ix2-px1,iy2-py1);
+ int px1 = j*psize + dx;
+ int py1 = i*psize + dy;
+ pics[i][j].draw(px1, py1, cx1, cy1, cx2, cy2);