Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed May 23, 2019
1 parent 9809c1e commit 332bfd8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/effects/qgsblureffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ void QgsBlurEffect::draw( QgsRenderContext &context )

void QgsBlurEffect::drawStackBlur( QgsRenderContext &context )
{
int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
int blurLevel = std::floor( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
QImage im = sourceAsImage( context )->copy();
QgsImageOperation::stackBlur( im, blurLevel );
drawBlurredImage( context, im );
}

void QgsBlurEffect::drawGaussianBlur( QgsRenderContext &context )
{
int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
int blurLevel = std::floor( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
QImage *im = QgsImageOperation::gaussianBlur( *sourceAsImage( context ), blurLevel );
drawBlurredImage( context, *im );
delete im;
Expand Down
2 changes: 2 additions & 0 deletions src/core/effects/qgsblureffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "qgis_core.h"
#include "qgspainteffect.h"
#include "qgsunittypes.h"
#include "qgsmapunitscale.h"
#include "qgis.h"
#include <QPainter>

Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgsgloweffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void QgsGlowEffect::draw( QgsRenderContext &context )
dtProps.ramp = ramp;
QgsImageOperation::distanceTransform( im, dtProps );

int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
int blurLevel = std::floor( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
if ( blurLevel <= 16 )
{
QgsImageOperation::stackBlur( im, blurLevel );
Expand Down
4 changes: 2 additions & 2 deletions src/core/effects/qgsshadoweffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void QgsShadowEffect::draw( QgsRenderContext &context )

QgsImageOperation::overlayColor( colorisedIm, mColor );

int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
int blurLevel = std::floor( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
if ( blurLevel <= 16 )
{
QgsImageOperation::stackBlur( colorisedIm, blurLevel );
Expand Down Expand Up @@ -168,7 +168,7 @@ void QgsShadowEffect::readProperties( const QgsStringMap &props )
QRectF QgsShadowEffect::boundingRect( const QRectF &rect, const QgsRenderContext &context ) const
{
//blur radius and offset distance
int blurLevel = std::round( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
int blurLevel = std::floor( context.convertToPainterUnits( mBlurLevel, mBlurUnit, mBlurMapUnitScale ) );
double spread = context.convertToPainterUnits( mOffsetDist, mOffsetUnit, mOffsetMapUnitScale );
//plus possible extension due to blur, with a couple of extra pixels thrown in for safety
spread += blurLevel * 2 + 10;
Expand Down

0 comments on commit 332bfd8

Please sign in to comment.