0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_antialias.cxx
1 /***********************************************************************
2
3 FONCTION :
4 ----------
5 File OpenGl_antialias :
6
7
8 REMARQUES:
9 ---------- 
10
11
12 HISTORIQUE DES MODIFICATIONS   :
13 --------------------------------
14 xx-xx-xx : xxx ; Creation.
15 20-02-96 : FMN ; Suppression code inutile:
16 01-04-96 : CAL ; Integration MINSK portage WNT
17
18 ************************************************************************/
19
20 /*----------------------------------------------------------------------*/
21 /*
22 * Includes
23 */
24
25 #include <OpenGl_tgl_all.hxx>
26
27 #include <stddef.h>
28 #include <stdio.h>
29
30 #include <OpenGl_cmn_varargs.hxx>
31 #include <OpenGl_telem_attri.hxx>
32 #include <OpenGl_tsm.hxx>
33 #include <OpenGl_telem.hxx>
34 #include <OpenGl_telem_inquire.hxx>
35
36 /*----------------------------------------------------------------------*/
37
38 static  TStatus  AntiAliasingAdd( TSM_ELEM_DATA, Tint, cmn_key* );
39 static  TStatus  AntiAliasingDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
40 static  TStatus  AntiAliasingPrint( TSM_ELEM_DATA, Tint, cmn_key* );
41 static  TStatus  AntiAliasingInquire( TSM_ELEM_DATA, Tint, cmn_key* );
42
43 /*----------------------------------------------------------------------*/
44
45 static  TStatus  (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
46 {
47     0,             /* PickTraverse */
48     AntiAliasingDisplay,
49     AntiAliasingAdd,
50     0,             /* Delete */
51     AntiAliasingPrint,
52     AntiAliasingInquire
53 };
54
55 /*----------------------------------------------------------------------*/
56
57 MtblPtr
58 TelAntiAliasingInitClass( TelType *el )
59 {
60   *el = TelAntiAliasing;
61   return MtdTbl;
62 }
63
64 /*----------------------------------------------------------------------*/
65
66 static  TStatus
67 AntiAliasingAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
68 {
69   ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
70
71   return TSuccess;
72 }
73
74 /*----------------------------------------------------------------------*/
75
76 static  TStatus
77 AntiAliasingDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
78 {
79   CMN_KEY  key;
80
81   key.id = TelAntiAliasing;
82   key.data.ldata = d.ldata;
83   TsmSetAttri( 1, &key );
84   return TSuccess;
85 }
86
87 /*----------------------------------------------------------------------*/
88
89 static  TStatus
90 AntiAliasingPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
91 {
92   if( data.ldata == TOn )
93     fprintf( stdout, "TelAntiAliasing. Value = ON\n" );
94   else
95     fprintf( stdout, "TelAntiAliasing. Value = OFF\n" );
96   fprintf( stdout, "\n" );
97
98   return TSuccess;
99 }
100
101 /*----------------------------------------------------------------------*/
102
103 static TStatus
104 AntiAliasingInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
105 {
106   Tint i;
107
108   for( i = 0; i < n; i++ )
109   {
110     switch( k[i]->id )
111     {
112     case INQ_GET_SIZE_ID:
113       {
114         k[i]->data.ldata = sizeof( Tint );
115         break;
116       }
117     case INQ_GET_CONTENT_ID:
118       {
119         TEL_INQ_CONTENT *c;
120         Teldata         *w;
121
122         c = (tel_inq_content)k[i]->data.pdata;
123         w = c->data;
124         c->act_size = 0;
125         w->idata = data.ldata;
126         break;
127       }
128     }
129   }
130
131   return TSuccess;
132 }
133
134 /*----------------------------------------------------------------------*/