Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / include / freerdp / cache / glyph.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Glyph Cache
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __GLYPH_CACHE_H
21 #define __GLYPH_CACHE_H
22
23 #include <freerdp/api.h>
24 #include <freerdp/types.h>
25 #include <freerdp/update.h>
26 #include <freerdp/utils/stream.h>
27
28 typedef struct _GLYPH_CACHE GLYPH_CACHE;
29 typedef struct _FRAGMENT_CACHE_ENTRY FRAGMENT_CACHE_ENTRY;
30 typedef struct _FRAGMENT_CACHE FRAGMENT_CACHE;
31 typedef struct rdp_glyph_cache rdpGlyphCache;
32
33 #include <freerdp/cache/cache.h>
34
35 struct _GLYPH_CACHE
36 {
37         uint32 number;
38         uint32 maxCellSize;
39         rdpGlyph** entries;
40 };
41
42 struct _FRAGMENT_CACHE_ENTRY
43 {
44         void* fragment;
45         uint32 size;
46 };
47
48 struct _FRAGMENT_CACHE
49 {
50         FRAGMENT_CACHE_ENTRY* entries;
51 };
52
53 struct rdp_glyph_cache
54 {
55         FRAGMENT_CACHE fragCache;
56         GLYPH_CACHE glyphCache[10];
57
58         rdpContext* context;
59         rdpSettings* settings;
60 };
61
62 FREERDP_API rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, uint32 id, uint32 index);
63 FREERDP_API void glyph_cache_put(rdpGlyphCache* glyph_cache, uint32 id, uint32 index, rdpGlyph* entry);
64
65 FREERDP_API void* glyph_cache_fragment_get(rdpGlyphCache* glyph, uint32 index, uint32* count);
66 FREERDP_API void glyph_cache_fragment_put(rdpGlyphCache* glyph, uint32 index, uint32 count, void* entry);
67
68 FREERDP_API void glyph_cache_register_callbacks(rdpUpdate* update);
69
70 FREERDP_API rdpGlyphCache* glyph_cache_new(rdpSettings* settings);
71 FREERDP_API void glyph_cache_free(rdpGlyphCache* glyph);
72
73 #endif /* __GLYPH_CACHE_H */