~ubuntu-branches/ubuntu/vivid/freerdp/vivid

« back to all changes in this revision

Viewing changes to libfreerdp/gdi/16bpp.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-11-11 12:20:50 UTC
  • mfrom: (1.2.5)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20141111122050-7z628f4ab38qxad5
Tags: upstream-1.1.0~git20140921.1.440916e+dfsg1
ImportĀ upstreamĀ versionĀ 1.1.0~git20140921.1.440916e+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * FreeRDP: A Remote Desktop Protocol Implementation
 
3
 * GDI 16bpp Internal Buffer Routines
 
4
 *
 
5
 * Copyright 2010-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
#ifdef HAVE_CONFIG_H
 
21
#include "config.h"
 
22
#endif
 
23
 
 
24
#include <stdio.h>
 
25
#include <string.h>
 
26
#include <stdlib.h>
 
27
 
 
28
#include <freerdp/api.h>
 
29
#include <freerdp/freerdp.h>
 
30
#include <freerdp/gdi/gdi.h>
 
31
#include <freerdp/codec/color.h>
 
32
 
 
33
#include <freerdp/gdi/pen.h>
 
34
#include <freerdp/gdi/bitmap.h>
 
35
#include <freerdp/gdi/region.h>
 
36
#include <freerdp/gdi/clipping.h>
 
37
#include <freerdp/gdi/drawing.h>
 
38
 
 
39
#include <freerdp/gdi/16bpp.h>
 
40
 
 
41
UINT16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color)
 
42
{
 
43
        BYTE r, g, b;
 
44
        UINT16 color16;
 
45
 
 
46
        GetBGR32(r, g, b, color);
 
47
 
 
48
        if (hdc->rgb555)
 
49
        {
 
50
                if (hdc->invert)
 
51
                {
 
52
                        color16 = BGR15(r, g, b);
 
53
                }
 
54
                else
 
55
                {
 
56
                        color16 = RGB15(r, g, b);
 
57
                }
 
58
        }
 
59
        else
 
60
        {
 
61
                if (hdc->invert)
 
62
                {
 
63
                        color16 = BGR16(r, g, b);
 
64
                }
 
65
                else
 
66
                {
 
67
                        color16 = RGB16(r, g, b);
 
68
                }
 
69
        }
 
70
 
 
71
        return color16;
 
72
}
 
73
 
 
74
int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
 
75
{
 
76
        int x, y;
 
77
        UINT16 *dstp;
 
78
        int nXDest, nYDest;
 
79
        int nWidth, nHeight;
 
80
 
 
81
        UINT16 color16;
 
82
        
 
83
        gdi_RectToCRgn(rect, &nXDest, &nYDest, &nWidth, &nHeight);
 
84
        
 
85
        if (gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0)
 
86
                return 0;
 
87
 
 
88
        color16 = gdi_get_color_16bpp(hdc, hbr->color);
 
89
 
 
90
        for (y = 0; y < nHeight; y++)
 
91
        {
 
92
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y);
 
93
 
 
94
                if (dstp != 0)
 
95
                {
 
96
                        for (x = 0; x < nWidth; x++)
 
97
                        {
 
98
                                *dstp = color16;
 
99
                                dstp++;
 
100
                        }
 
101
                }
 
102
        }
 
103
 
 
104
        gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight);
 
105
        return 0;
 
106
}
 
107
 
 
108
static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
109
{
 
110
        int y;
 
111
        BYTE* dstp;
 
112
 
 
113
        for (y = 0; y < nHeight; y++)
 
114
        {
 
115
                dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
116
 
 
117
                if (dstp != 0)
 
118
                        memset(dstp, 0, nWidth * hdcDest->bytesPerPixel);
 
119
        }
 
120
 
 
121
        return 0;
 
122
}
 
123
 
 
124
static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
125
{
 
126
        int y;
 
127
        BYTE* dstp;
 
128
        
 
129
        for (y = 0; y < nHeight; y++)
 
130
        {
 
131
                dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
132
 
 
133
                if (dstp != 0)
 
134
                        memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel);
 
135
        }
 
136
 
 
137
        return 0;
 
138
}
 
