sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [sis] branch geoapi-4.0 updated: Image : fix missing translation in AbstractRenderedImage.getData() method
Date Thu, 12 Dec 2019 08:28:31 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 0f90b1a  Image : fix missing translation in AbstractRenderedImage.getData() method
0f90b1a is described below

commit 0f90b1a2cca33d3789909e39293632a1c27ddbb0
Author: jsorel <johann.sorel@geomatys.com>
AuthorDate: Thu Dec 12 09:23:26 2019 +0100

    Image : fix missing translation in AbstractRenderedImage.getData() method
---
 .../java/org/apache/sis/internal/image/AbstractRenderedImage.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/image/AbstractRenderedImage.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/image/AbstractRenderedImage.java
index 57afe79..7b138a1 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/image/AbstractRenderedImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/image/AbstractRenderedImage.java
@@ -80,7 +80,7 @@ public abstract class AbstractRenderedImage implements RenderedImage {
     @Override
     public Raster getData(Rectangle rect) {
         final SampleModel sm = getSampleModel().createCompatibleSampleModel(rect.width, rect.height);
-        final Raster rasterOut = Raster.createWritableRaster(sm, null);
+        Raster rasterOut = Raster.createWritableRaster(sm, null);
 
         // Clear dataBuffer to 0 value for all bank
         for (int s = 0; s < rasterOut.getDataBuffer().getSize(); s++) {
@@ -119,6 +119,9 @@ public abstract class AbstractRenderedImage implements RenderedImage {
             }
         }
 
+        if (rect.x != 0 && rect.y != 0) {
+            rasterOut = rasterOut.createTranslatedChild(rect.x, rect.y);
+        }
         return rasterOut;
     }
 


Mime
View raw message