branch | RCL_3 |
changeset 60 | 6c158198356e |
parent 46 | 4376525cdefb |
59:e5618cc85d74 | 60:6c158198356e |
---|---|
448 { |
448 { |
449 end = (long)aOffset + (long)aWidth - 1; |
449 end = (long)aOffset + (long)aWidth - 1; |
450 start = (long)aOffset + (long)aScanLength*((long)aHeight-1); |
450 start = (long)aOffset + (long)aScanLength*((long)aHeight-1); |
451 } |
451 } |
452 |
452 |
453 // |
|
454 // aScanLength may be < 0, hence end < start is valid. |
|
455 // |
|
456 if ((start < 0) || (start > limit) || (end < 0) || (end > limit)) |
|
457 { |
|
458 throw new ArrayIndexOutOfBoundsException("destination range exceeds array bounds"); |
|
459 } |
|
460 |
|
461 final int width = iWidth; |
453 final int width = iWidth; |
462 final int height = iHeight; |
454 final int height = iHeight; |
463 |
455 |
464 final int sx1 = aX; // left column |
456 final int sx1 = aX; // left column |
465 final int sx2 = aX + aWidth; // right column |
457 final int sx2 = aX + aWidth; // right column |
476 if (xRangeError || yRangeError) |
468 if (xRangeError || yRangeError) |
477 { |
469 { |
478 final String info = "args=("+aX+','+aY+','+aWidth+','+aHeight+"), rect=("+sx1 +','+sy1+','+sx2+','+sy2+"), image width="+width+",height="+height; |
470 final String info = "args=("+aX+','+aY+','+aWidth+','+aHeight+"), rect=("+sx1 +','+sy1+','+sx2+','+sy2+"), image width="+width+",height="+height; |
479 throw new IllegalArgumentException("getRGB: Exceeding bounds of source image: " + info); |
471 throw new IllegalArgumentException("getRGB: Exceeding bounds of source image: " + info); |
480 } |
472 } |
473 |
|
474 // |
|
475 // aScanLength may be < 0, hence end < start is valid. |
|
476 // |
|
477 if ((start < 0) || (start > limit) || (end < 0) || (end > limit)) |
|
478 { |
|
479 throw new ArrayIndexOutOfBoundsException("destination range exceeds array bounds"); |
|
480 } |
|
481 |
|
481 final int scanLength = Math.abs(aScanLength); |
482 final int scanLength = Math.abs(aScanLength); |
482 |
483 |
483 if (scanLength < aWidth) |
484 if (scanLength < aWidth) |
484 { |
485 { |
485 throw new IllegalArgumentException("abs(Scanlength) should be >= width"); |
486 throw new IllegalArgumentException("abs(Scanlength) should be >= width"); |