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.

136 lines
3.3 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: lineto.c
  8. *
  9. * Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
  10. * Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved.
  11. *****************************************************************************/
  12. #include "precomp.h"
  13. #include "gdi.h"
  14. #include "rops.h"
  15. #include "log.h"
  16. //-----------------------------------------------------------------------------
  17. // BOOL DrvLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix)
  18. //
  19. // DrvLineTo() is an optimised, integer co-ordinate, API call that doesn't
  20. // support styling. The integer-line code in Strips.c is called to do the
  21. // hard work.
  22. //
  23. //
  24. //-----------------------------------------------------------------------------
  25. BOOL
  26. DrvLineTo(
  27. SURFOBJ* pso,
  28. CLIPOBJ* pco,
  29. BRUSHOBJ* pbo,
  30. LONG x1,
  31. LONG y1,
  32. LONG x2,
  33. LONG y2,
  34. RECTL* prclBounds,
  35. MIX mix)
  36. {
  37. PDev* ppdev;
  38. Surf* psurf;
  39. BOOL bResetHW;
  40. DWORD logicOp;
  41. RECTL* prclClip = (RECTL*)NULL;
  42. BOOL retVal;
  43. ULONG iSolidColor = pbo->iSolidColor;
  44. BOOL bResult;
  45. //
  46. // PUnt call to engine if not in video memory
  47. //
  48. psurf = (Surf*)pso->dhsurf;
  49. if (psurf->flags & SF_SM)
  50. {
  51. goto puntIt;
  52. }
  53. if (pco != NULL)
  54. {
  55. if( pco->iDComplexity == DC_COMPLEX)
  56. {
  57. // hardware does not support complex clipping
  58. goto puntIt;
  59. }
  60. else if(pco->iDComplexity == DC_RECT)
  61. {
  62. prclClip = &(pco->rclBounds);
  63. }
  64. }
  65. ppdev = (PDev*) pso->dhpdev;
  66. //@@BEGIN_DDKSPLIT
  67. #if MULTITHREADED
  68. if(ppdev->ulLockCount)
  69. {
  70. DBG_GDI((MT_LOG_LEVEL, "DrvLineTo: re-entered! %d", ppdev->ulLockCount));
  71. }
  72. EngAcquireSemaphore(ppdev->hsemLock);
  73. ppdev->ulLockCount++;
  74. #endif
  75. //@@END_DDKSPLIT
  76. vCheckGdiContext(ppdev);
  77. ppdev->psurf = psurf;
  78. // Get the logic op.
  79. logicOp = ulRop3ToLogicop(gaMix[mix & 0xff]);
  80. // Need to set up Permedia2 modes and colors appropriately for the line.
  81. bResetHW = bInitializeStrips(ppdev, iSolidColor, logicOp, prclClip);
  82. // bFastIntegerLine expects co-ords in 28.4 format
  83. bResult = bFastIntegerLine (ppdev, x1 << 4, y1 << 4, x2 << 4, y2 << 4);
  84. // If we have to restore the state then... do it.
  85. if (bResetHW)
  86. vResetStrips(ppdev);
  87. InputBufferFlush(ppdev);
  88. //@@BEGIN_DDKSPLIT
  89. #if MULTITHREADED
  90. ppdev->ulLockCount--;
  91. EngReleaseSemaphore(ppdev->hsemLock);
  92. #endif
  93. //@@END_DDKSPLIT
  94. if(bResult)
  95. return TRUE;
  96. // we failed to draw above, fall through thus punting to engine
  97. puntIt:
  98. //@@BEGIN_DDKSPLIT
  99. #if GDI_TEST
  100. ULONG flags = vPuntBefore(NULL, pso);
  101. #endif
  102. //@@END_DDKSPLIT
  103. bResult = EngLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix);
  104. //@@BEGIN_DDKSPLIT
  105. #if GDI_TEST
  106. vPuntAfter(flags, NULL, pso);
  107. vLogPunt();
  108. #endif
  109. //@@END_DDKSPLIT
  110. return bResult;
  111. }// DrvLineTo()