Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 11, 2020
1 parent 28c8eef commit c7ef8c8
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 2 deletions.
Expand Up @@ -759,6 +759,13 @@ Returns the stroke width map unit scale.
virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context );
%Docstring
Custom stroke
%End

virtual bool applyBrushTransformFromContext() const;
%Docstring
Returns ``True`` if the image brush should be transformed using the render context's texture origin.

.. versionadded:: 3.16
%End

private:
Expand Down Expand Up @@ -1041,6 +1048,7 @@ Returns the map unit scale for the image's width.

virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context );

virtual bool applyBrushTransformFromContext() const;

};

Expand Down
12 changes: 11 additions & 1 deletion src/core/symbology/qgsfillsymbollayer.cpp
Expand Up @@ -1597,7 +1597,7 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF &points, const QVec
p->setPen( QPen( Qt::NoPen ) );

QTransform bkTransform = mBrush.transform();
if ( !context.renderContext().textureOrigin().isNull() )
if ( applyBrushTransformFromContext() && !context.renderContext().textureOrigin().isNull() )
{
QPointF leftCorner = context.renderContext().textureOrigin();
QTransform t = mBrush.transform();
Expand Down Expand Up @@ -1751,6 +1751,11 @@ bool QgsImageFillSymbolLayer::hasDataDefinedProperties() const
return false;
}

bool QgsImageFillSymbolLayer::applyBrushTransformFromContext() const
{
return true;
}


//QgsSVGFillSymbolLayer

Expand Down Expand Up @@ -4171,6 +4176,11 @@ void QgsRasterFillSymbolLayer::applyDataDefinedSettings( QgsSymbolRenderContext
applyPattern( mBrush, file, width, opacity, context );
}

bool QgsRasterFillSymbolLayer::applyBrushTransformFromContext() const
{
return false;
}

void QgsRasterFillSymbolLayer::applyPattern( QBrush &brush, const QString &imageFilePath, const double width, const double alpha, const QgsSymbolRenderContext &context )
{
QSize size;
Expand Down
9 changes: 8 additions & 1 deletion src/core/symbology/qgsfillsymbollayer.h
Expand Up @@ -710,6 +710,13 @@ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayer

virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context ) { Q_UNUSED( context ) }

/**
* Returns TRUE if the image brush should be transformed using the render context's texture origin.
*
* \since QGIS 3.16
*/
virtual bool applyBrushTransformFromContext() const;

private:
#ifdef SIP_RUN
QgsImageFillSymbolLayer( const QgsImageFillSymbolLayer &other );
Expand Down Expand Up @@ -922,7 +929,7 @@ class CORE_EXPORT QgsRasterFillSymbolLayer: public QgsImageFillSymbolLayer
protected:

void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;

bool applyBrushTransformFromContext() const override;
private:

//! Path to the image file
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit c7ef8c8

Please sign in to comment.