Skip to content

Commit

Permalink
prevent crash in QgsRasterLayer::drawMultiBandColor
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5227 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 8, 2006
1 parent 4e8221d commit 3d9fca4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/raster/qgsrasterlayer.cpp
Expand Up @@ -2466,12 +2466,13 @@ void QgsRasterLayer::drawMultiBandColor(QPainter * theQPainter, QgsRasterViewPor

#ifdef QGISDEBUG
QPixmap* pm = dynamic_cast<QPixmap*>(theQPainter->device());
QgsDebugMsg("QgsRasterLayer::drawMultiBandColor: theQPainter stats: ");
QgsDebugMsg("width = " + QString::number(pm->width()));
QgsDebugMsg("height = " + QString::number(pm->height()));

pm->save("/tmp/qgis-rasterlayer-drawmultibandcolor-test-a.png", "PNG");

if(pm)
{
QgsDebugMsg("QgsRasterLayer::drawMultiBandColor: theQPainter stats: ");
QgsDebugMsg("width = " + QString::number(pm->width()));
QgsDebugMsg("height = " + QString::number(pm->height()));
pm->save("/tmp/qgis-rasterlayer-drawmultibandcolor-test-a.png", "PNG");
}
#endif

// \/\/\/ - added to handle zoomed-in rasters
Expand Down Expand Up @@ -2514,8 +2515,10 @@ QgsDebugMsg("QgsRasterLayer::drawSingleBandGray: painting image to canvas from s

#ifdef QGISDEBUG
QgsDebugMsg("QgsRasterLayer::drawMultiBandColor: theQPainter->drawImage.");
pm->save("/tmp/qgis-rasterlayer-drawmultibandcolor-test-b.png", "PNG");

if(pm)
{
pm->save("/tmp/qgis-rasterlayer-drawmultibandcolor-test-b.png", "PNG");
}
#endif

//free the scanline memory
Expand Down

0 comments on commit 3d9fca4

Please sign in to comment.