Ticket #1751 (closed enhancement: fixed)

Opened 6 years ago

Last modified 6 years ago

[PATCH] Adds a transparent color index for handling empty CADRG subblocks

Reported by: rouault Owned by: rouault
Priority: normal Milestone: 1.5.0
Component: GDAL_Raster Version: 1.4.2
Severity: normal Keywords: CADRG nitf
Cc: warmerdam

Description

Currently, NITFRasterBand::IReadBlock returns a block with color index 0 if there is no noDataValue (see code below). Unfortunatelly a lot of CADRG products (no to say all of them) do not define a transparent color. My patch consists in adding an extra color index for transparency if there is none in the product. Thus, empty subblocks will be displayed with this transparent color.

    else /* nBlockResult == BLKREAD_NULL */
    {
        if( psImage->bNoDataSet )
            memset( pImage, psImage->nNoDataValue,
                    psImage->nWordSize*psImage->nBlockWidth*psImage->nBlockHeight);
        else
            memset( pImage, 0,
                    psImage->nWordSize*psImage->nBlockWidth*psImage->nBlockHeight);

        return CE_None;
    }

Attachments

gdal_svn_cadrg_empty_subblock_bug1751.patch Download (1.7 KB) - added by rouault 6 years ago.

Change History

Changed 6 years ago by rouault

Changed 6 years ago by rouault

  • type changed from defect to enhancement

Changed 6 years ago by warmerdam

  • keywords nitf added
  • milestone set to 1.5.0

Even,

This patch looks ok. Go ahead and apply it, but only in trunk. I don't want risky behavior changes in 1.4.3.

PS. please include "nitf" in keywords for all nitf driver bugs.

Changed 6 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed

Commited in trunk in r11906

Changed 6 years ago by warmerdam

In r11923 I changed this code to only add the transparent LUT entry if there is a LUT. Fixes test stream crash.

Note: See TracTickets for help on using tickets.