Salome HOME
debug of tests
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Overview.cxx
index bc809703f433f68c82e3be656123c6c455761bbd..e3cb8a6c42b55213fccb9306d12557e3eda69c67 100644 (file)
@@ -278,12 +278,25 @@ QImage HYDROGUI_Overview::dump() const
   int aHeight = myViewPort->height();
 
   Image_PixMap aPix;
-  view->ToPixMap( aPix,aWidth, aHeight,Graphic3d_BT_RGBA );
 
+#if OCC_VERSION_LARGE >= 0x07020000
+  view->ToPixMap( aPix,aWidth, aHeight,Graphic3d_BT_RGBA );
   QImage anImage( aPix.Data(), aWidth, aHeight, QImage::Format_ARGB32 );
   anImage = anImage.mirrored();
   anImage = anImage.rgbSwapped();
-
+#else
+  view->ToPixMap(aPix, aWidth, aHeight, Graphic3d_BT_RGB);
+  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 ).GetRGB();
+      QColor color = QColor::fromRgbF( pixel.Red(), pixel.Green(), pixel.Blue() );
+      anImage.setPixelColor( i, j, color );
+    }
+  }
+  if ( aPix.IsTopDown() )
+    anImage = anImage.mirrored();
+#endif
   if( myBand && myBand->isVisible() )
   {
     QPixmap aPixmap = QPixmap::fromImage( anImage );
@@ -291,7 +304,6 @@ QImage HYDROGUI_Overview::dump() const
     myBand->render( &aPixmap, p );
     anImage = aPixmap.toImage();
   }
-
   return anImage;
 }