0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_tgl_utilgr.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5file OpenGl_tgl_utilgr :
6
7
8REMARQUES:
9----------
10
11
12HISTORIQUE DES MODIFICATIONS :
13--------------------------------
14xx-xx-xx : xxx ; Creation.
1529-04-96 : FMN ; Correction Warning.
1630-01-97 : FMN ; Suppression call_util_init_indexes()
1703-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
18
19************************************************************************/
20
21/*----------------------------------------------------------------------*/
22/*
23* Includes
24*/
25
26
27#include <OpenGl_tgl_all.hxx>
28
29#include <string.h>
30#include <stdio.h>
31#include <stdlib.h>
32
33#include <InterfaceGraphic_Graphic3d.hxx>
34#include <OpenGl_context.hxx>
35
36#include <OpenGl_tgl_utilgr.hxx>
37#include <OpenGl_Memory.hxx>
38
39Tint
40call_util_context_group_place( CALL_DEF_GROUP * agroup )
41{
42 Tint n;
43
44 n = 0;
45 if( agroup->ContextLine.IsSet )
46 n = n + CALL_DEF_CONTEXTLINE_SIZE;
47 if( agroup->ContextFillArea.IsSet )
48 n = n + CALL_DEF_CONTEXTFILLAREA_SIZE;
49 if( agroup->ContextMarker.IsSet )
50 n = n + CALL_DEF_CONTEXTMARKER_SIZE;
51 if( agroup->ContextText.IsSet )
52 n = n + CALL_DEF_CONTEXTTEXT_SIZE;
53
54 return n;
55}
56
57
58Tint
59call_util_osd_putenv( Tchar *symbol, Tchar *value )
60{
61#ifndef WNT
62 Tchar *s;
63 Tint l;
64
65 l = strlen((char*)symbol) + strlen((char*)value) + 2;
66 s = new Tchar[l];;
67 if( s )
68 {
69 sprintf( (char*)s,"%s=%s", symbol, value );
70 if( !putenv((char*)s) )
71 return 1;
72 }
73 return 0;
74#else
75 return SetEnvironmentVariable ( (LPCSTR)symbol, (LPCSTR)value );
76#endif /* WNT */
77}
78
79Tint
80call_util_rgbindex( Tfloat r, Tfloat g, Tfloat b )
81{
82 union
83 {
84 Tint colpack;
85 unsigned char rgb[3];
86 } rgb2ind;
87
88 rgb2ind.colpack = 0;
89 rgb2ind.rgb[0] = ( unsigned char )(r*100);
90 rgb2ind.rgb[1] = ( unsigned char )(g*100);
91 rgb2ind.rgb[2] = ( unsigned char )(b*100);
92
93 return rgb2ind.colpack;
94}