From 2e7d81ca1e08ffb83ce3a60b232c2fc7481108a7 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 13 Sep 2013 10:29:05 +0000 Subject: [PATCH] Use QImage instead of QPixmap for drawing of result image because of this method can be called from non GUI thread. --- src/ImageComposer/ImageComposer_Operator.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ImageComposer/ImageComposer_Operator.cxx b/src/ImageComposer/ImageComposer_Operator.cxx index cb9a75eb0..2e2aabf3d 100644 --- a/src/ImageComposer/ImageComposer_Operator.cxx +++ b/src/ImageComposer/ImageComposer_Operator.cxx @@ -72,14 +72,17 @@ ImageComposer_Image ImageComposer_Operator::process( const QVariant& theObj1, anImage1.setTransform( anImage1.transform() * aTranslate ); anImage2.setTransform( anImage2.transform() * aTranslate ); - QPixmap aResultImage( int(aBounds.width()), int(aBounds.height()) ); - aResultImage.fill( myBackground ); + QImage aResultImage( int(aBounds.width()), int(aBounds.height()), QImage::Format_ARGB32 ); + //QPixmap aResultImage( int(aBounds.width()), int(aBounds.height()) ); + //aResultImage.fill( myBackground ); QPainter aPainter( &aResultImage ); - aPainter.setRenderHint( QPainter::SmoothPixmapTransform, true ); + //aPainter.setRenderHint( QPainter::SmoothPixmapTransform, true ); aPainter.setRenderHint( QPainter::Antialiasing, true ); aPainter.setRenderHint( QPainter::HighQualityAntialiasing, true ); + aPainter.fillRect( QRect( 0, 0, int(aBounds.width()), int(aBounds.height()) ), myBackground ); + anImage1Var.setValue( anImage1 ); anImage2Var.setValue( anImage2 ); @@ -90,7 +93,7 @@ ImageComposer_Image ImageComposer_Operator::process( const QVariant& theObj1, QTransform aResultTransform = anImage1.transform(); aResultTransform.translate( aBounds.left(), aBounds.top() ); - aResult = aResultImage.toImage(); + aResult = aResultImage; aResult.setTransform( aResultTransform ); return aResult; -- 2.39.2