From: mpa Date: Thu, 11 Sep 2014 09:02:10 +0000 (+0400) Subject: moved method imageToPixmap() from GEOM_Displayer to GUI module (OCCViewer) as external X-Git-Tag: V7_5_0a1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ffc08bf4b1ed5056d0c6c482dcc2d9ac0310941;p=modules%2Fgeom.git moved method imageToPixmap() from GEOM_Displayer to GUI module (OCCViewer) as external --- diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index a012c220b..fbecdc54a 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -77,6 +77,7 @@ #include #include +#include // OCCT Includes #include @@ -158,47 +159,6 @@ namespace return aMap; } - //=========================================================================== - // Function : imageToPixmap - // Purpose : Concert QImage to OCCT pixmap - //=========================================================================== - static inline Handle(Image_PixMap) 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; - } - //=========================================================================== // Function : getDefaultTexture // Purpose : Get default texture