From: rnv Date: Fri, 30 May 2014 08:21:11 +0000 (+0400) Subject: Use OCCT method to make OCC Viewer snapshot. X-Git-Tag: V7_5_0a1~47 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3cda729fd88fab5a7d374dbfd130c429ec1c45bc;p=modules%2Fgui.git Use OCCT method to make OCC Viewer snapshot. --- diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index ed1d3c1db..be3311217 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -89,6 +89,8 @@ #endif +#include + #include #include "utilities.h" @@ -1914,6 +1916,10 @@ QImage OCCViewer_ViewWindow::dumpView() int aWidth = myViewPort->width(); int aHeight = myViewPort->height(); + + // rnv: An old approach to dump the OCCViewer content + // Now used OCCT built-in procedure. + /* QApplication::syncX(); view->Redraw(); // In order to reactivate GL context //view->Update(); @@ -1950,10 +1956,13 @@ QImage OCCViewer_ViewWindow::dumpView() glReadPixels( p.x(), p.y(), aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, data); + */ + + Image_PixMap aPix; + view->ToPixMap(aPix,aWidth, aHeight,Graphic3d_BT_RGBA); - QImage anImage( data, aWidth, aHeight, QImage::Format_ARGB32 ); + QImage anImage( aPix.Data(), aWidth, aHeight, QImage::Format_ARGB32 ); anImage = anImage.mirrored(); - anImage = anImage.rgbSwapped(); return anImage; }