1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00
Files
occt/src/Standard/Standard_Integer.hxx
kgv a174a3c54f 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
2013-02-08 15:05:16 +04:00

173 lines
6.9 KiB
C++
Executable File

// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _Standard_Integer_HeaderFile
#define _Standard_Integer_HeaderFile
#ifndef _Standard_TypeDef_HeaderFile
#include <Standard_TypeDef.hxx>
#endif
#ifndef _Standard_values_HeaderFile
# include <Standard_values.h>
#endif
class Handle_Standard_Type;
__Standard_API const Handle_Standard_Type& Standard_Integer_Type_();
// ===============================================
// Methods from Standard_Entity class which are redefined:
// - Hascode
// - IsEqual
// - IsSimilar
// - Shallowcopy
// - ShallowDump
// ===============================================
// ==================================
// Methods implemeted in Standard_Integer.cxx
// ==================================
__Standard_API Standard_Integer NextPrimeForMap(const Standard_Integer anInt ) ;
__Standard_API long NextPrime (const long me);
__Standard_API Standard_Integer CharToInt (const Standard_Character me);
__Standard_API Standard_Integer CharToInt (const Standard_CString me);
__Standard_API Standard_Integer ShallowCopy (const Standard_Integer me);
// ===============
// Inline methods
// ===============
// ------------------------------------------------------------------
// Abs : Returns the absolute value of an Integer
// ------------------------------------------------------------------
inline Standard_Integer Abs (const Standard_Integer Value)
{
return Value >= 0 ? Value : -Value;
}
// ------------------------------------------------------------------
// Hascode : Computes a hascoding value for a given Integer
// ------------------------------------------------------------------
inline Standard_Integer HashCode (const Standard_Integer theMe,
const Standard_Integer theUpper)
{
//return (Abs (theMe) % theUpper) + 1;
return ((theMe & 0x7fffffff ) % theUpper) + 1;
}
// ------------------------------------------------------------------
// IsEqual : Returns Standard_True if two integers are equal
// ------------------------------------------------------------------
inline Standard_Boolean IsEqual (const Standard_Integer theOne,
const Standard_Integer theTwo)
{
return theOne == theTwo;
}
#if (defined(_LP64) || defined(__LP64__) || defined(_WIN64))
// ------------------------------------------------------------------
// Hascode : Computes a hascoding value for a given unsigned integer
// ------------------------------------------------------------------
inline Standard_Integer HashCode (const Standard_Utf32Char theMe,
const Standard_Integer theUpper)
{
return ((theMe & 0x7fffffff ) % theUpper) + 1;
}
// ------------------------------------------------------------------
// IsEqual : Returns Standard_True if two integers are equal
// ------------------------------------------------------------------
inline Standard_Boolean IsEqual (const Standard_Utf32Char theOne,
const Standard_Utf32Char theTwo)
{
return theOne == theTwo;
}
#endif
// ------------------------------------------------------------------
// IsSimilar : Returns Standard_True if two integers are equal
// ------------------------------------------------------------------
inline Standard_Boolean IsSimilar (const Standard_Integer One,
const Standard_Integer Two)
{ return One == Two; }
// ------------------------------------------------------------------
// IsEven : Returns Standard_True if an integer is even
// ------------------------------------------------------------------
inline Standard_Boolean IsEven (const Standard_Integer Value)
{ return Value % 2 == 0; }
// ------------------------------------------------------------------
// IsOdd : Returns Standard_True if an integer is odd
// ------------------------------------------------------------------
inline Standard_Boolean IsOdd (const Standard_Integer Value)
{ return Value % 2 == 1; }
// ------------------------------------------------------------------
// Max : Returns the maximum integer between two integers
// ------------------------------------------------------------------
inline Standard_Integer Max (const Standard_Integer Val1,
const Standard_Integer Val2)
{
return Val1 >= Val2 ? Val1 : Val2;
}
// ------------------------------------------------------------------
// Min : Returns the minimum integer between two integers
// ------------------------------------------------------------------
inline Standard_Integer Min (const Standard_Integer Val1,
const Standard_Integer Val2)
{
return Val1 <= Val2 ? Val1 : Val2;
}
// ------------------------------------------------------------------
// Modulus : Returns the remainder of division between two integers
// ------------------------------------------------------------------
inline Standard_Integer Modulus (const Standard_Integer Value,
const Standard_Integer Divisor)
{ return Value % Divisor; }
// ------------------------------------------------------------------
// Square : Returns the square of an integer
// ------------------------------------------------------------------
inline Standard_Integer Square(const Standard_Integer Value)
{ return Value * Value; }
// ------------------------------------------------------------------
// IntegerFirst : Returns the minimum value of an integer
// ------------------------------------------------------------------
inline Standard_Integer IntegerFirst()
{ return INT_MIN; }
// ------------------------------------------------------------------
// IntegerLast : Returns the maximum value of an integer
// ------------------------------------------------------------------
inline Standard_Integer IntegerLast()
{ return INT_MAX; }
// ------------------------------------------------------------------
// IntegerSize : Returns the size in digits of an integer
// ------------------------------------------------------------------
inline Standard_Integer IntegerSize()
{ return BITS(Standard_Integer); }
#endif