Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1545 lines
80 KiB

  1. /****************************************************************************/
  2. // odapi.cpp
  3. //
  4. // Order Decoder API functions.
  5. //
  6. // Copyright (c) 1997-2000 Microsoft Corp.
  7. // Portions copyright (c) 1992-2000 Microsoft
  8. /****************************************************************************/
  9. #include <adcg.h>
  10. extern "C" {
  11. #define TRC_GROUP TRC_GROUP_CORE
  12. #define TRC_FILE "aodapi"
  13. #include <atrcapi.h>
  14. }
  15. #define TSC_HR_FILEID TSC_HR_ODAPI_CPP
  16. #include "od.h"
  17. /****************************************************************************/
  18. /* Define macros used to build the Order Decoder decoding data tables. */
  19. /* */
  20. /* Entries can be of fixed size or variable size. Variable size entries */
  21. /* must be the last in each order structure. OD decodes variable entries */
  22. /* into the unpacked structures. */
  23. /****************************************************************************/
  24. /****************************************************************************/
  25. /* Fields can either be signed (DCINT16 etc), or unsigned (DCUINT16 etc). */
  26. /****************************************************************************/
  27. #define SIGNED_FIELD OD_OFI_TYPE_SIGNED
  28. #define UNSIGNED_FIELD 0
  29. /****************************************************************************/
  30. /* DTABLE_FIXED_ENTRY */
  31. /* */
  32. /* Field is a fixed size */
  33. /* type - The unencoded order structure type */
  34. /* size - The size of the encoded version of the field */
  35. /* signed - TRUE if the field is signed, FALSE otherwise */
  36. /* field - The name of the field in the order structure */
  37. /****************************************************************************/
  38. #define DTABLE_FIXED_ENTRY(type,size,signed,field) \
  39. { (DCUINT8)FIELDOFFSET(type,field), \
  40. (DCUINT8)FIELDSIZE(type,field), \
  41. (DCUINT8)size, \
  42. (DCUINT8)(OD_OFI_TYPE_FIXED | signed) }
  43. /****************************************************************************/
  44. /* DTABLE_FIXED_COORDS_ENTRY */
  45. /* */
  46. /* Field is coordinate of a fixed size */
  47. /* type - The unencoded order structure type */
  48. /* size - The size of the encoded version of the field */
  49. /* signed - TRUE if the field is signed, FALSE otherwise */
  50. /* field - The name of the field in the order structure */
  51. /****************************************************************************/
  52. #define DTABLE_FIXED_COORDS_ENTRY(type,size,signed,field) \
  53. { (DCUINT8)FIELDOFFSET(type,field), \
  54. (DCUINT8)FIELDSIZE(type,field), \
  55. (DCUINT8)size, \
  56. (DCUINT8)(OD_OFI_TYPE_FIXED | OD_OFI_TYPE_COORDINATES | signed) }
  57. /****************************************************************************/
  58. /* DTABLE_DATA_ENTRY */
  59. /* */
  60. /* Field is a fixed number of bytes (array?) */
  61. /* type - The unencoded order structure type */
  62. /* size - The number of bytes in the encoded version of the field */
  63. /* signed - TRUE if the field is signed, FALSE otherwise */
  64. /* field - The name of the field in the order structure */
  65. /****************************************************************************/
  66. #define DTABLE_DATA_ENTRY(type,size,signed,field) \
  67. { (DCUINT8)FIELDOFFSET(type,field), \
  68. (DCUINT8)FIELDSIZE(type,field), \
  69. (DCUINT8)size, \
  70. (DCUINT8)(OD_OFI_TYPE_FIXED | OD_OFI_TYPE_DATA | signed) }
  71. /****************************************************************************/
  72. /* DTABLE_VARIABLE_ENTRY */
  73. /* */
  74. /* Field is a variable structure of the form below, with the length field */
  75. /* encoded as ONE byte */
  76. /* typedef struct */
  77. /* { */
  78. /* DCUINT32 len; */
  79. /* varType varEntry[len]; */
  80. /* } varStruct */
  81. /* */
  82. /* type - The unencoded order structure type */
  83. /* size - The size of the encoded version of the field */
  84. /* signed - TRUE if the field is signed, FALSE otherwise */
  85. /* field - The name of the field in the order structure (varStruct) */
  86. /* elem - The name of the variable element array (varEntry) */
  87. /****************************************************************************/
  88. #define DTABLE_VARIABLE_ENTRY(type,size,signed,field,elem) \
  89. { (DCUINT8)FIELDOFFSET(type,field.len), \
  90. (DCUINT8)FIELDSIZE(type,field.elem[0]), \
  91. (DCUINT8)size, \
  92. (DCUINT8)(OD_OFI_TYPE_VARIABLE | signed) }
  93. /****************************************************************************/
  94. /* DTABLE_LONG_VARIABLE_ENTRY */
  95. /* */
  96. /* Field is a variable structure of the form below, with the length field */
  97. /* encoded as TWO bytes */
  98. /* typedef struct */
  99. /* { */
  100. /* DCUINT32 len; */
  101. /* varType varEntry[len]; */
  102. /* } varStruct */
  103. /* */
  104. /* type - The unencoded order structure type */
  105. /* size - The size of the encoded version of the field */
  106. /* signed - TRUE if the field is signed, FALSE otherwise */
  107. /* field - The name of the field in the order structure (varStruct) */
  108. /* elem - The name of the variable element array (varEntry) */
  109. /****************************************************************************/
  110. #define DTABLE_LONG_VARIABLE_ENTRY(type,size,signed,field,elem) \
  111. { (DCUINT8)FIELDOFFSET(type,field.len), \
  112. (DCUINT8)FIELDSIZE(type,field.elem[0]), \
  113. (DCUINT8)size, \
  114. (DCUINT8)(OD_OFI_TYPE_LONG_VARIABLE | signed) }
  115. // Unused currently, so we also can ifdef some code.
  116. #ifdef USE_VARIABLE_COORDS
  117. /****************************************************************************/
  118. /* DTABLE_VARIABLE_COORDS_ENTRY */
  119. /* */
  120. /* Field is a variable structure with its length encoded in ONE byte and */
  121. /* containing coords of the form */
  122. /* typedef struct */
  123. /* { */
  124. /* DCUINT32 len; */
  125. /* varCoord varEntry[len]; */
  126. /* } varStruct */
  127. /* */
  128. /* type - The unencoded order structure type */
  129. /* size - The size of the encoded version of the field */
  130. /* signed - TRUE if the field is signed, FALSE otherwise */
  131. /* field - The name of the field in the order structure (varStruct) */
  132. /* elem - The name of the variable element array (varEntry) */
  133. /****************************************************************************/
  134. #define DTABLE_VARIABLE_COORDS_ENTRY(type,size,signed,field,elem) \
  135. { (DCUINT8)FIELDOFFSET(type,field.len), \
  136. (DCUINT8)FIELDSIZE(type,field.elem[0]), \
  137. (DCUINT8)size, \
  138. (DCUINT8)(OD_OFI_TYPE_VARIABLE | OD_OFI_TYPE_COORDINATES | signed) }
  139. /****************************************************************************/
  140. /* DTABLE_LONG_VARIABLE_COORDS_ENTRY */
  141. /* */
  142. /* Field is a variable structure with its length encoded in TWO bytes and */
  143. /* containing coords of the form */
  144. /* typedef struct */
  145. /* { */
  146. /* DCUINT32 len; */
  147. /* varCoord varEntry[len]; */
  148. /* } varStruct */
  149. /* */
  150. /* type - The unencoded order structure type */
  151. /* size - The size of the encoded version of the field */
  152. /* signed - TRUE if the field is signed, FALSE otherwise */
  153. /* field - The name of the field in the order structure (varStruct) */
  154. /* elem - The name of the variable element array (varEntry) */
  155. /****************************************************************************/
  156. #define DTABLE_LONG_VARIABLE_COORDS_ENTRY(type,size,signed,field,elem) \
  157. { (DCUINT8)FIELDOFFSET(type,field.len), \
  158. (DCUINT8)FIELDSIZE(type,field.elem[0]), \
  159. (DCUINT8)size, \
  160. (DCUINT8)(OD_OFI_TYPE_LONG_VARIABLE | OD_OFI_TYPE_COORDINATES | signed) }
  161. #endif // USE_VARIABLE_COORDS
  162. const OD_ORDER_FIELD_INFO odDstBltFields[] =
  163. {
  164. DTABLE_FIXED_COORDS_ENTRY(DSTBLT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  165. DTABLE_FIXED_COORDS_ENTRY(DSTBLT_ORDER, 2, SIGNED_FIELD, nTopRect),
  166. DTABLE_FIXED_COORDS_ENTRY(DSTBLT_ORDER, 2, SIGNED_FIELD, nWidth),
  167. DTABLE_FIXED_COORDS_ENTRY(DSTBLT_ORDER, 2, SIGNED_FIELD, nHeight),
  168. DTABLE_FIXED_ENTRY (DSTBLT_ORDER, 1, UNSIGNED_FIELD, bRop)
  169. };
  170. // Fast-path decode function used.
  171. #if 0
  172. const OD_ORDER_FIELD_INFO odPatBltFields[] =
  173. {
  174. DTABLE_FIXED_COORDS_ENTRY(PATBLT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  175. DTABLE_FIXED_COORDS_ENTRY(PATBLT_ORDER, 2, SIGNED_FIELD, nTopRect),
  176. DTABLE_FIXED_COORDS_ENTRY(PATBLT_ORDER, 2, SIGNED_FIELD, nWidth),
  177. DTABLE_FIXED_COORDS_ENTRY(PATBLT_ORDER, 2, SIGNED_FIELD, nHeight),
  178. DTABLE_FIXED_ENTRY (PATBLT_ORDER, 1, UNSIGNED_FIELD, bRop),
  179. DTABLE_DATA_ENTRY (PATBLT_ORDER, 3, UNSIGNED_FIELD, BackColor),
  180. DTABLE_DATA_ENTRY (PATBLT_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  181. DTABLE_FIXED_ENTRY (PATBLT_ORDER, 1, SIGNED_FIELD, BrushOrgX),
  182. DTABLE_FIXED_ENTRY (PATBLT_ORDER, 1, SIGNED_FIELD, BrushOrgY),
  183. DTABLE_FIXED_ENTRY (PATBLT_ORDER, 1, UNSIGNED_FIELD, BrushStyle),
  184. DTABLE_FIXED_ENTRY (PATBLT_ORDER, 1, UNSIGNED_FIELD, BrushHatch),
  185. DTABLE_DATA_ENTRY (PATBLT_ORDER, 7, UNSIGNED_FIELD, BrushExtra)
  186. };
  187. #endif
  188. const OD_ORDER_FIELD_INFO odScrBltFields[] =
  189. {
  190. DTABLE_FIXED_COORDS_ENTRY(SCRBLT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  191. DTABLE_FIXED_COORDS_ENTRY(SCRBLT_ORDER, 2, SIGNED_FIELD, nTopRect),
  192. DTABLE_FIXED_COORDS_ENTRY(SCRBLT_ORDER, 2, SIGNED_FIELD, nWidth),
  193. DTABLE_FIXED_COORDS_ENTRY(SCRBLT_ORDER, 2, SIGNED_FIELD, nHeight),
  194. DTABLE_FIXED_ENTRY (SCRBLT_ORDER, 1, UNSIGNED_FIELD, bRop),
  195. DTABLE_FIXED_COORDS_ENTRY(SCRBLT_ORDER, 2, SIGNED_FIELD, nXSrc),
  196. DTABLE_FIXED_COORDS_ENTRY(SCRBLT_ORDER, 2, SIGNED_FIELD, nYSrc)
  197. };
  198. // Fast-path decode function used.
  199. #if 0
  200. const OD_ORDER_FIELD_INFO odLineToFields[] =
  201. {
  202. DTABLE_FIXED_ENTRY (LINETO_ORDER, 2, SIGNED_FIELD, BackMode),
  203. DTABLE_FIXED_COORDS_ENTRY(LINETO_ORDER, 2, SIGNED_FIELD, nXStart),
  204. DTABLE_FIXED_COORDS_ENTRY(LINETO_ORDER, 2, SIGNED_FIELD, nYStart),
  205. DTABLE_FIXED_COORDS_ENTRY(LINETO_ORDER, 2, SIGNED_FIELD, nXEnd),
  206. DTABLE_FIXED_COORDS_ENTRY(LINETO_ORDER, 2, SIGNED_FIELD, nYEnd),
  207. DTABLE_DATA_ENTRY (LINETO_ORDER, 3, UNSIGNED_FIELD, BackColor),
  208. DTABLE_FIXED_ENTRY (LINETO_ORDER, 1, UNSIGNED_FIELD, ROP2),
  209. DTABLE_FIXED_ENTRY (LINETO_ORDER, 1, UNSIGNED_FIELD, PenStyle),
  210. DTABLE_FIXED_ENTRY (LINETO_ORDER, 1, UNSIGNED_FIELD, PenWidth),
  211. DTABLE_DATA_ENTRY (LINETO_ORDER, 3, UNSIGNED_FIELD, PenColor)
  212. };
  213. #endif
  214. // Fast-path decode function used.
  215. #if 0
  216. const OD_ORDER_FIELD_INFO odOpaqueRectFields[] =
  217. {
  218. DTABLE_FIXED_COORDS_ENTRY(OPAQUERECT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  219. DTABLE_FIXED_COORDS_ENTRY(OPAQUERECT_ORDER, 2, SIGNED_FIELD, nTopRect),
  220. DTABLE_FIXED_COORDS_ENTRY(OPAQUERECT_ORDER, 2, SIGNED_FIELD, nWidth),
  221. DTABLE_FIXED_COORDS_ENTRY(OPAQUERECT_ORDER, 2, SIGNED_FIELD, nHeight),
  222. DTABLE_DATA_ENTRY(OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, Color.u.rgb.red),
  223. DTABLE_DATA_ENTRY(OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, Color.u.rgb.green),
  224. DTABLE_DATA_ENTRY(OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, Color.u.rgb.blue)
  225. };
  226. #endif
  227. const OD_ORDER_FIELD_INFO odSaveBitmapFields[] =
  228. {
  229. DTABLE_FIXED_ENTRY (SAVEBITMAP_ORDER, 4, UNSIGNED_FIELD,
  230. SavedBitmapPosition),
  231. DTABLE_FIXED_COORDS_ENTRY(SAVEBITMAP_ORDER, 2, SIGNED_FIELD,
  232. nLeftRect),
  233. DTABLE_FIXED_COORDS_ENTRY(SAVEBITMAP_ORDER, 2, SIGNED_FIELD,
  234. nTopRect),
  235. DTABLE_FIXED_COORDS_ENTRY(SAVEBITMAP_ORDER, 2, SIGNED_FIELD,
  236. nRightRect),
  237. DTABLE_FIXED_COORDS_ENTRY(SAVEBITMAP_ORDER, 2, SIGNED_FIELD,
  238. nBottomRect),
  239. DTABLE_FIXED_ENTRY (SAVEBITMAP_ORDER, 1, UNSIGNED_FIELD,
  240. Operation)
  241. };
  242. // Fast-path decode function used.
  243. #if 0
  244. const OD_ORDER_FIELD_INFO odMemBltFields[] =
  245. {
  246. DTABLE_FIXED_ENTRY (MEMBLT_R2_ORDER, 2, UNSIGNED_FIELD, Common.cacheId),
  247. DTABLE_FIXED_COORDS_ENTRY(MEMBLT_R2_ORDER, 2, SIGNED_FIELD, Common.nLeftRect),
  248. DTABLE_FIXED_COORDS_ENTRY(MEMBLT_R2_ORDER, 2, SIGNED_FIELD, Common.nTopRect),
  249. DTABLE_FIXED_COORDS_ENTRY(MEMBLT_R2_ORDER, 2, SIGNED_FIELD, Common.nWidth),
  250. DTABLE_FIXED_COORDS_ENTRY(MEMBLT_R2_ORDER, 2, SIGNED_FIELD, Common.nHeight),
  251. DTABLE_FIXED_ENTRY (MEMBLT_R2_ORDER, 1, UNSIGNED_FIELD, Common.bRop),
  252. DTABLE_FIXED_COORDS_ENTRY(MEMBLT_R2_ORDER, 2, SIGNED_FIELD, Common.nXSrc),
  253. DTABLE_FIXED_COORDS_ENTRY(MEMBLT_R2_ORDER, 2, SIGNED_FIELD, Common.nYSrc),
  254. DTABLE_FIXED_ENTRY (MEMBLT_R2_ORDER, 2, UNSIGNED_FIELD, Common.cacheIndex)
  255. };
  256. #endif
  257. const OD_ORDER_FIELD_INFO odMem3BltFields[] =
  258. {
  259. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 2, UNSIGNED_FIELD,Common.cacheId),
  260. DTABLE_FIXED_COORDS_ENTRY(MEM3BLT_R2_ORDER, 2, SIGNED_FIELD, Common.nLeftRect),
  261. DTABLE_FIXED_COORDS_ENTRY(MEM3BLT_R2_ORDER, 2, SIGNED_FIELD, Common.nTopRect),
  262. DTABLE_FIXED_COORDS_ENTRY(MEM3BLT_R2_ORDER, 2, SIGNED_FIELD, Common.nWidth),
  263. DTABLE_FIXED_COORDS_ENTRY(MEM3BLT_R2_ORDER, 2, SIGNED_FIELD, Common.nHeight),
  264. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 1, UNSIGNED_FIELD,Common.bRop),
  265. DTABLE_FIXED_COORDS_ENTRY(MEM3BLT_R2_ORDER, 2, SIGNED_FIELD, Common.nXSrc),
  266. DTABLE_FIXED_COORDS_ENTRY(MEM3BLT_R2_ORDER, 2, SIGNED_FIELD, Common.nYSrc),
  267. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 3, UNSIGNED_FIELD,BackColor),
  268. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 3, UNSIGNED_FIELD,ForeColor),
  269. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 1, SIGNED_FIELD, BrushOrgX),
  270. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 1, SIGNED_FIELD, BrushOrgY),
  271. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 1, UNSIGNED_FIELD,BrushStyle),
  272. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 1, UNSIGNED_FIELD,BrushHatch),
  273. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 7, UNSIGNED_FIELD,BrushExtra),
  274. DTABLE_FIXED_ENTRY (MEM3BLT_R2_ORDER, 2, UNSIGNED_FIELD,Common.cacheIndex)
  275. };
  276. const OD_ORDER_FIELD_INFO odMultiDstBltFields[] =
  277. {
  278. DTABLE_FIXED_COORDS_ENTRY(MULTI_DSTBLT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  279. DTABLE_FIXED_COORDS_ENTRY(MULTI_DSTBLT_ORDER, 2, SIGNED_FIELD, nTopRect),
  280. DTABLE_FIXED_COORDS_ENTRY(MULTI_DSTBLT_ORDER, 2, SIGNED_FIELD, nWidth),
  281. DTABLE_FIXED_COORDS_ENTRY(MULTI_DSTBLT_ORDER, 2, SIGNED_FIELD, nHeight),
  282. DTABLE_FIXED_ENTRY (MULTI_DSTBLT_ORDER, 1, UNSIGNED_FIELD, bRop),
  283. DTABLE_FIXED_ENTRY (MULTI_DSTBLT_ORDER, 1, UNSIGNED_FIELD, nDeltaEntries),
  284. DTABLE_LONG_VARIABLE_ENTRY(MULTI_DSTBLT_ORDER, 1, UNSIGNED_FIELD, codedDeltaList, Deltas)
  285. };
  286. const OD_ORDER_FIELD_INFO odMultiPatBltFields[] =
  287. {
  288. DTABLE_FIXED_COORDS_ENTRY(MULTI_PATBLT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  289. DTABLE_FIXED_COORDS_ENTRY(MULTI_PATBLT_ORDER, 2, SIGNED_FIELD, nTopRect),
  290. DTABLE_FIXED_COORDS_ENTRY(MULTI_PATBLT_ORDER, 2, SIGNED_FIELD, nWidth),
  291. DTABLE_FIXED_COORDS_ENTRY(MULTI_PATBLT_ORDER, 2, SIGNED_FIELD, nHeight),
  292. DTABLE_FIXED_ENTRY (MULTI_PATBLT_ORDER, 1, UNSIGNED_FIELD, bRop),
  293. DTABLE_DATA_ENTRY (MULTI_PATBLT_ORDER, 3, UNSIGNED_FIELD, BackColor),
  294. DTABLE_DATA_ENTRY (MULTI_PATBLT_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  295. DTABLE_FIXED_ENTRY (MULTI_PATBLT_ORDER, 1, SIGNED_FIELD, BrushOrgX),
  296. DTABLE_FIXED_ENTRY (MULTI_PATBLT_ORDER, 1, SIGNED_FIELD, BrushOrgY),
  297. DTABLE_FIXED_ENTRY (MULTI_PATBLT_ORDER, 1, UNSIGNED_FIELD, BrushStyle),
  298. DTABLE_FIXED_ENTRY (MULTI_PATBLT_ORDER, 1, UNSIGNED_FIELD, BrushHatch),
  299. DTABLE_DATA_ENTRY (MULTI_PATBLT_ORDER, 7, UNSIGNED_FIELD, BrushExtra),
  300. DTABLE_FIXED_ENTRY (MULTI_PATBLT_ORDER, 1, UNSIGNED_FIELD, nDeltaEntries),
  301. DTABLE_LONG_VARIABLE_ENTRY(MULTI_PATBLT_ORDER, 1, UNSIGNED_FIELD, codedDeltaList, Deltas)
  302. };
  303. const OD_ORDER_FIELD_INFO odMultiScrBltFields[] =
  304. {
  305. DTABLE_FIXED_COORDS_ENTRY(MULTI_SCRBLT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  306. DTABLE_FIXED_COORDS_ENTRY(MULTI_SCRBLT_ORDER, 2, SIGNED_FIELD, nTopRect),
  307. DTABLE_FIXED_COORDS_ENTRY(MULTI_SCRBLT_ORDER, 2, SIGNED_FIELD, nWidth),
  308. DTABLE_FIXED_COORDS_ENTRY(MULTI_SCRBLT_ORDER, 2, SIGNED_FIELD, nHeight),
  309. DTABLE_FIXED_ENTRY (MULTI_SCRBLT_ORDER, 1, UNSIGNED_FIELD, bRop),
  310. DTABLE_FIXED_COORDS_ENTRY(MULTI_SCRBLT_ORDER, 2, SIGNED_FIELD, nXSrc),
  311. DTABLE_FIXED_COORDS_ENTRY(MULTI_SCRBLT_ORDER, 2, SIGNED_FIELD, nYSrc),
  312. DTABLE_FIXED_ENTRY (MULTI_SCRBLT_ORDER, 1, UNSIGNED_FIELD, nDeltaEntries),
  313. DTABLE_LONG_VARIABLE_ENTRY(MULTI_SCRBLT_ORDER, 1, UNSIGNED_FIELD, codedDeltaList, Deltas)
  314. };
  315. const OD_ORDER_FIELD_INFO odMultiOpaqueRectFields[] =
  316. {
  317. DTABLE_FIXED_COORDS_ENTRY(MULTI_OPAQUERECT_ORDER, 2, SIGNED_FIELD, nLeftRect),
  318. DTABLE_FIXED_COORDS_ENTRY(MULTI_OPAQUERECT_ORDER, 2, SIGNED_FIELD, nTopRect),
  319. DTABLE_FIXED_COORDS_ENTRY(MULTI_OPAQUERECT_ORDER, 2, SIGNED_FIELD, nWidth),
  320. DTABLE_FIXED_COORDS_ENTRY(MULTI_OPAQUERECT_ORDER, 2, SIGNED_FIELD, nHeight),
  321. DTABLE_DATA_ENTRY (MULTI_OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, Color.u.rgb.red),
  322. DTABLE_DATA_ENTRY (MULTI_OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, Color.u.rgb.green),
  323. DTABLE_DATA_ENTRY (MULTI_OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, Color.u.rgb.blue),
  324. DTABLE_FIXED_ENTRY (MULTI_OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, nDeltaEntries),
  325. DTABLE_LONG_VARIABLE_ENTRY(MULTI_OPAQUERECT_ORDER, 1, UNSIGNED_FIELD, codedDeltaList, Deltas)
  326. };
  327. const OD_ORDER_FIELD_INFO odPolygonSCFields[] =
  328. {
  329. DTABLE_FIXED_COORDS_ENTRY(POLYGON_SC_ORDER, 2, SIGNED_FIELD, XStart),
  330. DTABLE_FIXED_COORDS_ENTRY(POLYGON_SC_ORDER, 2, SIGNED_FIELD, YStart),
  331. DTABLE_FIXED_ENTRY (POLYGON_SC_ORDER, 1, UNSIGNED_FIELD, ROP2),
  332. DTABLE_FIXED_ENTRY (POLYGON_SC_ORDER, 1, UNSIGNED_FIELD, FillMode),
  333. DTABLE_DATA_ENTRY (POLYGON_SC_ORDER, 3, UNSIGNED_FIELD, BrushColor),
  334. DTABLE_FIXED_ENTRY (POLYGON_SC_ORDER, 1, UNSIGNED_FIELD, NumDeltaEntries),
  335. DTABLE_VARIABLE_ENTRY (POLYGON_SC_ORDER, 1, UNSIGNED_FIELD, CodedDeltaList, Deltas)
  336. };
  337. const OD_ORDER_FIELD_INFO odPolygonCBFields[] =
  338. {
  339. DTABLE_FIXED_COORDS_ENTRY(POLYGON_CB_ORDER, 2, SIGNED_FIELD, XStart),
  340. DTABLE_FIXED_COORDS_ENTRY(POLYGON_CB_ORDER, 2, SIGNED_FIELD, YStart),
  341. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, UNSIGNED_FIELD, ROP2),
  342. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, UNSIGNED_FIELD, FillMode),
  343. DTABLE_DATA_ENTRY (POLYGON_CB_ORDER, 3, UNSIGNED_FIELD, BackColor),
  344. DTABLE_DATA_ENTRY (POLYGON_CB_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  345. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, SIGNED_FIELD, BrushOrgX),
  346. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, SIGNED_FIELD, BrushOrgY),
  347. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, UNSIGNED_FIELD, BrushStyle),
  348. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, UNSIGNED_FIELD, BrushHatch),
  349. DTABLE_DATA_ENTRY (POLYGON_CB_ORDER, 7, UNSIGNED_FIELD, BrushExtra),
  350. DTABLE_FIXED_ENTRY (POLYGON_CB_ORDER, 1, UNSIGNED_FIELD, NumDeltaEntries),
  351. DTABLE_VARIABLE_ENTRY (POLYGON_CB_ORDER, 1, UNSIGNED_FIELD, CodedDeltaList, Deltas)
  352. };
  353. const OD_ORDER_FIELD_INFO odPolyLineFields[] =
  354. {
  355. DTABLE_FIXED_COORDS_ENTRY(POLYLINE_ORDER, 2, SIGNED_FIELD, XStart),
  356. DTABLE_FIXED_COORDS_ENTRY(POLYLINE_ORDER, 2, SIGNED_FIELD, YStart),
  357. DTABLE_FIXED_ENTRY (POLYLINE_ORDER, 1, UNSIGNED_FIELD, ROP2),
  358. DTABLE_FIXED_ENTRY (POLYLINE_ORDER, 2, UNSIGNED_FIELD, BrushCacheEntry),
  359. DTABLE_DATA_ENTRY (POLYLINE_ORDER, 3, UNSIGNED_FIELD, PenColor),
  360. DTABLE_FIXED_ENTRY (POLYLINE_ORDER, 1, UNSIGNED_FIELD, NumDeltaEntries),
  361. DTABLE_VARIABLE_ENTRY (POLYLINE_ORDER, 1, UNSIGNED_FIELD, CodedDeltaList, Deltas)
  362. };
  363. const OD_ORDER_FIELD_INFO odEllipseSCFields[] =
  364. {
  365. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_SC_ORDER, 2, SIGNED_FIELD, LeftRect),
  366. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_SC_ORDER, 2, SIGNED_FIELD, TopRect),
  367. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_SC_ORDER, 2, SIGNED_FIELD, RightRect),
  368. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_SC_ORDER, 2, SIGNED_FIELD, BottomRect),
  369. DTABLE_FIXED_ENTRY (ELLIPSE_SC_ORDER, 1, UNSIGNED_FIELD, ROP2),
  370. DTABLE_FIXED_ENTRY (ELLIPSE_SC_ORDER, 1, UNSIGNED_FIELD, FillMode),
  371. DTABLE_DATA_ENTRY (ELLIPSE_SC_ORDER, 3, UNSIGNED_FIELD, Color)
  372. };
  373. const OD_ORDER_FIELD_INFO odEllipseCBFields[] =
  374. {
  375. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_CB_ORDER, 2, SIGNED_FIELD, LeftRect),
  376. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_CB_ORDER, 2, SIGNED_FIELD, TopRect),
  377. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_CB_ORDER, 2, SIGNED_FIELD, RightRect),
  378. DTABLE_FIXED_COORDS_ENTRY(ELLIPSE_CB_ORDER, 2, SIGNED_FIELD, BottomRect),
  379. DTABLE_FIXED_ENTRY (ELLIPSE_CB_ORDER, 1, UNSIGNED_FIELD, ROP2),
  380. DTABLE_FIXED_ENTRY (ELLIPSE_CB_ORDER, 1, UNSIGNED_FIELD, FillMode),
  381. DTABLE_DATA_ENTRY (ELLIPSE_CB_ORDER, 3, UNSIGNED_FIELD, BackColor),
  382. DTABLE_DATA_ENTRY (ELLIPSE_CB_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  383. DTABLE_FIXED_ENTRY (ELLIPSE_CB_ORDER, 1, SIGNED_FIELD, BrushOrgX),
  384. DTABLE_FIXED_ENTRY (ELLIPSE_CB_ORDER, 1, SIGNED_FIELD, BrushOrgY),
  385. DTABLE_FIXED_ENTRY (ELLIPSE_CB_ORDER, 1, UNSIGNED_FIELD, BrushStyle),
  386. DTABLE_FIXED_ENTRY (ELLIPSE_CB_ORDER, 1, UNSIGNED_FIELD, BrushHatch),
  387. DTABLE_DATA_ENTRY (ELLIPSE_CB_ORDER, 7, UNSIGNED_FIELD, BrushExtra)
  388. };
  389. // Fast-path decode function used.
  390. #if 0
  391. const OD_ORDER_FIELD_INFO odFastIndexFields[] =
  392. {
  393. DTABLE_DATA_ENTRY (FAST_INDEX_ORDER, 1, UNSIGNED_FIELD, cacheId),
  394. DTABLE_DATA_ENTRY (FAST_INDEX_ORDER, 2, UNSIGNED_FIELD, fDrawing),
  395. DTABLE_DATA_ENTRY (FAST_INDEX_ORDER, 3, UNSIGNED_FIELD, BackColor),
  396. DTABLE_DATA_ENTRY (FAST_INDEX_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  397. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, BkLeft),
  398. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, BkTop),
  399. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, BkRight),
  400. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, BkBottom),
  401. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, OpLeft),
  402. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, OpTop),
  403. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, OpRight),
  404. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, OpBottom),
  405. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, x),
  406. DTABLE_FIXED_COORDS_ENTRY(FAST_INDEX_ORDER, 2, SIGNED_FIELD, y),
  407. DTABLE_VARIABLE_ENTRY (FAST_INDEX_ORDER, 1, UNSIGNED_FIELD, variableBytes, arecs)
  408. };
  409. #endif
  410. const OD_ORDER_FIELD_INFO odFastGlyphFields[] =
  411. {
  412. DTABLE_DATA_ENTRY (FAST_GLYPH_ORDER, 1, UNSIGNED_FIELD, cacheId),
  413. DTABLE_DATA_ENTRY (FAST_GLYPH_ORDER, 2, UNSIGNED_FIELD, fDrawing),
  414. DTABLE_DATA_ENTRY (FAST_GLYPH_ORDER, 3, UNSIGNED_FIELD, BackColor),
  415. DTABLE_DATA_ENTRY (FAST_GLYPH_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  416. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, BkLeft),
  417. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, BkTop),
  418. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, BkRight),
  419. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, BkBottom),
  420. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, OpLeft),
  421. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, OpTop),
  422. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, OpRight),
  423. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, OpBottom),
  424. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, x),
  425. DTABLE_FIXED_COORDS_ENTRY(FAST_GLYPH_ORDER, 2, SIGNED_FIELD, y),
  426. DTABLE_VARIABLE_ENTRY (FAST_GLYPH_ORDER, 1, UNSIGNED_FIELD, variableBytes, glyphData)
  427. };
  428. const OD_ORDER_FIELD_INFO odGlyphIndexFields[] =
  429. {
  430. DTABLE_DATA_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD, cacheId),
  431. DTABLE_DATA_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD, flAccel),
  432. DTABLE_DATA_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD, ulCharInc),
  433. DTABLE_DATA_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD, fOpRedundant),
  434. DTABLE_DATA_ENTRY (INDEX_ORDER, 3, UNSIGNED_FIELD, BackColor),
  435. DTABLE_DATA_ENTRY (INDEX_ORDER, 3, UNSIGNED_FIELD, ForeColor),
  436. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, BkLeft),
  437. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, BkTop),
  438. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, BkRight),
  439. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, BkBottom),
  440. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, OpLeft),
  441. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, OpTop),
  442. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, OpRight),
  443. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, OpBottom),
  444. DTABLE_FIXED_ENTRY (INDEX_ORDER, 1, SIGNED_FIELD, BrushOrgX),
  445. DTABLE_FIXED_ENTRY (INDEX_ORDER, 1, SIGNED_FIELD, BrushOrgY),
  446. DTABLE_FIXED_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD, BrushStyle),
  447. DTABLE_FIXED_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD, BrushHatch),
  448. DTABLE_DATA_ENTRY (INDEX_ORDER, 7, UNSIGNED_FIELD, BrushExtra),
  449. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, x),
  450. DTABLE_FIXED_ENTRY (INDEX_ORDER, 2, SIGNED_FIELD, y),
  451. DTABLE_VARIABLE_ENTRY (INDEX_ORDER, 1, UNSIGNED_FIELD,
  452. variableBytes, arecs)
  453. };
  454. #ifdef DRAW_NINEGRID
  455. const OD_ORDER_FIELD_INFO odDrawNineGridFields[] =
  456. {
  457. DTABLE_FIXED_COORDS_ENTRY(DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcLeft),
  458. DTABLE_FIXED_COORDS_ENTRY(DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcTop),
  459. DTABLE_FIXED_COORDS_ENTRY(DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcRight),
  460. DTABLE_FIXED_COORDS_ENTRY(DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcBottom),
  461. DTABLE_FIXED_ENTRY (DRAWNINEGRID_ORDER, 2, UNSIGNED_FIELD, bitmapId)
  462. };
  463. const OD_ORDER_FIELD_INFO odMultiDrawNineGridFields[] =
  464. {
  465. DTABLE_FIXED_COORDS_ENTRY(MULTI_DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcLeft),
  466. DTABLE_FIXED_COORDS_ENTRY(MULTI_DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcTop),
  467. DTABLE_FIXED_COORDS_ENTRY(MULTI_DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcRight),
  468. DTABLE_FIXED_COORDS_ENTRY(MULTI_DRAWNINEGRID_ORDER, 2, SIGNED_FIELD, srcBottom),
  469. DTABLE_FIXED_ENTRY (MULTI_DRAWNINEGRID_ORDER, 2, UNSIGNED_FIELD, bitmapId),
  470. DTABLE_FIXED_ENTRY (MULTI_DRAWNINEGRID_ORDER, 1, UNSIGNED_FIELD, nDeltaEntries),
  471. DTABLE_LONG_VARIABLE_ENTRY(MULTI_DRAWNINEGRID_ORDER, 1, UNSIGNED_FIELD, codedDeltaList, Deltas)
  472. };
  473. #endif
  474. // Order attributes used for decoding, organized to optimize cache line
  475. // usage. The fourth and fifth fields of each row are the fast-path decode
  476. // and order handler functions, respectively. If a fast-path decode function
  477. // is used, neither a decoding table nor a handler function is needed,
  478. // since fast-path decode functions also perform the handling.
  479. //
  480. // This table contains just the static portions it is used to initialise
  481. // the per instance table in the constructor below
  482. //
  483. OD_ORDER_TABLE odInitializeOrderTable[TS_MAX_ORDERS] = {
  484. { odDstBltFields, NUM_DSTBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  485. { NULL, /* fastpath */ NUM_PATBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  486. { odScrBltFields, NUM_SCRBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  487. { NULL, 0, NULL, 0, 0, NULL, NULL },
  488. { NULL, 0, NULL, 0, 0, NULL, NULL },
  489. { NULL, 0, NULL, 0, 0, NULL, NULL },
  490. { NULL, 0, NULL, 0, 0, NULL, NULL },
  491. #ifdef DRAW_NINEGRID
  492. { odDrawNineGridFields, NUM_DRAWNINEGRID_FIELDS, NULL, 0, 0, NULL, NULL },
  493. { odMultiDrawNineGridFields, NUM_MULTI_DRAWNINEGRID_FIELDS, NULL, 0, 0, NULL, NULL },
  494. #else
  495. { NULL, 0, NULL, 0, 0, NULL, NULL },
  496. { NULL, 0, NULL, 0, 0, NULL, NULL },
  497. #endif
  498. { NULL, /* fastpath */ NUM_LINETO_FIELDS, NULL, 0, 0, NULL, NULL },
  499. { NULL, /* fastpath*/ NUM_OPAQUERECT_FIELDS, NULL, 0, 0, NULL, NULL },
  500. { odSaveBitmapFields, NUM_SAVEBITMAP_FIELDS, NULL, 0, 0, NULL, NULL },
  501. { NULL, 0, NULL, 0, 0, NULL, NULL },
  502. { NULL, /* fastpath */ NUM_MEMBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  503. { odMem3BltFields, NUM_MEM3BLT_FIELDS, NULL, 0, 0, NULL, NULL },
  504. { odMultiDstBltFields, NUM_MULTIDSTBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  505. { odMultiPatBltFields, NUM_MULTIPATBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  506. { odMultiScrBltFields, NUM_MULTISCRBLT_FIELDS, NULL, 0, 0, NULL, NULL },
  507. { odMultiOpaqueRectFields, NUM_MULTIOPAQUERECT_FIELDS, NULL, 0, 0, NULL, NULL },
  508. { NULL, /* fastpath*/ NUM_FAST_INDEX_FIELDS, NULL, 0, 0, NULL, NULL },
  509. { odPolygonSCFields, NUM_POLYGON_SC_FIELDS, NULL, 0, 0, NULL, NULL },
  510. { odPolygonCBFields, NUM_POLYGON_CB_FIELDS, NULL, 0, 0, NULL, NULL },
  511. { odPolyLineFields, NUM_POLYLINE_FIELDS, NULL, 0, 0, NULL, NULL },
  512. { NULL, 0, NULL, 0, 0, NULL, NULL },
  513. { odFastGlyphFields, NUM_FAST_GLYPH_FIELDS, NULL, 0, 0, NULL, NULL },
  514. { odEllipseSCFields, NUM_ELLIPSE_SC_FIELDS, NULL, 0, 0, NULL, NULL },
  515. { odEllipseCBFields, NUM_ELLIPSE_CB_FIELDS, NULL, 0, 0, NULL, NULL },
  516. { odGlyphIndexFields, NUM_INDEX_FIELDS, NULL, 0, 0, NULL, NULL },
  517. };
  518. #if 0
  519. //
  520. // This is the original just here for reference
  521. //
  522. {
  523. { odDstBltFields, NUM_DSTBLT_FIELDS, (PUH_ORDER)&_OD.lastDstblt, NULL, ODHandleDstBlts },
  524. { NULL, /* fastpath */ NUM_PATBLT_FIELDS, (PUH_ORDER)&_OD.lastPatblt, ODDecodePatBlt, NULL },
  525. { odScrBltFields, NUM_SCRBLT_FIELDS, (PUH_ORDER)&_OD.lastScrblt, NULL, ODHandleScrBlts },
  526. { NULL, 0, NULL, NULL, NULL },
  527. { NULL, 0, NULL, NULL, NULL },
  528. { NULL, 0, NULL, NULL, NULL },
  529. { NULL, 0, NULL, NULL, NULL },
  530. { NULL, 0, NULL, NULL, NULL },
  531. { NULL, 0, NULL, NULL, NULL },
  532. { NULL, /* fastpath */ NUM_LINETO_FIELDS, (PUH_ORDER)&_OD.lastLineTo, ODDecodeLineTo, NULL },
  533. { NULL, /* fastpath*/ NUM_OPAQUERECT_FIELDS, (PUH_ORDER)&_OD.lastOpaqueRect, ODDecodeOpaqueRect, NULL },
  534. { odSaveBitmapFields, NUM_SAVEBITMAP_FIELDS, (PUH_ORDER)&_OD.lastSaveBitmap, NULL, ODHandleSaveBitmap },
  535. { NULL, 0, NULL, NULL, NULL },
  536. { NULL, /* fastpath */ NUM_MEMBLT_FIELDS, (PUH_ORDER)&_OD.lastMembltR2, ODDecodeMemBlt, NULL },
  537. { odMem3BltFields, NUM_MEM3BLT_FIELDS, (PUH_ORDER)&_OD.lastMem3bltR2, NULL, ODHandleMem3Blt },
  538. { odMultiDstBltFields, NUM_MULTIDSTBLT_FIELDS, (PUH_ORDER)&_OD.lastMultiDstBlt, NULL, ODHandleDstBlts },
  539. { odMultiPatBltFields, NUM_MULTIPATBLT_FIELDS, (PUH_ORDER)&_OD.lastMultiPatBlt, NULL, ODHandleMultiPatBlt },
  540. { odMultiScrBltFields, NUM_MULTISCRBLT_FIELDS, (PUH_ORDER)&_OD.lastMultiScrBlt, NULL, ODHandleScrBlts },
  541. { odMultiOpaqueRectFields, NUM_MULTIOPAQUERECT_FIELDS, (PUH_ORDER)&_OD.lastMultiOpaqueRect, NULL, ODHandleMultiOpaqueRect },
  542. { NULL, /* fastpath*/ NUM_FAST_INDEX_FIELDS, (PUH_ORDER)&_OD.lastFastIndex, ODDecodeFastIndex, NULL },
  543. { odPolygonSCFields, NUM_POLYGON_SC_FIELDS, (PUH_ORDER)&_OD.lastPolygonSC, NULL, ODHandlePolygonSC },
  544. { odPolygonCBFields, NUM_POLYGON_CB_FIELDS, (PUH_ORDER)&_OD.lastPolygonCB, NULL, ODHandlePolygonCB },
  545. { odPolyLineFields, NUM_POLYLINE_FIELDS, (PUH_ORDER)&_OD.lastPolyLine, NULL, ODHandlePolyLine },
  546. { NULL, 0, NULL, NULL, NULL },
  547. { odFastGlyphFields, NUM_FAST_GLYPH_FIELDS, (PUH_ORDER)&_OD.lastFastGlyph, NULL, ODHandleFastGlyph },
  548. { odEllipseSCFields, NUM_ELLIPSE_SC_FIELDS, (PUH_ORDER)&_OD.lastEllipseSC, NULL, ODHandleEllipseSC },
  549. { odEllipseCBFields, NUM_ELLIPSE_CB_FIELDS, (PUH_ORDER)&_OD.lastEllipseCB, NULL, ODHandleEllipseCB },
  550. { odGlyphIndexFields, NUM_INDEX_FIELDS, (PUH_ORDER)&_OD.lastIndex, NULL, ODHandleGlyphIndex }
  551. };
  552. #endif
  553. #ifdef DC_HICOLOR
  554. #ifdef DC_DEBUG
  555. // Names of all the order types
  556. DCTCHAR orderNames[TS_MAX_ORDERS + TS_NUM_SECONDARY_ORDERS][64] = {
  557. _T("DSTBLT "),
  558. _T("PATBLT "),
  559. _T("SCRBLT "),
  560. _T("unused "),
  561. _T("unused "),
  562. _T("unused "),
  563. _T("unused "),
  564. #ifdef DRAW_NINEGRID
  565. _T("DRAWNINEGRID "),
  566. _T("MULTI_DRAWNINEGRID "),
  567. #else
  568. _T("unused "),
  569. _T("unused "),
  570. #endif
  571. _T("LINETO "),
  572. _T("OPAQUERECT "),
  573. _T("SAVEBITMAP "),
  574. _T("unused "),
  575. _T("MEMBLT_R2 "),
  576. _T("MEM3BLT_R2 "),
  577. _T("MULTIDSTBLT "),
  578. _T("MULTIPATBLT "),
  579. _T("MULTISCRBLT "),
  580. _T("MULTIOPAQUERECT "),
  581. _T("FAST_INDEX "),
  582. _T("POLYGON_SC (not wince) "),
  583. _T("POLYGON_CB (not wince) "),
  584. _T("POLYLINE "),
  585. _T("unused "),
  586. _T("FAST_GLYPH "),
  587. _T("ELLIPSE_SC (not wince) "),
  588. _T("ELLIPSE_CB (not wince) "),
  589. _T("INDEX (not expected) "),
  590. _T("unused "),
  591. _T("unused "),
  592. _T("unused "),
  593. _T("unused "),
  594. _T("U/C CACHE BMP (legacy) "),
  595. _T("C COLOR TABLE (8bpp) "),
  596. _T("COM CACHE BMP (legacy) "),
  597. _T("C GLYPH "),
  598. _T("U/C CACHE BMP R2 "),
  599. _T("COM CACHE BMP R2 "),
  600. _T("unused "),
  601. _T("CACHE BRUSH ")
  602. };
  603. #endif
  604. #endif
  605. COD::COD(CObjs* objs)
  606. {
  607. _pClientObjects = objs;
  608. DC_MEMCPY( odOrderTable, odInitializeOrderTable, sizeof(odOrderTable));
  609. //
  610. // Initialize the per instance pointers of the ordertable
  611. //
  612. //{ odDstBltFields, NUM_DSTBLT_FIELDS, (PUH_ORDER)&_OD.lastDstblt, NULL, ODHandleDstBlts },
  613. odOrderTable[0].LastOrder = (PUH_ORDER)&_OD.lastDstblt;
  614. odOrderTable[0].cbMaxOrderLen = sizeof(_OD.lastDstblt);
  615. odOrderTable[0].pFastDecode = NULL;
  616. odOrderTable[0].pHandler = ODHandleDstBlts;
  617. //{ NULL, /* fastpath */ NUM_PATBLT_FIELDS, (PUH_ORDER)&_OD.lastPatblt, ODDecodePatBlt, NULL },
  618. odOrderTable[1].LastOrder = (PUH_ORDER)&_OD.lastPatblt;
  619. odOrderTable[1].cbMaxOrderLen = sizeof(_OD.lastPatblt);
  620. odOrderTable[1].pFastDecode = ODDecodePatBlt;
  621. odOrderTable[1].pHandler = NULL;
  622. //{ odScrBltFields, NUM_SCRBLT_FIELDS, (PUH_ORDER)&_OD.lastScrblt, NULL, ODHandleScrBlts },
  623. odOrderTable[2].LastOrder = (PUH_ORDER)&_OD.lastScrblt;
  624. odOrderTable[2].cbMaxOrderLen = sizeof(_OD.lastScrblt);
  625. odOrderTable[2].pFastDecode = NULL;
  626. odOrderTable[2].pHandler = ODHandleScrBlts;
  627. //{ NULL, 0, NULL, NULL, NULL },
  628. //{ NULL, 0, NULL, NULL, NULL },
  629. //{ NULL, 0, NULL, NULL, NULL },
  630. //{ NULL, 0, NULL, NULL, NULL },
  631. #ifdef DRAW_NINEGRID
  632. odOrderTable[7].LastOrder = (PUH_ORDER)&_OD.lastDrawNineGrid;
  633. odOrderTable[7].cbMaxOrderLen = sizeof(_OD.lastDrawNineGrid);
  634. odOrderTable[7].pFastDecode = NULL;
  635. odOrderTable[7].pHandler = ODHandleDrawNineGrid;
  636. odOrderTable[8].LastOrder = (PUH_ORDER)&_OD.lastMultiDrawNineGrid;
  637. odOrderTable[8].cbMaxOrderLen = sizeof(_OD.lastMultiDrawNineGrid);
  638. odOrderTable[8].pFastDecode = NULL;
  639. odOrderTable[8].pHandler = ODHandleMultiDrawNineGrid;
  640. #else
  641. //{ NULL, 0, NULL, NULL, NULL },
  642. //{ NULL, 0, NULL, NULL, NULL },
  643. #endif
  644. //{ NULL, /* fastpath */ NUM_LINETO_FIELDS, (PUH_ORDER)&_OD.lastLineTo, ODDecodeLineTo, NULL },
  645. odOrderTable[9].LastOrder = (PUH_ORDER)&_OD.lastLineTo;
  646. odOrderTable[9].cbMaxOrderLen = sizeof(_OD.lastLineTo);
  647. odOrderTable[9].pFastDecode = ODDecodeLineTo;
  648. odOrderTable[9].pHandler = NULL;
  649. //{ NULL, /* fastpath*/ NUM_OPAQUERECT_FIELDS, (PUH_ORDER)&_OD.lastOpaqueRect, ODDecodeOpaqueRect, NULL },
  650. odOrderTable[10].LastOrder = (PUH_ORDER)&_OD.lastOpaqueRect;
  651. odOrderTable[10].cbMaxOrderLen = sizeof(_OD.lastOpaqueRect);
  652. odOrderTable[10].pFastDecode = ODDecodeOpaqueRect;
  653. odOrderTable[10].pHandler = NULL;
  654. //{ odSaveBitmapFields, NUM_SAVEBITMAP_FIELDS, (PUH_ORDER)&_OD.lastSaveBitmap, NULL, ODHandleSaveBitmap },
  655. odOrderTable[11].LastOrder = (PUH_ORDER)&_OD.lastSaveBitmap;
  656. odOrderTable[11].cbMaxOrderLen = sizeof(_OD.lastSaveBitmap);
  657. odOrderTable[11].pFastDecode = NULL;
  658. odOrderTable[11].pHandler = ODHandleSaveBitmap;
  659. //{ NULL, 0, NULL, NULL, NULL },
  660. // { NULL, /* fastpath */ NUM_MEMBLT_FIELDS, (PUH_ORDER)&_OD.lastMembltR2, ODDecodeMemBlt, NULL },
  661. odOrderTable[13].LastOrder = (PUH_ORDER)&_OD.lastMembltR2;
  662. odOrderTable[13].cbMaxOrderLen = sizeof(_OD.lastMembltR2);
  663. odOrderTable[13].pFastDecode = ODDecodeMemBlt;
  664. odOrderTable[13].pHandler = NULL;
  665. //{ odMem3BltFields, NUM_MEM3BLT_FIELDS, (PUH_ORDER)&_OD.lastMem3bltR2, NULL, ODHandleMem3Blt },
  666. odOrderTable[14].LastOrder = (PUH_ORDER)&_OD.lastMem3bltR2;
  667. odOrderTable[14].cbMaxOrderLen = sizeof(_OD.lastMem3bltR2);
  668. odOrderTable[14].pFastDecode = NULL;
  669. odOrderTable[14].pHandler = ODHandleMem3Blt;
  670. //{ odMultiDstBltFields, NUM_MULTIDSTBLT_FIELDS, (PUH_ORDER)&_OD.lastMultiDstBlt, NULL, ODHandleDstBlts },
  671. odOrderTable[15].LastOrder = (PUH_ORDER)&_OD.lastMultiDstBlt;
  672. odOrderTable[15].cbMaxOrderLen = sizeof(_OD.lastMultiDstBlt);
  673. odOrderTable[15].pFastDecode = NULL;
  674. odOrderTable[15].pHandler = ODHandleDstBlts;
  675. //{ odMultiPatBltFields, NUM_MULTIPATBLT_FIELDS, (PUH_ORDER)&_OD.lastMultiPatBlt, NULL, ODHandleMultiPatBlt },
  676. odOrderTable[16].LastOrder = (PUH_ORDER)&_OD.lastMultiPatBlt;
  677. odOrderTable[16].cbMaxOrderLen = sizeof(_OD.lastMultiPatBlt);
  678. odOrderTable[16].pFastDecode = NULL;
  679. odOrderTable[16].pHandler = ODHandleMultiPatBlt;
  680. //{ odMultiScrBltFields, NUM_MULTISCRBLT_FIELDS, (PUH_ORDER)&_OD.lastMultiScrBlt, NULL, ODHandleScrBlts },
  681. odOrderTable[17].LastOrder = (PUH_ORDER)&_OD.lastMultiScrBlt;
  682. odOrderTable[17].cbMaxOrderLen = sizeof(_OD.lastMultiScrBlt);
  683. odOrderTable[17].pFastDecode = NULL;
  684. odOrderTable[17].pHandler = ODHandleScrBlts;
  685. //{ odMultiOpaqueRectFields, NUM_MULTIOPAQUERECT_FIELDS, (PUH_ORDER)&_OD.lastMultiOpaqueRect, NULL, ODHandleMultiOpaqueRect },
  686. odOrderTable[18].LastOrder = (PUH_ORDER)&_OD.lastMultiOpaqueRect;
  687. odOrderTable[18].cbMaxOrderLen = sizeof(_OD.lastMultiOpaqueRect);
  688. odOrderTable[18].pFastDecode = NULL;
  689. odOrderTable[18].pHandler = ODHandleMultiOpaqueRect;
  690. //{ NULL, /* fastpath*/ NUM_FAST_INDEX_FIELDS, (PUH_ORDER)&_OD.lastFastIndex, ODDecodeFastIndex, NULL },
  691. odOrderTable[19].LastOrder = (PUH_ORDER)&_OD.lastFastIndex;
  692. odOrderTable[19].cbMaxOrderLen = sizeof(_OD.lastFastIndex);
  693. odOrderTable[19].pFastDecode = ODDecodeFastIndex;
  694. odOrderTable[19].pHandler = NULL;
  695. //{ odPolygonSCFields, NUM_POLYGON_SC_FIELDS, (PUH_ORDER)&_OD.lastPolygonSC, NULL, ODHandlePolygonSC },
  696. odOrderTable[20].LastOrder = (PUH_ORDER)&_OD.lastPolygonSC;
  697. odOrderTable[20].cbMaxOrderLen = sizeof(_OD.lastPolygonSC);
  698. odOrderTable[20].pFastDecode = NULL;
  699. odOrderTable[20].pHandler = ODHandlePolygonSC;
  700. //{ odPolygonCBFields, NUM_POLYGON_CB_FIELDS, (PUH_ORDER)&_OD.lastPolygonCB, NULL, ODHandlePolygonCB },
  701. odOrderTable[21].LastOrder = (PUH_ORDER)&_OD.lastPolygonCB;
  702. odOrderTable[21].cbMaxOrderLen = sizeof(_OD.lastPolygonCB);
  703. odOrderTable[21].pFastDecode = NULL;
  704. odOrderTable[21].pHandler = ODHandlePolygonCB;
  705. //{ odPolyLineFields, NUM_POLYLINE_FIELDS, (PUH_ORDER)&_OD.lastPolyLine, NULL, ODHandlePolyLine },
  706. odOrderTable[22].LastOrder = (PUH_ORDER)&_OD.lastPolyLine;
  707. odOrderTable[22].cbMaxOrderLen = sizeof(_OD.lastPolyLine);
  708. odOrderTable[22].pFastDecode = NULL;
  709. odOrderTable[22].pHandler = ODHandlePolyLine;
  710. //{ NULL, 0, NULL, NULL, NULL },
  711. //{ odFastGlyphFields, NUM_FAST_GLYPH_FIELDS, (PUH_ORDER)&_OD.lastFastGlyph, NULL, ODHandleFastGlyph },
  712. odOrderTable[24].LastOrder = (PUH_ORDER)&_OD.lastFastGlyph;
  713. odOrderTable[24].cbMaxOrderLen = sizeof(_OD.lastFastGlyph);
  714. odOrderTable[24].pFastDecode = NULL;
  715. odOrderTable[24].pHandler = ODHandleFastGlyph;
  716. //{ odEllipseSCFields, NUM_ELLIPSE_SC_FIELDS, (PUH_ORDER)&_OD.lastEllipseSC, NULL, ODHandleEllipseSC },
  717. odOrderTable[25].LastOrder = (PUH_ORDER)&_OD.lastEllipseSC;
  718. odOrderTable[25].cbMaxOrderLen = sizeof(_OD.lastEllipseSC);
  719. odOrderTable[25].pFastDecode = NULL;
  720. odOrderTable[25].pHandler = ODHandleEllipseSC;
  721. //{ odEllipseCBFields, NUM_ELLIPSE_CB_FIELDS, (PUH_ORDER)&_OD.lastEllipseCB, NULL, ODHandleEllipseCB },
  722. odOrderTable[26].LastOrder = (PUH_ORDER)&_OD.lastEllipseCB;
  723. odOrderTable[26].cbMaxOrderLen = sizeof(_OD.lastEllipseCB);
  724. odOrderTable[26].pFastDecode = NULL;
  725. odOrderTable[26].pHandler = ODHandleEllipseCB;
  726. //{ odGlyphIndexFields, NUM_INDEX_FIELDS, (PUH_ORDER)&_OD.lastIndex, NULL, ODHandleGlyphIndex }
  727. odOrderTable[27].LastOrder = (PUH_ORDER)&_OD.lastIndex;
  728. odOrderTable[27].cbMaxOrderLen = sizeof(_OD.lastIndex);
  729. odOrderTable[27].pFastDecode = NULL;
  730. odOrderTable[27].pHandler = ODHandleGlyphIndex;
  731. }
  732. COD::~COD()
  733. {
  734. }
  735. /****************************************************************************/
  736. /* Name: OD_Init */
  737. /* */
  738. /* Purpose: Initializes the Order Decoder */
  739. /****************************************************************************/
  740. DCVOID DCAPI COD::OD_Init(DCVOID)
  741. {
  742. DC_BEGIN_FN("OD_Init");
  743. _pOp = _pClientObjects->_pOPObject;
  744. _pUh = _pClientObjects->_pUHObject;
  745. _pCc = _pClientObjects->_pCcObject;
  746. _pUi = _pClientObjects->_pUiObject;
  747. _pCd = _pClientObjects->_pCdObject;
  748. memset(&_OD, 0, sizeof(_OD));
  749. TRC_NRM((TB, _T("Initialized")));
  750. DC_END_FN();
  751. }
  752. /****************************************************************************/
  753. /* Name: OD_Term */
  754. /* */
  755. /* Purpose: Terminates the Order Decoder */
  756. /****************************************************************************/
  757. DCVOID DCAPI COD::OD_Term(DCVOID)
  758. {
  759. DC_BEGIN_FN("OD_Term");
  760. TRC_NRM((TB, _T("Terminating")));
  761. DC_END_FN();
  762. }
  763. /****************************************************************************/
  764. /* Name: OD_Enable */
  765. /* */
  766. /* Purpose: Called to enable _OD. */
  767. /****************************************************************************/
  768. void DCAPI COD::OD_Enable(void)
  769. {
  770. DC_BEGIN_FN("OD_Enable");
  771. // Reset the OD data.
  772. _OD.lastOrderType = TS_ENC_PATBLT_ORDER;
  773. _OD.pLastOrder = odOrderTable[_OD.lastOrderType].LastOrder;
  774. // Set all prev order buffers buffers to null, then set the order type
  775. // for each one, which is used by UHReplayGDIOrders().
  776. #define RESET_ORDER(field, ord) \
  777. { \
  778. memset(&_OD.field, 0, sizeof(_OD.field)); \
  779. ((PATBLT_ORDER*)(((PUH_ORDER)_OD.field)->orderData))->type = DCLO16(ord);\
  780. }
  781. RESET_ORDER(lastDstblt, TS_ENC_DSTBLT_ORDER);
  782. RESET_ORDER(lastPatblt, TS_ENC_PATBLT_ORDER);
  783. RESET_ORDER(lastScrblt, TS_ENC_SCRBLT_ORDER);
  784. RESET_ORDER(lastLineTo, TS_ENC_LINETO_ORDER);
  785. RESET_ORDER(lastSaveBitmap, TS_ENC_SAVEBITMAP_ORDER);
  786. RESET_ORDER(lastMembltR2, TS_ENC_MEMBLT_R2_ORDER);
  787. RESET_ORDER(lastMem3bltR2, TS_ENC_MEM3BLT_R2_ORDER);
  788. RESET_ORDER(lastOpaqueRect, TS_ENC_OPAQUERECT_ORDER);
  789. RESET_ORDER(lastMultiDstBlt, TS_ENC_MULTIDSTBLT_ORDER);
  790. RESET_ORDER(lastMultiPatBlt, TS_ENC_MULTIPATBLT_ORDER);
  791. RESET_ORDER(lastMultiScrBlt, TS_ENC_MULTISCRBLT_ORDER);
  792. RESET_ORDER(lastMultiOpaqueRect, TS_ENC_MULTIOPAQUERECT_ORDER);
  793. RESET_ORDER(lastFastIndex, TS_ENC_FAST_INDEX_ORDER);
  794. RESET_ORDER(lastPolygonSC, TS_ENC_POLYGON_SC_ORDER);
  795. RESET_ORDER(lastPolygonCB, TS_ENC_POLYGON_CB_ORDER);
  796. RESET_ORDER(lastPolyLine, TS_ENC_POLYLINE_ORDER);
  797. RESET_ORDER(lastFastGlyph, TS_ENC_FAST_GLYPH_ORDER);
  798. RESET_ORDER(lastEllipseSC, TS_ENC_ELLIPSE_SC_ORDER);
  799. RESET_ORDER(lastEllipseCB, TS_ENC_ELLIPSE_CB_ORDER);
  800. RESET_ORDER(lastIndex, TS_ENC_INDEX_ORDER);
  801. #ifdef DRAW_NINEGRID
  802. RESET_ORDER(lastDrawNineGrid, TS_ENC_DRAWNINEGRID_ORDER);
  803. RESET_ORDER(lastMultiDrawNineGrid, TS_ENC_DRAWNINEGRID_ORDER);
  804. #endif
  805. // Reset the bounds rectangle.
  806. memset(&_OD.lastBounds, 0, sizeof(_OD.lastBounds));
  807. for(int i = 0; i < TS_MAX_ORDERS; i++) {
  808. odOrderTable[_OD.lastOrderType].cbVariableDataLen = 0;
  809. }
  810. #ifdef DC_HICOLOR
  811. //#ifdef DC_DEBUG
  812. /************************************************************************/
  813. /* Reset the list of order types we've seen */
  814. /************************************************************************/
  815. TRC_ALT((TB, _T("Clear order types received list")));
  816. memset(_OD.orderHit, 0, sizeof(_OD.orderHit));
  817. //#endif
  818. #endif
  819. DC_END_FN();
  820. }
  821. /****************************************************************************/
  822. /* Name: OD_Disable */
  823. /* */
  824. /* Purpose: Disables _OD. */
  825. /****************************************************************************/
  826. void DCAPI COD::OD_Disable(void)
  827. {
  828. DC_BEGIN_FN("OD_Disable");
  829. #ifdef DC_HICOLOR
  830. #ifdef DC_DEBUG
  831. int i;
  832. #endif
  833. #endif
  834. #ifdef DC_HICOLOR
  835. #ifdef DC_DEBUG
  836. /************************************************************************/
  837. /* Dump the list of order types we've seen */
  838. /************************************************************************/
  839. TRC_DBG((TB, _T("Received order types:")));
  840. for (i = 0; i < (TS_MAX_ORDERS + TS_NUM_SECONDARY_ORDERS); i++) {
  841. TRC_DBG((TB, _T("- %02d %s %s"), i, orderNames[i], _OD.orderHit[i] ?
  842. _T("YES") : _T("NO") ));
  843. }
  844. #endif
  845. #endif
  846. TRC_NRM((TB, _T("Disabling OD")));
  847. DC_END_FN();
  848. }
  849. // Unneeded because we can fast-path single-field deltas below if we don't
  850. // have variable-length coord fields.
  851. #ifdef USE_VARIABLE_COORDS
  852. /****************************************************************************/
  853. /* Given two arrays, a source array and an array of deltas, add each delta */
  854. /* to the corresponding element in the source array, storing the results in */
  855. /* the source array. */
  856. /* */
  857. /* srcArray - The array of source values */
  858. /* srcArrayType - The type of the array of source values */
  859. /* deltaArray - The array of deltas */
  860. /* numElements - The number of elements in the arrays */
  861. /****************************************************************************/
  862. #define COPY_DELTA_ARRAY(srcArray, srcArrayType, deltaArray, numElements) \
  863. { \
  864. DCUINT index; \
  865. for (index = 0; index < (numElements); index++) \
  866. { \
  867. (srcArray)[index] = (srcArrayType) \
  868. ((srcArray)[index] + (deltaArray)[index]); \
  869. } \
  870. }
  871. /****************************************************************************/
  872. /* Name: ODCopyFromDeltaCoords */
  873. /* */
  874. /* Purpose: Adjusts an array of coordinate values by the amounts */
  875. /* specified in an array of coordinate deltas. */
  876. /* */
  877. /* Params: IN/OUT: ppSrc - pointer to pointer to source data. */
  878. /* Updated by this function to after the processed */
  879. /* delta coordinate data. */
  880. /* IN/OUT: pDst - pointer to coordinates to adjust. */
  881. /* IN: destFieldLength - size of elements in the dest array.*/
  882. /* IN: signedValue - TRUE if the elements are signed. */
  883. /* IN: number of elements in the arrays. */
  884. /****************************************************************************/
  885. _inline DCVOID DCINTERNAL COD::ODCopyFromDeltaCoords( PPDCINT8 ppSrc,
  886. PDCVOID pDst,
  887. DCUINT dstFieldLength,
  888. DCBOOL signedValue,
  889. DCUINT numElements )
  890. {
  891. PDCINT8 pSrc;
  892. DC_BEGIN_FN("ODCopyFromDeltaCoords");
  893. pSrc = *ppSrc;
  894. switch (dstFieldLength)
  895. {
  896. case 1:
  897. if (signedValue) {
  898. PDCINT8 pDst8Signed = (PDCINT8)pDst;
  899. COPY_DELTA_ARRAY( pDst8Signed,
  900. DCINT8,
  901. pSrc,
  902. numElements );
  903. }
  904. else {
  905. PDCUINT8 pDst8Unsigned = (PDCUINT8)pDst;
  906. COPY_DELTA_ARRAY( pDst8Unsigned,
  907. DCUINT8,
  908. pSrc,
  909. numElements );
  910. }
  911. break;
  912. case 2:
  913. if (signedValue) {
  914. PDCINT16 pDst16Signed = (PDCINT16)pDst;
  915. COPY_DELTA_ARRAY( pDst16Signed,
  916. DCINT16,
  917. pSrc,
  918. numElements );
  919. }
  920. else {
  921. PDCUINT16 pDst16Unsigned = (PDCUINT16)pDst;
  922. COPY_DELTA_ARRAY( pDst16Unsigned,
  923. DCUINT16,
  924. pSrc,
  925. numElements );
  926. }
  927. break;
  928. case 4:
  929. if (signedValue) {
  930. PDCINT32 pDst32Signed = (PDCINT32)pDst;
  931. COPY_DELTA_ARRAY( pDst32Signed,
  932. DCINT32,
  933. pSrc,
  934. numElements );
  935. }
  936. else
  937. {
  938. PDCUINT32 pDst32Unsigned = (PDCUINT32)pDst;
  939. COPY_DELTA_ARRAY( pDst32Unsigned,
  940. DCUINT32,
  941. pSrc,
  942. numElements );
  943. }
  944. break;
  945. default:
  946. TRC_ERR((TB, _T("Bad destination field length %d"), dstFieldLength));
  947. break;
  948. }
  949. *ppSrc += numElements;
  950. DC_END_FN();
  951. }
  952. #endif // USE_VARIABLE_COORDS
  953. /****************************************************************************/
  954. /* Name: OD_DecodeOrder */
  955. /* */
  956. /* Purpose: Decodes an encoded order. */
  957. /* */
  958. /* Params: IN: ppEncodedOrderData - pointer to a pointer to the encoded */
  959. /* order data. */
  960. /* OUT: pLengthDecoded - pointer to a variable that receives */
  961. /* the amount of encoded order data used to produce the */
  962. /* decoded order. */
  963. /****************************************************************************/
  964. HRESULT DCAPI COD::OD_DecodeOrder(PPDCVOID ppEncodedOrderData,
  965. DCUINT uiEncodedDataLength, PUH_ORDER *ppOrder)
  966. {
  967. HRESULT hr = E_FAIL;
  968. BYTE FAR *pControlFlags;
  969. BYTE FAR *pNextDataToCopy;
  970. BYTE FAR *pDataEnd;
  971. PUINT32_UA pEncodingFlags;
  972. unsigned numEncodingFlagBytes;
  973. unsigned cZeroEncodingFlagBytes;
  974. unsigned encodedFieldLength;
  975. unsigned unencodedFieldLength;
  976. unsigned numReps;
  977. unsigned i;
  978. BYTE FAR *pDest;
  979. BYTE FAR *pLastOrderEnd;
  980. PUH_ORDER rc = NULL;
  981. UINT32 fieldChangedBits;
  982. const OD_ORDER_FIELD_INFO FAR *pTableEntry;
  983. DC_BEGIN_FN("OD_DecodeOrder");
  984. *ppOrder = NULL;
  985. pDataEnd = (PBYTE)*ppEncodedOrderData + uiEncodedDataLength;
  986. CHECK_READ_ONE_BYTE(*ppEncodedOrderData, pDataEnd, hr,
  987. (TB, _T("no data passed in")))
  988. // Control flags are always the first byte.
  989. pControlFlags = (BYTE FAR *)(*ppEncodedOrderData);
  990. // Check that the order has standard encoding.
  991. TRC_ASSERT((*pControlFlags & TS_STANDARD),
  992. (TB, _T("Non-standard encoding: %u"), (unsigned)*pControlFlags));
  993. TRC_ASSERT(!(*pControlFlags & TS_SECONDARY),
  994. (TB, _T("Unencoded: %u"), (unsigned)*pControlFlags));
  995. // If type has changed, new type will be first byte in encoded order.
  996. // Get pointer to last order of this type. The encoding flags follow
  997. // this byte (if it is present).
  998. if (*pControlFlags & TS_TYPE_CHANGE) {
  999. CHECK_READ_ONE_BYTE((pControlFlags + 1), pDataEnd, hr,
  1000. (TB, _T("no data passed in")))
  1001. TRC_DBG((TB, _T("Change type from %d to %d"), _OD.lastOrderType,
  1002. *(pControlFlags + 1)));
  1003. if (*(pControlFlags + 1) >= TS_MAX_ORDERS) {
  1004. TRC_ERR((TB, _T("Invalid order type %u"), *(pControlFlags + 1)));
  1005. hr = E_TSC_CORE_DECODETYPE;
  1006. DC_QUIT;
  1007. }
  1008. _OD.lastOrderType = *(pControlFlags + 1);
  1009. if (TS_MAX_ORDERS < _OD.lastOrderType) {
  1010. TRC_ABORT((TB, _T("invalid order type: %u"), _OD.lastOrderType));
  1011. hr = E_TSC_CORE_DECODETYPE;
  1012. DC_QUIT;
  1013. }
  1014. // SECURITY: use the cbMaxOrderLen to be sure this entry in the
  1015. // table is filled out
  1016. if (0 == odOrderTable[_OD.lastOrderType].cbMaxOrderLen) {
  1017. TRC_ABORT((TB, _T("invalid order type: %u"), _OD.lastOrderType));
  1018. hr = E_TSC_CORE_DECODETYPE;
  1019. DC_QUIT;
  1020. }
  1021. _OD.pLastOrder = odOrderTable[_OD.lastOrderType].LastOrder;
  1022. pEncodingFlags = (PUINT32_UA)(pControlFlags + 2);
  1023. }
  1024. else {
  1025. pEncodingFlags = (PUINT32_UA)(pControlFlags + 1);
  1026. }
  1027. TRC_DBG((TB, _T("Type %x"), _OD.lastOrderType));
  1028. #ifdef DC_HICOLOR
  1029. //#ifdef DC_DEBUG
  1030. /************************************************************************/
  1031. /* For high color testing, we want to confirm that we've received each */
  1032. /* of the order types */
  1033. /************************************************************************/
  1034. _OD.orderHit[_OD.lastOrderType] += 1;
  1035. //#endif
  1036. #endif
  1037. // Work out how many bytes are used to store the encoding flags for
  1038. // this order. There is a flag for each field in the order structure.
  1039. // For historical reasons, add 1 to the real number of fields before
  1040. // calculating. This means that the first byte of field flags can
  1041. // only contain 7 field bits.
  1042. numEncodingFlagBytes = (odOrderTable[_OD.lastOrderType].NumFields + 1 +
  1043. 7) / 8;
  1044. TRC_DBG((TB, _T("numEncodingFlagBytes %d"), numEncodingFlagBytes));
  1045. TRC_ASSERT((numEncodingFlagBytes <= 3),
  1046. (TB, _T("Too many flag bytes (%d)"), numEncodingFlagBytes));
  1047. // Find out how many zero bytes of encoding flags there are.
  1048. cZeroEncodingFlagBytes = (*pControlFlags & TS_ZERO_FIELD_COUNT_MASK) >>
  1049. TS_ZERO_FIELD_COUNT_SHIFT;
  1050. if (cZeroEncodingFlagBytes > numEncodingFlagBytes) {
  1051. TRC_ERR((TB, _T("Too many zero encoding flag bytes (%d)"),
  1052. cZeroEncodingFlagBytes));
  1053. hr = E_TSC_CORE_LENGTH;
  1054. DC_QUIT;
  1055. }
  1056. // Now we know how many bytes make up the flags we can get a pointer to
  1057. // where we start decoding the order data from.
  1058. pNextDataToCopy = (BYTE FAR *)pEncodingFlags + numEncodingFlagBytes -
  1059. cZeroEncodingFlagBytes;
  1060. // Now build up the order header.
  1061. // If a bounding rectangle is included, copy it into the order header.
  1062. if (*pControlFlags & TS_BOUNDS) {
  1063. BYTE FAR *pFlags;
  1064. // The encoding used is a byte of flags followed by a variable number
  1065. // of 16-bit coordinate values and 8-bit delta coordinate values
  1066. // (which may be interleaved).
  1067. // If there are zero bounds deltas then we are done.
  1068. if (!(*pControlFlags & TS_ZERO_BOUNDS_DELTAS)) {
  1069. // The first byte of the encoding will contain the flags that
  1070. // represent how the coordinates of the rectangle were encoded.
  1071. pFlags = pNextDataToCopy;
  1072. pNextDataToCopy++;
  1073. CHECK_READ_ONE_BYTE(pFlags, pDataEnd, hr,
  1074. (TB, _T("No data to read flags")))
  1075. // If the flags indicate that none of the coordinates have
  1076. // changed then we are done
  1077. if (*pFlags != 0) {
  1078. // For each of the four coordinate values in the rectangle:
  1079. // If the coordinate was encoded as an 8-bit delta then add
  1080. // on the delta to the previous value. If the coordinate
  1081. // was encoded as a 16-bit value then copy the value across.
  1082. // Otherwise the coordinate was the same as the previous one
  1083. // so leave it alone.
  1084. if (*pFlags & TS_BOUND_DELTA_LEFT) {
  1085. CHECK_READ_ONE_BYTE(pNextDataToCopy, pDataEnd, hr,
  1086. ( TB, _T("TS_BOUND_DELTA_LEFT; pData %u pEnd %u"),
  1087. pNextDataToCopy + 1, pDataEnd ))
  1088. _OD.lastBounds.left += (int)(*((char FAR *)
  1089. pNextDataToCopy));
  1090. pNextDataToCopy++;
  1091. }
  1092. else if (*pFlags & TS_BOUND_LEFT) {
  1093. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1094. sizeof(UINT16), hr,
  1095. ( TB, _T("TS_BOUND_LEFT; pData %u pEnd %u"),
  1096. pNextDataToCopy, pDataEnd ));
  1097. _OD.lastBounds.left = DC_EXTRACT_INT16_UA(pNextDataToCopy);
  1098. pNextDataToCopy += sizeof(UINT16);
  1099. }
  1100. if (*pFlags & TS_BOUND_DELTA_TOP) {
  1101. CHECK_READ_ONE_BYTE(pNextDataToCopy, pDataEnd, hr,
  1102. ( TB, _T("TS_BOUND_DELTA_TOP; pData %u pEnd %u"),
  1103. pNextDataToCopy + 1, pDataEnd ));
  1104. _OD.lastBounds.top += (int)(*((char FAR *)
  1105. pNextDataToCopy));
  1106. pNextDataToCopy++;
  1107. }
  1108. else if (*pFlags & TS_BOUND_TOP) {
  1109. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1110. sizeof(UINT16),hr,
  1111. ( TB, _T("TS_BOUND_TOP; pData %u pEnd %u"),
  1112. pNextDataToCopy, pDataEnd ));
  1113. _OD.lastBounds.top = DC_EXTRACT_INT16_UA(pNextDataToCopy);
  1114. pNextDataToCopy += sizeof(UINT16);
  1115. }
  1116. if (*pFlags & TS_BOUND_DELTA_RIGHT) {
  1117. CHECK_READ_ONE_BYTE(pNextDataToCopy, pDataEnd, hr,
  1118. ( TB, _T("TS_BOUND_DELTA_RIGHT; pData %u pEnd %u"),
  1119. pNextDataToCopy + 1, pDataEnd ));
  1120. _OD.lastBounds.right += (int)(*((char FAR *)
  1121. pNextDataToCopy));
  1122. pNextDataToCopy++;
  1123. }
  1124. else if (*pFlags & TS_BOUND_RIGHT) {
  1125. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1126. sizeof(UINT16), hr,
  1127. ( TB, _T("TS_BOUND_RIGHT; pData %u pEnd %u"),
  1128. pNextDataToCopy, pDataEnd ));
  1129. _OD.lastBounds.right = DC_EXTRACT_INT16_UA(
  1130. pNextDataToCopy);
  1131. pNextDataToCopy += sizeof(UINT16);
  1132. }
  1133. if (*pFlags & TS_BOUND_DELTA_BOTTOM) {
  1134. CHECK_READ_ONE_BYTE(pNextDataToCopy, pDataEnd, hr,
  1135. ( TB, _T("TS_BOUND_DELTA_BOTTOM; pData %u pEnd %u"),
  1136. pNextDataToCopy + 1, pDataEnd ));
  1137. _OD.lastBounds.bottom += (int)(*((char FAR *)
  1138. pNextDataToCopy));
  1139. pNextDataToCopy++;
  1140. }
  1141. else if (*pFlags & TS_BOUND_BOTTOM) {
  1142. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd, sizeof(UINT16),
  1143. hr, ( TB, _T("TS_BOUND_BOTTOM; pData %u pEnd %u"),
  1144. pNextDataToCopy, pDataEnd ));
  1145. _OD.lastBounds.bottom = DC_EXTRACT_INT16_UA(
  1146. pNextDataToCopy);
  1147. pNextDataToCopy += sizeof(UINT16);
  1148. }
  1149. }
  1150. }
  1151. // Copy the (possibly newly calculated) bounds to the order header.
  1152. _OD.pLastOrder->dstRect = _OD.lastBounds;
  1153. TRC_NRM((TB, _T("Decoded bounds l %d t %d r %d b %d"),
  1154. _OD.pLastOrder->dstRect.left, _OD.pLastOrder->dstRect.top,
  1155. _OD.pLastOrder->dstRect.right, _OD.pLastOrder->dstRect.bottom));
  1156. }
  1157. // Locate the entry in the decoding table for this order type and
  1158. // extract the encoded order flags from the encoded order.
  1159. fieldChangedBits = 0;
  1160. for (i = (numEncodingFlagBytes - cZeroEncodingFlagBytes); i > 0; i--) {
  1161. fieldChangedBits <<= 8;
  1162. fieldChangedBits |= (UINT32)((BYTE FAR *)pEncodingFlags)[i - 1];
  1163. }
  1164. // If there is a fast-path decode function, use it.
  1165. // Fast-path decode functions also do the order handling once decoded.
  1166. // They must set pOrder->dstRect if (ControlFlags & TS_BOUNDS) == 0.
  1167. if (odOrderTable[_OD.lastOrderType].pFastDecode != NULL) {
  1168. hr = callMemberFunction(*this,
  1169. odOrderTable[_OD.lastOrderType].pFastDecode)(*pControlFlags,
  1170. &pNextDataToCopy, pDataEnd - pNextDataToCopy, fieldChangedBits);
  1171. DC_QUIT_ON_FAIL(hr);
  1172. goto PostFastPathDecode;
  1173. }
  1174. // Now decode the order:
  1175. // while field changed bits are non-zero
  1176. // if rightmost bit is non-zero
  1177. // decode the corresponding changed field
  1178. // skip to next entry in decoding table
  1179. // shift field changed bits right one bit
  1180. pTableEntry = odOrderTable[_OD.lastOrderType].pOrderTable;
  1181. pLastOrderEnd = (BYTE FAR *)_OD.pLastOrder +
  1182. odOrderTable[_OD.lastOrderType].cbMaxOrderLen;
  1183. TRC_ASSERT((pTableEntry != NULL),
  1184. (TB,_T("Unsupported order type %d received!"), _OD.lastOrderType));
  1185. while (fieldChangedBits != 0) {
  1186. // If this field was encoded (ie changed since the last order)...
  1187. if (fieldChangedBits & 0x1) {
  1188. // Set up a pointer to the destination (unencoded) field.
  1189. pDest = (BYTE FAR *)_OD.pLastOrder + pTableEntry->fieldPos +
  1190. UH_ORDER_HEADER_SIZE;
  1191. // If the field type is OD_OFI_TYPE_DATA, we just copy the
  1192. // number of bytes given by the encoded length in the table.
  1193. if (pTableEntry->fieldType & OD_OFI_TYPE_DATA) {
  1194. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1195. pTableEntry->fieldEncodedLen, hr,
  1196. ( TB, _T("OD_OFI_TYPE_DATA; pData %u pEnd %u"),
  1197. pNextDataToCopy + pTableEntry->fieldEncodedLen, pDataEnd));
  1198. CHECK_WRITE_N_BYTES(pDest, pLastOrderEnd,
  1199. pTableEntry->fieldEncodedLen, hr,
  1200. (TB, _T("Decode past end of buffer")));
  1201. memcpy(pDest, pNextDataToCopy, pTableEntry->fieldEncodedLen);
  1202. pNextDataToCopy += pTableEntry->fieldEncodedLen;
  1203. TRC_TST((TB, _T("Byte data field, len %d"), numReps));
  1204. }
  1205. else {
  1206. // This is not a straightforward data copy. The length of
  1207. // the source and destination data is given in the table in
  1208. // the fieldEncodedLen and fieldUnencodedLen elements
  1209. // respectively.
  1210. encodedFieldLength = pTableEntry->fieldEncodedLen;
  1211. unencodedFieldLength = pTableEntry->fieldUnencodedLen;
  1212. // If the order was encoded using delta coordinate mode and
  1213. // this field is a coordinate then convert the coordinate from
  1214. // the single byte sized delta to a value of the size given by
  1215. // unencodedFieldLen...
  1216. // Note that we've already handled the leading length field of
  1217. // variable length fields above, so we don't have to worry
  1218. // about fixed/variable issues here.
  1219. if ((*pControlFlags & TS_DELTA_COORDINATES) &&
  1220. (pTableEntry->fieldType & OD_OFI_TYPE_COORDINATES)) {
  1221. // Since we are not using variable-length coord fields,
  1222. // we can fast-path with an assumption that the source is
  1223. // length 1. Also, all coord fields are currently
  1224. // signed and destination size is always 4, so we can drop
  1225. // more branches.
  1226. if (!(pTableEntry->fieldType & OD_OFI_TYPE_SIGNED)) {
  1227. TRC_ABORT((TB,_T("Someone added a non-signed COORD")
  1228. _T(" field - order type %u"), _OD.lastOrderType));
  1229. hr = E_TSC_CORE_LENGTH;
  1230. DC_QUIT;
  1231. }
  1232. if (pTableEntry->fieldUnencodedLen != 4) {
  1233. TRC_ABORT((TB,_T("Someone added a non-4-byte COORD")
  1234. _T(" field - order type %u"), _OD.lastOrderType));
  1235. hr = E_TSC_CORE_LENGTH;
  1236. DC_QUIT;
  1237. }
  1238. CHECK_READ_ONE_BYTE(pNextDataToCopy, pDataEnd, hr,( TB,
  1239. _T("Reading destination offset past data end")));
  1240. CHECK_WRITE_N_BYTES(pDest, pLastOrderEnd, sizeof(INT32), hr,
  1241. (TB, _T("Decode past end of buffer")));
  1242. *((INT32 FAR *)pDest) += *((char FAR *)pNextDataToCopy);
  1243. pNextDataToCopy++;
  1244. #ifdef USE_VARIABLE_COORDS
  1245. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1246. (numReps * sizeof(BYTE)), hr,
  1247. ( TB, _T("Bad offset into lastOrder")));
  1248. CHECK_WRITE_N_BYTES(pDest, pLastOrderEnd,
  1249. pTableEntry->fieldUnencodedLen, hr,
  1250. (TB, _T("decode off end of buffer" )));
  1251. ODCopyFromDeltaCoords((PPDCINT8)&pNextDataToCopy,
  1252. pDest, pTableEntry->fieldUnencodedLen,
  1253. pTableEntry->fieldType & OD_OFI_TYPE_SIGNED,
  1254. numReps);
  1255. #endif
  1256. }
  1257. else {
  1258. if (pTableEntry->fieldType & OD_OFI_TYPE_FIXED) {
  1259. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1260. pTableEntry->fieldEncodedLen, hr,
  1261. ( TB, _T("OD_OFI_TYPE_FIXED; pData %u pEnd %u"),
  1262. pNextDataToCopy + pTableEntry->fieldEncodedLen,
  1263. pDataEnd));
  1264. CHECK_READ_N_BYTES(pDest, pLastOrderEnd,
  1265. pTableEntry->fieldUnencodedLen, hr,
  1266. ( TB, _T("Bad offset into lastOrder")));
  1267. // Copy the field with appropriate field size conversion.
  1268. hr = ODDecodeFieldSingle(&pNextDataToCopy, pDest,
  1269. pTableEntry->fieldEncodedLen,
  1270. pTableEntry->fieldUnencodedLen,
  1271. pTableEntry->fieldType & OD_OFI_TYPE_SIGNED);
  1272. DC_QUIT_ON_FAIL(hr);
  1273. }
  1274. else {
  1275. // We assume that variable entries are only bytes
  1276. // (dest size = 1).
  1277. if(pTableEntry->fieldUnencodedLen != 1 ||
  1278. pTableEntry->fieldEncodedLen != 1) {
  1279. TRC_ABORT((TB,_T("Somebody added a variable field with ")
  1280. _T("non-byte contents - order type %u"),
  1281. _OD.lastOrderType));
  1282. hr = E_TSC_CORE_LENGTH;
  1283. DC_QUIT;
  1284. }
  1285. // This is a variable length field - see if it's long or
  1286. // short.
  1287. if (!(pTableEntry->fieldType &
  1288. OD_OFI_TYPE_LONG_VARIABLE)) {
  1289. CHECK_READ_ONE_BYTE(pNextDataToCopy, pDataEnd, hr,
  1290. ( TB, _T("Reading numReps (BYTE)")));
  1291. // This is a variable field. The next byte to be
  1292. // decoded contains the number of BYTES of encoded
  1293. // data (not elements), so divide by the encoded
  1294. // field size to get numReps.
  1295. numReps = *pNextDataToCopy;
  1296. // (/ pTableEntry->fieldEncodedLen) - bytes only
  1297. // Step past the length field in the encoded order.
  1298. pNextDataToCopy++;
  1299. }
  1300. else {
  1301. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd,
  1302. sizeof(UINT16), hr,
  1303. ( TB, _T("Reading numReps (UINT16)")));
  1304. // This is a long variable field. The next two
  1305. // bytes to be decoded contain the number of BYTES
  1306. // of encoded data (not elements), so divide by the
  1307. // encoded field size to get numReps.
  1308. numReps = *((PUINT16_UA)pNextDataToCopy);
  1309. // (/ pTableEntry->fieldEncodedLen) - bytes only
  1310. // Step past the length field in the encoded order.
  1311. pNextDataToCopy += sizeof(UINT16);
  1312. }
  1313. TRC_TST((TB, _T("Var field: encoded size %d, unencoded ")
  1314. "size %d, reps %d", pTableEntry->fieldEncodedLen,
  1315. pTableEntry->fieldUnencodedLen, numReps));
  1316. // Cast from unsigned to UINT16 is safe since the numReps read above
  1317. // is no more than a UINT16
  1318. odOrderTable[_OD.lastOrderType].cbVariableDataLen = (UINT16)numReps;
  1319. // For a variable length field, the unencoded version
  1320. // contains a UINT32 for the length (in bytes) of the
  1321. // following variable data, followed by the actual
  1322. // data. Fill in the length field in the unencoded
  1323. // order.
  1324. *(PUINT32)pDest = numReps; // (* pTableEntry->fieldUnencodedLen)
  1325. pDest += sizeof(UINT32);
  1326. CHECK_READ_N_BYTES(pNextDataToCopy, pDataEnd, numReps,
  1327. hr, ( TB, _T("Reading numReps past end of data")));
  1328. CHECK_WRITE_N_BYTES(pDest, pLastOrderEnd, numReps, hr,
  1329. ( TB,
  1330. _T("Writing numReps bytes past end of last order")));
  1331. // We assume that variable entries are only bytes
  1332. // (dest size = 1), since no one is using anything longer.
  1333. memcpy(pDest, pNextDataToCopy, numReps);
  1334. pNextDataToCopy += numReps;
  1335. }
  1336. }
  1337. }
  1338. }
  1339. // Move on to the next field in the order structure...
  1340. fieldChangedBits >>= 1;
  1341. pTableEntry++;
  1342. }
  1343. // Pass to the order handler (non-fast-path). These functions must set
  1344. // pOrder->dstRect to the bounding rect of the entire operation if
  1345. // bBoundsSet is FALSE, and set the clip region appropriately.
  1346. TRC_ASSERT((odOrderTable[_OD.lastOrderType].pHandler != NULL),
  1347. (TB,_T("Fast-path decoder and order handler funcs both NULL (ord=%u)"),
  1348. _OD.lastOrderType));
  1349. hr = callMemberFunction(*this, odOrderTable[_OD.lastOrderType].pHandler)(
  1350. _OD.pLastOrder, odOrderTable[_OD.lastOrderType].cbVariableDataLen,
  1351. *pControlFlags & TS_BOUNDS);
  1352. DC_QUIT_ON_FAIL(hr);
  1353. PostFastPathDecode:
  1354. // Update the source pointer to the start of the next encoded order.
  1355. TRC_ASSERT( (DCUINT)(pNextDataToCopy - (BYTE*)(*ppEncodedOrderData)) <= uiEncodedDataLength,
  1356. (TB, _T("Decoded more data than available")));
  1357. *ppEncodedOrderData = (PDCVOID)pNextDataToCopy;
  1358. TRC_DBG((TB, _T("Return %p"), *ppEncodedOrderData));
  1359. *ppOrder = _OD.pLastOrder;
  1360. DC_EXIT_POINT:
  1361. DC_END_FN();
  1362. return hr;
  1363. }