You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2019/03/27 09:36:07 UTC

[sis] 02/02: Fix unexpected DisjointExtentException when requested image size is 1x1 pixel.

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit dc385097825567c6fa95af2f4c33186036754b08
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Mar 27 10:34:51 2019 +0100

    Fix unexpected DisjointExtentException when requested image size is 1x1 pixel.
---
 .../src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
index b505598..2f4613c 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
@@ -231,8 +231,8 @@ public class ImageRenderer {
         final long ymin = Math.max(yreq, ycov);
         final long xmax = Math.min(sliceExtent.getHigh(xd), source.getHigh(xd));
         final long ymax = Math.min(sliceExtent.getHigh(yd), source.getHigh(yd));
-        if (xmax <= xmin || ymax <= ymin) {
-            final int d = (xmax <= xmin) ? xd : yd;
+        if (xmax < xmin || ymax < ymin) {                                           // max are inclusive.
+            final int d = (xmax < xmin) ? xd : yd;
             throw new DisjointExtentException(source.getAxisIdentification(d, d),
                     source.getLow(d), source.getHigh(d), sliceExtent.getLow(d), sliceExtent.getHigh(d));
         }