From 9e517aa404e99b0f4ea34b8039b4d9d3b54be60c Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 7 Jul 2017 15:16:04 +0300 Subject: [PATCH] 0023463: [EDF] dumpView() in OCC viewer produces incorrect image - Second attempt, with direct transfer of each pixel --- src/OCCViewer/OCCViewer_ViewWindow.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index c6bfdc7fd..de787bc3a 100644 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -2281,8 +2281,18 @@ QImage OCCViewer_ViewWindow::dumpView() Image_PixMap aPix; view->ToPixMap(aPix, aWidth, aHeight, Graphic3d_BT_RGB); - QImage anImage( aPix.Data(), aWidth, aHeight, QImage::Format_RGB888 ); - anImage = anImage.mirrored(); + + QImage anImage( aWidth, aHeight, QImage::Format_ARGB32 ); + for ( int i = 0; i < aWidth; i++ ) { + for ( int j = 0; j < aHeight; j++ ) { + Quantity_Color pixel = aPix.PixelColor( i, j ); + QColor color = QColor::fromRgbF( pixel.Red(), pixel.Green(), pixel.Blue() ); + anImage.setPixelColor( i, j, color ); + } + } + + if ( aPix.IsTopDown() ) + anImage = anImage.mirrored(); return anImage; #endif // USE_OLD_IMPLEMENTATION -- 2.30.2