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.

109 lines
3.3 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * GDISAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: LineTo.c
  8. *
  9. * Content: The code in this file handles the DrvLineTo() API call.
  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*Routine******************************\
  16. * BOOL DrvLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix)
  17. *
  18. * DrvLineTo() is an optimised, integer co-ordinate, API call that doesn't
  19. * support styling. The integer-line code in Strips.c is called to do the
  20. * hard work.
  21. *
  22. * Note that:
  23. * 1. pco can be NULL.
  24. * 2. we only handle simple clipping.
  25. *
  26. \**************************************************************************/
  27. BOOL DrvLineTo(
  28. SURFOBJ* pso,
  29. CLIPOBJ* pco,
  30. BRUSHOBJ* pbo,
  31. LONG x1,
  32. LONG y1,
  33. LONG x2,
  34. LONG y2,
  35. RECTL *prclBounds,
  36. MIX mix)
  37. {
  38. PDEV* ppdev;
  39. DSURF* pdsurf;
  40. BOOL ResetGLINT; // Does GLINT need resetting?
  41. DWORD logicOp;
  42. RECTL* prclClip = (RECTL*) NULL;
  43. ULONG iSolidColor = pbo->iSolidColor;
  44. BOOL retVal;
  45. GLINT_DECL_VARS;
  46. // Pass the surface off to GDI if it's a device bitmap
  47. // that we've converted to a DIB
  48. pdsurf = (DSURF*) pso->dhsurf;
  49. if (pdsurf->dt & DT_DIB)
  50. {
  51. return(EngLineTo(pdsurf->pso,
  52. pco,
  53. pbo,
  54. x1,
  55. y1,
  56. x2,
  57. y2,
  58. prclBounds,
  59. mix));
  60. }
  61. // Return to sender if the clipping is too difficult
  62. if (pco && pco->iDComplexity == DC_COMPLEX)
  63. {
  64. return(FALSE);
  65. }
  66. ppdev = (PDEV*) pso->dhpdev;
  67. GLINT_DECL_INIT;
  68. REMOVE_SWPOINTER(pso);
  69. DISPDBG((DBGLVL, "Drawing DrvLines through GLINT"));
  70. SETUP_PPDEV_OFFSETS(ppdev, pdsurf);
  71. // Set up the clipping rectangle, if there is one
  72. if (pco && pco->iDComplexity == DC_RECT)
  73. {
  74. prclClip = &(pco->rclBounds);
  75. }
  76. // Get the logic op.
  77. logicOp = GlintLogicOpsFromR2[mix & 0xff];
  78. // Need to set up Glint modes and colors appropriately for the line.
  79. ResetGLINT = (*ppdev->pgfnInitStrips)(ppdev,
  80. iSolidColor,
  81. logicOp,
  82. prclClip);
  83. // We have to convert our integer co-ords to 28.4 fixed points.
  84. retVal = ppdev->pgfnIntegerLine(ppdev,
  85. x1 << 4,
  86. y1 << 4,
  87. x2 << 4,
  88. y2 << 4);
  89. // If we have to restore the state then... do it.
  90. if (ResetGLINT)
  91. {
  92. (*ppdev->pgfnResetStrips)(ppdev);
  93. }
  94. return (retVal);
  95. }