0023006: Improvement to debug memory leaks and insufficient memory growths.
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_3.cxx
CommitLineData
2166f0fa
SK
1// File: OpenGl_GraphicDriver_3.cxx
2// Created: 20 October 2011
3// Author: Sergey ZERCHANINOV
4// Copyright: OPEN CASCADE 2011
7fd59977 5
2166f0fa 6#include <OpenGl_GraphicDriver.hxx>
7fd59977 7
2166f0fa 8#include <TColStd_HArray1OfByte.hxx>
7fd59977 9
2166f0fa
SK
10#include <OpenGl_Display.hxx>
11#include <OpenGl_Structure.hxx>
7fd59977 12
2166f0fa
SK
13void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup)
14{
15 if (theCGroup.ptrGroup == NULL)
16 return;
7fd59977 17
2166f0fa
SK
18 ((OpenGl_Group* )theCGroup.ptrGroup)->Clear();
19 InvalidateAllWorkspaces();
7fd59977 20}
21
2166f0fa
SK
22void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& )
23{
24 // Do nothing
7fd59977 25}
26
2166f0fa
SK
27void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
28 const Standard_Integer theNoInsert)
29{
30 if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL)
31 return;
7fd59977 32
2166f0fa
SK
33 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert);
34 InvalidateAllWorkspaces();
7fd59977 35}
36
2166f0fa
SK
37void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
38{
39 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
40 if (aStructure)
41 {
42 theCGroup.ptrGroup = aStructure->AddGroup();
43 InvalidateAllWorkspaces();
7fd59977 44 }
7fd59977 45}
46
2166f0fa
SK
47void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup,
48 const Standard_Integer theNoInsert)
49{
50 if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return;
7fd59977 51
2166f0fa
SK
52 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert);
53 InvalidateAllWorkspaces();
7fd59977 54}
55
2166f0fa
SK
56void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
57 const Standard_Integer theNoInsert)
58{
59 if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return;
7fd59977 60
2166f0fa
SK
61 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
62 InvalidateAllWorkspaces();
7fd59977 63}
64
2166f0fa
SK
65void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
66 const Standard_Integer theNoInsert,
67 const Standard_Integer theMarkWidth,
68 const Standard_Integer theMarkHeight,
69 const Handle(TColStd_HArray1OfByte)& theTexture)
7fd59977 70{
2166f0fa
SK
71 if(!theCGroup.ContextMarker.IsDef)
72 return;
7fd59977 73
2166f0fa
SK
74 if (!openglDisplay.IsNull())
75 openglDisplay->AddUserMarker ((int )theCGroup.ContextMarker.Scale, theMarkWidth, theMarkHeight, theTexture);
7fd59977 76
2166f0fa
SK
77 if (theCGroup.ptrGroup != NULL)
78 {
79 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
80 InvalidateAllWorkspaces();
7fd59977 81 }
7fd59977 82}
83
2166f0fa
SK
84void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& )
85{
86 // Do nothing
7fd59977 87}
88
2166f0fa
SK
89void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
90{
91 OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
92 if (aStructure == NULL)
93 return;
7fd59977 94
2166f0fa
SK
95 aStructure->RemoveGroup ((const OpenGl_Group* )theCGroup.ptrGroup);
96 InvalidateAllWorkspaces();
7fd59977 97}
98
2166f0fa
SK
99void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup,
100 const Standard_Integer theNoInsert)
101{
102 if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL)
103 return;
7fd59977 104
2166f0fa
SK
105 ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert);
106 InvalidateAllWorkspaces();
7fd59977 107}