139
 
 
140
static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
141
{
 
142
        int y;
 
143
        BYTE* srcp;
 
144
        BYTE* dstp;
 
145
 
 
146
        if ((hdcDest->selectedObject != hdcSrc->selectedObject) ||
 
147
            gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0)
 
148
        {
 
149
                for (y = 0; y < nHeight; y++)
 
150
                {
 
151
                        srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
152
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
153
 
 
154
                        if (srcp != 0 && dstp != 0)
 
155
                                memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
 
156
                }
 
157
 
 
158
                return 0;
 
159
        }
 
160
        
 
161
        if (nYSrc < nYDest)
 
162
        {
 
163
                /* copy down (bottom to top) */
 
164
                for (y = nHeight - 1; y >= 0; y--)
 
165
                {
 
166
                        srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
167
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
168
 
 
169
                        if (srcp != 0 && dstp != 0)
 
170
                                memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
 
171
                }
 
172
        }
 
173
        else if (nYSrc > nYDest || nXSrc > nXDest)
 
174
        {
 
175
                /* copy up or left (top top bottom) */
 
176
                for (y = 0; y < nHeight; y++)
 
177
                {
 
178
                        srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
179
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
180
 
 
181
                        if (srcp != 0 && dstp != 0)
 
182
                                memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
 
183
                }
 
184
        }
 
185
        else
 
186
        {
 
187
                /* copy straight right */
 
188
                for (y = 0; y < nHeight; y++)
 
189
                {
 
190
                        srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
191
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
192
 
 
193
                        if (srcp != 0 && dstp != 0)
 
194
                                memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
 
195
                }
 
196
        }
 
197
        
 
198
        return 0;
 
199
}
 
200
 
 
201
static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
202
{
 
203
        int x, y;
 
204
        UINT16* srcp;
 
205
        UINT16* dstp;
 
206
        
 
207
        for (y = 0; y < nHeight; y++)
 
208
        {
 
209
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
210
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
211
 
 
212
                if (dstp != 0)
 
213
                {
 
214
                        for (x = 0; x < nWidth; x++)
 
215
                        {
 
216
                                *dstp = ~(*srcp);
 
217
                                srcp++;
 
218
                                dstp++;
 
219
                        }
 
220
                }
 
221
        }
 
222
 
 
223
        return 0;
 
224
}
 
225
 
 
226
static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
227
{
 
228
        int x, y;
 
229
        UINT16* dstp;
 
230
                
 
231
        for (y = 0; y < nHeight; y++)
 
232
        {
 
233
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
234
 
 
235
                if (dstp != 0)
 
236
                {
 
237
                        for (x = 0; x < nWidth; x++)
 
238
                        {
 
239
                                *dstp = ~(*dstp);
 
240
                                dstp++;
 
241
                        }
 
242
                }
 
243
        }
 
244
 
 
245
        return 0;
 
246
}
 
247
 
 
248
static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
249
{
 
250
        int x, y;
 
251
        UINT16* srcp;
 
252
        UINT16* dstp;
 
253
                
 
254
        for (y = 0; y < nHeight; y++)
 
255
        {
 
256
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
257
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
258
 
 
259
                if (dstp != 0)
 
260
                {
 
261
                        for (x = 0; x < nWidth; x++)
 
262
                        {
 
263
                                *dstp = *srcp & ~(*dstp);
 
264
                                srcp++;
 
265
                                dstp++;
 
266
                        }
 
267
                }
 
268
        }
 
269
 
 
270
        return 0;
 
271
}
 
272
 
 
273
static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
274
{
 
275
        int x, y;
 
276
        UINT16* srcp;
 
277
        UINT16* dstp;
 
278
                
 
279
        for (y = 0; y < nHeight; y++)
 
280
        {
 
281
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
282
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
283
 
 
284
                if (dstp != 0)
 
285
                {
 
286
                        for (x = 0; x < nWidth; x++)
 
287
                        {
 
288
                                *dstp = ~(*srcp) & ~(*dstp);
 
289
                                srcp++;
 
290
                                dstp++;
 
291
                        }
 
292
                }
 
293
        }
 
294
 
 
295
        return 0;
 
296
}
 
297
 
 
298
static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
299
{
 
300
        int x, y;
 
301
        UINT16* srcp;
 
302
        UINT16* dstp;
 
303
                
 
304
        for (y = 0; y < nHeight; y++)
 
305
        {
 
306
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
307
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
308
 
 
309
                if (dstp != 0)
 
310
                {
 
311
                        for (x = 0; x < nWidth; x++)
 
312
                        {
 
313
                                *dstp ^= *srcp;
 
314
                                srcp++;
 
315
                                dstp++;
 
316
                        }
 
317
                }
 
318
        }
 
319
 
 
320
        return 0;
 
321
}
 
