Salome HOME
updated copyright message
[modules/gui.git] / src / OCCViewer / OCCViewer_Utilities.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 8ee02c3..aaafb13
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2023  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -27,6 +27,8 @@
 #include "QtxActionToolMgr.h"
 #include "QtxMultiAction.h"
 
+#include <Basics_OCCTVersion.hxx>
+
 // OCC includes
 #include <V3d_View.hxx>
 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
@@ -40,12 +42,23 @@ Handle(Image_PixMap) OCCViewer_Utilities::imageToPixmap( const QImage& anImage )
 {
   Handle(Image_PixMap) aPixmap = new Image_PixMap();
   if ( !anImage.isNull() ) {
+#if OCC_VERSION_LARGE < 0x07070000
     aPixmap->InitTrash( Image_PixMap::ImgBGRA, anImage.width(), anImage.height() );
+#else
+    aPixmap->InitTrash( Image_Format_BGRA, anImage.width(), anImage.height() );
+#endif
+
+#if OCC_VERSION_LARGE < 0x07050000
     aPixmap->SetTopDown( Standard_True );
+#endif
 
     const uchar* aImageBytes = anImage.bits();
-      
+
+#if OCC_VERSION_LARGE < 0x07050000
     for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) {
+#else
+    for ( int aLine = 0; aLine < anImage.height(); ++aLine ) {
+#endif
       // convert pixels from ARGB to renderer-compatible RGBA
       for ( int aByte = 0; aByte < anImage.width(); ++aByte ) {
            Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue<Image_ColorBGRA>(aLine, aByte);
@@ -119,6 +132,8 @@ OCCViewer_ViewWindow::Mode2dType OCCViewer_Utilities::setViewer2DMode
       case OCCViewer_ViewWindow::YZPlane:
         aView3d->SetProj (V3d_Xpos);
         break;
+      default:
+        break;
     }
   }