From: vsr Date: Fri, 10 Oct 2014 09:37:00 +0000 (+0400) Subject: Merge from SKV_CCreator_from_HYDRO branch X-Git-Tag: V7_5_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c749d0058791f7355fda38093837c1a69bdfde48;p=modules%2Fgui.git Merge from SKV_CCreator_from_HYDRO branch --- c749d0058791f7355fda38093837c1a69bdfde48 diff --cc src/OCCViewer/OCCViewer_Utilities.cxx index 5b9a8797d,fd9c9242c..51c388365 mode 100755,100644..100755 --- a/src/OCCViewer/OCCViewer_Utilities.cxx +++ b/src/OCCViewer/OCCViewer_Utilities.cxx @@@ -25,58 -6,16 +25,60 @@@ #include "SUIT_ViewManager.h" #include "QtxActionToolMgr.h" +#include "QtxMultiAction.h" +// KERNEL includes +#include + +// OCC includes #include +// QT includes +#include #include +Handle(Image_PixMap) OCCViewer_Utilities::imageToPixmap( const QImage& anImage ) +{ + Handle(Image_PixMap) aPixmap = new Image_PixMap(); + if ( !anImage.isNull() ) { + aPixmap->InitTrash( Image_PixMap::ImgBGRA, anImage.width(), anImage.height() ); + aPixmap->SetTopDown( Standard_True ); + + const uchar* aImageBytes = anImage.bits(); + + for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) { +#if OCC_VERSION_LARGE > 0x06070100 + // convert pixels from ARGB to renderer-compatible RGBA + for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { + Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue(aLine, aByte); + + aPixmapBytes.b() = (Standard_Byte) *aImageBytes++; + aPixmapBytes.g() = (Standard_Byte) *aImageBytes++; + aPixmapBytes.r() = (Standard_Byte) *aImageBytes++; + aPixmapBytes.a() = (Standard_Byte) *aImageBytes++; + } +#else + Image_ColorBGRA* aPixmapBytes = aPixmap->EditData().ChangeRow(aLine); + + // convert pixels from ARGB to renderer-compatible RGBA + for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { + aPixmapBytes->b() = (Standard_Byte) *aImageBytes++; + aPixmapBytes->g() = (Standard_Byte) *aImageBytes++; + aPixmapBytes->r() = (Standard_Byte) *aImageBytes++; + aPixmapBytes->a() = (Standard_Byte) *aImageBytes++; + aPixmapBytes++; + } +#endif + } + } + return aPixmap; +} + - void OCCViewer_Utilities::setViewer2DMode( OCCViewer_Viewer* theViewer, + OCCViewer_ViewWindow::Mode2dType OCCViewer_Utilities::setViewer2DMode + ( OCCViewer_Viewer* theViewer, const OCCViewer_ViewWindow::Mode2dType& theMode ) { + OCCViewer_ViewWindow::Mode2dType anOldMode = OCCViewer_ViewWindow::No2dMode; OCCViewer_ViewFrame* aFrame = dynamic_cast ( theViewer->getViewManager()->getActiveView() ); OCCViewer_ViewWindow* aView = aFrame ? aFrame->getView( OCCViewer_ViewFrame::MAIN_VIEW ) : 0; diff --cc src/OCCViewer/OCCViewer_Utilities.h index 1cbbacf24,8319bf74d..fee76863f mode 100755,100644..100755 --- a/src/OCCViewer/OCCViewer_Utilities.h +++ b/src/OCCViewer/OCCViewer_Utilities.h