322
 
 
323
static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
324
{
 
325
        int x, y;
 
326
        UINT16* srcp;
 
327
        UINT16* dstp;
 
328
                
 
329
        for (y = 0; y < nHeight; y++)
 
330
        {
 
331
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
332
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
333
 
 
334
                if (dstp != 0)
 
335
                {
 
336
                        for (x = 0; x < nWidth; x++)
 
337
                        {
 
338
                                *dstp &= *srcp;
 
339
                                srcp++;
 
340
                                dstp++;
 
341
                        }
 
342
                }
 
343
        }
 
344
 
 
345
        return 0;
 
346
}
 
347
 
 
348
static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
349
{
 
350
        int x, y;
 
351
        UINT16* srcp;
 
352
        UINT16* dstp;
 
353
                
 
354
        for (y = 0; y < nHeight; y++)
 
355
        {
 
356
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
357
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
358
 
 
359
                if (dstp != 0)
 
360
                {
 
361
                        for (x = 0; x < nWidth; x++)
 
362
                        {
 
363
                                *dstp |= *srcp;
 
364
                                srcp++;
 
365
                                dstp++;
 
366
                        }
 
367
                }
 
368
        }
 
369
 
 
370
        return 0;
 
371
}
 
372
 
 
373
static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
374
{       
 
375
        int x, y;
 
376
        BYTE* srcp;
 
377
        UINT16* dstp;
 
378
        UINT16 src16;
 
379
        UINT16 color16;
 
380
        HGDI_BITMAP hSrcBmp;
 
381
 
 
382
        /* D = (S & P) | (~S & D) */
 
383
        /* DSPDxax, used to draw glyphs */
 
384
 
 
385
        color16 = gdi_get_color_16bpp(hdcDest, hdcDest->textColor);
 
386
 
 
387
        hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
 
388
 
 
389
        if (hdcSrc->bytesPerPixel != 1)
 
390
        {
 
391
                fprintf(stderr, "BitBlt_DSPDxax expects 1 bpp, unimplemented for %d\n", hdcSrc->bytesPerPixel);
 
392
                return 0;
 
393
        }
 
394
        
 
395
        for (y = 0; y < nHeight; y++)
 
396
        {
 
397
                srcp = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
398
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
399
 
 
400
                if (dstp != 0)
 
401
                {
 
402
                        for (x = 0; x < nWidth; x++)
 
403
                        {
 
404
                                src16 = (*srcp << 8) | *srcp;
 
405
                                *dstp = (src16 & color16) | (~src16 & *dstp);
 
406
                                srcp++;
 
407
                                dstp++;
 
408
                        }
 
409
                }
 
410
        }
 
411
 
 
412
        return 0;
 
413
}
 
414
 
 
415
static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
416
{
 
417
        int x, y;
 
418
        UINT16* srcp;
 
419
        UINT16* dstp;
 
420
        UINT16* patp;
 
421
        UINT16 color16;
 
422
 
 
423
        /* D = (S & D) | (~S & P) */
 
424
 
 
425
        if (hdcDest->brush->style == GDI_BS_SOLID)
 
426
        {
 
427
                color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);
 
428
                patp = (UINT16*) &color16;
 
429
 
 
430
                for (y = 0; y < nHeight; y++)
 
431
                {
 
432
                        srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
433
                        dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
434
 
 
435
                        if (dstp != 0)
 
436
                        {
 
437
                                for (x = 0; x < nWidth; x++)
 
438
                                {
 
439
                                        *dstp = (*srcp & *dstp) | (~(*srcp) & *patp);
 
440
                                        srcp++;
 
441
                                        dstp++;
 
442
                                }
 
443
                        }
 
444
                }
 
445
        }
 
446
        else
 
447
        {
 
448
                for (y = 0; y < nHeight; y++)
 
449
                {
 
450
                        srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
451
                        dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
452
 
 
453
                        if (dstp != 0)
 
454
                        {
 
455
                                for (x = 0; x < nWidth; x++)
 
456
                                {
 
457
                                        patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
458
                                        *dstp = (*srcp & *dstp) | (~(*srcp) & *patp);
 
459
                                        srcp++;
 
460
                                        dstp++;
 
461
                                }
 
462
                        }
 
463
                }
 
464
        }
 
465
 
 
466
        return 0;
 
467
}
 
468
 
 
469
static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
470
{
 
471
        int x, y;
 
472
        UINT16* srcp;
 
473
        UINT16* dstp;
 
474
        UINT16* patp;
 
475
        
 
476
        for (y = 0; y < nHeight; y++)
 
477
        {
 
478
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
479
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
480
 
 
481
                if (dstp != 0)
 
482
                {
 
483
                        for (x = 0; x < nWidth; x++)
 
484
                        {
 
485
                                patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
486
                                *dstp = *srcp & ~(*patp);
 
487
                                srcp++;
 
488
                                dstp++;
 
489
                        }
 
490
                }
 
491
        }
 
492
        
 
493
        return 0;
 
494
}
 
