From d2eddacc8f64d67bbb36c3582922ece935d34861 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 12 Nov 2015 12:47:26 +0300 Subject: [PATCH] 0026862: Configuration - avoid usage of 3rd-party headers within OpenGl_View and D3DHost_View Move Font_FTFont::Rect structure into dedicated header Font_FTFont. D3DHost_View, OpenGl_Font, Font_TextFormatter - use forward declarations. Fix regressions after #0024776 OpenGl_View::IsInvalidated() - fix misprint. D3DHost_View::Redraw() - assign myFBO before rendering. D3DHost_FrameBuffer::Init() - fix always zero viewport. --- src/D3DHost/D3DHost_FrameBuffer.cxx | 4 +- src/D3DHost/D3DHost_FrameBuffer.hxx | 9 ++-- src/D3DHost/D3DHost_View.cxx | 74 ++++++++++++++++---------- src/D3DHost/D3DHost_View.hxx | 13 ++--- src/Font/FILES | 1 + src/Font/Font_FTFont.cxx | 10 ++-- src/Font/Font_FTFont.hxx | 66 ++--------------------- src/Font/Font_Rect.hxx | 81 +++++++++++++++++++++++++++++ src/Font/Font_TextFormatter.cxx | 2 + src/Font/Font_TextFormatter.hxx | 9 +++- src/OpenGl/OpenGl_Font.cxx | 1 + src/OpenGl/OpenGl_Font.hxx | 24 +++------ src/OpenGl/OpenGl_Text.cxx | 9 ++-- src/OpenGl/OpenGl_Text.hxx | 2 +- src/OpenGl/OpenGl_TextBuilder.cxx | 10 ++-- src/OpenGl/OpenGl_View.hxx | 2 +- 16 files changed, 180 insertions(+), 137 deletions(-) create mode 100644 src/Font/Font_Rect.hxx diff --git a/src/D3DHost/D3DHost_FrameBuffer.cxx b/src/D3DHost/D3DHost_FrameBuffer.cxx index 41415c8c1b..0526cd6636 100644 --- a/src/D3DHost/D3DHost_FrameBuffer.cxx +++ b/src/D3DHost/D3DHost_FrameBuffer.cxx @@ -92,13 +92,13 @@ Standard_Boolean D3DHost_FrameBuffer::Init (const Handle(OpenGl_Context)& theCtx const Standard_Integer theSizeX, const Standard_Integer theSizeY) { + Release (theCtx.operator->()); + myVPSizeX = theSizeX; myVPSizeY = theSizeY; const Standard_Integer aSizeX = theSizeX > 0 ? theSizeX : 2; const Standard_Integer aSizeY = theSizeY > 0 ? theSizeY : 2; - Release (theCtx.operator->()); - // Render target surface should be lockable on // Windows XP and non-lockable on Windows Vista or higher if (theD3DDevice->CreateRenderTarget (aSizeX, aSizeY, diff --git a/src/D3DHost/D3DHost_FrameBuffer.hxx b/src/D3DHost/D3DHost_FrameBuffer.hxx index 22eed6e645..3e7719dfa8 100644 --- a/src/D3DHost/D3DHost_FrameBuffer.hxx +++ b/src/D3DHost/D3DHost_FrameBuffer.hxx @@ -19,6 +19,7 @@ #include struct IDirect3DDevice9; +struct IDirect3DSurface9; //! Implements bridge FBO for direct rendering to Direct3D surfaces. class D3DHost_FrameBuffer : public OpenGl_FrameBuffer @@ -58,7 +59,7 @@ public: IDirect3DSurface9* D3dColorSurface() { return myD3dSurf; } //! Returns WDDM hande for D3D color surface. - HANDLE D3dColorSurfaceShare() { return myD3dSurfShare; } + void* D3dColorSurfaceShare() { return myD3dSurfShare; } protected: @@ -67,9 +68,9 @@ protected: protected: IDirect3DSurface9* myD3dSurf; //!< D3D surface - HANDLE myD3dSurfShare; //!< D3D surface share handle in WDDM - HANDLE myGlD3dDevice; //!< WGL/D3D device handle - HANDLE myGlD3dSurf; //!< WGL/D3D surface handle + void* myD3dSurfShare; //!< D3D surface share handle in WDDM + void* myGlD3dDevice; //!< WGL/D3D device handle + void* myGlD3dSurf; //!< WGL/D3D surface handle Standard_Integer myLockCount; //!< locking counter public: diff --git a/src/D3DHost/D3DHost_View.cxx b/src/D3DHost/D3DHost_View.cxx index c03ed4c443..08532ddfc3 100644 --- a/src/D3DHost/D3DHost_View.cxx +++ b/src/D3DHost/D3DHost_View.cxx @@ -13,6 +13,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include @@ -22,7 +24,7 @@ // function : d3dFormatError // purpose : // ======================================================================= -TCollection_AsciiString D3DHost_View::d3dFormatError (HRESULT theErrCode) +TCollection_AsciiString D3DHost_View::d3dFormatError (const long theErrCode) { switch (theErrCode) { @@ -48,22 +50,22 @@ D3DHost_View::D3DHost_View (const Handle(Graphic3d_StructureManager)& theMgr, : OpenGl_View (theMgr, theDriver, theCaps, theDeviceLostFlag, theCounter), myD3dLib (NULL), myD3dDevice (NULL), + myD3dParams (new D3DPRESENT_PARAMETERS()), myRefreshRate (D3DPRESENT_RATE_DEFAULT), myIsD3dEx (false) { - memset(&myD3dParams, 0, sizeof(myD3dParams)); - memset(&myCurrMode, 0, sizeof(myCurrMode)); - - myD3dParams.Windowed = TRUE; - myD3dParams.SwapEffect = D3DSWAPEFFECT_DISCARD; - myD3dParams.BackBufferFormat = D3DFMT_X8R8G8B8; - myD3dParams.BackBufferCount = 1; - myD3dParams.BackBufferHeight = 2; - myD3dParams.BackBufferWidth = 2; - myD3dParams.EnableAutoDepthStencil = FALSE; - myD3dParams.AutoDepthStencilFormat = D3DFMT_D16_LOCKABLE; - myD3dParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - myD3dParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; + memset(myD3dParams.operator->(), 0, sizeof(D3DPRESENT_PARAMETERS)); + + myD3dParams->Windowed = TRUE; + myD3dParams->SwapEffect = D3DSWAPEFFECT_DISCARD; + myD3dParams->BackBufferFormat = D3DFMT_X8R8G8B8; + myD3dParams->BackBufferCount = 1; + myD3dParams->BackBufferHeight = 2; + myD3dParams->BackBufferWidth = 2; + myD3dParams->EnableAutoDepthStencil = FALSE; + myD3dParams->AutoDepthStencilFormat = D3DFMT_D16_LOCKABLE; + myD3dParams->FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; + myD3dParams->PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; } // ======================================================================= @@ -166,21 +168,23 @@ bool D3DHost_View::d3dInit() UINT anAdapterId = D3DADAPTER_DEFAULT; // setup the present parameters - if (myD3dLib->GetAdapterDisplayMode (anAdapterId, &myCurrMode) == D3D_OK) + D3DDISPLAYMODE aCurrMode; + memset(&aCurrMode, 0, sizeof(aCurrMode)); + if (myD3dLib->GetAdapterDisplayMode (anAdapterId, &aCurrMode) == D3D_OK) { - myD3dParams.BackBufferFormat = myCurrMode.Format; - myRefreshRate = myCurrMode.RefreshRate; + myD3dParams->BackBufferFormat = aCurrMode.Format; + myRefreshRate = aCurrMode.RefreshRate; } - myD3dParams.Windowed = TRUE; - myD3dParams.BackBufferWidth = myWindow->Width(); - myD3dParams.BackBufferHeight = myWindow->Height(); - myD3dParams.hDeviceWindow = (HWND )myWindow->PlatformWindow()->NativeHandle(); + myD3dParams->Windowed = TRUE; + myD3dParams->BackBufferWidth = myWindow->Width(); + myD3dParams->BackBufferHeight = myWindow->Height(); + myD3dParams->hDeviceWindow = (HWND )myWindow->PlatformWindow()->NativeHandle(); // create the Video Device HRESULT isOK = myD3dLib->CreateDevice (anAdapterId, D3DDEVTYPE_HAL, (HWND )myWindow->PlatformWindow()->NativeHandle(), D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE, - &myD3dParams, &myD3dDevice); + myD3dParams.get(), &myD3dDevice); if (isOK < 0) { return false; @@ -200,13 +204,13 @@ bool D3DHost_View::d3dReset() return false; } - myD3dParams.Windowed = TRUE; - myD3dParams.BackBufferWidth = myWindow->Width(); - myD3dParams.BackBufferHeight = myWindow->Height(); - myD3dParams.hDeviceWindow = (HWND )myWindow->PlatformWindow()->NativeHandle(); - myD3dParams.FullScreen_RefreshRateInHz = !myD3dParams.Windowed ? myRefreshRate : 0; + myD3dParams->Windowed = TRUE; + myD3dParams->BackBufferWidth = myWindow->Width(); + myD3dParams->BackBufferHeight = myWindow->Height(); + myD3dParams->hDeviceWindow = (HWND )myWindow->PlatformWindow()->NativeHandle(); + myD3dParams->FullScreen_RefreshRateInHz = !myD3dParams->Windowed ? myRefreshRate : 0; - HRESULT isOK = myD3dDevice->Reset(&myD3dParams); + HRESULT isOK = myD3dDevice->Reset(myD3dParams.get()); return isOK == D3D_OK; } @@ -297,11 +301,18 @@ void D3DHost_View::Redraw() { return; } + else if (myFBO != NULL) + { + OpenGl_View::Redraw(); + return; + } Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext(); myToFlipOutput = Standard_True; myD3dWglFbo->LockSurface (aCtx); + myFBO = myD3dWglFbo.get(); OpenGl_View::Redraw(); + myFBO = NULL; myD3dWglFbo->UnlockSurface (aCtx); myToFlipOutput = Standard_False; if (aCtx->caps->buffersNoSwap) @@ -340,10 +351,17 @@ void D3DHost_View::RedrawImmediate() { return; } + else if (myFBO != NULL) + { + OpenGl_View::Redraw(); + return; + } myToFlipOutput = Standard_True; myD3dWglFbo->LockSurface (aCtx); + myFBO = myD3dWglFbo.get(); OpenGl_View::RedrawImmediate(); + myFBO = NULL; myD3dWglFbo->UnlockSurface (aCtx); myToFlipOutput = Standard_False; if (aCtx->caps->buffersNoSwap) diff --git a/src/D3DHost/D3DHost_View.hxx b/src/D3DHost/D3DHost_View.hxx index c37c578b6f..c2a9c9fb11 100644 --- a/src/D3DHost/D3DHost_View.hxx +++ b/src/D3DHost/D3DHost_View.hxx @@ -16,13 +16,14 @@ #ifndef _D3DHost_View_HeaderFile #define _D3DHost_View_HeaderFile -#include - #include #include #include class D3DHost_GraphicDriver; +struct IDirect3D9; +struct IDirect3DDevice9; +typedef struct _D3DPRESENT_PARAMETERS_ D3DPRESENT_PARAMETERS; //! The D3D host view implementation that overrides rendering methods. class D3DHost_View : public OpenGl_View @@ -75,7 +76,7 @@ public: protected: //! Auxiliary method. - Standard_EXPORT static TCollection_AsciiString d3dFormatError (HRESULT theErrCode); + Standard_EXPORT static TCollection_AsciiString d3dFormatError (const long theErrCode); //! Initialize the D3D library. Standard_EXPORT bool d3dInitLib(); @@ -104,9 +105,9 @@ protected: IDirect3D9* myD3dLib; //!< Direct3D library instance IDirect3DDevice9* myD3dDevice; //!< Direct3D device object - D3DPRESENT_PARAMETERS myD3dParams; //!< parameters for created Direct3D device - D3DDISPLAYMODE myCurrMode; //!< temporary variable - UINT myRefreshRate; //!< refresh rate in fullscreen mode + NCollection_Handle + myD3dParams; //!< parameters for created Direct3D device + unsigned int myRefreshRate; //!< refresh rate in fullscreen mode bool myIsD3dEx; //!< D3dEx flag for WDDM Handle(D3DHost_FrameBuffer) myD3dWglFbo; //!< D3D/WGL interop FBO diff --git a/src/Font/FILES b/src/Font/FILES index b42bb13848..234bb0142c 100644 --- a/src/Font/FILES +++ b/src/Font/FILES @@ -11,6 +11,7 @@ Font_FTLibrary.cxx Font_FTLibrary.hxx Font_NameOfFont.hxx Font_NListOfSystemFont.hxx +Font_Rect.hxx Font_SystemFont.cxx Font_SystemFont.hxx Font_NameOfFont.hxx diff --git a/src/Font/Font_FTFont.cxx b/src/Font/Font_FTFont.cxx index d05739e86a..6243a5dd3a 100755 --- a/src/Font/Font_FTFont.cxx +++ b/src/Font/Font_FTFont.cxx @@ -262,9 +262,9 @@ float Font_FTFont::AdvanceY (const Standard_Utf32Char theUCharNext) // function : BoundingBox // purpose : // ======================================================================= -Font_FTFont::Rect Font_FTFont::BoundingBox (const NCollection_String& theString, - const Graphic3d_HorizontalTextAlignment theAlignX, - const Graphic3d_VerticalTextAlignment theAlignY) +Font_Rect Font_FTFont::BoundingBox (const NCollection_String& theString, + const Graphic3d_HorizontalTextAlignment theAlignX, + const Graphic3d_VerticalTextAlignment theAlignY) { Font_TextFormatter aFormatter; aFormatter.SetupAlignment (theAlignX, theAlignY); @@ -273,9 +273,7 @@ Font_FTFont::Rect Font_FTFont::BoundingBox (const NCollection_String& aFormatter.Append (theString, *this); aFormatter.Format(); - Rect aBndBox; - + Font_Rect aBndBox; aFormatter.BndBox (aBndBox); - return aBndBox; } diff --git a/src/Font/Font_FTFont.hxx b/src/Font/Font_FTFont.hxx index d7ea03b031..1ddfee0ac6 100755 --- a/src/Font/Font_FTFont.hxx +++ b/src/Font/Font_FTFont.hxx @@ -18,73 +18,17 @@ #include #include +#include #include #include #include #include -#include //! Wrapper over FreeType font. //! Notice that this class uses internal buffers for loaded glyphs //! and it is absolutely UNSAFE to load/read glyph from concurrent threads! class Font_FTFont : public Standard_Transient { - -public: - - //! Auxiliary structure - rectangle definition - struct Rect - { - float Left; - float Right; - float Top; - float Bottom; - - NCollection_Vec2 TopLeft() const - { - return NCollection_Vec2 (Left, Top); - } - - NCollection_Vec2& TopLeft (NCollection_Vec2& theVec) const - { - theVec.x() = Left; - theVec.y() = Top; - return theVec; - } - - NCollection_Vec2& TopRight (NCollection_Vec2& theVec) const - { - theVec.x() = Right; - theVec.y() = Top; - return theVec; - } - - NCollection_Vec2& BottomLeft (NCollection_Vec2& theVec) const - { - theVec.x() = Left; - theVec.y() = Bottom; - return theVec; - } - - NCollection_Vec2& BottomRight (NCollection_Vec2& theVec) const - { - theVec.x() = Right; - theVec.y() = Bottom; - return theVec; - } - - float Width () const - { - return Right - Left; - } - - float Height () const - { - return Top - Bottom; - } - - }; - public: //! Create uninitialized instance. @@ -186,7 +130,7 @@ public: } //! Retrieve glyph bitmap rectangle - inline void GlyphRect (Font_FTFont::Rect& theRect) const + inline void GlyphRect (Font_Rect& theRect) const { const FT_Bitmap& aBitmap = myFTFace->glyph->bitmap; theRect.Left = float(myFTFace->glyph->bitmap_left); @@ -198,9 +142,9 @@ public: //! Computes bounding box of the given text using plain-text formatter (Font_TextFormatter). //! Note that bounding box takes into account the text alignment options. //! Its corners are relative to the text alignment anchor point, their coordinates can be negative. - Standard_EXPORT Rect BoundingBox (const NCollection_String& theString, - const Graphic3d_HorizontalTextAlignment theAlignX, - const Graphic3d_VerticalTextAlignment theAlignY); + Standard_EXPORT Font_Rect BoundingBox (const NCollection_String& theString, + const Graphic3d_HorizontalTextAlignment theAlignX, + const Graphic3d_VerticalTextAlignment theAlignY); protected: diff --git a/src/Font/Font_Rect.hxx b/src/Font/Font_Rect.hxx new file mode 100644 index 0000000000..50c598a8dd --- /dev/null +++ b/src/Font/Font_Rect.hxx @@ -0,0 +1,81 @@ +// Created by: Kirill GAVRILOV +// Copyright (c) 2013-2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Font_Rect_H__ +#define _Font_Rect_H__ + +#include + +//! Auxiliary POD structure - 2D rectangle definition. +struct Font_Rect +{ + + float Left; //!< left position + float Right; //!< right position + float Top; //!< top position + float Bottom; //!< bottom position + + //! Top-left corner as vec2. + NCollection_Vec2 TopLeft() const + { + return NCollection_Vec2 (Left, Top); + } + + //! Top-left corner as vec2. + NCollection_Vec2& TopLeft (NCollection_Vec2& theVec) const + { + theVec.x() = Left; + theVec.y() = Top; + return theVec; + } + + //! Top-right corner as vec2. + NCollection_Vec2& TopRight (NCollection_Vec2& theVec) const + { + theVec.x() = Right; + theVec.y() = Top; + return theVec; + } + + //! Bottom-left corner as vec2. + NCollection_Vec2& BottomLeft (NCollection_Vec2& theVec) const + { + theVec.x() = Left; + theVec.y() = Bottom; + return theVec; + } + + //! Bottom-right corner as vec2. + NCollection_Vec2& BottomRight (NCollection_Vec2& theVec) const + { + theVec.x() = Right; + theVec.y() = Bottom; + return theVec; + } + + //! Rectangle width. + float Width() const + { + return Right - Left; + } + + //! Rectangle height. + float Height() const + { + return Top - Bottom; + } + +}; + +#endif // _Font_Rect_H__ diff --git a/src/Font/Font_TextFormatter.cxx b/src/Font/Font_TextFormatter.cxx index c31e60f900..520b3c9270 100644 --- a/src/Font/Font_TextFormatter.cxx +++ b/src/Font/Font_TextFormatter.cxx @@ -15,6 +15,8 @@ #include +#include + namespace { typedef NCollection_Vec2 Vec2f; diff --git a/src/Font/Font_TextFormatter.hxx b/src/Font/Font_TextFormatter.hxx index f63d524524..19d68e7e39 100755 --- a/src/Font/Font_TextFormatter.hxx +++ b/src/Font/Font_TextFormatter.hxx @@ -16,9 +16,14 @@ #ifndef Font_TextFormatter_Header #define Font_TextFormatter_Header -#include +#include +#include +#include #include #include +#include + +class Font_FTFont; //! This class intended to prepare formatted text. class Font_TextFormatter @@ -74,7 +79,7 @@ public: } //! @param bounding box. - inline void BndBox (Font_FTFont::Rect& theBndBox) const + inline void BndBox (Font_Rect& theBndBox) const { theBndBox.Left = 0.0f; switch (myAlignX) diff --git a/src/OpenGl/OpenGl_Font.cxx b/src/OpenGl/OpenGl_Font.cxx index 977ecb170e..f7f1abb761 100755 --- a/src/OpenGl/OpenGl_Font.cxx +++ b/src/OpenGl/OpenGl_Font.cxx @@ -16,6 +16,7 @@ #include #include +#include #include #include #include diff --git a/src/OpenGl/OpenGl_Font.hxx b/src/OpenGl/OpenGl_Font.hxx index 367ef8a4d1..fbc794d328 100755 --- a/src/OpenGl/OpenGl_Font.hxx +++ b/src/OpenGl/OpenGl_Font.hxx @@ -19,12 +19,14 @@ #include #include -#include +#include #include #include #include +class Font_FTFont; + //! Texture font. class OpenGl_Font : public OpenGl_Resource { @@ -34,9 +36,9 @@ public: //! Simple structure stores tile rectangle. struct Tile { - Font_FTFont::Rect uv; //!< UV coordinates in texture - Font_FTFont::Rect px; //!< pixel displacement coordinates - GLuint texture; //!< GL texture ID + Font_Rect uv; //!< UV coordinates in texture + Font_Rect px; //!< pixel displacement coordinates + GLuint texture; //!< GL texture ID }; struct RectI @@ -71,12 +73,6 @@ public: return myFont; } - //! @return FreeType font instance specified on construction. - inline Handle(Font_FTFont)& FTFont() - { - return myFont; - } - //! @return true if font was loaded successfully. inline bool IsValid() const { @@ -95,14 +91,6 @@ public: //! FreeType font instance should be already initialized! Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx); - //! Compute advance to the next character with kerning applied when applicable. - //! Assuming text rendered horizontally. - inline float AdvanceX (const Standard_Utf32Char theUChar, - const Standard_Utf32Char theUCharNext) - { - return myFont->AdvanceX (theUChar, theUCharNext); - } - //! @return vertical distance from the horizontal baseline to the highest character coordinate inline float Ascender() const { diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index a27f4fdbcd..2aacc5216e 100644 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -382,16 +383,16 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx, } else if (aCharThis == ' ') { - aWidth += aFont->AdvanceX (aCharThis, aCharNext); + aWidth += aFont->FTFont()->AdvanceX (aCharThis, aCharNext); continue; } else if (aCharThis == '\t') { - aWidth += aFont->AdvanceX (' ', aCharNext) * 8.0f; + aWidth += aFont->FTFont()->AdvanceX (' ', aCharNext) * 8.0f; continue; } - aWidth += aFont->AdvanceX (aCharThis, aCharNext); + aWidth += aFont->FTFont()->AdvanceX (aCharThis, aCharNext); } theWidth = Max (theWidth, aWidth); @@ -735,7 +736,7 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx, aFormatter.SetupAlignment (myParams.HAlign, myParams.VAlign); aFormatter.Reset(); - aFormatter.Append (myString, *myFont->FTFont()); + aFormatter.Append (myString, *myFont->FTFont().operator->()); aFormatter.Format(); OpenGl_TextBuilder aBuilder; diff --git a/src/OpenGl/OpenGl_Text.hxx b/src/OpenGl/OpenGl_Text.hxx index 207b6ac2cd..6615698bed 100755 --- a/src/OpenGl/OpenGl_Text.hxx +++ b/src/OpenGl/OpenGl_Text.hxx @@ -146,7 +146,7 @@ protected: mutable NCollection_Vector myTextures; //!< textures' IDs mutable NCollection_Vector myVertsVbo; //!< VBOs of vertices mutable NCollection_Vector myTCrdsVbo; //!< VBOs of texture coordinates - mutable Font_FTFont::Rect myBndBox; + mutable Font_Rect myBndBox; protected: diff --git a/src/OpenGl/OpenGl_TextBuilder.cxx b/src/OpenGl/OpenGl_TextBuilder.cxx index c814e24108..ea1bbdda0f 100644 --- a/src/OpenGl/OpenGl_TextBuilder.cxx +++ b/src/OpenGl/OpenGl_TextBuilder.cxx @@ -16,6 +16,8 @@ #include #include +#include + namespace { //! Apply floor to vector components. @@ -81,13 +83,13 @@ void OpenGl_TextBuilder::createGlyphs (const Font_TextFormatter& else if (aCharThis == ' ') { ++aSymbolsCounter; - aPen.x() += theFont.AdvanceX (' ', aCharNext); + aPen.x() += theFont.FTFont()->AdvanceX (' ', aCharNext); continue; } else if (aCharThis == '\t') { const Standard_Integer aSpacesNum = (theFormatter.TabSize() - (aSymbolsCounter - 1) % theFormatter.TabSize()); - aPen.x() += theFont.AdvanceX (' ', aCharNext) * Standard_ShortReal(aSpacesNum); + aPen.x() += theFont.FTFont()->AdvanceX (' ', aCharNext) * Standard_ShortReal(aSpacesNum); aSymbolsCounter += aSpacesNum; continue; } @@ -101,8 +103,8 @@ void OpenGl_TextBuilder::createGlyphs (const Font_TextFormatter& aTile.px.Left += aTopLeft.x(); aTile.px.Bottom += aTopLeft.y(); aTile.px.Top += aTopLeft.y(); - const Font_FTFont::Rect& aRectUV = aTile.uv; - const GLuint aTexture = aTile.texture; + const Font_Rect& aRectUV = aTile.uv; + const GLuint aTexture = aTile.texture; Standard_Integer aListId = 0; for (aListId = 0; aListId < theTextures.Length(); ++aListId) diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx index c52b86c777..7c6043c7bf 100644 --- a/src/OpenGl/OpenGl_View.hxx +++ b/src/OpenGl/OpenGl_View.hxx @@ -147,7 +147,7 @@ public: Standard_EXPORT virtual void Invalidate() Standard_OVERRIDE; //! Return true if view content cache has been invalidated. - virtual Standard_Boolean IsInvalidated() Standard_OVERRIDE { return myBackBufferRestored; } + virtual Standard_Boolean IsInvalidated() Standard_OVERRIDE { return !myBackBufferRestored; } //! Displays z-buffer trihedron. Standard_EXPORT virtual void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER, -- 2.20.1