From: adv Date: Fri, 13 Sep 2013 10:29:05 +0000 (+0000) Subject: Use QImage instead of QPixmap for drawing of result image because of this method... X-Git-Tag: BR_hydro_v_0_1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2e7d81ca1e08ffb83ce3a60b232c2fc7481108a7;p=modules%2Fgui.git Use QImage instead of QPixmap for drawing of result image because of this method can be called from non GUI thread. --- 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;