495
 
 
496
static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
497
{
 
498
        int x, y;
 
499
        UINT16* dstp;
 
500
        UINT16* patp;
 
501
 
 
502
        for (y = 0; y < nHeight; y++)
 
503
        {
 
504
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
505
 
 
506
                if (dstp != 0)
 
507
                {
 
508
                        for (x = 0; x < nWidth; x++)
 
509
                        {
 
510
                                patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
511
 
 
512
                                *dstp = *dstp & *patp;
 
513
                                dstp++;
 
514
                        }
 
515
                }
 
516
        }
 
517
 
 
518
        return 0;
 
519
}
 
520
 
 
521
static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
522
{
 
523
        int x, y;
 
524
        UINT16* dstp;
 
525
        UINT16* patp;
 
526
 
 
527
        for (y = 0; y < nHeight; y++)
 
528
        {
 
529
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
530
 
 
531
                if (dstp != 0)
 
532
                {
 
533
                        for (x = 0; x < nWidth; x++)
 
534
                        {
 
535
                                patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
536
                                *dstp = *dstp ^ ~(*patp);
 
537
                                dstp++;
 
538
                        }
 
539
                }
 
540
        }
 
541
 
 
542
        return 0;
 
543
}
 
544
 
 
545
static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
546
{
 
547
        int x, y;
 
548
        UINT16* srcp;
 
549
        UINT16* dstp;
 
550
 
 
551
        for (y = 0; y < nHeight; y++)
 
552
        {
 
553
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
554
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
555
 
 
556
                if (dstp != 0)
 
557
                {
 
558
                        for (x = 0; x < nWidth; x++)
 
559
                        {
 
560
                                *dstp = ~(*srcp) & (*dstp);
 
561
                                srcp++;
 
562
                                dstp++;
 
563
                        }
 
564
                }
 
565
        }
 
566
 
 
567
        return 0;
 
568
}
 
569
 
 
570
 
 
571
static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
572
{
 
573
        int x, y;
 
574
        UINT16* srcp;
 
575
        UINT16* dstp;
 
576
        UINT16* patp;
 
577
        
 
578
        for (y = 0; y < nHeight; y++)
 
579
        {
 
580
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
581
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
582
 
 
583
                if (dstp != 0)
 
584
                {
 
585
                        for (x = 0; x < nWidth; x++)
 
586
                        {
 
587
                                patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
588
                                *dstp = *srcp & *patp;
 
589
                                srcp++;
 
590
                                dstp++;
 
591
                        }
 
592
                }
 
593
        }
 
594
        
 
595
        return 0;
 
596
}
 
597
 
 
598
static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
599
{
 
600
        int x, y;
 
601
        UINT16* srcp;
 
602
        UINT16* dstp;
 
603
        
 
604
        for (y = 0; y < nHeight; y++)
 
605
        {
 
606
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
607
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
608
 
 
609
                if (dstp != 0)
 
610
                {
 
611
                        for (x = 0; x < nWidth; x++)
 
612
                        {                               
 
613
                                *dstp = ~(*srcp) | *dstp;
 
614
                                srcp++;
 
615
                                dstp++;
 
616
                        }
 
617
                }
 
618
        }
 
619
        
 
620
        return 0;
 
621
}
 
622
 
 
623
static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
624
{
 
625
        int x, y, xOffset, yOffset;
 
626
        UINT16* dstp;
 
627
        UINT16* patp;
 
628
        UINT16 color16;
 
629
 
 
630
        if (hdcDest->brush->style == GDI_BS_SOLID)
 
631
        {
 
632
                color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);
 
633
 
 
634
                for (y = 0; y < nHeight; y++)
 
635
                {
 
636
                        dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
637
 
 
638
                        if (dstp != 0)
 
639
                        {
 
640
                                for (x = 0; x < nWidth; x++)
 
641
                                {
 
642
                                        *dstp = color16;
 
643
                                        dstp++;
 
644
                                }
 
645
                        }
 
646
                }
 
647
        }
 
648
        else
 
