]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Fri, 19 Nov 2010 08:10:17 +0000 (08:10 +0000)
committervsv <vsv@opencascade.com>
Fri, 19 Nov 2010 08:10:17 +0000 (08:10 +0000)
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/OCCViewer_ViewWindow.cxx

index 2bcd60f21cc943b11966c0425f6c968dd0e70864..5baf2963e51be365a88a9149ba16ec8c489025a2 100644 (file)
@@ -216,3 +216,11 @@ void OCCViewer_ViewFrame::onContextMenuRequested(QContextMenuEvent*)
   myPopupRequestedView = dynamic_cast<OCCViewer_ViewWindow*>(sender());
 }
 
+void OCCViewer_ViewFrame::onDumpView()
+{
+  if (myPopupRequestedView) {
+    myPopupRequestedView->onDumpView(); 
+  } else {
+    getView(MAIN_VIEW)->onDumpView(); 
+  }
+}
index 7607577ddd765a05773291f17851e3ceba7dc1ea..19212da77efbc7f8056b1855c70a32baf6dc35c3 100644 (file)
@@ -104,7 +104,7 @@ public slots:
    
   void onMaximizedView( OCCViewer_ViewWindow*, bool );
 
-  virtual void onDumpView() { getView(MAIN_VIEW)->onDumpView(); }
+  virtual void onDumpView();
 
 private slots:
   void onContextMenuRequested(QContextMenuEvent*);
index 121614a05d8b035c8c61dfec7d5370b6422df0db..350790032f2d50c069ae3fe483dcb699addff67f 100755 (executable)
@@ -1547,14 +1547,18 @@ QImage OCCViewer_ViewWindow::dumpView()
   Handle(V3d_View) view = myViewPort->getView();
   if ( view.IsNull() )
     return QImage();
+  
   int aWidth = myViewPort->width();
   int aHeight = myViewPort->height();
   QApplication::syncX();
-  view->Update();
+  view->Redraw(); // In order to reactivate GL context
+  //view->Update();
 
   OpenGLUtils_FrameBuffer aFrameBuffer;
   if( aFrameBuffer.init( aWidth, aHeight ) )
   {
+    QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
+   
     glPushAttrib( GL_VIEWPORT_BIT );
     glViewport( 0, 0, aWidth, aHeight );
     aFrameBuffer.bind();
@@ -1565,8 +1569,6 @@ QImage OCCViewer_ViewWindow::dumpView()
     aFrameBuffer.unbind();
     glPopAttrib();
 
-    QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
-
     aFrameBuffer.bind();
     glReadPixels( 0, 0, aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, anImage.bits() );
     aFrameBuffer.unbind();
@@ -1575,9 +1577,8 @@ QImage OCCViewer_ViewWindow::dumpView()
     anImage = anImage.mirrored();
     return anImage;
   }
-
   // if frame buffers are unsupported, use old functionality
-  view->Redraw();
+  //view->Redraw();
 
   unsigned char* data = new unsigned char[ aWidth*aHeight*4 ];