@@ -164,9 +164,9 @@ int QgsRelief::processRaster( QProgressDialog* p )
164164 float * scanLine2 = ( float * ) CPLMalloc ( sizeof ( float ) * xSize );
165165 float * scanLine3 = ( float * ) CPLMalloc ( sizeof ( float ) * xSize );
166166
167- int * resultRedLine = ( int * ) CPLMalloc ( sizeof ( int ) * xSize );
168- int * resultGreenLine = ( int * ) CPLMalloc ( sizeof ( int ) * xSize );
169- int * resultBlueLine = ( int * ) CPLMalloc ( sizeof ( int ) * xSize );
167+ char * resultRedLine = ( char * ) CPLMalloc ( sizeof ( char ) * xSize );
168+ char * resultGreenLine = ( char * ) CPLMalloc ( sizeof ( char ) * xSize );
169+ char * resultBlueLine = ( char * ) CPLMalloc ( sizeof ( char ) * xSize );
170170
171171 if ( p )
172172 {
@@ -247,9 +247,9 @@ int QgsRelief::processRaster( QProgressDialog* p )
247247 }
248248 }
249249
250- GDALRasterIO ( outputRedBand, GF_Write, 0 , i, xSize, 1 , resultRedLine, xSize, 1 , GDT_Int32 , 0 , 0 );
251- GDALRasterIO ( outputGreenBand, GF_Write, 0 , i, xSize, 1 , resultGreenLine, xSize, 1 , GDT_Int32 , 0 , 0 );
252- GDALRasterIO ( outputBlueBand, GF_Write, 0 , i, xSize, 1 , resultBlueLine, xSize, 1 , GDT_Int32 , 0 , 0 );
250+ GDALRasterIO ( outputRedBand, GF_Write, 0 , i, xSize, 1 , resultRedLine, xSize, 1 , GDT_Byte , 0 , 0 );
251+ GDALRasterIO ( outputGreenBand, GF_Write, 0 , i, xSize, 1 , resultGreenLine, xSize, 1 , GDT_Byte , 0 , 0 );
252+ GDALRasterIO ( outputBlueBand, GF_Write, 0 , i, xSize, 1 , resultBlueLine, xSize, 1 , GDT_Byte , 0 , 0 );
253253 }
254254
255255 if ( p )
@@ -278,7 +278,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
278278}
279279
280280bool QgsRelief::processNineCellWindow ( float * x1, float * x2, float * x3, float * x4, float * x5, float * x6, float * x7, float * x8, float * x9,
281- int * red, int * green, int * blue )
281+ char * red, char * green, char * blue )
282282{
283283 // 1. component: colour and hillshade from 300 degrees
284284 int r = 0 ;
@@ -363,9 +363,9 @@ bool QgsRelief::processNineCellWindow( float* x1, float* x2, float* x3, float* x
363363 b = b3 * 0.1 + b * 0.9 ;
364364 }
365365
366- *red = r;
367- *green = g;
368- *blue = b;
366+ *red = ( char ) r;
367+ *green = ( char ) g;
368+ *blue = ( char ) b;
369369 return true ;
370370}
371371
@@ -444,7 +444,7 @@ GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH o
444444 papszOptions = CSLSetNameValue ( papszOptions, " COMPRESS" , " PACKBITS" );
445445
446446 // create three band raster (reg, green, blue)
447- GDALDatasetH outputDataset = GDALCreate ( outputDriver, mOutputFile .toLocal8Bit ().data (), xSize, ySize, 3 , GDT_Int32 , papszOptions );
447+ GDALDatasetH outputDataset = GDALCreate ( outputDriver, mOutputFile .toLocal8Bit ().data (), xSize, ySize, 3 , GDT_Byte , papszOptions );
448448 if ( outputDataset == NULL )
449449 {
450450 return outputDataset;
0 commit comments