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.

117 lines
2.5 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1998 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * DpPath.cpp
  8. *
  9. * Abstract:
  10. *
  11. * DpPath engine function implementation
  12. *
  13. * Created:
  14. *
  15. * 1/14/2k ericvan
  16. *
  17. \**************************************************************************/
  18. #include "precomp.hpp"
  19. /**************************************************************************\
  20. *
  21. * Function Description:
  22. *
  23. * Create a widen path from an existing path, pen and context. The context
  24. * provides the world to transform matrix, and surface dpiX, dpiY
  25. *
  26. * Arguments:
  27. *
  28. * path, context, pen
  29. *
  30. * Return Value:
  31. *
  32. * DpPath* - widened path
  33. *
  34. * Created:
  35. *
  36. * 1/14/2k ericvan
  37. *
  38. \**************************************************************************/
  39. DpPath*
  40. GpPath::DriverCreateWidenedPath(
  41. const DpPath* path,
  42. const DpPen* pen,
  43. DpContext* context,
  44. BOOL outline
  45. )
  46. {
  47. const GpPath* gpPath = GpPath::GetPath(path);
  48. const GpPen* gpPen = GpPen::GetPen(pen);
  49. ASSERT(gpPath->IsValid());
  50. ASSERT(gpPen->IsValid());
  51. GpPath* widenPath;
  52. GpMatrix identityMatrix; // default initialized to identity matrix.
  53. widenPath = gpPath->GetWidenedPath(
  54. gpPen,
  55. context ?
  56. &(context->WorldToDevice) :
  57. &identityMatrix,
  58. FlatnessDefault
  59. );
  60. if(outline && (widenPath!=NULL))
  61. {
  62. // pass in identity matrix because GetWidenedPath has already
  63. // transformed into the device space.
  64. // Note: We explicitly ignore the return code here because we want
  65. // to draw witht he widened path if the ComputeWindingModeOutline
  66. // fails.
  67. widenPath->ComputeWindingModeOutline(&identityMatrix, FlatnessDefault);
  68. }
  69. // Returns NULL on failure.
  70. return (DpPath*) widenPath;
  71. }
  72. VOID
  73. GpPath::DriverDeletePath(
  74. DpPath* path
  75. )
  76. {
  77. GpPath* gpPath = GpPath::GetPath(path);
  78. ASSERT(gpPath->IsValid());
  79. delete gpPath;
  80. }
  81. DpPath*
  82. GpPath::DriverClonePath(
  83. DpPath* path
  84. )
  85. {
  86. GpPath* gpPath = GpPath::GetPath(path);
  87. ASSERT(gpPath->IsValid());
  88. return (DpPath*)(gpPath->Clone());
  89. }
  90. VOID
  91. GpPath::DriverTransformPath(
  92. DpPath* path,
  93. GpMatrix* matrix
  94. )
  95. {
  96. GpPath* gpPath = GpPath::GetPath(path);
  97. ASSERT(gpPath->IsValid());
  98. gpPath->Transform(matrix);
  99. }