jscript: Use bytecode for '|=' expression.
[wine] / dlls / gdi32 / dibdrv / dc.c
1 /*
2  * DIB driver initialization and DC functions.
3  *
4  * Copyright 2011 Huw Davies
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <assert.h>
22
23 #include "gdi_private.h"
24 #include "dibdrv.h"
25
26 #include "wine/exception.h"
27 #include "wine/debug.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(dib);
30
31 static const DWORD bit_fields_888[3] = {0xff0000, 0x00ff00, 0x0000ff};
32 static const DWORD bit_fields_555[3] = {0x7c00, 0x03e0, 0x001f};
33
34 static void calc_shift_and_len(DWORD mask, int *shift, int *len)
35 {
36     int s, l;
37
38     if(!mask)
39     {
40         *shift = *len = 0;
41         return;
42     }
43
44     s = 0;
45     while ((mask & 1) == 0)
46     {
47         mask >>= 1;
48         s++;
49     }
50     l = 0;
51     while ((mask & 1) == 1)
52     {
53         mask >>= 1;
54         l++;
55     }
56     *shift = s;
57     *len = l;
58 }
59
60 static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
61 {
62     dib->red_mask    = bit_fields[0];
63     dib->green_mask  = bit_fields[1];
64     dib->blue_mask   = bit_fields[2];
65     calc_shift_and_len(dib->red_mask,   &dib->red_shift,   &dib->red_len);
66     calc_shift_and_len(dib->green_mask, &dib->green_shift, &dib->green_len);
67     calc_shift_and_len(dib->blue_mask,  &dib->blue_shift,  &dib->blue_len);
68 }
69
70 BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit_fields,
71                    RGBQUAD *color_table, int color_table_size, void *bits, enum dib_info_flags flags)
72 {
73     dib->bit_count    = bi->biBitCount;
74     dib->width        = bi->biWidth;
75     dib->height       = bi->biHeight;
76     dib->compression  = bi->biCompression;
77     dib->stride       = get_dib_stride( dib->width, dib->bit_count );
78     dib->bits.ptr     = bits;
79     dib->bits.is_copy = FALSE;
80     dib->bits.free    = NULL;
81     dib->bits.param   = NULL;
82     dib->flags        = flags;
83
84     if(dib->height < 0) /* top-down */
85     {
86         dib->height = -dib->height;
87     }
88     else /* bottom-up */
89     {
90         /* bits always points to the top-left corner and the stride is -ve */
91         dib->bits.ptr = (BYTE*)dib->bits.ptr + (dib->height - 1) * dib->stride;
92         dib->stride  = -dib->stride;
93     }
94
95     dib->funcs = &funcs_null;
96
97     switch(dib->bit_count)
98     {
99     case 32:
100         if(bi->biCompression == BI_RGB)
101             bit_fields = bit_fields_888;
102
103         init_bit_fields(dib, bit_fields);
104
105         if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
106             dib->funcs = &funcs_8888;
107         else
108             dib->funcs = &funcs_32;
109         break;
110
111     case 24:
112         dib->funcs = &funcs_24;
113         break;
114
115     case 16:
116         if(bi->biCompression == BI_RGB)
117             bit_fields = bit_fields_555;
118
119         init_bit_fields(dib, bit_fields);
120
121         if(dib->red_mask == 0x7c00 && dib->green_mask == 0x03e0 && dib->blue_mask == 0x001f)
122             dib->funcs = &funcs_555;
123         else
124             dib->funcs = &funcs_16;
125         break;
126
127     case 8:
128         dib->funcs = &funcs_8;
129         break;
130
131     case 4:
132         dib->funcs = &funcs_4;
133         break;
134
135     case 1:
136         dib->funcs = &funcs_1;
137         break;
138
139     default:
140         TRACE("bpp %d not supported, will forward to graphics driver.\n", dib->bit_count);
141         return FALSE;
142     }
143
144     if(color_table)
145     {
146         if (flags & private_color_table)
147         {
148             dib->color_table = HeapAlloc(GetProcessHeap(), 0, color_table_size * sizeof(dib->color_table[0]));
149             if(!dib->color_table) return FALSE;
150             memcpy(dib->color_table, color_table, color_table_size * sizeof(color_table[0]));
151         }
152         else
153             dib->color_table = color_table;
154         dib->color_table_size = color_table_size;
155     }
156     else
157     {
158         dib->color_table = NULL;
159         dib->color_table_size = 0;
160     }
161
162     return TRUE;
163 }
164
165 BOOL init_dib_info_from_brush(dib_info *dib, const BITMAPINFO *bi, void *bits, UINT usage, HPALETTE palette)
166 {
167     DWORD *masks = (bi->bmiHeader.biCompression == BI_BITFIELDS) ? (DWORD *)bi->bmiColors : NULL;
168     RGBQUAD *color_table = NULL, pal_table[256];
169     int num_colors = get_dib_num_of_colors( bi );
170
171     if(num_colors)
172     {
173         if(usage == DIB_PAL_COLORS)
174         {
175             PALETTEENTRY entries[256];
176             const WORD *index = (const WORD *)bi->bmiColors;
177             UINT i, count = GetPaletteEntries( palette, 0, num_colors, entries );
178             for (i = 0; i < num_colors; i++, index++)
179             {
180                 PALETTEENTRY *entry = &entries[*index % count];
181                 pal_table[i].rgbRed      = entry->peRed;
182                 pal_table[i].rgbGreen    = entry->peGreen;
183                 pal_table[i].rgbBlue     = entry->peBlue;
184                 pal_table[i].rgbReserved = 0;
185             }
186             color_table = pal_table;
187         }
188         else color_table = (RGBQUAD *)bi->bmiColors;
189     }
190     return init_dib_info(dib, &bi->bmiHeader, masks, color_table, num_colors, bits, private_color_table);
191 }
192
193 BOOL init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
194 {
195     unsigned int colors = get_dib_num_of_colors( info );
196     void *colorptr = (char *)&info->bmiHeader + info->bmiHeader.biSize;
197     const DWORD *bitfields = (info->bmiHeader.biCompression == BI_BITFIELDS) ? (DWORD *)colorptr : NULL;
198
199     return init_dib_info( dib, &info->bmiHeader, bitfields, colors ? colorptr : NULL, colors, bits, flags );
200 }
201
202 BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
203 {
204     if (!bmp->dib)
205     {
206         char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
207         BITMAPINFO *info = (BITMAPINFO *)buffer;
208
209         get_ddb_bitmapinfo( bmp, info );
210         if (!bmp->bitmap.bmBits)
211         {
212             int width_bytes = get_dib_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
213             bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
214                                             bmp->bitmap.bmHeight * width_bytes );
215             if (!bmp->bitmap.bmBits) return FALSE;
216         }
217         return init_dib_info_from_bitmapinfo( dib, info, bmp->bitmap.bmBits,
218                                               flags | private_color_table );
219     }
220     return init_dib_info( dib, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
221                           bmp->color_table, bmp->nb_colors, bmp->dib->dsBm.bmBits, flags );
222 }
223
224 static void clear_dib_info(dib_info *dib)
225 {
226     dib->color_table = NULL;
227     dib->bits.ptr    = NULL;
228     dib->bits.free   = NULL;
229     dib->bits.param  = NULL;
230 }
231
232 /**********************************************************************
233  *      free_dib_info
234  *
235  * Free the resources associated with a dib and optionally the bits
236  */
237 void free_dib_info(dib_info *dib)
238 {
239     if (dib->flags & private_color_table)
240         HeapFree(GetProcessHeap(), 0, dib->color_table);
241
242     if (dib->bits.free) dib->bits.free( &dib->bits );
243     clear_dib_info( dib );
244 }
245
246 void copy_dib_color_info(dib_info *dst, const dib_info *src)
247 {
248     dst->bit_count        = src->bit_count;
249     dst->red_mask         = src->red_mask;
250     dst->green_mask       = src->green_mask;
251     dst->blue_mask        = src->blue_mask;
252     dst->red_len          = src->red_len;
253     dst->green_len        = src->green_len;
254     dst->blue_len         = src->blue_len;
255     dst->red_shift        = src->red_shift;
256     dst->green_shift      = src->green_shift;
257     dst->blue_shift       = src->blue_shift;
258     dst->funcs            = src->funcs;
259     dst->color_table_size = src->color_table_size;
260     dst->color_table      = NULL;
261     dst->flags            = src->flags;
262     if(dst->color_table_size)
263     {
264         int size = dst->color_table_size * sizeof(dst->color_table[0]);
265         if (dst->flags & private_color_table)
266         {
267             dst->color_table = HeapAlloc(GetProcessHeap(), 0, size);
268             memcpy(dst->color_table, src->color_table, size);
269         }
270         else
271             dst->color_table = src->color_table;
272     }
273 }
274
275 DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
276                           const BITMAPINFO *dst_info, void *dst_bits, BOOL add_alpha )
277 {
278     dib_info src_dib, dst_dib;
279     DWORD ret;
280
281     if ( !init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, 0 ) )
282         return ERROR_BAD_FORMAT;
283     if ( !init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, 0 ) )
284         return ERROR_BAD_FORMAT;
285
286     __TRY
287     {
288         dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
289         ret = TRUE;
290     }
291     __EXCEPT_PAGE_FAULT
292     {
293         WARN( "invalid bits pointer %p\n", src_bits );
294         ret = FALSE;
295     }
296     __ENDTRY
297
298     /* We shared the color tables, so there's no need to free the dib_infos here */
299     if(!ret) return ERROR_BAD_FORMAT;
300
301     /* update coordinates, the destination rectangle is always stored at 0,0 */
302     src->x -= src->visrect.left;
303     src->y -= src->visrect.top;
304     offset_rect( &src->visrect, -src->visrect.left, -src->visrect.top );
305
306     if (add_alpha && dst_dib.funcs == &funcs_8888 && src_dib.funcs != &funcs_8888)
307     {
308         DWORD *pixel = dst_dib.bits.ptr;
309         int x, y;
310
311         for (y = src->visrect.top; y < src->visrect.bottom; y++, pixel += dst_dib.stride / 4)
312             for (x = src->visrect.left; x < src->visrect.right; x++)
313                 pixel[x] |= 0xff000000;
314     }
315
316     return ERROR_SUCCESS;
317 }
318
319 static void update_fg_colors( dibdrv_physdev *pdev )
320 {
321     pdev->pen_color   = get_pixel_color( pdev, pdev->pen_colorref,   TRUE );
322     pdev->brush_color = get_pixel_color( pdev, pdev->brush_colorref, TRUE );
323     pdev->text_color  = get_pixel_color( pdev, GetTextColor( pdev->dev.hdc ), TRUE );
324 }
325
326 static void update_masks( dibdrv_physdev *pdev, INT rop )
327 {
328     calc_and_xor_masks( rop, pdev->pen_color, &pdev->pen_and, &pdev->pen_xor );
329     update_brush_rop( pdev, rop );
330     if( GetBkMode( pdev->dev.hdc ) == OPAQUE )
331         calc_and_xor_masks( rop, pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
332 }
333
334  /***********************************************************************
335  *           add_extra_clipping_region
336  *
337  * Temporarily add a region to the current clipping region.
338  * The returned region must be restored with restore_clipping_region.
339  */
340 HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn )
341 {
342     HRGN ret, clip;
343
344     if (!(clip = CreateRectRgn( 0, 0, 0, 0 ))) return 0;
345     CombineRgn( clip, pdev->clip, rgn, RGN_AND );
346     ret = pdev->clip;
347     pdev->clip = clip;
348     return ret;
349 }
350
351 /***********************************************************************
352  *           restore_clipping_region
353  */
354 void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn )
355 {
356     if (!rgn) return;
357     DeleteObject( pdev->clip );
358     pdev->clip = rgn;
359 }
360
361 /**********************************************************************
362  *           dibdrv_CreateDC
363  */
364 static BOOL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
365                              LPCWSTR output, const DEVMODEW *data )
366 {
367     dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) );
368
369     if (!pdev) return FALSE;
370     if (!(pdev->clip = CreateRectRgn(0, 0, 0, 0)))
371     {
372         HeapFree( GetProcessHeap(), 0, pdev );
373         return FALSE;
374     }
375     clear_dib_info(&pdev->dib);
376     clear_dib_info(&pdev->brush_dib);
377     push_dc_driver( dev, &pdev->dev, &dib_driver );
378     return TRUE;
379 }
380
381 /***********************************************************************
382  *           dibdrv_DeleteDC
383  */
384 static BOOL dibdrv_DeleteDC( PHYSDEV dev )
385 {
386     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
387     TRACE("(%p)\n", dev);
388     DeleteObject(pdev->clip);
389     free_pattern_brush(pdev);
390     free_dib_info(&pdev->dib);
391     HeapFree( GetProcessHeap(), 0, pdev );
392     return TRUE;
393 }
394
395 /***********************************************************************
396  *           dibdrv_CopyBitmap
397  */
398 static BOOL dibdrv_CopyBitmap( HBITMAP src, HBITMAP dst )
399 {
400     return nulldrv_CopyBitmap( src, dst );
401 }
402
403 /***********************************************************************
404  *           dibdrv_DeleteBitmap
405  */
406 static BOOL dibdrv_DeleteBitmap( HBITMAP bitmap )
407 {
408     return TRUE;
409 }
410
411 /***********************************************************************
412  *           dibdrv_SelectBitmap
413  */
414 static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
415 {
416     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectBitmap );
417     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
418     BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
419     TRACE("(%p, %p)\n", dev, bitmap);
420
421     if (!bmp) return 0;
422
423     free_dib_info(&pdev->dib);
424     pdev->defer = 0;
425     if(!init_dib_info_from_bitmapobj(&pdev->dib, bmp, private_color_table))
426         pdev->defer |= DEFER_FORMAT;
427
428     GDI_ReleaseObj( bitmap );
429
430     return next->funcs->pSelectBitmap( next, bitmap );
431 }
432
433 /***********************************************************************
434  *           dibdrv_SetBkColor
435  */
436 static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color )
437 {
438     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkColor );
439     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
440
441     pdev->bkgnd_color = get_pixel_color( pdev, color, FALSE );
442
443     if( GetBkMode(dev->hdc) == OPAQUE )
444         calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
445     else
446     {
447         pdev->bkgnd_and = ~0u;
448         pdev->bkgnd_xor = 0;
449     }
450
451     update_fg_colors( pdev ); /* Only needed in the 1 bpp case */
452
453     return next->funcs->pSetBkColor( next, color );
454 }
455
456 /***********************************************************************
457  *           dibdrv_SetBkMode
458  */
459 static INT dibdrv_SetBkMode( PHYSDEV dev, INT mode )
460 {
461     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkMode );
462     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
463
464     if( mode == OPAQUE )
465         calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
466     else
467     {
468         pdev->bkgnd_and = ~0u;
469         pdev->bkgnd_xor = 0;
470     }
471
472     return next->funcs->pSetBkMode( next, mode );
473 }
474
475 /***********************************************************************
476  *           dibdrv_SetDeviceClipping
477  */
478 static void dibdrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn )
479 {
480     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetDeviceClipping );
481     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
482     TRACE("(%p, %p, %p)\n", dev, vis_rgn, clip_rgn);
483
484     CombineRgn( pdev->clip, vis_rgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY );
485     return next->funcs->pSetDeviceClipping( next, vis_rgn, clip_rgn);
486 }
487
488 /***********************************************************************
489  *           dibdrv_SetDIBColorTable
490  */
491 static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RGBQUAD *colors )
492 {
493     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetDIBColorTable );
494     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
495     TRACE("(%p, %d, %d, %p)\n", dev, pos, count, colors);
496
497     if( pdev->dib.color_table && pos < pdev->dib.color_table_size )
498     {
499         if( pos + count > pdev->dib.color_table_size ) count = pdev->dib.color_table_size - pos;
500         memcpy( pdev->dib.color_table + pos, colors, count * sizeof(RGBQUAD) );
501
502         pdev->bkgnd_color = get_pixel_color( pdev, GetBkColor( dev->hdc ), FALSE );
503         update_fg_colors( pdev );
504
505         update_masks( pdev, GetROP2( dev->hdc ) );
506     }
507     return next->funcs->pSetDIBColorTable( next, pos, count, colors );
508 }
509
510 /***********************************************************************
511  *           dibdrv_SetROP2
512  */
513 static INT dibdrv_SetROP2( PHYSDEV dev, INT rop )
514 {
515     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetROP2 );
516     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
517
518     update_masks( pdev, rop );
519
520     return next->funcs->pSetROP2( next, rop );
521 }
522
523 /***********************************************************************
524  *           dibdrv_SetTextColor
525  */
526 static COLORREF dibdrv_SetTextColor( PHYSDEV dev, COLORREF color )
527 {
528     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetTextColor );
529     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
530
531     pdev->text_color = get_pixel_color( pdev, color, TRUE );
532     update_aa_ranges( pdev );
533
534     return next->funcs->pSetTextColor( next, color );
535 }
536
537 const struct gdi_dc_funcs dib_driver =
538 {
539     NULL,                               /* pAbortDoc */
540     NULL,                               /* pAbortPath */
541     dibdrv_AlphaBlend,                  /* pAlphaBlend */
542     NULL,                               /* pAngleArc */
543     NULL,                               /* pArc */
544     NULL,                               /* pArcTo */
545     NULL,                               /* pBeginPath */
546     dibdrv_BlendImage,                  /* pBlendImage */
547     NULL,                               /* pChoosePixelFormat */
548     NULL,                               /* pChord */
549     NULL,                               /* pCloseFigure */
550     dibdrv_CopyBitmap,                  /* pCopyBitmap */
551     NULL,                               /* pCreateBitmap */
552     NULL,                               /* pCreateCompatibleDC */
553     dibdrv_CreateDC,                    /* pCreateDC */
554     NULL,                               /* pCreateDIBSection */
555     dibdrv_DeleteBitmap,                /* pDeleteBitmap */
556     dibdrv_DeleteDC,                    /* pDeleteDC */
557     NULL,                               /* pDeleteObject */
558     NULL,                               /* pDescribePixelFormat */
559     NULL,                               /* pDeviceCapabilities */
560     NULL,                               /* pEllipse */
561     NULL,                               /* pEndDoc */
562     NULL,                               /* pEndPage */
563     NULL,                               /* pEndPath */
564     NULL,                               /* pEnumFonts */
565     NULL,                               /* pEnumICMProfiles */
566     NULL,                               /* pExcludeClipRect */
567     NULL,                               /* pExtDeviceMode */
568     NULL,                               /* pExtEscape */
569     NULL,                               /* pExtFloodFill */
570     NULL,                               /* pExtSelectClipRgn */
571     dibdrv_ExtTextOut,                  /* pExtTextOut */
572     NULL,                               /* pFillPath */
573     NULL,                               /* pFillRgn */
574     NULL,                               /* pFlattenPath */
575     NULL,                               /* pFontIsLinked */
576     NULL,                               /* pFrameRgn */
577     NULL,                               /* pGdiComment */
578     NULL,                               /* pGdiRealizationInfo */
579     NULL,                               /* pGetCharABCWidths */
580     NULL,                               /* pGetCharABCWidthsI */
581     NULL,                               /* pGetCharWidth */
582     NULL,                               /* pGetDeviceCaps */
583     NULL,                               /* pGetDeviceGammaRamp */
584     NULL,                               /* pGetFontData */
585     NULL,                               /* pGetFontUnicodeRanges */
586     NULL,                               /* pGetGlyphIndices */
587     NULL,                               /* pGetGlyphOutline */
588     NULL,                               /* pGetICMProfile */
589     dibdrv_GetImage,                    /* pGetImage */
590     NULL,                               /* pGetKerningPairs */
591     NULL,                               /* pGetNearestColor */
592     NULL,                               /* pGetOutlineTextMetrics */
593     dibdrv_GetPixel,                    /* pGetPixel */
594     NULL,                               /* pGetPixelFormat */
595     NULL,                               /* pGetSystemPaletteEntries */
596     NULL,                               /* pGetTextCharsetInfo */
597     NULL,                               /* pGetTextExtentExPoint */
598     NULL,                               /* pGetTextExtentExPointI */
599     NULL,                               /* pGetTextFace */
600     NULL,                               /* pGetTextMetrics */
601     dibdrv_GradientFill,                /* pGradientFill */
602     NULL,                               /* pIntersectClipRect */
603     NULL,                               /* pInvertRgn */
604     dibdrv_LineTo,                      /* pLineTo */
605     NULL,                               /* pModifyWorldTransform */
606     NULL,                               /* pMoveTo */
607     NULL,                               /* pOffsetClipRgn */
608     NULL,                               /* pOffsetViewportOrg */
609     NULL,                               /* pOffsetWindowOrg */
610     dibdrv_PaintRgn,                    /* pPaintRgn */
611     dibdrv_PatBlt,                      /* pPatBlt */
612     NULL,                               /* pPie */
613     NULL,                               /* pPolyBezier */
614     NULL,                               /* pPolyBezierTo */
615     NULL,                               /* pPolyDraw */
616     NULL,                               /* pPolyPolygon */
617     dibdrv_PolyPolyline,                /* pPolyPolyline */
618     NULL,                               /* pPolygon */
619     dibdrv_Polyline,                    /* pPolyline */
620     NULL,                               /* pPolylineTo */
621     dibdrv_PutImage,                    /* pPutImage */
622     NULL,                               /* pRealizeDefaultPalette */
623     NULL,                               /* pRealizePalette */
624     dibdrv_Rectangle,                   /* pRectangle */
625     NULL,                               /* pResetDC */
626     NULL,                               /* pRestoreDC */
627     NULL,                               /* pRoundRect */
628     NULL,                               /* pSaveDC */
629     NULL,                               /* pScaleViewportExt */
630     NULL,                               /* pScaleWindowExt */
631     dibdrv_SelectBitmap,                /* pSelectBitmap */
632     dibdrv_SelectBrush,                 /* pSelectBrush */
633     NULL,                               /* pSelectClipPath */
634     NULL,                               /* pSelectFont */
635     NULL,                               /* pSelectPalette */
636     dibdrv_SelectPen,                   /* pSelectPen */
637     NULL,                               /* pSetArcDirection */
638     dibdrv_SetBkColor,                  /* pSetBkColor */
639     dibdrv_SetBkMode,                   /* pSetBkMode */
640     dibdrv_SetDCBrushColor,             /* pSetDCBrushColor */
641     dibdrv_SetDCPenColor,               /* pSetDCPenColor */
642     dibdrv_SetDIBColorTable,            /* pSetDIBColorTable */
643     NULL,                               /* pSetDIBitsToDevice */
644     dibdrv_SetDeviceClipping,           /* pSetDeviceClipping */
645     NULL,                               /* pSetDeviceGammaRamp */
646     NULL,                               /* pSetLayout */
647     NULL,                               /* pSetMapMode */
648     NULL,                               /* pSetMapperFlags */
649     dibdrv_SetPixel,                    /* pSetPixel */
650     NULL,                               /* pSetPixelFormat */
651     NULL,                               /* pSetPolyFillMode */
652     dibdrv_SetROP2,                     /* pSetROP2 */
653     NULL,                               /* pSetRelAbs */
654     NULL,                               /* pSetStretchBltMode */
655     NULL,                               /* pSetTextAlign */
656     NULL,                               /* pSetTextCharacterExtra */
657     dibdrv_SetTextColor,                /* pSetTextColor */
658     NULL,                               /* pSetTextJustification */
659     NULL,                               /* pSetViewportExt */
660     NULL,                               /* pSetViewportOrg */
661     NULL,                               /* pSetWindowExt */
662     NULL,                               /* pSetWindowOrg */
663     NULL,                               /* pSetWorldTransform */
664     NULL,                               /* pStartDoc */
665     NULL,                               /* pStartPage */
666     dibdrv_StretchBlt,                  /* pStretchBlt */
667     NULL,                               /* pStretchDIBits */
668     NULL,                               /* pStrokeAndFillPath */
669     NULL,                               /* pStrokePath */
670     NULL,                               /* pSwapBuffers */
671     NULL,                               /* pUnrealizePalette */
672     NULL,                               /* pWidenPath */
673     NULL,                               /* pwglCopyContext */
674     NULL,                               /* pwglCreateContext */
675     NULL,                               /* pwglCreateContextAttribsARB */
676     NULL,                               /* pwglDeleteContext */
677     NULL,                               /* pwglGetPbufferDCARB */
678     NULL,                               /* pwglGetProcAddress */
679     NULL,                               /* pwglMakeContextCurrentARB */
680     NULL,                               /* pwglMakeCurrent */
681     NULL,                               /* pwglSetPixelFormatWINE */
682     NULL,                               /* pwglShareLists */
683     NULL,                               /* pwglUseFontBitmapsA */
684     NULL                                /* pwglUseFontBitmapsW */
685 };