/[rdesktop]/sourceforge.net/trunk/rdesktop/cache.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/cache.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 207 by matthewc, Thu Sep 26 14:26:46 2002 UTC revision 379 by jsorg71, Fri May 30 21:31:59 2003 UTC
# Line 24  Line 24 
24    
25    
26  /* BITMAP CACHE */  /* BITMAP CACHE */
27  static HBITMAP bmpcache[3][600];  static HBITMAP g_bmpcache[3][600];
28    
29  /* Retrieve a bitmap from the cache */  /* Retrieve a bitmap from the cache */
30  HBITMAP  HBITMAP
# Line 32  cache_get_bitmap(uint8 cache_id, uint16 Line 32  cache_get_bitmap(uint8 cache_id, uint16
32  {  {
33          HBITMAP bitmap;          HBITMAP bitmap;
34    
35          if ((cache_id < NUM_ELEMENTS(bmpcache)) && (cache_idx < NUM_ELEMENTS(bmpcache[0])))          if ((cache_id < NUM_ELEMENTS(g_bmpcache)) && (cache_idx < NUM_ELEMENTS(g_bmpcache[0])))
36          {          {
37                  bitmap = bmpcache[cache_id][cache_idx];                  bitmap = g_bmpcache[cache_id][cache_idx];
38                  if (bitmap != NULL)                  if (bitmap != NULL)
39                          return bitmap;                          return bitmap;
40          }          }
# Line 49  cache_put_bitmap(uint8 cache_id, uint16 Line 49  cache_put_bitmap(uint8 cache_id, uint16
49  {  {
50          HBITMAP old;          HBITMAP old;
51    
52          if ((cache_id < NUM_ELEMENTS(bmpcache)) && (cache_idx < NUM_ELEMENTS(bmpcache[0])))          if ((cache_id < NUM_ELEMENTS(g_bmpcache)) && (cache_idx < NUM_ELEMENTS(g_bmpcache[0])))
53          {          {
54                  old = bmpcache[cache_id][cache_idx];                  old = g_bmpcache[cache_id][cache_idx];
55                  if (old != NULL)                  if (old != NULL)
56                          ui_destroy_bitmap(old);                          ui_destroy_bitmap(old);
57    
58                  bmpcache[cache_id][cache_idx] = bitmap;                  g_bmpcache[cache_id][cache_idx] = bitmap;
59          }          }
60          else          else
61          {          {
# Line 65  cache_put_bitmap(uint8 cache_id, uint16 Line 65  cache_put_bitmap(uint8 cache_id, uint16
65    
66    
67  /* FONT CACHE */  /* FONT CACHE */
68  static FONTGLYPH fontcache[12][256];  static FONTGLYPH g_fontcache[12][256];
69    
70  /* Retrieve a glyph from the font cache */  /* Retrieve a glyph from the font cache */
71  FONTGLYPH *  FONTGLYPH *
# Line 73  cache_get_font(uint8 font, uint16 charac Line 73  cache_get_font(uint8 font, uint16 charac
73  {  {
74          FONTGLYPH *glyph;          FONTGLYPH *glyph;
75    
76          if ((font < NUM_ELEMENTS(fontcache)) && (character < NUM_ELEMENTS(fontcache[0])))          if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0])))
77          {          {
78                  glyph = &fontcache[font][character];                  glyph = &g_fontcache[font][character];
79                  if (glyph->pixmap != NULL)                  if (glyph->pixmap != NULL)
80                          return glyph;                          return glyph;
81          }          }
# Line 91  cache_put_font(uint8 font, uint16 charac Line 91  cache_put_font(uint8 font, uint16 charac
91  {  {
92          FONTGLYPH *glyph;          FONTGLYPH *glyph;
93    
94          if ((font < NUM_ELEMENTS(fontcache)) && (character < NUM_ELEMENTS(fontcache[0])))          if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0])))
95          {          {
96                  glyph = &fontcache[font][character];                  glyph = &g_fontcache[font][character];
97                  if (glyph->pixmap != NULL)                  if (glyph->pixmap != NULL)
98                          ui_destroy_glyph(glyph->pixmap);                          ui_destroy_glyph(glyph->pixmap);
99    
# Line 111  cache_put_font(uint8 font, uint16 charac Line 111  cache_put_font(uint8 font, uint16 charac
111    
112    
113  /* TEXT CACHE */  /* TEXT CACHE */
114  static DATABLOB textcache[256];  static DATABLOB g_textcache[256];
115    
116  /* Retrieve a text item from the cache */  /* Retrieve a text item from the cache */
117  DATABLOB *  DATABLOB *
# Line 119  cache_get_text(uint8 cache_id) Line 119  cache_get_text(uint8 cache_id)
119  {  {
120          DATABLOB *text;          DATABLOB *text;
121    
122          if (cache_id < NUM_ELEMENTS(textcache))          if (cache_id < NUM_ELEMENTS(g_textcache))
123          {          {
124                  text = &textcache[cache_id];                  text = &g_textcache[cache_id];
125                  if (text->data != NULL)                  if (text->data != NULL)
126                          return text;                          return text;
127          }          }
# Line 136  cache_put_text(uint8 cache_id, void *dat Line 136  cache_put_text(uint8 cache_id, void *dat
136  {  {
137          DATABLOB *text;          DATABLOB *text;
138    
139          if (cache_id < NUM_ELEMENTS(textcache))          if (cache_id < NUM_ELEMENTS(g_textcache))
140          {          {
141                  text = &textcache[cache_id];                  text = &g_textcache[cache_id];
142                  if (text->data != NULL)                  if (text->data != NULL)
143                          xfree(text->data);                          xfree(text->data);
144    
# Line 154  cache_put_text(uint8 cache_id, void *dat Line 154  cache_put_text(uint8 cache_id, void *dat
154    
155    
156  /* DESKTOP CACHE */  /* DESKTOP CACHE */
157  static uint8 deskcache[0x38400 * 4];  static uint8 g_deskcache[0x38400 * 4];
158    
159  /* Retrieve desktop data from the cache */  /* Retrieve desktop data from the cache */
160  uint8 *  uint8 *
# Line 162  cache_get_desktop(uint32 offset, int cx, Line 162  cache_get_desktop(uint32 offset, int cx,
162  {  {
163          int length = cx * cy * bytes_per_pixel;          int length = cx * cy * bytes_per_pixel;
164    
165          if ((offset + length) <= sizeof(deskcache))          if ((offset + length) <= sizeof(g_deskcache))
166          {          {
167                  return &deskcache[offset];                  return &g_deskcache[offset];
168          }          }
169    
170          error("get desktop %d:%d\n", offset, length);          error("get desktop %d:%d\n", offset, length);
# Line 177  cache_put_desktop(uint32 offset, int cx, Line 177  cache_put_desktop(uint32 offset, int cx,
177  {  {
178          int length = cx * cy * bytes_per_pixel;          int length = cx * cy * bytes_per_pixel;
179    
180          if ((offset + length) <= sizeof(deskcache))          if ((offset + length) <= sizeof(g_deskcache))
181          {          {
182                  cx *= bytes_per_pixel;                  cx *= bytes_per_pixel;
183                  while (cy--)                  while (cy--)
184                  {                  {
185                          memcpy(&deskcache[offset], data, cx);                          memcpy(&g_deskcache[offset], data, cx);
186                          data += scanline;                          data += scanline;
187                          offset += cx;                          offset += cx;
188                  }                  }
# Line 195  cache_put_desktop(uint32 offset, int cx, Line 195  cache_put_desktop(uint32 offset, int cx,
195    
196    
197  /* CURSOR CACHE */  /* CURSOR CACHE */
198  static HCURSOR cursorcache[0x20];  static HCURSOR g_cursorcache[0x20];
199    
200  /* Retrieve cursor from cache */  /* Retrieve cursor from cache */
201  HCURSOR  HCURSOR
# Line 203  cache_get_cursor(uint16 cache_idx) Line 203  cache_get_cursor(uint16 cache_idx)
203  {  {
204          HCURSOR cursor;          HCURSOR cursor;
205    
206          if (cache_idx < NUM_ELEMENTS(cursorcache))          if (cache_idx < NUM_ELEMENTS(g_cursorcache))
207          {          {
208                  cursor = cursorcache[cache_idx];                  cursor = g_cursorcache[cache_idx];
209                  if (cursor != NULL)                  if (cursor != NULL)
210                          return cursor;                          return cursor;
211          }          }
# Line 220  cache_put_cursor(uint16 cache_idx, HCURS Line 220  cache_put_cursor(uint16 cache_idx, HCURS
220  {  {
221          HCURSOR old;          HCURSOR old;
222    
223          if (cache_idx < NUM_ELEMENTS(cursorcache))          if (cache_idx < NUM_ELEMENTS(g_cursorcache))
224          {          {
225                  old = cursorcache[cache_idx];                  old = g_cursorcache[cache_idx];
226                  if (old != NULL)                  if (old != NULL)
227                          ui_destroy_cursor(old);                          ui_destroy_cursor(old);
228    
229                  cursorcache[cache_idx] = cursor;                  g_cursorcache[cache_idx] = cursor;
230          }          }
231          else          else
232          {          {

Legend:
Removed from v.207  
changed lines
  Added in v.379

  ViewVC Help
Powered by ViewVC 1.1.26