1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-13 14:27:08 +03:00

0023457: Slow text rendering

Added class Font_FTFont wrapper over FreeType face

Unify collections methods NCollection_Array1, NCollection_Sequence, NCollection_Vector:
declare Upper, Lower, First, Last, ChangeFirst, ChangeLast methods for all these collections.

Added method NCollection_DataMap::Find() with check key is bound + retrieve value within single call interface.

OpenGl_Context::ReleaseResource() method now supports lazy release of shared resources.

Added class OpenGl_Font which implements textured fonts support.
Added class OpenGl_TextFormatter for text formatting using OpenGl_Font.

OpenGl_Text was redesigned to use OpenGl_FontFormatter.

OpenGl_FontMgr class was removed.
All methods related to text rendered removed from OpenGl_Display class.

OpenGl_Trihedron and OpenGl_GraduatedTrihedron classes were redesigned
to use OpenGl_Text.

OpenGl_PrinterContext instance was moved to OpenGl_GraphicDriver fields
(eliminated usage of global instance).

Added test cases into 3rdparty/fonts grid to check different font styles
and perform FPS tests (no automated results - requires manual analysis
or snapshots comparisons).

Removed unused CSF_FTGL dependency.
OpenGl_Text::setupMatrix - do not apply floor for myWinZ
This commit is contained in:
kgv
2013-02-08 15:05:16 +04:00
parent 163ef25006
commit a174a3c54f
72 changed files with 5397 additions and 2606 deletions

View File

@@ -47,6 +47,7 @@
#include <OpenGl_Display.hxx>
#include <OpenGl_Matrix.hxx>
#include <OpenGl_NamedStatus.hxx>
#include <OpenGl_PrinterContext.hxx>
#include <OpenGl_TextParam.hxx>
#include <Handle_OpenGl_View.hxx>
@@ -92,7 +93,8 @@ public:
//! Special method to perform printing.
//! System-specific and currently only Win platform implemented.
Standard_Boolean Print (const Graphic3d_CView& theCView,
Standard_Boolean Print (const Handle(OpenGl_PrinterContext)& thePrintContext,
const Graphic3d_CView& theCView,
const Aspect_CLayer2d& theCUnderLayer,
const Aspect_CLayer2d& theCOverLayer,
const Aspect_Handle theHPrintDC,
@@ -101,6 +103,11 @@ public:
const Aspect_PrintAlgo thePrintAlgorithm,
const Standard_Real theScaleFactor);
const Handle(OpenGl_PrinterContext)& PrinterContext() const
{
return myPrintContext;
}
void DisplayCallback (const Graphic3d_CView& theCView, int theReason);
// szvgl: defined in OpenGl_Workspace_1.cxx
@@ -156,6 +163,10 @@ public:
Standard_EXPORT const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply);
Standard_EXPORT const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply);
Standard_EXPORT const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply);
inline const OpenGl_TextParam* AspectTextParams() const
{
return TextParam_applied;
}
//! Clear the applied aspect state.
void ResetAppliedAspect();
@@ -164,29 +175,6 @@ public:
Standard_EXPORT Handle(OpenGl_Texture) EnableTexture (const Handle(OpenGl_Texture)& theTexture,
const Handle(Graphic3d_TextureParams)& theParams = NULL);
//// RELATED TO FONTS ////
int FindFont (const char* theFontName,
const Font_FontAspect theFontAspect,
const int theBestSize = -1,
const float theXScale = 1.0f,
const float theYScale = 1.0f)
{
return myDisplay->FindFont (theFontName, theFontAspect, theBestSize, theXScale, theYScale);
}
void StringSize (const wchar_t* theText, int& theWidth, int& theAscent, int& theDescent)
{
myDisplay->StringSize (theText, theWidth, theAscent, theDescent);
}
void RenderText (const wchar_t* theText, const int theIs2d,
const float theX, const float theY, const float theZ)
{
const OpenGl_AspectText* anAspect = AspectText (Standard_True);
myDisplay->RenderText (theText, theIs2d, theX, theY, theZ, anAspect, TextParam_applied);
}
protected:
void CopyBuffers (const Standard_Boolean theFrontToBack);
@@ -206,6 +194,7 @@ protected:
protected: //! @name protected fields
Handle(OpenGl_PrinterContext) myPrintContext;
Handle(OpenGl_View) myView; // WSViews - now just one view is supported
Standard_Boolean myIsTransientOpen; // transientOpen
Standard_Boolean myRetainMode;