Skip to content

Commit

Permalink
Fix resampling with otf-reprojection turned on
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Dec 19, 2011
1 parent 66ef651 commit 5f21627
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/raster/qgspalettedrasterrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
***************************************************************************/

#include "qgspalettedrasterrenderer.h"
#include "qgscoordinatetransform.h"
#include "qgsmaptopixel.h"
#include "qgsrasterviewport.h"
#include <QColor>
Expand Down Expand Up @@ -46,7 +47,13 @@ void QgsPalettedRasterRenderer::draw( QPainter* p, QgsRasterViewPort* viewPort,
if ( mResampler )
{
//read data at source resolution if zoomed in, else do oversampling with factor 2.5
double pixelRatio = theQgsMapToPixel->mapUnitsPerPixel() / ( mProvider->extent().width() / mProvider->xSize() );
QgsRectangle providerExtent = mProvider->extent();
if ( viewPort->mSrcCRS.isValid() && viewPort->mDestCRS.isValid() && viewPort->mSrcCRS != viewPort->mDestCRS )
{
QgsCoordinateTransform t( viewPort->mSrcCRS, viewPort->mDestCRS );
providerExtent = t.transformBoundingBox( providerExtent );
}
double pixelRatio = theQgsMapToPixel->mapUnitsPerPixel() / ( providerExtent.width() / mProvider->xSize() );
double oversampling = pixelRatio > 1.0 ? 2.5 : pixelRatio;
nCols = viewPort->drawableAreaXDim * oversampling;
nRows = viewPort->drawableAreaYDim * oversampling;
Expand Down

0 comments on commit 5f21627

Please sign in to comment.