Opened 11 years ago

Closed 5 years ago

#5202 closed defect (wontfix)

Per-band nodata never gives alpha=0

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: Algorithms Version: unspecified
Severity: normal Keywords: warp nodata
Cc:

Description

If you do a warp with several (or perhaps even one?) band using per band nodata rather than UNIFIED_SRC_NODATA and you have an output mask or alpha band then the output mask is never set to zero.

This small patch will fix this for at least one mode.

warmerdam@gdal:~/gdal/alg$ svn diff
Index: gdalwarpkernel.cpp
===================================================================
--- gdalwarpkernel.cpp	(revision 26332)
+++ gdalwarpkernel.cpp	(working copy)
@@ -4057,6 +4057,7 @@
 /*      Loop processing each band.                                      */
 /* ==================================================================== */
             int iBand;
+	    int bGotAtLeastOneBand = FALSE;
 
             iDstOffset = iDstX + iDstY * nDstXSize;
 
@@ -4081,11 +4082,13 @@
                             GWKSetPixelValue( poWK, iBand, iDstOffset, 
                                               dfBandDensity, (double) bValue, 
                                               0.0 );
+			    bGotAtLeastOneBand = TRUE;
                         }
                     }
                     else
                     {
                         poWK->papabyDstImage[iBand][iDstOffset] = bValue;
+			bGotAtLeastOneBand = TRUE;
                     }
                 }
             }
@@ -4093,6 +4096,9 @@
 /* -------------------------------------------------------------------- */
 /*      Mark this pixel valid/opaque in the output.                     */
 /* -------------------------------------------------------------------- */
+	    if (!bGotAtLeastOneBand)
+	      dfDensity = 0.0;
+
             GWKOverlayDensity( poWK, iDstOffset, dfDensity );
 
             if( poWK->panDstValid != NULL )

Change History (2)

comment:1 by Jukka Rahkonen, 9 years ago

The patch is not applied to gdal/alg/gdalwarpkernel.cpp yet.

comment:2 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.