649
        {
 
650
                /* align pattern to 8x8 grid to make sure transition
 
651
                between different pattern blocks are smooth */
 
652
 
 
653
                if (hdcDest->brush->style == GDI_BS_HATCHED)
 
654
                {
 
655
                        xOffset = nXDest % 8;
 
656
                        yOffset = nYDest % 8 + 2; // +2 added after comparison to mstsc
 
657
                }
 
658
                else
 
659
                {
 
660
                        xOffset = 0;
 
661
                        yOffset = 0;
 
662
                }
 
663
                for (y = 0; y < nHeight; y++)
 
664
                {
 
665
                        dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
666
 
 
667
                        if (dstp != 0)
 
668
                        {
 
669
                                for (x = 0; x < nWidth; x++)
 
670
                                {
 
671
                                        patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x+xOffset, y+yOffset);
 
672
                                        *dstp = *patp;
 
673
                                        dstp++;
 
674
                                }
 
675
                        }
 
676
                }
 
677
        }
 
678
 
 
679
        return 0;
 
680
}
 
681
 
 
682
static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
 
683
{
 
684
        int x, y;
 
685
        UINT16* dstp;
 
686
        UINT16* patp;
 
687
        UINT16 color16;
 
688
 
 
689
        if (hdcDest->brush->style == GDI_BS_SOLID)
 
690
        {
 
691
                color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);
 
692
 
 
693
                for (y = 0; y < nHeight; y++)
 
694
                {
 
695
                        dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
696
 
 
697
                        if (dstp != 0)
 
698
                        {
 
699
                                for (x = 0; x < nWidth; x++)
 
700
                                {
 
701
                                        *dstp ^= color16;
 
702
                                        dstp++;
 
703
                                }
 
704
                        }
 
705
                }
 
706
        }
 
707
        else
 
708
        {
 
709
                for (y = 0; y < nHeight; y++)
 
710
                {
 
711
                        dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
712
 
 
713
                        if (dstp != 0)
 
714
                        {
 
715
                                for (x = 0; x < nWidth; x++)
 
716
                                {
 
717
                                        patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
718
                                        *dstp = *patp ^ *dstp;
 
719
                                        dstp++;
 
720
                                }
 
721
                        }
 
722
                }
 
723
        }
 
724
        
 
725
        return 0;
 
726
}
 
727
 
 
728
static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 
729
{
 
730
        int x, y;
 
731
        UINT16* srcp;
 
732
        UINT16* dstp;
 
733
        UINT16* patp;
 
734
        
 
735
        for (y = 0; y < nHeight; y++)
 
736
        {
 
737
                srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
 
738
                dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
739
 
 
740
                if (dstp != 0)
 
741
                {
 
742
                        for (x = 0; x < nWidth; x++)
 
743
                        {
 
744
                                patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
 
745
                                *dstp = *dstp | (*patp | ~(*srcp));
 
746
                                srcp++;
 
747
                                dstp++;
 
748
                        }
 
749
                }
 
750
        }
 
751
        
 
752
        return 0;
 
753
}
 
754
 
 
755
int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop)
 
756
{
 
757
        if (hdcSrc != NULL)
 
758
        {
 
759
                if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc) == 0)
 
760
                        return 0;
 
761
        }
 
762
        else
 
763
        {
 
764
                if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL) == 0)
 
765
                        return 0;
 
766
        }
 
767
        
 
768
        gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight);
 
769
        
 
770
        switch (rop)
 
771
        {
 
772
                case GDI_BLACKNESS:
 
773
                        return BitBlt_BLACKNESS_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight);
 
774
                        break;
 
775
 
 
776
                case GDI_WHITENESS:
 
777
                        return BitBlt_WHITENESS_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight);
 
778
                        break;
 
779
 
 
780
                case GDI_SRCCOPY:
 
781
                        return BitBlt_SRCCOPY_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
782
                        break;
 
783
 
 
784
                case GDI_SPna:
 
785
                        return BitBlt_SPna_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
786
                        break;
 
787
 
 
788
                case GDI_DSna:
 
789
                        return BitBlt_DSna_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
790
                        break;
 
791
 
 
792
                case GDI_DSPDxax:
 
793
                        return BitBlt_DSPDxax_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
794
                        break;
 
795
                        
 
796
                case GDI_PSDPxax:
 
797
                        return BitBlt_PSDPxax_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
798
                        break;
 
799
 
 
800
                case GDI_NOTSRCCOPY:
 
801
                        return BitBlt_NOTSRCCOPY_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
802
                        break;
 
803
 
 
804
                case GDI_DSTINVERT:
 
805
                        return BitBlt_DSTINVERT_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight);
 
806
                        break;
 
807
 
 
808
                case GDI_SRCERASE:
 
809
                        return BitBlt_SRCERASE_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
