375 |
int dstY = (dy1 < dy2) ? dy1 : dy2; |
int dstY = (dy1 < dy2) ? dy1 : dy2; |
376 |
|
|
377 |
// Clipping. This requires the dst to be scaled as well, |
// Clipping. This requires the dst to be scaled as well, |
378 |
|
if (srcWidth > width) |
379 |
|
{ |
380 |
|
dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); |
381 |
|
srcWidth = width - srcX; |
382 |
|
} |
383 |
|
|
384 |
|
if (srcHeight > height) |
385 |
|
{ |
386 |
|
dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); |
387 |
|
srcHeight = height - srcY; |
388 |
|
} |
389 |
|
|
390 |
if (srcWidth + srcX > width) |
if (srcWidth + srcX > width) |
391 |
{ |
{ |
392 |
dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); |
dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); |
393 |
srcWidth = width - srcX; |
srcWidth = width - srcX; |
394 |
} |
} |
395 |
|
|
396 |
if (srcHeight + srcY > height) |
if (srcHeight + srcY > height) |
397 |
{ |
{ |
398 |
dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); |
dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); |
399 |
srcHeight = height - srcY; |
srcHeight = height - srcY; |
400 |
} |
} |
401 |
|
|
402 |
if(bgcolor != null) |
if(bgcolor != null) |
403 |
drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), |
drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), |
404 |
bgcolor.getBlue (), |
bgcolor.getBlue (), |