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.

299 lines
8.0 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1998-2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * DpDriver
  8. *
  9. * Abstract:
  10. *
  11. * Represents the driver interface that a driver will implement.
  12. * Unfortunately, in this version, the meaning is a bit confused -
  13. * the member functions are not pure virtual - rather, they implement
  14. * the software rasterizer.
  15. *
  16. * The plan is that the software rasterizer will look just like another
  17. * driver - DpDriver will be abstract, and the software rasterizer will
  18. * derive a class from DpDriver.
  19. *
  20. * Notes:
  21. *
  22. *
  23. *
  24. * Created:
  25. *
  26. * 12/01/1998 andrewgo
  27. * Created it.
  28. * 03/24/1999 agodfrey
  29. * Moved into separate file.
  30. *
  31. \**************************************************************************/
  32. #ifndef _DPDRIVER_HPP
  33. #define _DPDRIVER_HPP
  34. // Private data, used by GDI+.
  35. struct DpDriverInternal;
  36. #define DriverDrawImageFlags DWORD
  37. #define DriverDrawImageCachedBackground 0x00000001
  38. #define DriverDrawImageFirstImageBand 0x00000002
  39. #define DriverDrawImageLastImageBand 0x00000004
  40. //--------------------------------------------------------------------------
  41. // Base driver class
  42. //--------------------------------------------------------------------------
  43. class DpDriver
  44. {
  45. private:
  46. // We now use an ObjectTag to determine if the object is valid
  47. // instead of using a BOOL. This is much more robust and helps
  48. // with debugging. It also enables us to version our objects
  49. // more easily with a version number in the ObjectTag.
  50. ObjectTag Tag; // Keep this as the 1st value in the object!
  51. struct DpDriverInternal * Internal;
  52. protected:
  53. VOID SetValid(BOOL valid)
  54. {
  55. Tag = valid ? ObjectTagDpDriver : ObjectTagInvalid;
  56. }
  57. public:
  58. BOOL IsLockable; // TRUE if any surfaces with this
  59. // driver interface are opaque, meaning
  60. // that Lock() may not be called
  61. GpDevice *Device; // Associated device
  62. public:
  63. DpDriver();
  64. DpDriver(GpDevice *device)
  65. {
  66. SetValid(TRUE); // set to valid state
  67. IsLockable = TRUE;
  68. Device = device;
  69. Internal = NULL;
  70. }
  71. virtual ~DpDriver();
  72. BOOL IsValid() const
  73. {
  74. ASSERT((Tag == ObjectTagDpDriver) || (Tag == ObjectTagInvalid));
  75. #if DBG
  76. if (Tag == ObjectTagInvalid)
  77. {
  78. WARNING1("Invalid DpDriver");
  79. }
  80. #endif
  81. return (Tag == ObjectTagDpDriver);
  82. }
  83. virtual VOID
  84. DesktopChangeNotification()
  85. {
  86. // do nothing
  87. }
  88. virtual VOID
  89. UpdateSurfacePixelFormat(DpBitmap *surface)
  90. {
  91. // do nothing.
  92. // used primarily by the multimon driver to update the pixel format
  93. // for the meta surface.
  94. }
  95. virtual VOID
  96. PaletteChangeNotification()
  97. {
  98. // do nothing
  99. }
  100. virtual VOID
  101. Flush(
  102. GpDevice *device,
  103. DpBitmap *surface,
  104. GpFlushIntention intention)
  105. {
  106. surface->Flush(intention);
  107. }
  108. virtual VOID
  109. SetupClipping(
  110. HDC hdc,
  111. DpContext * context,
  112. const GpRect * drawBounds,
  113. BOOL & isClip,
  114. BOOL & usePathClipping,
  115. BOOL forceClipping
  116. );
  117. virtual VOID
  118. RestoreClipping(
  119. HDC hdc,
  120. BOOL isClip,
  121. BOOL usePathClipping
  122. );
  123. virtual GpStatus
  124. StrokePath(
  125. DpContext * context,
  126. DpBitmap * surface,
  127. const GpRect * drawBounds,
  128. const DpPath * path,
  129. const DpPen * pen
  130. );
  131. virtual GpStatus
  132. FillRects(
  133. DpContext * context,
  134. DpBitmap * surface,
  135. const GpRect * drawBounds,
  136. INT numRects, // NOTE: You must check for empty
  137. const GpRectF * rects, // rectangles!
  138. const DpBrush * brush
  139. );
  140. virtual GpStatus
  141. FillPath(
  142. DpContext * context,
  143. DpBitmap * surface,
  144. const GpRect * drawBounds,
  145. const DpPath * path,
  146. const DpBrush * brush
  147. );
  148. virtual GpStatus
  149. FillRegion(
  150. DpContext *context,
  151. DpBitmap *surface,
  152. const GpRect *drawBounds,
  153. const DpRegion *region,
  154. const DpBrush *brush
  155. );
  156. virtual GpStatus
  157. SolidText(
  158. DpContext* context,
  159. DpBitmap* surface,
  160. const GpRect* drawBounds,
  161. GpColor color,
  162. const GpGlyphPos *glyphPos,
  163. INT count,
  164. GpTextRenderingHint textMode,
  165. BOOL rightToLeft
  166. );
  167. virtual GpStatus
  168. GdiText(
  169. HDC hdc,
  170. INT angle, // In tenths of a degree
  171. const UINT16 *glyphs,
  172. const PointF *glyphOrigins,
  173. INT glyphCount,
  174. BOOL rightToLeft,
  175. UINT16 blankGlyph = 0
  176. );
  177. virtual GpStatus
  178. BrushText(
  179. DpContext* context,
  180. DpBitmap* surface,
  181. const GpRect* drawBounds,
  182. const DpBrush* brush,
  183. const GpGlyphPos *glyphPos,
  184. INT count,
  185. GpTextRenderingHint textMode
  186. );
  187. virtual GpStatus
  188. DrawGlyphs(
  189. DrawGlyphData *drawGlyphData
  190. );
  191. virtual GpStatus
  192. DrawImage(
  193. DpContext * context,
  194. DpBitmap * srcSurface,
  195. DpBitmap * dstSurface,
  196. const GpRect * drawBounds,
  197. const DpImageAttributes * imgAttributes,
  198. INT numPoints,
  199. const GpPointF * dstPoints,
  200. const GpRectF * srcRect,
  201. DriverDrawImageFlags flags
  202. );
  203. // Draw the CachedBitmap on the destination bitmap.
  204. virtual GpStatus
  205. DrawCachedBitmap(
  206. DpContext *context,
  207. DpCachedBitmap *src,
  208. DpBitmap *dst,
  209. INT x, INT y // where to put it on the destination.
  210. );
  211. virtual GpStatus
  212. MoveBits(
  213. DpContext *context,
  214. DpBitmap *surface,
  215. const GpRect *drawBounds,
  216. const GpRect *dstRect, // Device coordinates
  217. const GpPoint *srcPoint // Device coordinates
  218. );
  219. //--------------------------------------------------------------------------
  220. // Low-level driver functions
  221. //--------------------------------------------------------------------------
  222. // !!! We will inevitably be adding more functions in the next version,
  223. // which would mean that they would have to be added to the end
  224. // of the VTable?
  225. // !!! Extend the following to represent low-level D3D token primitives
  226. //--------------------------------------------------------------------------
  227. // Direct access functions - Required if IsLockable
  228. //--------------------------------------------------------------------------
  229. // Lock can return FALSE only in the case of catastrophic failure
  230. // !!! What do we do about transitional surfaces?
  231. virtual GpStatus
  232. Lock(
  233. DpBitmap *surface,
  234. const GpRect *drawBounds,
  235. INT *stride, // [OUT] - Returned stride
  236. VOID **bits // [OUT] - Returned pointer to bits
  237. );
  238. virtual VOID
  239. Unlock(
  240. DpBitmap *surface
  241. );
  242. protected:
  243. GpStatus
  244. SolidStrokePathOnePixel(
  245. DpContext *context,
  246. DpBitmap *surface,
  247. const GpRect *drawBounds,
  248. const DpPath *path,
  249. const DpPen *pen,
  250. BOOL drawLast
  251. );
  252. };
  253. #endif