810
                        break;
 
811
 
 
812
                case GDI_NOTSRCERASE:
 
813
                        return BitBlt_NOTSRCERASE_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
814
                        break;
 
815
 
 
816
                case GDI_SRCINVERT:
 
817
                        return BitBlt_SRCINVERT_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
818
                        break;
 
819
 
 
820
                case GDI_SRCAND:
 
821
                        return BitBlt_SRCAND_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
822
                        break;
 
823
 
 
824
                case GDI_SRCPAINT:
 
825
                        return BitBlt_SRCPAINT_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
826
                        break;
 
827
 
 
828
                case GDI_MERGECOPY:
 
829
                        return BitBlt_MERGECOPY_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
830
                        break;
 
831
 
 
832
                case GDI_MERGEPAINT:
 
833
                        return BitBlt_MERGEPAINT_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
834
                        break;
 
835
 
 
836
                case GDI_PATCOPY:
 
837
                        return BitBlt_PATCOPY_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight);
 
838
                        break;
 
839
 
 
840
                case GDI_PATINVERT:
 
841
                        return BitBlt_PATINVERT_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight);
 
842
                        break;
 
843
 
 
844
                case GDI_PATPAINT:
 
845
                        return BitBlt_PATPAINT_16bpp(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc);
 
846
                        break;
 
847
        }
 
848
        
 
849
        fprintf(stderr, "BitBlt: unknown rop: 0x%08X\n", rop);
 
850
        return 1;
 
851
}
 
852
 
 
853
int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop)
 
854
{
 
855
        if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0)
 
856
                return 0;
 
857
        
 
858
        gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
859
 
 
860
        switch (rop)
 
861
        {
 
862
                case GDI_PATCOPY:
 
863
                        return BitBlt_PATCOPY_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
864
                        break;
 
865
 
 
866
                case GDI_PATINVERT:
 
867
                        return BitBlt_PATINVERT_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
868
                        break;
 
869
                        
 
870
                case GDI_DSTINVERT:
 
871
                        return BitBlt_DSTINVERT_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
872
                        break;
 
873
 
 
874
                case GDI_BLACKNESS:
 
875
                        return BitBlt_BLACKNESS_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
876
                        break;
 
877
 
 
878
                case GDI_WHITENESS:
 
879
                        return BitBlt_WHITENESS_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
880
                        break;
 
881
 
 
882
                case GDI_DPa:
 
883
                        return BitBlt_DPa_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
884
                        break;
 
885
 
 
886
                case GDI_PDxn:
 
887
                        return BitBlt_PDxn_16bpp(hdc, nXLeft, nYLeft, nWidth, nHeight);
 
888
                        break;
 
889
 
 
890
                default:
 
891
                        break;
 
892
        }
 
893
        
 
894
        fprintf(stderr, "PatBlt: unknown rop: 0x%08X\n", rop);
 
895
        return 1;
 
896
}
 
897
 
 
898
static INLINE void SetPixel_BLACK_16bpp(UINT16 *pixel, UINT16 *pen)
 
899
{
 
900
        /* D = 0 */
 
901
        *pixel = 0;
 
902
}
 
903
 
 
904
static INLINE void SetPixel_NOTMERGEPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
905
{
 
906
        /* D = ~(D | P) */
 
907
        *pixel = ~(*pixel | *pen);
 
908
}
 
909
 
 
910
static INLINE void SetPixel_MASKNOTPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
911
{
 
912
        /* D = D & ~P */
 
913
        *pixel &= ~(*pen);
 
914
}
 
915
 
 
916
static INLINE void SetPixel_NOTCOPYPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
917
{
 
918
        /* D = ~P */
 
919
        *pixel = ~(*pen);
 
920
}
 
921
 
 
922
static INLINE void SetPixel_MASKPENNOT_16bpp(UINT16 *pixel, UINT16 *pen)
 
923
{
 
924
        /* D = P & ~D */
 
925
        *pixel = *pen & ~*pixel;
 
926
}
 
927
 
 
928
static INLINE void SetPixel_NOT_16bpp(UINT16 *pixel, UINT16 *pen)
 
929
{
 
930
        /* D = ~D */
 
931
        *pixel = ~(*pixel);
 
932
}
 
933
 
 
934
static INLINE void SetPixel_XORPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
935
{
 
936
        /* D = D ^ P */
 
937
        *pixel = *pixel ^ *pen;
 
938
}
 
939
 
 
940
static INLINE void SetPixel_NOTMASKPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
941
{
 
942
        /* D = ~(D & P) */
 
943
        *pixel = ~(*pixel & *pen);
 
944
}
 
