0023457: Slow text rendering
[occt.git] / src / OpenGl / OpenGl_AspectText.cxx
CommitLineData
b311480e 1// Created on: 2011-07-13
2// Created by: Sergey ZERCHANINOV
a174a3c5 3// Copyright (c) 2011-2013 OPEN CASCADE SAS
b311480e 4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
2166f0fa 20#include <OpenGl_AspectText.hxx>
bf75be98 21#include <OpenGl_Workspace.hxx>
2166f0fa 22
a174a3c5 23namespace
24{
25 static const TEL_COLOUR TheDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
26};
2166f0fa 27
a174a3c5 28// =======================================================================
29// function : OpenGl_AspectText
30// purpose :
31// =======================================================================
32OpenGl_AspectText::OpenGl_AspectText()
33: myFont ("Courier") ,
34 myColor (TheDefaultColor),
35 mySubtitleColor (TheDefaultColor),
36 myAngle (0.0f),
37 myStyleType (Aspect_TOST_NORMAL),
38 myDisplayType (Aspect_TODT_NORMAL),
39 myFontAspect (Font_FA_Regular),
40 myZoomable (false)
2166f0fa 41{
a174a3c5 42 //
2166f0fa
SK
43}
44
a174a3c5 45// =======================================================================
46// function : ~OpenGl_AspectText
47// purpose :
48// =======================================================================
49OpenGl_AspectText::~OpenGl_AspectText()
2166f0fa 50{
a174a3c5 51 //
2166f0fa
SK
52}
53
a174a3c5 54// =======================================================================
55// function : SetContext
56// purpose :
57// =======================================================================
58void OpenGl_AspectText::SetContext (const CALL_DEF_CONTEXTTEXT& theContext)
2166f0fa 59{
a174a3c5 60 myFont = theContext.Font;
61 myColor.rgb[0] = (float )theContext.Color.r;
62 myColor.rgb[1] = (float )theContext.Color.g;
63 myColor.rgb[2] = (float )theContext.Color.b;
2166f0fa 64 myColor.rgb[3] = 1.0f;
a174a3c5 65 mySubtitleColor.rgb[0] = (float )theContext.ColorSubTitle.r;
66 mySubtitleColor.rgb[1] = (float )theContext.ColorSubTitle.g;
67 mySubtitleColor.rgb[2] = (float )theContext.ColorSubTitle.b;
2166f0fa 68 mySubtitleColor.rgb[3] = 1.0f;
a174a3c5 69 myAngle = (float )theContext.TextAngle;
70 myStyleType = (Aspect_TypeOfStyleText )theContext.Style;
71 myDisplayType = (Aspect_TypeOfDisplayText )theContext.DisplayType;
72 myFontAspect = (Font_FontAspect )theContext.TextFontAspect;
73 myZoomable = (theContext.TextZoomable != 0);
2166f0fa
SK
74}
75
a174a3c5 76// =======================================================================
77// function : Render
78// purpose :
79// =======================================================================
5e27df78 80void OpenGl_AspectText::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
2166f0fa 81{
5e27df78 82 theWorkspace->SetAspectText (this);
83}
84
a174a3c5 85// =======================================================================
86// function : Release
87// purpose :
88// =======================================================================
5e27df78 89void OpenGl_AspectText::Release (const Handle(OpenGl_Context)& theContext)
90{
91 //
2166f0fa 92}