FreeRDP
orders.h
1 
22 #ifndef FREERDP_LIB_CORE_ORDERS_H
23 #define FREERDP_LIB_CORE_ORDERS_H
24 
25 #include "rdp.h"
26 
27 #include <freerdp/types.h>
28 #include <freerdp/update.h>
29 #include <freerdp/api.h>
30 
31 #include <winpr/stream.h>
32 
33 /* Order Control Flags */
34 #define ORDER_STANDARD 0x01
35 #define ORDER_SECONDARY 0x02
36 #define ORDER_BOUNDS 0x04
37 #define ORDER_TYPE_CHANGE 0x08
38 #define ORDER_DELTA_COORDINATES 0x10
39 #define ORDER_ZERO_BOUNDS_DELTAS 0x20
40 #define ORDER_ZERO_FIELD_BYTE_BIT0 0x40
41 #define ORDER_ZERO_FIELD_BYTE_BIT1 0x80
42 
43 /* Bound Field Flags */
44 #define BOUND_LEFT 0x01
45 #define BOUND_TOP 0x02
46 #define BOUND_RIGHT 0x04
47 #define BOUND_BOTTOM 0x08
48 #define BOUND_DELTA_LEFT 0x10
49 #define BOUND_DELTA_TOP 0x20
50 #define BOUND_DELTA_RIGHT 0x40
51 #define BOUND_DELTA_BOTTOM 0x80
52 
53 /* Field Presence Flags */
54 #define ORDER_FIELD_01 0x000001
55 #define ORDER_FIELD_02 0x000002
56 #define ORDER_FIELD_03 0x000004
57 #define ORDER_FIELD_04 0x000008
58 #define ORDER_FIELD_05 0x000010
59 #define ORDER_FIELD_06 0x000020
60 #define ORDER_FIELD_07 0x000040
61 #define ORDER_FIELD_08 0x000080
62 #define ORDER_FIELD_09 0x000100
63 #define ORDER_FIELD_10 0x000200
64 #define ORDER_FIELD_11 0x000400
65 #define ORDER_FIELD_12 0x000800
66 #define ORDER_FIELD_13 0x001000
67 #define ORDER_FIELD_14 0x002000
68 #define ORDER_FIELD_15 0x004000
69 #define ORDER_FIELD_16 0x008000
70 #define ORDER_FIELD_17 0x010000
71 #define ORDER_FIELD_18 0x020000
72 #define ORDER_FIELD_19 0x040000
73 #define ORDER_FIELD_20 0x080000
74 #define ORDER_FIELD_21 0x100000
75 #define ORDER_FIELD_22 0x200000
76 #define ORDER_FIELD_23 0x400000
77 
78 /* Bitmap Cache Flags */
79 #define CBR2_8BPP 0x3
80 #define CBR2_16BPP 0x4
81 #define CBR2_24BPP 0x5
82 #define CBR2_32BPP 0x6
83 
84 #define CBR23_8BPP 0x3
85 #define CBR23_16BPP 0x4
86 #define CBR23_24BPP 0x5
87 #define CBR23_32BPP 0x6
88 
89 #define CBR3_IGNORABLE_FLAG 0x08
90 #define CBR3_DO_NOT_CACHE 0x10
91 
92 /* Primary Drawing Orders */
93 #define ORDER_TYPE_DSTBLT 0x00
94 #define ORDER_TYPE_PATBLT 0x01
95 #define ORDER_TYPE_SCRBLT 0x02
96 #define ORDER_TYPE_DRAW_NINE_GRID 0x07
97 #define ORDER_TYPE_MULTI_DRAW_NINE_GRID 0x08
98 #define ORDER_TYPE_LINE_TO 0x09
99 #define ORDER_TYPE_OPAQUE_RECT 0x0A
100 #define ORDER_TYPE_SAVE_BITMAP 0x0B
101 #define ORDER_TYPE_MEMBLT 0x0D
102 #define ORDER_TYPE_MEM3BLT 0x0E
103 #define ORDER_TYPE_MULTI_DSTBLT 0x0F
104 #define ORDER_TYPE_MULTI_PATBLT 0x10
105 #define ORDER_TYPE_MULTI_SCRBLT 0x11
106 #define ORDER_TYPE_MULTI_OPAQUE_RECT 0x12
107 #define ORDER_TYPE_FAST_INDEX 0x13
108 #define ORDER_TYPE_POLYGON_SC 0x14
109 #define ORDER_TYPE_POLYGON_CB 0x15
110 #define ORDER_TYPE_POLYLINE 0x16
111 #define ORDER_TYPE_FAST_GLYPH 0x18
112 #define ORDER_TYPE_ELLIPSE_SC 0x19
113 #define ORDER_TYPE_ELLIPSE_CB 0x1A
114 #define ORDER_TYPE_GLYPH_INDEX 0x1B
115 
116 /* Primary Drawing Orders Fields */
117 #define DSTBLT_ORDER_FIELDS 5
118 #define PATBLT_ORDER_FIELDS 12
119 #define SCRBLT_ORDER_FIELDS 7
120 #define DRAW_NINE_GRID_ORDER_FIELDS 5
121 #define MULTI_DRAW_NINE_GRID_ORDER_FIELDS 7
122 #define LINE_TO_ORDER_FIELDS 10
123 #define OPAQUE_RECT_ORDER_FIELDS 7
124 #define SAVE_BITMAP_ORDER_FIELDS 6
125 #define MEMBLT_ORDER_FIELDS 9
126 #define MEM3BLT_ORDER_FIELDS 16
127 #define MULTI_DSTBLT_ORDER_FIELDS 7
128 #define MULTI_PATBLT_ORDER_FIELDS 14
129 #define MULTI_SCRBLT_ORDER_FIELDS 9
130 #define MULTI_OPAQUE_RECT_ORDER_FIELDS 9
131 #define FAST_INDEX_ORDER_FIELDS 15
132 #define POLYGON_SC_ORDER_FIELDS 7
133 #define POLYGON_CB_ORDER_FIELDS 13
134 #define POLYLINE_ORDER_FIELDS 7
135 #define FAST_GLYPH_ORDER_FIELDS 15
136 #define ELLIPSE_SC_ORDER_FIELDS 7
137 #define ELLIPSE_CB_ORDER_FIELDS 13
138 #define GLYPH_INDEX_ORDER_FIELDS 22
139 
140 /* Primary Drawing Orders Field Bytes */
141 #define DSTBLT_ORDER_FIELD_BYTES 1
142 #define PATBLT_ORDER_FIELD_BYTES 2
143 #define SCRBLT_ORDER_FIELD_BYTES 1
144 #define DRAW_NINE_GRID_ORDER_FIELD_BYTES 1
145 #define MULTI_DRAW_NINE_GRID_ORDER_FIELD_BYTES 1
146 #define LINE_TO_ORDER_FIELD_BYTES 2
147 #define OPAQUE_RECT_ORDER_FIELD_BYTES 1
148 #define SAVE_BITMAP_ORDER_FIELD_BYTES 1
149 #define MEMBLT_ORDER_FIELD_BYTES 2
150 #define MEM3BLT_ORDER_FIELD_BYTES 3
151 #define MULTI_DSTBLT_ORDER_FIELD_BYTES 1
152 #define MULTI_PATBLT_ORDER_FIELD_BYTES 2
153 #define MULTI_SCRBLT_ORDER_FIELD_BYTES 2
154 #define MULTI_OPAQUE_RECT_ORDER_FIELD_BYTES 2
155 #define FAST_INDEX_ORDER_FIELD_BYTES 2
156 #define POLYGON_SC_ORDER_FIELD_BYTES 1
157 #define POLYGON_CB_ORDER_FIELD_BYTES 2
158 #define POLYLINE_ORDER_FIELD_BYTES 1
159 #define FAST_GLYPH_ORDER_FIELD_BYTES 2
160 #define ELLIPSE_SC_ORDER_FIELD_BYTES 1
161 #define ELLIPSE_CB_ORDER_FIELD_BYTES 2
162 #define GLYPH_INDEX_ORDER_FIELD_BYTES 3
163 
164 /* Secondary Drawing Orders */
165 #define ORDER_TYPE_BITMAP_UNCOMPRESSED 0x00
166 #define ORDER_TYPE_CACHE_COLOR_TABLE 0x01
167 #define ORDER_TYPE_CACHE_BITMAP_COMPRESSED 0x02
168 #define ORDER_TYPE_CACHE_GLYPH 0x03
169 #define ORDER_TYPE_BITMAP_UNCOMPRESSED_V2 0x04
170 #define ORDER_TYPE_BITMAP_COMPRESSED_V2 0x05
171 #define ORDER_TYPE_CACHE_BRUSH 0x07
172 #define ORDER_TYPE_BITMAP_COMPRESSED_V3 0x08
173 
174 /* Alternate Secondary Drawing Orders */
175 #define ORDER_TYPE_SWITCH_SURFACE 0x00
176 #define ORDER_TYPE_CREATE_OFFSCREEN_BITMAP 0x01
177 #define ORDER_TYPE_STREAM_BITMAP_FIRST 0x02
178 #define ORDER_TYPE_STREAM_BITMAP_NEXT 0x03
179 #define ORDER_TYPE_CREATE_NINE_GRID_BITMAP 0x04
180 #define ORDER_TYPE_GDIPLUS_FIRST 0x05
181 #define ORDER_TYPE_GDIPLUS_NEXT 0x06
182 #define ORDER_TYPE_GDIPLUS_END 0x07
183 #define ORDER_TYPE_GDIPLUS_CACHE_FIRST 0x08
184 #define ORDER_TYPE_GDIPLUS_CACHE_NEXT 0x09
185 #define ORDER_TYPE_GDIPLUS_CACHE_END 0x0A
186 #define ORDER_TYPE_WINDOW 0x0B
187 #define ORDER_TYPE_COMPDESK_FIRST 0x0C
188 #define ORDER_TYPE_FRAME_MARKER 0x0D
189 
190 #define CG_GLYPH_UNICODE_PRESENT 0x0010
191 
192 FREERDP_LOCAL BYTE get_primary_drawing_order_field_bytes(UINT32 orderType, BOOL* pValid);
193 
194 FREERDP_LOCAL BOOL update_recv_order(rdpUpdate* update, wStream* s);
195 
196 FREERDP_LOCAL BOOL update_write_field_flags(wStream* s, UINT32 fieldFlags, BYTE flags,
197  BYTE fieldBytes);
198 
199 FREERDP_LOCAL BOOL update_write_bounds(wStream* s, ORDER_INFO* orderInfo);
200 
201 FREERDP_LOCAL size_t update_approximate_dstblt_order(ORDER_INFO* orderInfo,
202  const DSTBLT_ORDER* dstblt);
203 FREERDP_LOCAL BOOL update_write_dstblt_order(wStream* s, ORDER_INFO* orderInfo,
204  const DSTBLT_ORDER* dstblt);
205 
206 FREERDP_LOCAL size_t update_approximate_patblt_order(ORDER_INFO* orderInfo, PATBLT_ORDER* patblt);
207 FREERDP_LOCAL BOOL update_write_patblt_order(wStream* s, ORDER_INFO* orderInfo,
208  PATBLT_ORDER* patblt);
209 
210 FREERDP_LOCAL size_t update_approximate_scrblt_order(ORDER_INFO* orderInfo,
211  const SCRBLT_ORDER* scrblt);
212 FREERDP_LOCAL BOOL update_write_scrblt_order(wStream* s, ORDER_INFO* orderInfo,
213  const SCRBLT_ORDER* scrblt);
214 
215 FREERDP_LOCAL size_t update_approximate_opaque_rect_order(ORDER_INFO* orderInfo,
216  const OPAQUE_RECT_ORDER* opaque_rect);
217 FREERDP_LOCAL BOOL update_write_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo,
218  const OPAQUE_RECT_ORDER* opaque_rect);
219 
220 FREERDP_LOCAL size_t update_approximate_line_to_order(ORDER_INFO* orderInfo,
221  const LINE_TO_ORDER* line_to);
222 FREERDP_LOCAL BOOL update_write_line_to_order(wStream* s, ORDER_INFO* orderInfo,
223  const LINE_TO_ORDER* line_to);
224 
225 FREERDP_LOCAL size_t update_approximate_memblt_order(ORDER_INFO* orderInfo,
226  const MEMBLT_ORDER* memblt);
227 FREERDP_LOCAL BOOL update_write_memblt_order(wStream* s, ORDER_INFO* orderInfo,
228  const MEMBLT_ORDER* memblt);
229 
230 FREERDP_LOCAL size_t update_approximate_glyph_index_order(ORDER_INFO* orderInfo,
231  const GLYPH_INDEX_ORDER* glyph_index);
232 FREERDP_LOCAL BOOL update_write_glyph_index_order(wStream* s, ORDER_INFO* orderInfo,
233  GLYPH_INDEX_ORDER* glyph_index);
234 
235 FREERDP_LOCAL size_t update_approximate_cache_bitmap_order(const CACHE_BITMAP_ORDER* cache_bitmap,
236  BOOL compressed, const UINT16* flags);
237 FREERDP_LOCAL BOOL update_write_cache_bitmap_order(wStream* s,
238  const CACHE_BITMAP_ORDER* cache_bitmap_order,
239  BOOL compressed, UINT16* flags);
240 
241 FREERDP_LOCAL size_t update_approximate_cache_bitmap_v2_order(
242  CACHE_BITMAP_V2_ORDER* cache_bitmap_v2, BOOL compressed, const UINT16* flags);
243 FREERDP_LOCAL BOOL update_write_cache_bitmap_v2_order(wStream* s,
244  CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order,
245  BOOL compressed, UINT16* flags);
246 
247 FREERDP_LOCAL size_t
248 update_approximate_cache_bitmap_v3_order(CACHE_BITMAP_V3_ORDER* cache_bitmap_v3, UINT16* flags);
249 FREERDP_LOCAL BOOL update_write_cache_bitmap_v3_order(wStream* s,
250  CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order,
251  UINT16* flags);
252 
253 FREERDP_LOCAL size_t update_approximate_cache_color_table_order(
254  const CACHE_COLOR_TABLE_ORDER* cache_color_table, const UINT16* flags);
255 FREERDP_LOCAL BOOL update_write_cache_color_table_order(
256  wStream* s, const CACHE_COLOR_TABLE_ORDER* cache_color_table_order, UINT16* flags);
257 
258 FREERDP_LOCAL size_t update_approximate_cache_glyph_order(const CACHE_GLYPH_ORDER* cache_glyph,
259  const UINT16* flags);
260 FREERDP_LOCAL BOOL update_write_cache_glyph_order(wStream* s,
261  const CACHE_GLYPH_ORDER* cache_glyph_order,
262  UINT16* flags);
263 
264 FREERDP_LOCAL size_t update_approximate_cache_glyph_v2_order(
265  const CACHE_GLYPH_V2_ORDER* cache_glyph_v2, const UINT16* flags);
266 FREERDP_LOCAL BOOL update_write_cache_glyph_v2_order(wStream* s,
267  const CACHE_GLYPH_V2_ORDER* cache_glyph_v2,
268  UINT16* flags);
269 
270 FREERDP_LOCAL size_t update_approximate_cache_brush_order(const CACHE_BRUSH_ORDER* cache_brush,
271  const UINT16* flags);
272 FREERDP_LOCAL BOOL update_write_cache_brush_order(wStream* s,
273  const CACHE_BRUSH_ORDER* cache_brush_order,
274  UINT16* flags);
275 
276 FREERDP_LOCAL size_t update_approximate_create_offscreen_bitmap_order(
277  const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
278 FREERDP_LOCAL BOOL update_write_create_offscreen_bitmap_order(
279  wStream* s, const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
280 
281 FREERDP_LOCAL size_t
282 update_approximate_switch_surface_order(const SWITCH_SURFACE_ORDER* switch_surface);
283 FREERDP_LOCAL BOOL update_write_switch_surface_order(wStream* s,
284  const SWITCH_SURFACE_ORDER* switch_surface);
285 
286 #endif /* FREERDP_LIB_CORE_ORDERS_H */