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.

92 lines
2.8 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: paint.c
  8. *
  9. * Content: DrvPaint support
  10. *
  11. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. #include "precomp.h"
  15. /******************************Public*Data*********************************\
  16. * MIX translation table
  17. *
  18. * Translates a mix 1-16, into an old style Rop 0-255.
  19. *
  20. \**************************************************************************/
  21. BYTE gaMix[] =
  22. {
  23. 0xFF, // R2_WHITE - Allow rop = gaMix[mix & 0x0F]
  24. 0x00, // R2_BLACK
  25. 0x05, // R2_NOTMERGEPEN
  26. 0x0A, // R2_MASKNOTPEN
  27. 0x0F, // R2_NOTCOPYPEN
  28. 0x50, // R2_MASKPENNOT
  29. 0x55, // R2_NOT
  30. 0x5A, // R2_XORPEN
  31. 0x5F, // R2_NOTMASKPEN
  32. 0xA0, // R2_MASKPEN
  33. 0xA5, // R2_NOTXORPEN
  34. 0xAA, // R2_NOP
  35. 0xAF, // R2_MERGENOTPEN
  36. 0xF0, // R2_COPYPEN
  37. 0xF5, // R2_MERGEPENNOT
  38. 0xFA, // R2_MERGEPEN
  39. 0xFF // R2_WHITE - Allow rop = gaMix[mix & 0xFF]
  40. };
  41. /******************************Public*Routine******************************\
  42. * BOOL DrvPaint
  43. *
  44. \**************************************************************************/
  45. BOOL DrvPaint(
  46. SURFOBJ* pso,
  47. CLIPOBJ* pco,
  48. BRUSHOBJ* pbo,
  49. POINTL* pptlBrush,
  50. MIX mix)
  51. {
  52. BOOL bRet;
  53. ROP4 rop4;
  54. rop4 = ((MIX) gaMix[mix >> 8] << 8) | gaMix[mix & 0xf];
  55. // Since our DrvFillPath routine handles almost all fills, DrvPaint
  56. // won't get called all that much (mainly via PaintRgn, FillRgn, or
  57. // complex clipped polygons). As such, we save some code and simply
  58. // punt to DrvBitBlt:
  59. DISPDBG((DBGLVL, "DrvPaint: calling DrvBitBlt"));
  60. if (rop4 == 0x5555)
  61. {
  62. // special processing for Invert
  63. bRet = DrvBitBlt(pso, // Dst
  64. pso, // Src
  65. NULL, // Mask
  66. pco, // Clip
  67. NULL, // pxlo
  68. &pco->rclBounds, // Bounding Dest rect
  69. (POINTL*)(&pco->rclBounds), // Source point
  70. NULL, // Mask point
  71. NULL, // Brush
  72. NULL, // brush origin
  73. 0x3333); // not src
  74. }
  75. else
  76. {
  77. bRet = DrvBitBlt(pso, NULL, NULL, pco, NULL, &pco->rclBounds, NULL,
  78. NULL, pbo, pptlBrush, rop4);
  79. }
  80. return(bRet);
  81. }