From 3cda729fd88fab5a7d374dbfd130c429ec1c45bc Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 30 May 2014 12:21:11 +0400 Subject: [PATCH] Use OCCT method to make OCC Viewer snapshot. --- src/OCCViewer/OCCViewer_ViewWindow.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; } -- 2.39.2