945
 
 
946
static INLINE void SetPixel_MASKPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
947
{
 
948
        /* D = D & P */
 
949
        *pixel &= *pen;
 
950
}
 
951
 
 
952
static INLINE void SetPixel_NOTXORPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
953
{
 
954
        /* D = ~(D ^ P) */
 
955
        *pixel = ~(*pixel ^ *pen);
 
956
}
 
957
 
 
958
static INLINE void SetPixel_NOP_16bpp(UINT16 *pixel, UINT16 *pen)
 
959
{
 
960
        /* D = D */
 
961
}
 
962
 
 
963
static INLINE void SetPixel_MERGENOTPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
964
{
 
965
        /* D = D | ~P */
 
966
        *pixel |= ~(*pen);
 
967
}
 
968
 
 
969
static INLINE void SetPixel_COPYPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
970
{
 
971
        /* D = P */
 
972
        *pixel = *pen;
 
973
}
 
974
 
 
975
static INLINE void SetPixel_MERGEPENNOT_16bpp(UINT16 *pixel, UINT16 *pen)
 
976
{
 
977
        /* D = P | ~D */
 
978
        *pixel = *pen | ~(*pixel);
 
979
}
 
980
 
 
981
static INLINE void SetPixel_MERGEPEN_16bpp(UINT16 *pixel, UINT16 *pen)
 
982
{
 
983
        /* D = P | D */
 
984
        *pixel |= *pen;
 
985
}
 
986
 
 
987
static INLINE void SetPixel_WHITE_16bpp(UINT16 *pixel, UINT16 *pen)
 
988
{
 
989
        /* D = 1 */
 
990
        *pixel = 0xFFFF;
 
991
}
 
992
 
 
993
#define PIXEL_TYPE              UINT16
 
994
#define GDI_GET_POINTER         gdi_GetPointer_16bpp
 
995
#define GDI_GET_PEN_COLOR       gdi_GetPenColor_16bpp
 
996
 
 
997
#define LINE_TO                 LineTo_BLACK_16bpp
 
998
#define SET_PIXEL_ROP2          SetPixel_BLACK_16bpp
 
999
#include "include/line.c"
 
1000
#undef LINE_TO
 
1001
#undef SET_PIXEL_ROP2
 
1002
 
 
1003
#define LINE_TO                 LineTo_NOTMERGEPEN_16bpp
 
1004
#define SET_PIXEL_ROP2          SetPixel_NOTMERGEPEN_16bpp
 
1005
#include "include/line.c"
 
1006
#undef LINE_TO
 
1007
#undef SET_PIXEL_ROP2
 
1008
 
 
1009
#define LINE_TO                 LineTo_MASKNOTPEN_16bpp
 
1010
#define SET_PIXEL_ROP2          SetPixel_MASKNOTPEN_16bpp
 
1011
#include "include/line.c"
 
1012
#undef LINE_TO
 
1013
#undef SET_PIXEL_ROP2
 
1014
 
 
1015
#define LINE_TO                 LineTo_NOTCOPYPEN_16bpp
 
1016
#define SET_PIXEL_ROP2          SetPixel_NOTCOPYPEN_16bpp
 
1017
#include "include/line.c"
 
1018
#undef LINE_TO
 
1019
#undef SET_PIXEL_ROP2
 
1020
 
 
1021
#define LINE_TO                 LineTo_MASKPENNOT_16bpp
 
1022
#define SET_PIXEL_ROP2          SetPixel_MASKPENNOT_16bpp
 
1023
#include "include/line.c"
 
1024
#undef LINE_TO
 
1025
#undef SET_PIXEL_ROP2
 
1026
 
 
1027
#define LINE_TO                 LineTo_NOT_16bpp
 
1028
#define SET_PIXEL_ROP2          SetPixel_NOT_16bpp
 
1029
#include "include/line.c"
 
1030
#undef LINE_TO
 
1031
#undef SET_PIXEL_ROP2
 
1032
 
 
1033
#define LINE_TO                 LineTo_XORPEN_16bpp
 
1034
#define SET_PIXEL_ROP2          SetPixel_XORPEN_16bpp
 
1035
#include "include/line.c"
 
1036
#undef LINE_TO
 
1037
#undef SET_PIXEL_ROP2
 
1038
 
 
1039
#define LINE_TO                 LineTo_NOTMASKPEN_16bpp
 
1040
#define SET_PIXEL_ROP2          SetPixel_NOTMASKPEN_16bpp
 
1041
#include "include/line.c"
 
