Skip to content

Commit

Permalink
Invert color flag for raster renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Dec 28, 2011
1 parent 172a7c8 commit cd03489
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/raster/qgsrasterrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "qgsmaptopixel.h"

QgsRasterRenderer::QgsRasterRenderer( QgsRasterDataProvider* provider, QgsRasterResampler* resampler ): mProvider( provider ), mResampler( resampler ),
mOpacity( 1.0 ), mRasterTransparency( 0 ), mAlphaBand( -1 )
mOpacity( 1.0 ), mRasterTransparency( 0 ), mAlphaBand( -1 ), mInvertColor( false )
{
}

Expand Down Expand Up @@ -64,7 +64,7 @@ void QgsRasterRenderer::startRasterRead( int bandNumber, QgsRasterViewPort* view
pInfo.nCols = viewPort->drawableAreaXDim * oversampling;
pInfo.nRows = viewPort->drawableAreaYDim * oversampling;
int totalMemoryUsage = pInfo.nCols * pInfo.nRows * mProvider->dataTypeSize( bandNumber );
int parts = totalMemoryUsage / /*100000000*/ 100000 + 1;
int parts = totalMemoryUsage / 100000000 /*100000*/ + 1;
pInfo.nPartsPerDimension = sqrt( parts );
pInfo.nColsPerPart = pInfo.nCols / pInfo.nPartsPerDimension;
pInfo.nRowsPerPart = pInfo.nRows / pInfo.nPartsPerDimension;
Expand Down
5 changes: 5 additions & 0 deletions src/core/raster/qgsrasterrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class QgsRasterRenderer
void setAlphaBand( int band ) { mAlphaBand = band; }
int alphaBand() const { return mAlphaBand; }

void setInvertColor( bool invert ){ mInvertColor = invert; }
bool invertColor() const { return mInvertColor; }

protected:
inline double readValue( void *data, QgsRasterDataProvider::DataType type, int index );

Expand All @@ -77,6 +80,8 @@ class QgsRasterRenderer
Default: -1 (not set)*/
int mAlphaBand;

bool mInvertColor;

private:
/**Remove part into and release memory*/
void removePartInfo( int bandNumer );
Expand Down

0 comments on commit cd03489

Please sign in to comment.