From f823def059fe4dde8b8c14f7b7b3064687e3b89a Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 22 Nov 2013 06:54:16 +0400 Subject: [PATCH] 0024392: TKService, Image_PixMap - use bottom-up image data storage by default --- src/Graphic3d/Graphic3d_TextureRoot.cdl | 1 + src/Image/Image_PixMap.cxx | 3 +-- src/Image/Image_PixMap.hxx | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Graphic3d/Graphic3d_TextureRoot.cdl b/src/Graphic3d/Graphic3d_TextureRoot.cdl index b812c4d382..4917ad1585 100755 --- a/src/Graphic3d/Graphic3d_TextureRoot.cdl +++ b/src/Graphic3d/Graphic3d_TextureRoot.cdl @@ -92,6 +92,7 @@ is -- Default implementation will dynamically load image from specified path within this method -- (and no copy will be preserved in this class instance). -- Inheritors may dynamically generate the image or return cached instance. + -- Notice, image data should be in Bottom-Up order (see Image_PixMap::IsTopDown())! -- @return the image for texture. GetParams (me) returns TextureParams from Graphic3d; diff --git a/src/Image/Image_PixMap.cxx b/src/Image/Image_PixMap.cxx index 3dcae01aa1..c8ec78d355 100644 --- a/src/Image/Image_PixMap.cxx +++ b/src/Image/Image_PixMap.cxx @@ -69,7 +69,7 @@ Image_PixMap::Image_PixMap() { memset (&myData, 0, sizeof(myData)); myData.mySizeBPP = 1; - myData.myTopToDown = 1; + myData.myTopToDown = Standard_Size(-1); setFormat (Image_PixMap::ImgGray); } @@ -232,7 +232,6 @@ void Image_PixMap::Clear (Image_PixMap::ImgFormat thePixelFormat) myIsOwnPointer = true; myData.mySizeX = myData.mySizeY = myData.mySizeRowBytes = 0; setFormat (thePixelFormat); - myData.myTopToDown = 1; } // ======================================================================= diff --git a/src/Image/Image_PixMap.hxx b/src/Image/Image_PixMap.hxx index 85532bd625..ef793aab97 100644 --- a/src/Image/Image_PixMap.hxx +++ b/src/Image/Image_PixMap.hxx @@ -156,13 +156,15 @@ public: // high-level API public: // low-level API for batch-processing (pixels reading / comparison / modification) - //! Returns true if image data stored from Top to the Down (default). - //! Some external APIs can return bottom-up data instead + //! Returns TRUE if image data is stored from Top to the Down. + //! By default Bottom Up order is used instead //! (topmost scanlines starts from the bottom in memory). + //! which is most image frameworks naturally support. + //! //! Notice that access methods within this class automatically //! convert input row-index to apply this flag! //! You should use this flag only if interconnect with alien APIs and buffers. - //! @return true if image data is top-down. + //! @return true if image data is top-down inline bool IsTopDown() const { return myData.myTopToDown == 1; @@ -170,8 +172,8 @@ public: // low-level API for batch-processing (pixels reading / comparison / mod //! Setup scanlines order in memory - top-down or bottom-up. //! Drawers should explicitly specify this value if current state IsTopDown() was ignored! - //! @param theIsTopDown - top-down flag. - inline void SetTopDown (bool theIsTopDown) + //! @param theIsTopDown top-down flag + inline void SetTopDown (const bool theIsTopDown) { myData.myTopToDown = (theIsTopDown ? 1 : Standard_Size(-1)); setTopDown(); -- 2.20.1