0024275: Cppcheck warnings on uninitialized class members
[occt.git] / src / OpenGl / OpenGl_PrinterContext.hxx
CommitLineData
b311480e 1// Created on: 2011-05-20
2// Created by: Anton POLETAEV
3// Copyright (c) 2011-2012 OPEN CASCADE SAS
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
7edf74fd
A
20#ifndef _OPENGL_PRINTERCONTEXT_H
21#define _OPENGL_PRINTERCONTEXT_H
22
7edf74fd 23#include <Standard_DefineHandle.hxx>
7edf74fd 24#include <TColStd_Array2OfReal.hxx>
a174a3c5 25#include <Handle_Standard_Transient.hxx>
7edf74fd
A
26
27//! Class provides specific information for redrawing view to offscreen buffer
28//! on printing. The information is: projection matrixes for tiling,
29//! scaling factors for text/markers and layer viewport dimensions.
a174a3c5 30class OpenGl_PrinterContext : public Standard_Transient
7edf74fd
A
31{
32
33public:
34
a174a3c5 35 //! Constructor
36 OpenGl_PrinterContext();
37
38 //! Destructor
39 virtual ~OpenGl_PrinterContext();
7edf74fd
A
40
41 //! Get view projection transformation matrix.
a174a3c5 42 inline const TColStd_Array2OfReal& GetProjTransformation() const
7edf74fd
A
43 {
44 return myProjTransform;
45 }
46
a174a3c5 47 //! Set view projection transformation matrix for printing/tiling purposes
48 //! theProjTransform parameter should be an 4x4 array.
49 bool SetProjTransformation (const TColStd_Array2OfReal& theProjTransform);
50
51 //! Setup view projection transformation matrix (glLoadMatrixf).
52 void LoadProjTransformation();
7edf74fd
A
53
54 //! Get text/markers scale factor
a174a3c5 55 inline void GetScale (Standard_ShortReal& theScaleX,
56 Standard_ShortReal& theScaleY) const
7edf74fd
A
57 {
58 theScaleX = myScaleX;
59 theScaleY = myScaleY;
60 }
61
a174a3c5 62 //! Set text scale factor
63 void SetScale (const Standard_ShortReal theScaleX,
64 const Standard_ShortReal theScaleY);
65
7edf74fd 66 //! Get layer viewport dimensions
a174a3c5 67 inline void GetLayerViewport (Standard_Integer& theViewportX,
68 Standard_Integer& theViewportY) const
7edf74fd
A
69 {
70 theViewportX = myLayerViewportX;
71 theViewportY = myLayerViewportY;
72 }
73
7edf74fd 74 //! Set layer viewport dimensions
a174a3c5 75 void SetLayerViewport (const Standard_Integer theViewportX,
76 const Standard_Integer theViewportY);
7edf74fd
A
77
78private:
79
7edf74fd 80 TColStd_Array2OfReal myProjTransform;
a174a3c5 81 Standard_ShortReal myProjMatrixGl[16];
82 Standard_ShortReal myScaleX;
83 Standard_ShortReal myScaleY;
84 Standard_Integer myLayerViewportX;
85 Standard_Integer myLayerViewportY;
86
87public:
88
89 DEFINE_STANDARD_RTTI(OpenGl_PrinterContext) // Type definition
90
7edf74fd
A
91};
92
a174a3c5 93DEFINE_STANDARD_HANDLE(OpenGl_PrinterContext, Standard_Transient)
94
7edf74fd 95#endif