1042
#undef LINE_TO
 
1043
#undef SET_PIXEL_ROP2
 
1044
 
 
1045
#define LINE_TO                 LineTo_MASKPEN_16bpp
 
1046
#define SET_PIXEL_ROP2          SetPixel_MASKPEN_16bpp
 
1047
#include "include/line.c"
 
1048
#undef LINE_TO
 
1049
#undef SET_PIXEL_ROP2
 
1050
 
 
1051
#define LINE_TO                 LineTo_NOTXORPEN_16bpp
 
1052
#define SET_PIXEL_ROP2          SetPixel_NOTXORPEN_16bpp
 
1053
#include "include/line.c"
 
1054
#undef LINE_TO
 
1055
#undef SET_PIXEL_ROP2
 
1056
 
 
1057
#define LINE_TO                 LineTo_NOP_16bpp
 
1058
#define SET_PIXEL_ROP2          SetPixel_NOP_16bpp
 
1059
#include "include/line.c"
 
1060
#undef LINE_TO
 
1061
#undef SET_PIXEL_ROP2
 
1062
 
 
1063
#define LINE_TO                 LineTo_MERGENOTPEN_16bpp
 
1064
#define SET_PIXEL_ROP2          SetPixel_MERGENOTPEN_16bpp
 
1065
#include "include/line.c"
 
1066
#undef LINE_TO
 
1067
#undef SET_PIXEL_ROP2
 
1068
 
 
1069
#define LINE_TO                 LineTo_COPYPEN_16bpp
 
1070
#define SET_PIXEL_ROP2          SetPixel_COPYPEN_16bpp
 
1071
#include "include/line.c"
 
1072
#undef LINE_TO
 
1073
#undef SET_PIXEL_ROP2
 
1074
 
 
1075
#define LINE_TO                 LineTo_MERGEPENNOT_16bpp
 
1076
#define SET_PIXEL_ROP2          SetPixel_MERGEPENNOT_16bpp
 
1077
#include "include/line.c"
 
1078
#undef LINE_TO
 
1079
#undef SET_PIXEL_ROP2
 
1080
 
 
1081
#define LINE_TO                 LineTo_MERGEPEN_16bpp
 
1082
#define SET_PIXEL_ROP2          SetPixel_MERGEPEN_16bpp
 
1083
#include "include/line.c"
 
1084
#undef LINE_TO
 
1085
#undef SET_PIXEL_ROP2
 
1086
 
 
1087
#define LINE_TO                 LineTo_WHITE_16bpp
 
1088
#define SET_PIXEL_ROP2          SetPixel_WHITE_16bpp
 
1089
#include "include/line.c"
 
1090
#undef LINE_TO
 
1091
#undef SET_PIXEL_ROP2
 
1092
 
 
1093
#undef PIXEL_TYPE
 
1094
#undef GDI_GET_POINTER
 
1095
#undef GDI_GET_PEN_COLOR
 
1096
 
 
1097
pLineTo_16bpp LineTo_ROP2_16bpp[32] =
 
1098
{
 
1099
        LineTo_BLACK_16bpp,
 
1100
        LineTo_NOTMERGEPEN_16bpp,
 
1101
        LineTo_MASKNOTPEN_16bpp,
 
1102
        LineTo_NOTCOPYPEN_16bpp,
 
1103
        LineTo_MASKPENNOT_16bpp,
 
1104
        LineTo_NOT_16bpp,
 
1105
        LineTo_XORPEN_16bpp,
 
1106
        LineTo_NOTMASKPEN_16bpp,
 
1107
        LineTo_MASKPEN_16bpp,
 
1108
        LineTo_NOTXORPEN_16bpp,
 
1109
        LineTo_NOP_16bpp,
 
1110
        LineTo_MERGENOTPEN_16bpp,
 
1111
        LineTo_COPYPEN_16bpp,
 
1112
        LineTo_MERGEPENNOT_16bpp,
 
1113
        LineTo_MERGEPEN_16bpp,
 
1114
        LineTo_WHITE_16bpp
 
1115
};
 
1116
 
 
1117
int LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd)
 
1118
{
 
1119
        pLineTo_16bpp _LineTo;
 
1120
        int rop2 = gdi_GetROP2(hdc) - 1;
 
1121
 
 
1122
        _LineTo = LineTo_ROP2_16bpp[rop2];
 
1123
 
 
1124
        if (_LineTo != NULL)
 
1125
                return _LineTo(hdc, nXEnd, nYEnd);
 
1126
        else
 
1127
                return 0;
 
1128
}