Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / include / freerdp / secondary.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Secondary Drawing Orders Interface API
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 __UPDATE_SECONDARY_H
21 #define __UPDATE_SECONDARY_H
22
23 #include <freerdp/types.h>
24
25 #define GLYPH_FRAGMENT_NOP              0x00
26 #define GLYPH_FRAGMENT_USE              0xFE
27 #define GLYPH_FRAGMENT_ADD              0xFF
28
29 #define CBR2_HEIGHT_SAME_AS_WIDTH       0x01
30 #define CBR2_PERSISTENT_KEY_PRESENT     0x02
31 #define CBR2_NO_BITMAP_COMPRESSION_HDR  0x08
32 #define CBR2_DO_NOT_CACHE               0x10
33
34 #define SCREEN_BITMAP_SURFACE           0xFFFF
35 #define BITMAP_CACHE_WAITING_LIST_INDEX 0x7FFF
36
37 #define CACHED_BRUSH                    0x80
38
39 #define BMF_1BPP                        0x1
40 #define BMF_8BPP                        0x3
41 #define BMF_16BPP                       0x4
42 #define BMF_24BPP                       0x5
43 #define BMF_32BPP                       0x6
44
45 #ifndef _WIN32
46 #define BS_SOLID                        0x00
47 #define BS_NULL                         0x01
48 #define BS_HATCHED                      0x02
49 #define BS_PATTERN                      0x03
50 #endif
51
52 #ifndef _WIN32
53 #define HS_HORIZONTAL           0x00
54 #define HS_VERTICAL                     0x01
55 #define HS_FDIAGONAL            0x02
56 #define HS_BDIAGONAL            0x03
57 #define HS_CROSS                        0x04
58 #define HS_DIAGCROSS            0x05
59 #endif
60
61 #define SO_FLAG_DEFAULT_PLACEMENT       0x01
62 #define SO_HORIZONTAL                   0x02
63 #define SO_VERTICAL                     0x04
64 #define SO_REVERSED                     0x08
65 #define SO_ZERO_BEARINGS                0x10
66 #define SO_CHAR_INC_EQUAL_BM_BASE       0x20
67 #define SO_MAXEXT_EQUAL_BM_SIDE         0x40
68
69 struct _CACHE_BITMAP_ORDER
70 {
71         uint32 cacheId;
72         uint32 bitmapBpp;
73         uint32 bitmapWidth;
74         uint32 bitmapHeight;
75         uint32 bitmapLength;
76         uint32 cacheIndex;
77         boolean compressed;
78         uint8 bitmapComprHdr[8];
79         uint8* bitmapDataStream;
80 };
81 typedef struct _CACHE_BITMAP_ORDER CACHE_BITMAP_ORDER;
82
83 struct _CACHE_BITMAP_V2_ORDER
84 {
85         uint32 cacheId;
86         uint32 flags;
87         uint32 key1;
88         uint32 key2;
89         uint32 bitmapBpp;
90         uint32 bitmapWidth;
91         uint32 bitmapHeight;
92         uint32 bitmapLength;
93         uint32 cacheIndex;
94         boolean compressed;
95         uint32 cbCompFirstRowSize;
96         uint32 cbCompMainBodySize;
97         uint32 cbScanWidth;
98         uint32 cbUncompressedSize;
99         uint8* bitmapDataStream;
100 };
101 typedef struct _CACHE_BITMAP_V2_ORDER CACHE_BITMAP_V2_ORDER;
102
103 struct _BITMAP_DATA_EX
104 {
105         uint32 bpp;
106         uint32 codecID;
107         uint32 width;
108         uint32 height;
109         uint32 length;
110         uint8* data;
111 };
112 typedef struct _BITMAP_DATA_EX BITMAP_DATA_EX;
113
114 struct _CACHE_BITMAP_V3_ORDER
115 {
116         uint32 cacheId;
117         uint32 bpp;
118         uint32 flags;
119         uint32 cacheIndex;
120         uint32 key1;
121         uint32 key2;
122         BITMAP_DATA_EX bitmapData;
123 };
124 typedef struct _CACHE_BITMAP_V3_ORDER CACHE_BITMAP_V3_ORDER;
125
126 struct _CACHE_COLOR_TABLE_ORDER
127 {
128         uint32 cacheIndex;
129         uint32 numberColors;
130         uint32* colorTable;
131 };
132 typedef struct _CACHE_COLOR_TABLE_ORDER CACHE_COLOR_TABLE_ORDER;
133
134 struct _GLYPH_DATA
135 {
136         uint32 cacheIndex;
137         sint32 x;
138         sint32 y;
139         uint32 cx;
140         uint32 cy;
141         uint32 cb;
142         uint8* aj;
143 };
144 typedef struct _GLYPH_DATA GLYPH_DATA;
145
146 struct _CACHE_GLYPH_ORDER
147 {
148         uint32 cacheId;
149         uint32 cGlyphs;
150         GLYPH_DATA* glyphData[255];
151         uint8* unicodeCharacters;
152 };
153 typedef struct _CACHE_GLYPH_ORDER CACHE_GLYPH_ORDER;
154
155 struct _GLYPH_DATA_V2
156 {
157         uint32 cacheIndex;
158         sint32 x;
159         sint32 y;
160         uint32 cx;
161         uint32 cy;
162         uint32 cb;
163         uint8* aj;
164 };
165 typedef struct _GLYPH_DATA_V2 GLYPH_DATA_V2;
166
167 struct _CACHE_GLYPH_V2_ORDER
168 {
169         uint32 cacheId;
170         uint32 flags;
171         uint32 cGlyphs;
172         GLYPH_DATA_V2* glyphData[255];
173         uint8* unicodeCharacters;
174 };
175 typedef struct _CACHE_GLYPH_V2_ORDER CACHE_GLYPH_V2_ORDER;
176
177 struct _CACHE_BRUSH_ORDER
178 {
179         uint32 index;
180         uint32 bpp;
181         uint32 cx;
182         uint32 cy;
183         uint32 style;
184         uint32 length;
185         uint8* data;
186 };
187 typedef struct _CACHE_BRUSH_ORDER CACHE_BRUSH_ORDER;
188
189 typedef void (*pCacheBitmap)(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap_order);
190 typedef void (*pCacheBitmapV2)(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order);
191 typedef void (*pCacheBitmapV3)(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order);
192 typedef void (*pCacheColorTable)(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table_order);
193 typedef void (*pCacheGlyph)(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph_order);
194 typedef void (*pCacheGlyphV2)(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
195 typedef void (*pCacheBrush)(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush_order);
196
197 struct rdp_secondary_update
198 {
199         rdpContext* context; /* 0 */
200         uint32 paddingA[16 - 1]; /* 1 */
201
202         pCacheBitmap CacheBitmap; /* 16 */
203         pCacheBitmapV2 CacheBitmapV2; /* 17 */
204         pCacheBitmapV3 CacheBitmapV3; /* 18 */
205         pCacheColorTable CacheColorTable; /* 19 */
206         pCacheGlyph CacheGlyph; /* 20 */
207         pCacheGlyphV2 CacheGlyphV2; /* 21 */
208         pCacheBrush CacheBrush; /* 22 */
209         uint32 paddingE[32 - 23]; /* 23 */
210
211         /* internal */
212
213         boolean glyph_v2;
214         CACHE_BITMAP_ORDER cache_bitmap_order;
215         CACHE_BITMAP_V2_ORDER cache_bitmap_v2_order;
216         CACHE_BITMAP_V3_ORDER cache_bitmap_v3_order;
217         CACHE_COLOR_TABLE_ORDER cache_color_table_order;
218         CACHE_GLYPH_ORDER cache_glyph_order;
219         CACHE_GLYPH_V2_ORDER cache_glyph_v2_order;
220         CACHE_BRUSH_ORDER cache_brush_order;
221 };
222 typedef struct rdp_secondary_update rdpSecondaryUpdate;
223
224 #endif /* __UPDATE_SECONDARY_H */