cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

primary.h (11761B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * Primary 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 FREERDP_UPDATE_PRIMARY_H
     21#define FREERDP_UPDATE_PRIMARY_H
     22
     23#include <freerdp/types.h>
     24
     25struct _GLYPH_DATA
     26{
     27	UINT32 cacheIndex;
     28	INT16 x;
     29	INT16 y;
     30	UINT32 cx;
     31	UINT32 cy;
     32	UINT32 cb;
     33	BYTE* aj;
     34};
     35typedef struct _GLYPH_DATA GLYPH_DATA;
     36
     37struct _GLYPH_DATA_V2
     38{
     39	UINT32 cacheIndex;
     40	INT32 x;
     41	INT32 y;
     42	UINT32 cx;
     43	UINT32 cy;
     44	UINT32 cb;
     45	BYTE* aj;
     46};
     47typedef struct _GLYPH_DATA_V2 GLYPH_DATA_V2;
     48
     49#define BACKMODE_TRANSPARENT 0x0001
     50#define BACKMODE_OPAQUE 0x0002
     51
     52struct rdp_bounds
     53{
     54	INT32 left;
     55	INT32 top;
     56	INT32 right;
     57	INT32 bottom;
     58};
     59typedef struct rdp_bounds rdpBounds;
     60
     61struct rdp_brush
     62{
     63	UINT32 x;
     64	UINT32 y;
     65	UINT32 bpp;
     66	UINT32 style;
     67	UINT32 hatch;
     68	UINT32 index;
     69	BYTE* data;
     70	BYTE p8x8[8];
     71};
     72typedef struct rdp_brush rdpBrush;
     73
     74struct _ORDER_INFO
     75{
     76	UINT32 controlFlags;
     77	UINT32 orderType;
     78	UINT32 fieldFlags;
     79	UINT32 boundsFlags;
     80	rdpBounds bounds;
     81	BOOL deltaCoordinates;
     82};
     83typedef struct _ORDER_INFO ORDER_INFO;
     84
     85struct _DSTBLT_ORDER
     86{
     87	INT32 nLeftRect;
     88	INT32 nTopRect;
     89	INT32 nWidth;
     90	INT32 nHeight;
     91	UINT32 bRop;
     92};
     93typedef struct _DSTBLT_ORDER DSTBLT_ORDER;
     94
     95struct _PATBLT_ORDER
     96{
     97	INT32 nLeftRect;
     98	INT32 nTopRect;
     99	INT32 nWidth;
    100	INT32 nHeight;
    101	UINT32 bRop;
    102	UINT32 backColor;
    103	UINT32 foreColor;
    104	rdpBrush brush;
    105};
    106typedef struct _PATBLT_ORDER PATBLT_ORDER;
    107
    108struct _SCRBLT_ORDER
    109{
    110	INT32 nLeftRect;
    111	INT32 nTopRect;
    112	INT32 nWidth;
    113	INT32 nHeight;
    114	UINT32 bRop;
    115	INT32 nXSrc;
    116	INT32 nYSrc;
    117};
    118typedef struct _SCRBLT_ORDER SCRBLT_ORDER;
    119
    120struct _OPAQUE_RECT_ORDER
    121{
    122	INT32 nLeftRect;
    123	INT32 nTopRect;
    124	INT32 nWidth;
    125	INT32 nHeight;
    126	UINT32 color;
    127};
    128typedef struct _OPAQUE_RECT_ORDER OPAQUE_RECT_ORDER;
    129
    130struct _DRAW_NINE_GRID_ORDER
    131{
    132	INT32 srcLeft;
    133	INT32 srcTop;
    134	INT32 srcRight;
    135	INT32 srcBottom;
    136	UINT32 bitmapId;
    137};
    138typedef struct _DRAW_NINE_GRID_ORDER DRAW_NINE_GRID_ORDER;
    139
    140struct _DELTA_RECT
    141{
    142	INT32 left;
    143	INT32 top;
    144	INT32 width;
    145	INT32 height;
    146};
    147typedef struct _DELTA_RECT DELTA_RECT;
    148
    149struct _MULTI_DSTBLT_ORDER
    150{
    151	INT32 nLeftRect;
    152	INT32 nTopRect;
    153	INT32 nWidth;
    154	INT32 nHeight;
    155	UINT32 bRop;
    156	UINT32 numRectangles;
    157	UINT32 cbData;
    158	DELTA_RECT rectangles[45];
    159};
    160typedef struct _MULTI_DSTBLT_ORDER MULTI_DSTBLT_ORDER;
    161
    162struct _MULTI_PATBLT_ORDER
    163{
    164	INT32 nLeftRect;
    165	INT32 nTopRect;
    166	INT32 nWidth;
    167	INT32 nHeight;
    168	UINT32 bRop;
    169	UINT32 backColor;
    170	UINT32 foreColor;
    171	rdpBrush brush;
    172	UINT32 numRectangles;
    173	UINT32 cbData;
    174	DELTA_RECT rectangles[45];
    175};
    176typedef struct _MULTI_PATBLT_ORDER MULTI_PATBLT_ORDER;
    177
    178struct _MULTI_SCRBLT_ORDER
    179{
    180	INT32 nLeftRect;
    181	INT32 nTopRect;
    182	INT32 nWidth;
    183	INT32 nHeight;
    184	UINT32 bRop;
    185	INT32 nXSrc;
    186	INT32 nYSrc;
    187	UINT32 numRectangles;
    188	UINT32 cbData;
    189	DELTA_RECT rectangles[45];
    190};
    191typedef struct _MULTI_SCRBLT_ORDER MULTI_SCRBLT_ORDER;
    192
    193struct _MULTI_OPAQUE_RECT_ORDER
    194{
    195	INT32 nLeftRect;
    196	INT32 nTopRect;
    197	INT32 nWidth;
    198	INT32 nHeight;
    199	UINT32 color;
    200	UINT32 numRectangles;
    201	UINT32 cbData;
    202	DELTA_RECT rectangles[45];
    203};
    204typedef struct _MULTI_OPAQUE_RECT_ORDER MULTI_OPAQUE_RECT_ORDER;
    205
    206struct _MULTI_DRAW_NINE_GRID_ORDER
    207{
    208	INT32 srcLeft;
    209	INT32 srcTop;
    210	INT32 srcRight;
    211	INT32 srcBottom;
    212	UINT32 bitmapId;
    213	UINT32 nDeltaEntries;
    214	UINT32 cbData;
    215	DELTA_RECT rectangles[45];
    216};
    217typedef struct _MULTI_DRAW_NINE_GRID_ORDER MULTI_DRAW_NINE_GRID_ORDER;
    218
    219struct _LINE_TO_ORDER
    220{
    221	UINT32 backMode;
    222	INT32 nXStart;
    223	INT32 nYStart;
    224	INT32 nXEnd;
    225	INT32 nYEnd;
    226	UINT32 backColor;
    227	UINT32 bRop2;
    228	UINT32 penStyle;
    229	UINT32 penWidth;
    230	UINT32 penColor;
    231};
    232typedef struct _LINE_TO_ORDER LINE_TO_ORDER;
    233
    234struct _DELTA_POINT
    235{
    236	INT32 x;
    237	INT32 y;
    238};
    239typedef struct _DELTA_POINT DELTA_POINT;
    240
    241struct _POLYLINE_ORDER
    242{
    243	INT32 xStart;
    244	INT32 yStart;
    245	UINT32 bRop2;
    246	UINT32 penColor;
    247	UINT32 numDeltaEntries;
    248	UINT32 cbData;
    249	DELTA_POINT* points;
    250};
    251typedef struct _POLYLINE_ORDER POLYLINE_ORDER;
    252
    253struct _MEMBLT_ORDER
    254{
    255	UINT32 cacheId;
    256	UINT32 colorIndex;
    257	INT32 nLeftRect;
    258	INT32 nTopRect;
    259	INT32 nWidth;
    260	INT32 nHeight;
    261	UINT32 bRop;
    262	INT32 nXSrc;
    263	INT32 nYSrc;
    264	UINT32 cacheIndex;
    265	rdpBitmap* bitmap;
    266};
    267typedef struct _MEMBLT_ORDER MEMBLT_ORDER;
    268
    269struct _MEM3BLT_ORDER
    270{
    271	UINT32 cacheId;
    272	UINT32 colorIndex;
    273	INT32 nLeftRect;
    274	INT32 nTopRect;
    275	INT32 nWidth;
    276	INT32 nHeight;
    277	UINT32 bRop;
    278	INT32 nXSrc;
    279	INT32 nYSrc;
    280	UINT32 backColor;
    281	UINT32 foreColor;
    282	rdpBrush brush;
    283	UINT32 cacheIndex;
    284	rdpBitmap* bitmap;
    285};
    286typedef struct _MEM3BLT_ORDER MEM3BLT_ORDER;
    287
    288struct _SAVE_BITMAP_ORDER
    289{
    290	UINT32 savedBitmapPosition;
    291	INT32 nLeftRect;
    292	INT32 nTopRect;
    293	INT32 nRightRect;
    294	INT32 nBottomRect;
    295	UINT32 operation;
    296};
    297typedef struct _SAVE_BITMAP_ORDER SAVE_BITMAP_ORDER;
    298
    299struct _GLYPH_FRAGMENT_INDEX
    300{
    301	UINT32 index;
    302	UINT32 delta;
    303};
    304typedef struct _GLYPH_FRAGMENT_INDEX GLYPH_FRAGMENT_INDEX;
    305
    306struct _GLYPH_FRAGMENT
    307{
    308	UINT32 operation;
    309	UINT32 index;
    310	UINT32 size;
    311	UINT32 nindices;
    312	GLYPH_FRAGMENT_INDEX* indices;
    313};
    314typedef struct _GLYPH_FRAGMENT GLYPH_FRAGMENT;
    315
    316struct _GLYPH_INDEX_ORDER
    317{
    318	UINT32 cacheId;
    319	UINT32 flAccel;
    320	UINT32 ulCharInc;
    321	UINT32 fOpRedundant;
    322	UINT32 backColor;
    323	UINT32 foreColor;
    324	INT32 bkLeft;
    325	INT32 bkTop;
    326	INT32 bkRight;
    327	INT32 bkBottom;
    328	INT32 opLeft;
    329	INT32 opTop;
    330	INT32 opRight;
    331	INT32 opBottom;
    332	rdpBrush brush;
    333	INT32 x;
    334	INT32 y;
    335	UINT32 cbData;
    336	BYTE data[256];
    337};
    338typedef struct _GLYPH_INDEX_ORDER GLYPH_INDEX_ORDER;
    339
    340struct _FAST_INDEX_ORDER
    341{
    342	UINT32 cacheId;
    343	UINT32 flAccel;
    344	UINT32 ulCharInc;
    345	UINT32 backColor;
    346	UINT32 foreColor;
    347	INT32 bkLeft;
    348	INT32 bkTop;
    349	INT32 bkRight;
    350	INT32 bkBottom;
    351	INT32 opLeft;
    352	INT32 opTop;
    353	INT32 opRight;
    354	INT32 opBottom;
    355	BOOL opaqueRect;
    356	INT32 x;
    357	INT32 y;
    358	UINT32 cbData;
    359	BYTE data[256];
    360};
    361typedef struct _FAST_INDEX_ORDER FAST_INDEX_ORDER;
    362
    363struct _FAST_GLYPH_ORDER
    364{
    365	UINT32 cacheId;
    366	UINT32 flAccel;
    367	UINT32 ulCharInc;
    368	UINT32 backColor;
    369	UINT32 foreColor;
    370	INT32 bkLeft;
    371	INT32 bkTop;
    372	INT32 bkRight;
    373	INT32 bkBottom;
    374	INT32 opLeft;
    375	INT32 opTop;
    376	INT32 opRight;
    377	INT32 opBottom;
    378	INT32 x;
    379	INT32 y;
    380	UINT32 cbData;
    381	BYTE data[256];
    382	GLYPH_DATA_V2 glyphData;
    383};
    384typedef struct _FAST_GLYPH_ORDER FAST_GLYPH_ORDER;
    385
    386struct _POLYGON_SC_ORDER
    387{
    388	INT32 xStart;
    389	INT32 yStart;
    390	UINT32 bRop2;
    391	UINT32 fillMode;
    392	UINT32 brushColor;
    393	UINT32 numPoints;
    394	UINT32 cbData;
    395	DELTA_POINT* points;
    396};
    397typedef struct _POLYGON_SC_ORDER POLYGON_SC_ORDER;
    398
    399struct _POLYGON_CB_ORDER
    400{
    401	INT32 xStart;
    402	INT32 yStart;
    403	UINT32 bRop2;
    404	UINT32 backMode;
    405	UINT32 fillMode;
    406	UINT32 backColor;
    407	UINT32 foreColor;
    408	rdpBrush brush;
    409	UINT32 numPoints;
    410	UINT32 cbData;
    411	DELTA_POINT* points;
    412};
    413typedef struct _POLYGON_CB_ORDER POLYGON_CB_ORDER;
    414
    415struct _ELLIPSE_SC_ORDER
    416{
    417	INT32 leftRect;
    418	INT32 topRect;
    419	INT32 rightRect;
    420	INT32 bottomRect;
    421	UINT32 bRop2;
    422	UINT32 fillMode;
    423	UINT32 color;
    424};
    425typedef struct _ELLIPSE_SC_ORDER ELLIPSE_SC_ORDER;
    426
    427struct _ELLIPSE_CB_ORDER
    428{
    429	INT32 leftRect;
    430	INT32 topRect;
    431	INT32 rightRect;
    432	INT32 bottomRect;
    433	UINT32 bRop2;
    434	UINT32 fillMode;
    435	UINT32 backColor;
    436	UINT32 foreColor;
    437	rdpBrush brush;
    438};
    439typedef struct _ELLIPSE_CB_ORDER ELLIPSE_CB_ORDER;
    440
    441typedef BOOL (*pDstBlt)(rdpContext* context, const DSTBLT_ORDER* dstblt);
    442typedef BOOL (*pPatBlt)(rdpContext* context, PATBLT_ORDER* patblt);
    443typedef BOOL (*pScrBlt)(rdpContext* context, const SCRBLT_ORDER* scrblt);
    444typedef BOOL (*pOpaqueRect)(rdpContext* context, const OPAQUE_RECT_ORDER* opaque_rect);
    445typedef BOOL (*pDrawNineGrid)(rdpContext* context, const DRAW_NINE_GRID_ORDER* draw_nine_grid);
    446typedef BOOL (*pMultiDstBlt)(rdpContext* context, const MULTI_DSTBLT_ORDER* multi_dstblt);
    447typedef BOOL (*pMultiPatBlt)(rdpContext* context, const MULTI_PATBLT_ORDER* multi_patblt);
    448typedef BOOL (*pMultiScrBlt)(rdpContext* context, const MULTI_SCRBLT_ORDER* multi_scrblt);
    449typedef BOOL (*pMultiOpaqueRect)(rdpContext* context,
    450                                 const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
    451typedef BOOL (*pMultiDrawNineGrid)(rdpContext* context,
    452                                   const MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
    453typedef BOOL (*pLineTo)(rdpContext* context, const LINE_TO_ORDER* line_to);
    454typedef BOOL (*pPolyline)(rdpContext* context, const POLYLINE_ORDER* polyline);
    455typedef BOOL (*pMemBlt)(rdpContext* context, MEMBLT_ORDER* memblt);
    456typedef BOOL (*pMem3Blt)(rdpContext* context, MEM3BLT_ORDER* memblt);
    457typedef BOOL (*pSaveBitmap)(rdpContext* context, const SAVE_BITMAP_ORDER* save_bitmap);
    458typedef BOOL (*pGlyphIndex)(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index);
    459typedef BOOL (*pFastIndex)(rdpContext* context, const FAST_INDEX_ORDER* fast_index);
    460typedef BOOL (*pFastGlyph)(rdpContext* context, const FAST_GLYPH_ORDER* fast_glyph);
    461typedef BOOL (*pPolygonSC)(rdpContext* context, const POLYGON_SC_ORDER* polygon_sc);
    462typedef BOOL (*pPolygonCB)(rdpContext* context, POLYGON_CB_ORDER* polygon_cb);
    463typedef BOOL (*pEllipseSC)(rdpContext* context, const ELLIPSE_SC_ORDER* ellipse_sc);
    464typedef BOOL (*pEllipseCB)(rdpContext* context, const ELLIPSE_CB_ORDER* ellipse_cb);
    465typedef BOOL (*pOrderInfo)(rdpContext* context, const ORDER_INFO* order_info,
    466                           const char* order_name);
    467
    468struct rdp_primary_update
    469{
    470	rdpContext* context;     /* 0 */
    471	UINT32 paddingA[16 - 1]; /* 1 */
    472
    473	pDstBlt DstBlt;                       /* 16 */
    474	pPatBlt PatBlt;                       /* 17 */
    475	pScrBlt ScrBlt;                       /* 18 */
    476	pOpaqueRect OpaqueRect;               /* 19 */
    477	pDrawNineGrid DrawNineGrid;           /* 20 */
    478	pMultiDstBlt MultiDstBlt;             /* 21 */
    479	pMultiPatBlt MultiPatBlt;             /* 22 */
    480	pMultiScrBlt MultiScrBlt;             /* 23 */
    481	pMultiOpaqueRect MultiOpaqueRect;     /* 24 */
    482	pMultiDrawNineGrid MultiDrawNineGrid; /* 25 */
    483	pLineTo LineTo;                       /* 26 */
    484	pPolyline Polyline;                   /* 27 */
    485	pMemBlt MemBlt;                       /* 28 */
    486	pMem3Blt Mem3Blt;                     /* 29 */
    487	pSaveBitmap SaveBitmap;               /* 30 */
    488	pGlyphIndex GlyphIndex;               /* 31 */
    489	pFastIndex FastIndex;                 /* 32 */
    490	pFastGlyph FastGlyph;                 /* 33 */
    491	pPolygonSC PolygonSC;                 /* 34 */
    492	pPolygonCB PolygonCB;                 /* 35 */
    493	pEllipseSC EllipseSC;                 /* 36 */
    494	pEllipseCB EllipseCB;                 /* 37 */
    495	/* Statistics callback */
    496	pOrderInfo OrderInfo;     /* 38 */
    497	UINT32 paddingB[48 - 39]; /* 39 */
    498
    499	/* internal */
    500
    501	ORDER_INFO order_info;
    502	DSTBLT_ORDER dstblt;
    503	PATBLT_ORDER patblt;
    504	SCRBLT_ORDER scrblt;
    505	OPAQUE_RECT_ORDER opaque_rect;
    506	DRAW_NINE_GRID_ORDER draw_nine_grid;
    507	MULTI_DSTBLT_ORDER multi_dstblt;
    508	MULTI_PATBLT_ORDER multi_patblt;
    509	MULTI_SCRBLT_ORDER multi_scrblt;
    510	MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
    511	MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
    512	LINE_TO_ORDER line_to;
    513	POLYLINE_ORDER polyline;
    514	MEMBLT_ORDER memblt;
    515	MEM3BLT_ORDER mem3blt;
    516	SAVE_BITMAP_ORDER save_bitmap;
    517	GLYPH_INDEX_ORDER glyph_index;
    518	FAST_INDEX_ORDER fast_index;
    519	FAST_GLYPH_ORDER fast_glyph;
    520	POLYGON_SC_ORDER polygon_sc;
    521	POLYGON_CB_ORDER polygon_cb;
    522	ELLIPSE_SC_ORDER ellipse_sc;
    523	ELLIPSE_CB_ORDER ellipse_cb;
    524};
    525typedef struct rdp_primary_update rdpPrimaryUpdate;
    526
    527#endif /* FREERDP_UPDATE_PRIMARY_H */