/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (hide annotations)
Tue Jul 25 12:34:29 2000 UTC (23 years, 10 months ago) by matty
File MIME type: text/plain
File size: 3237 byte(s)
Committing some awesome progress I made while overseas - this commit
really embodies a huge number of changes. We are now able to talk quite
fluently to a French NT Terminal Server - in normal usage only minor
font issues remain (handling of TEXT2 order is not perfect).

The next major hurdle is encryption, and it will be quite a big hurdle
- there seems to be some quite nasty session key stuff.

1 matty 9 /*
2     rdesktop: A Remote Desktop Protocol client.
3     Cache routines
4     Copyright (C) Matthew Chapman 1999-2000
5    
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10    
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     GNU General Public License for more details.
15    
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19     */
20    
21     #include "includes.h"
22    
23     HBITMAP cache_get_bitmap(HCONN conn, uint8 cache_id, uint16 cache_idx)
24     {
25     HBITMAP bitmap;
26    
27     if ((cache_id < NUM_ELEMENTS(conn->bmpcache))
28     && (cache_idx < NUM_ELEMENTS(conn->bmpcache[0])))
29     {
30     bitmap = conn->bmpcache[cache_id][cache_idx];
31     if (bitmap != NULL)
32     return bitmap;
33     }
34    
35     ERROR("Bitmap %d:%d not found\n", cache_id, cache_idx);
36     return NULL;
37     }
38    
39     void cache_put_bitmap(HCONN conn, uint8 cache_id, uint16 cache_idx, HBITMAP bitmap)
40     {
41     HBITMAP old;
42    
43     if ((cache_id < NUM_ELEMENTS(conn->bmpcache))
44     && (cache_idx < NUM_ELEMENTS(conn->bmpcache[0])))
45     {
46     old = conn->bmpcache[cache_id][cache_idx];
47     if (old != NULL)
48     ui_destroy_bitmap(conn->wnd, old);
49    
50     conn->bmpcache[cache_id][cache_idx] = bitmap;
51     }
52     else
53     {
54     ERROR("Bitmap %d:%d past end of cache\n", cache_id, cache_idx);
55     }
56     }
57    
58     FONT_GLYPH *cache_get_font(HCONN conn, uint8 font, uint16 character)
59     {
60     FONT_GLYPH *glyph;
61    
62     if ((font < NUM_ELEMENTS(conn->fontcache))
63     && (character < NUM_ELEMENTS(conn->fontcache[0])))
64     {
65     glyph = &conn->fontcache[font][character];
66     if (glyph->pixmap != NULL)
67     return glyph;
68     }
69    
70     ERROR("Font %d character %d not found\n", font, character);
71     return NULL;
72     }
73    
74     void cache_put_font(HCONN conn, uint8 font, uint32 character, uint16 baseline,
75     uint16 width, uint16 height, HGLYPH pixmap)
76     {
77     FONT_GLYPH *glyph;
78    
79     if ((font < NUM_ELEMENTS(conn->fontcache))
80     && (character < NUM_ELEMENTS(conn->fontcache[0])))
81     {
82     glyph = &conn->fontcache[font][character];
83     if (glyph->pixmap != NULL)
84     ui_destroy_glyph(conn->wnd, glyph->pixmap);
85    
86     glyph->baseline = baseline;
87     glyph->width = width;
88     glyph->height = height;
89     glyph->pixmap = pixmap;
90     }
91     else
92     {
93     ERROR("Font %d character %d past end of cache\n",
94     font, character);
95     }
96     }
97    
98     BLOB *cache_get_text(HCONN conn, uint8 cache_id)
99     {
100     BLOB *text;
101    
102     if (cache_id < NUM_ELEMENTS(conn->textcache))
103     {
104     text = &conn->textcache[cache_id];
105     if (text->data != NULL)
106     return text;
107     }
108    
109     ERROR("Text cache id %d not found\n", cache_id);
110     return NULL;
111     }
112    
113     void cache_put_text(HCONN conn, uint8 cache_id, void *data, int length)
114     {
115     BLOB *text;
116    
117     if (cache_id < NUM_ELEMENTS(conn->textcache))
118     {
119     text = &conn->textcache[cache_id];
120     if (text->data != NULL)
121     free(text->data);
122    
123     text->data = malloc(length);
124     text->size = length;
125     memcpy(text->data, data, length);
126     }
127     else
128     {
129     ERROR("Text cache id %d past end of cache\n", cache_id);
130     }
131     }

  ViewVC Help
Powered by ViewVC 1.1.26