return null;\r
}\r
\r
- // Subtraction here is because the coordinates were computed before the 1px border was stripped.\r
- if (startX > 0) {\r
- startX--;\r
- endX = raster.getWidth() - 2 - (endX - 1);\r
+ // -2 here is because the coordinates were computed before the 1px border was stripped.\r
+ if (startX == 0 && endX == 0) {\r
+ startX = -1;\r
+ endX = -1;\r
} else {\r
- // If no start point was ever found, we assume full stretch.\r
- endX = raster.getWidth() - 2;\r
+ if (startX > 0) {\r
+ startX--;\r
+ endX = raster.getWidth() - 2 - (endX - 1);\r
+ } else {\r
+ // If no start point was ever found, we assume full stretch.\r
+ endX = raster.getWidth() - 2;\r
+ }\r
}\r
- if (startY > 0) {\r
- startY--;\r
- endY = raster.getHeight() - 2 - (endY - 1);\r
+ if (startY == 0 && endY == 0) {\r
+ startY = -1;\r
+ endY = -1;\r
} else {\r
- // If no start point was ever found, we assume full stretch.\r
- endY = raster.getHeight() - 2;\r
+ if (startY > 0) {\r
+ startY--;\r
+ endY = raster.getHeight() - 2 - (endY - 1);\r
+ } else {\r
+ // If no start point was ever found, we assume full stretch.\r
+ endY = raster.getHeight() - 2;\r
+ }\r
}\r
\r
int[] pads = new int[] {startX, endX, startY, endY};\r