Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wmsrender: homogeneize unique_ptr/ref/pointer on Image #60635

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/server/services/wms/qgswmsrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ namespace QgsWms
return true;
}

QImage *QgsRenderer::getMap()
std::unique_ptr<QImage> QgsRenderer::getMap()
{
// check size
if ( !mContext.isValidWidthHeight() )
Expand Down Expand Up @@ -1074,7 +1074,7 @@ namespace QgsWms
mapSettings.setLayers( layers );

// rendering step for layers
QPainter *renderedPainter = layersRendering( mapSettings, *image );
QPainter *renderedPainter = layersRendering( mapSettings, image.get() );
if ( !renderedPainter ) // job has been canceled
{
return nullptr;
Expand All @@ -1094,7 +1094,7 @@ namespace QgsWms
image.reset( scaledImage );

// return
return image.release();
return image;
}

std::unique_ptr<QgsDxfExport> QgsRenderer::getDxf()
Expand Down Expand Up @@ -3452,7 +3452,7 @@ namespace QgsWms
mTemporaryLayers.clear();
}

QPainter *QgsRenderer::layersRendering( const QgsMapSettings &mapSettings, QImage &image ) const
QPainter *QgsRenderer::layersRendering( const QgsMapSettings &mapSettings, QImage *image ) const
{
QPainter *painter = nullptr;

Expand All @@ -3464,7 +3464,7 @@ namespace QgsWms
#endif
QgsMapRendererJobProxy renderJob( mContext.settings().parallelRendering(), mContext.settings().maxThreads(), &filters );

renderJob.render( mapSettings, &image, mContext.socketFeedback() );
renderJob.render( mapSettings, image, mContext.socketFeedback() );
painter = renderJob.takePainter();

if ( !renderJob.errors().isEmpty() )
Expand Down
4 changes: 2 additions & 2 deletions src/server/services/wms/qgswmsrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace QgsWms
* takes ownership of the image object).
* \since QGIS 3.8
*/
QImage *getMap();
std::unique_ptr<QImage> getMap();

/**
* Returns the map as DXF data
Expand Down Expand Up @@ -169,7 +169,7 @@ namespace QgsWms
QList<QgsMapLayer *> highlightLayers( QList<QgsWmsParametersHighlightLayer> params );

// Rendering step for layers
QPainter *layersRendering( const QgsMapSettings &mapSettings, QImage &image ) const;
QPainter *layersRendering( const QgsMapSettings &mapSettings, QImage *image ) const;

// Rendering step for annotations
void annotationsRendering( QPainter *painter, const QgsMapSettings &mapSettings ) const;
Expand Down