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.

2018 lines
73 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: dcobj.hxx
  3. *
  4. * Definition the the base DC user object
  5. *
  6. * Created: 23-Jul-1989 17:06:20
  7. * Author: Donald Sidoroff [donalds]
  8. *
  9. * Copyright (c) 1990-1999 Microsoft Corporation
  10. \**************************************************************************/
  11. #ifndef _DCOBJHXX_
  12. #define _DCOBJHXX_
  13. #ifndef GDIFLAGS_ONLY // used for gdikdx
  14. //
  15. // STOCKOBJECTS
  16. //
  17. extern HANDLE gahStockObjects[PRIV_STOCK_LAST+1];
  18. #define STOCKOBJ_PAL (HPAL) gahStockObjects[DEFAULT_PALETTE]
  19. #define STOCKFONT(iFont) (HLFONT) gahStockObjects[iFont]
  20. #define STOCKOBJ_SYSFONT (HLFONT) gahStockObjects[SYSTEM_FONT]
  21. #define STOCKOBJ_SYSFIXEDFONT (HLFONT) gahStockObjects[SYSTEM_FIXED_FONT]
  22. #define STOCKOBJ_OEMFIXEDFONT (HLFONT) gahStockObjects[OEM_FIXED_FONT]
  23. #define STOCKOBJ_ANSIFIXEDFONT (HLFONT) gahStockObjects[ANSI_FIXED_FONT]
  24. #define STOCKOBJ_ANSIVARFONT (HLFONT) gahStockObjects[ANSI_VAR_FONT]
  25. #define STOCKOBJ_DEFAULTDEVFONT (HLFONT) gahStockObjects[DEVICE_DEFAULT_FONT]
  26. #define STOCKOBJ_NULLBRUSH (HBRUSH) gahStockObjects[NULL_BRUSH]
  27. #define STOCKOBJ_WHITEPEN (HPEN) gahStockObjects[WHITE_PEN]
  28. #define STOCKOBJ_BLACKPEN (HPEN) gahStockObjects[BLACK_PEN]
  29. #define STOCKOBJ_NULLPEN (HPEN) gahStockObjects[NULL_PEN]
  30. #if(WINVER >= 0x0400)
  31. #define STOCKOBJ_DEFAULTGUIFONT (HLFONT) gahStockObjects[DEFAULT_GUI_FONT]
  32. #endif
  33. #define STOCKOBJ_BITMAP (HBITMAP) gahStockObjects[PRIV_STOCK_BITMAP]
  34. #define STOCKOBJ_COLORSPACE (HCOLORSPACE) gahStockObjects[PRIV_STOCK_COLORSPACE]
  35. BOOL bSetStockObject(HANDLE h,int iObj);
  36. #define MIRRORED_DC(pdc) (pdc->dwLayout() & LAYOUT_RTL)
  37. #define MIRRORED_DC_NO_BITMAP_FLIP(pdc) ((pdc->dwLayout() & (LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED)) == \
  38. (LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED))
  39. #endif // GDIFLAGS_ONLY used for gdikdx
  40. // Flags for dc.fs
  41. #define DC_DISPLAY 0x0001
  42. #define DC_DIRECT 0x0002
  43. #define DC_CANCELED 0x0004
  44. #define DC_PERMANANT 0x0008
  45. #define DC_DIRTY_RAO 0x0010
  46. #define DC_ACCUM_WMGR 0x0020
  47. #define DC_ACCUM_APP 0x0040
  48. #define DC_RESET 0x0080
  49. #define DC_SYNCHRONIZEACCESS 0x0100
  50. #define DC_EPSPRINTINGESCAPE 0x0200
  51. #define DC_TEMPINFODC 0x0400
  52. #define DC_FULLSCREEN 0x0800
  53. #define DC_IN_CLONEPDEV 0x1000
  54. #define DC_REDIRECTION 0x2000
  55. #define DC_SHAREACCESS 0x4000
  56. #define DC_STOCKBITMAP 0x8000
  57. // Flags for flPath in DC
  58. #define DCPATH_ACTIVE 0x0001L // Set if DC in path bracket
  59. #define DCPATH_SAVE 0x0002L // Set if lazy save for path pending
  60. #define DCPATH_CLOCKWISE 0x0004L // Set if arcs to be drawn clockwise
  61. // misc flags
  62. #define CA_DEFAULT 0x8000
  63. #ifndef GDIFLAGS_ONLY // used for gdikdx
  64. //
  65. // Forward Class declarations needed in this file
  66. //
  67. class EWNDOBJ;
  68. class SURFACE;
  69. extern DC_ATTR DcAttrDefault;
  70. #define QUICK_UFI_LINKS 4
  71. /*********************************Class************************************\
  72. * class DC
  73. *
  74. * History:
  75. * 3-Nov-1994 -by- Lingyun Wang [lingyunw]
  76. * Moved some client side attrs over
  77. *
  78. * Thu 09-Aug-1990 20:41:55 -by- Charles Whitmer [chuckwh]
  79. * Separated out the DCLEVEL part. Ripped out lots of fields.
  80. *
  81. * Thu 01-Jun-1989 08:43:17 by Kirk Olynyk [kirko]
  82. * Wrote it.
  83. \**************************************************************************/
  84. // The DCLEVEL is the part of the DC that must be preserved for each saved
  85. // DC level. The rest of the DC belongs to the Window Manager and the DC
  86. // Manager.
  87. class DCLEVEL
  88. {
  89. public:
  90. // *** ASSOCIATED OBJECTS ***
  91. HPAL hpal;
  92. PPALETTE ppal;
  93. // *** COLOR SPACE ***
  94. PVOID pColorSpace;
  95. // *** ICM modes ***
  96. ULONG lIcmMode;
  97. // *** SaveDC INFORMATION ***
  98. LONG lSaveDepth;
  99. LONG lSaveDepthStartDoc;
  100. HDC hdcSave;
  101. // *** BRUSH INFORMATION ***
  102. POINTL ptlKmBrushOrigin; // KM component of ptlBrushOrg
  103. // Brush origin matches dcattr in kmode
  104. PBRUSH pbrFill; // Brush used for filling
  105. PBRUSH pbrLine; // Brush used for lines
  106. PLFONT plfntNew_; // Currently selected font
  107. // *** PATHS DATA ***
  108. HPATH hpath; // DC's active or inactive path
  109. FLONG flPath;
  110. LINEATTRS laPath; // Realized line attributes
  111. // *** REGIONS DATA ***
  112. PREGION prgnClip; // May be NULL
  113. PREGION prgnMeta; // May be NULL
  114. // *** HALFTONE COLOR ADJUSTMENT DATA ***
  115. COLORADJUSTMENT ca;
  116. // *** FONT STATE FLAGS ***
  117. FLONG flFontState;
  118. // *** Forced mapping
  119. UNIVERSAL_FONT_ID ufi; // UFI to which mapping must be forced
  120. // *** Remote font links
  121. UNIVERSAL_FONT_ID aQuickLinks[QUICK_UFI_LINKS];
  122. PUNIVERSAL_FONT_ID pufi; // UFIs which must be linked to font in DC
  123. UINT uNumLinkedFonts; // number of UFIs currently linked
  124. BOOL bTurnOffLinking; // linking must be turned off to match state
  125. // on client machine
  126. // *** General Flags ***
  127. FLONG fl;
  128. // *** brush Flags ***
  129. FLONG flbrush;
  130. // *** TRANSFORMS COMPONENT DATA ***
  131. MATRIX mxWorldToDevice;
  132. MATRIX mxDeviceToWorld;
  133. MATRIX mxWorldToPage;
  134. EFLOAT efM11PtoD; // efM11 of the Page transform
  135. EFLOAT efM22PtoD; // efM22 of the Page transform
  136. EFLOAT efDxPtoD; // efDx of the Page transform
  137. EFLOAT efDyPtoD; // efDy of the Page transform
  138. EFLOAT efM11_TWIPS; // cache the TWIPS values
  139. EFLOAT efM22_TWIPS; //
  140. // *** Set by metafile component. ***
  141. EFLOAT efPr11; // (Page to Device)11 of the metafile recording device
  142. EFLOAT efPr22; // (Page to Device)22 of the metafile recording device
  143. // *** OBJECTS AFFECTED BY DYNAMIC MODE CHANGING ***
  144. //
  145. // These must come at the end of the DCLEVEL structure so that they're not
  146. // overwritten when the DCLEVEL is reset. Look at bCleanDC() to see how
  147. // the DCLEVEL only up to offsetof(DCLEVEL, pSurface) is copied.
  148. SURFACE *pSurface; // Level dependent for DCTYPE_MEMORY.
  149. SIZEL sizl; // Size of the surface or bitmap.
  150. };
  151. #endif // GDIFLAGS_ONLY used for gdikdx
  152. // These are the general flags for fl in the DCLEVEL
  153. #define DC_FL_PAL_BACK 0x00000001
  154. // These flags are used to specify the state of the font selected into the
  155. // DC. When the transform changes such that it may impact the font context,
  156. // the DC_DIRTYFONT_XFORM flag must be set. When the logical font is changed,
  157. // the DC_DIRTYFONT_LFONT flag must be set.
  158. //
  159. #define DC_DIRTYFONT_XFORM 0x00000001
  160. #define DC_DIRTYFONT_LFONT 0x00000002
  161. #define DC_UFI_MAPPING 0x00000004
  162. //
  163. // These flags are used to indicate which realizations may have been dirtied
  164. // since the objects (fonts, brushes, etc) were realized. The flags are set
  165. // where the action takes place, and are gathered here so that we can quickly
  166. // determine which objects need to be re-realized at API time.
  167. #define DC_DIRTYBRUSHES 0x00000001
  168. #ifndef GDIFLAGS_ONLY // used for gdikdx
  169. // used to keep track of remote fonts installed on this DC.
  170. typedef struct tagPFFLIST {
  171. PFF *pPFF;
  172. struct tagPFFLIST *pNext;
  173. } PFFLIST;
  174. // used to keep track of linked font setting from remote machine
  175. // used to keep track of color transform created on this DC.
  176. typedef struct tagCXFLIST {
  177. HANDLE hCXform;
  178. struct tagCXFLIST *pNext;
  179. } CXFLIST, *PCXFLIST;
  180. class PDEV; // Forward reference.
  181. /*********************************Class************************************\
  182. * class DC
  183. *
  184. * History:
  185. * 29-Dec-1994 -by- Eric Kutter [erick]
  186. * Added comment header, rearanged to have methods directly off of DC
  187. \**************************************************************************/
  188. class DC : public OBJECT
  189. {
  190. public:
  191. //
  192. // These fields can be changed asynchronously by dynamic mode changing.
  193. //
  194. DHPDEV dhpdev_; // Driver's dhpdev value
  195. DCTYPE dctp_;
  196. FSHORT fs_;
  197. //
  198. // DC Manager info.
  199. //
  200. PDEV *ppdev_;
  201. HSEMAPHORE hsemDcDevLock_; // Semaphore from the PDEV, not necessarily a Display.
  202. FLONG flGraphicsCaps_; // cached here from pdev
  203. FLONG flGraphicsCaps2_; // cached here from pdev
  204. //
  205. // Level dependent attributes
  206. //
  207. PDC_ATTR pDCAttr;
  208. DCLEVEL dclevel;
  209. DC_ATTR dcattr;
  210. //
  211. // Linked list of DC's off of palette
  212. //
  213. HDC hdcNext_; // linked list of DC's
  214. HDC hdcPrev_;
  215. //
  216. // Window Manager info.
  217. //
  218. ERECTL erclClip_; // This contains the first rectangle of
  219. // the Rao-Region. To quickly check for
  220. // no clip case we compare to this guy.
  221. EPOINTL eptlOrigin_; // DC origin
  222. ERECTL erclWindow_; // Extents of window
  223. ERECTL erclBounds_; // USER/Metafile accumulation
  224. ERECTL erclBoundsApp_; // Application accumulation
  225. REGION *prgnAPI_;
  226. REGION *prgnVis_; // Cached pointer to VisRgn
  227. REGION *prgnRao_; // Cached pointer to RaoRgn
  228. //
  229. // Accelerators for the brush
  230. //
  231. POINTL ptlFillOrigin_; // Alignment origin for brushes
  232. EBRUSHOBJ eboFill_; // Brush used for filling
  233. EBRUSHOBJ eboLine_; // Brush used for lines
  234. EBRUSHOBJ eboText_; // Brush used for text
  235. EBRUSHOBJ eboBackground_; // Brush used for opaque text
  236. //
  237. // Accelerators for Fonts
  238. //
  239. HLFONT hlfntCur_; // handle of the selected LFONT
  240. FLONG flSimulationFlags_; // cached from LFONT
  241. LONG lEscapement_; // cached from LFONT
  242. RFONT *prfnt_; // accelerator for font selection
  243. XCLIPOBJ co_; // cached clip object
  244. //
  245. // Remote font stuff.
  246. //
  247. PFFLIST *pPFFList; // list of remote fonts installed
  248. // on this DC.
  249. //
  250. // Color transform stuff
  251. //
  252. CXFLIST *pCXFList; // list of color transform created
  253. // on this DC.
  254. //
  255. // OpenGL info.
  256. //
  257. SHORT ipfdDevMax_; // Max device pixel formats, init to -1
  258. //
  259. // for printing, remember the copy count
  260. //
  261. ULONG ulCopyCount_; // copy count for printing
  262. SURFACE *psurfInfo_;
  263. POINTL ptlBandPosition_; // current band position in current page.
  264. #if DBG || defined(PRERELEASE)
  265. BOOL bValidateVisrgn_;
  266. #endif
  267. /**************************************************************************\
  268. *
  269. * Attribute methods
  270. *
  271. \**************************************************************************/
  272. public:
  273. DWORD iCS_CP() { return(pDCAttr->iCS_CP); }
  274. DWORD iCS_CP(DWORD dw) { return(pDCAttr->iCS_CP = dw); }
  275. BYTE jROP2() { return(pDCAttr->jROP2); }
  276. BYTE jROP2(BYTE j) { return(pDCAttr->jROP2 = j); }
  277. BYTE jBkMode() { return(pDCAttr->jBkMode); }
  278. BYTE jBkMode(BYTE j) { return(pDCAttr->jBkMode = j); }
  279. LONG lBkMode() { return(pDCAttr->lBkMode); }
  280. LONG lBkMode(LONG l) { return(pDCAttr->lBkMode = l); }
  281. BYTE jFillMode() { return(pDCAttr->jFillMode); }
  282. BYTE jFillMode(BYTE j) { return(pDCAttr->jFillMode = j); }
  283. LONG lFillMode() { return(pDCAttr->lFillMode); }
  284. LONG lFillMode(LONG l) { return(pDCAttr->lFillMode = l); }
  285. BYTE jStretchBltMode() { return(pDCAttr->jStretchBltMode); }
  286. BYTE jStretchBltMode(BYTE j) { return(pDCAttr->jStretchBltMode = j); }
  287. LONG lStretchBltMode() { return(pDCAttr->lStretchBltMode); }
  288. LONG lStretchBltMode(LONG l) { return(pDCAttr->lStretchBltMode = l); }
  289. int iGraphicsMode() { return(pDCAttr->iGraphicsMode); }
  290. int iGraphicsMode(int i) { return(pDCAttr->iGraphicsMode = i); }
  291. COLORREF crBackClr() { return(pDCAttr->crBackgroundClr); }
  292. COLORREF crBackClr(COLORREF cr) { return(pDCAttr->crBackgroundClr = cr); }
  293. ULONG ulBackClr() { return(pDCAttr->ulBackgroundClr); }
  294. ULONG ulBackClr(ULONG ul) { return(pDCAttr->ulBackgroundClr = ul); }
  295. COLORREF crTextClr() { return(pDCAttr->crForegroundClr); }
  296. COLORREF crTextClr(COLORREF cr) { return(pDCAttr->crForegroundClr = cr); }
  297. ULONG ulTextClr() { return(pDCAttr->ulForegroundClr); }
  298. ULONG ulTextClr(COLORREF ul) { return(pDCAttr->ulForegroundClr = ul); }
  299. COLORREF crDCBrushClr() { return(pDCAttr->crDCBrushClr); }
  300. COLORREF crDCBrushClr(COLORREF cr) { return(pDCAttr->crDCBrushClr = cr); }
  301. COLORREF ulDCBrushClr() { return(pDCAttr->ulDCBrushClr); }
  302. COLORREF ulDCBrushClr(ULONG ul) { return(pDCAttr->ulDCBrushClr = ul); }
  303. COLORREF crDCPenClr() { return(pDCAttr->crDCPenClr); }
  304. COLORREF crDCPenClr(COLORREF cr) { return(pDCAttr->crDCPenClr = cr); }
  305. COLORREF ulDCPenClr() { return(pDCAttr->ulDCPenClr); }
  306. COLORREF ulDCPenClr(ULONG ul) { return(pDCAttr->ulDCPenClr = ul); }
  307. FLONG flTextAlign() { return(pDCAttr->flTextAlign); }
  308. FLONG flTextAlign(FLONG fl) { return(pDCAttr->flTextAlign = fl);}
  309. LONG lTextAlign() { return(pDCAttr->lTextAlign); }
  310. LONG lTextAlign(LONG l) { return(pDCAttr->lTextAlign = l); }
  311. LONG lTextExtra() { return(pDCAttr->lTextExtra); }
  312. LONG lTextExtra(LONG l) { return(pDCAttr->lTextExtra = l); }
  313. LONG lBreakExtra() { return(pDCAttr->lBreakExtra); }
  314. LONG cBreak() { return(pDCAttr->cBreak); }
  315. LONG lBreakExtra(LONG l) { return(pDCAttr->lBreakExtra = l);}
  316. LONG cBreak(LONG l) { return(pDCAttr->cBreak = l); }
  317. DWORD dwLayout() { return(pDCAttr->dwLayout); }
  318. void dwLayout(DWORD dwLayout_) { pDCAttr->dwLayout = dwLayout_; }
  319. LONG lRelAbs() { return(pDCAttr->lRelAbs); }
  320. LONG lRelAbs(LONG l) { return(pDCAttr->lRelAbs = l); }
  321. /**************************************************************************\
  322. *
  323. * BRUSH methods
  324. *
  325. \**************************************************************************/
  326. public:
  327. // Return the current logical brush handle.
  328. PBRUSH pbrushFill() { return(dclevel.pbrFill); }
  329. PBRUSH pbrushLine() { return(dclevel.pbrLine); }
  330. PBRUSH pbrushFill(PBRUSH p) { return(dclevel.pbrFill=p); }
  331. PBRUSH pbrushLine(PBRUSH p) { return(dclevel.pbrLine=p); }
  332. FLONG flbrush() { return(dclevel.flbrush);}
  333. FLONG flbrush(FLONG fl) { return(dclevel.flbrush=fl); }
  334. // move brush flags here so that a different process can access this field (when it cannot
  335. // access the one in dc_attr)
  336. FLONG flbrushAdd(LONG lflag) { return(dclevel.flbrush |= lflag);}
  337. FLONG flbrushSub(LONG lflag) { return(dclevel.flbrush &= ~lflag);}
  338. EBRUSHOBJ *peboFill() { return(&eboFill_); }
  339. EBRUSHOBJ *peboLine() { return(&eboLine_); }
  340. EBRUSHOBJ *peboText() { return(&eboText_); }
  341. EBRUSHOBJ *peboBackground() { return(&eboBackground_); }
  342. // ptlFillOrigin -- Return a reference to the filling origin. (window)
  343. POINTL& ptlFillOrigin() { return(ptlFillOrigin_); }
  344. VOID ptlFillOrigin(PPOINTL pptl){ ptlFillOrigin_ = *pptl; }
  345. VOID ptlFillOrigin(LONG x, LONG y)
  346. {
  347. ptlFillOrigin_.x = x;
  348. ptlFillOrigin_.y = y;
  349. }
  350. // Update fill origin. Note: this routine uses the ptlBrushOrigin
  351. // from the dclevel, not pdcattr. This is because the value must
  352. // be visible to all process. This is kept in sync with
  353. // pdcattr->ptlBrushOrigin by a batched command
  354. VOID vCalcFillOrigin()
  355. {
  356. ptlFillOrigin_.x = dclevel.ptlKmBrushOrigin.x + eptlOrigin_.x;
  357. ptlFillOrigin_.y = dclevel.ptlKmBrushOrigin.y + eptlOrigin_.y;
  358. }
  359. // ptlKmBrushOrigin -- Set/return brush origin as set by application
  360. POINTL& ptlBrushOrigin() { return(dclevel.ptlKmBrushOrigin); }
  361. POINTL& ptlBrushOrigin(LONG x, LONG y)
  362. {
  363. dclevel.ptlKmBrushOrigin.x = x;
  364. dclevel.ptlKmBrushOrigin.y = y;
  365. vCalcFillOrigin();
  366. return(dclevel.ptlKmBrushOrigin);
  367. }
  368. HLFONT hlfntNew () { return((HLFONT)pDCAttr->hlfntNew);}
  369. HLFONT hlfntNew (HLFONT _hlfnt)
  370. {
  371. return((HLFONT)(pDCAttr->hlfntNew = (HANDLE) _hlfnt));
  372. }
  373. HBRUSH hbrush() { return((HBRUSH)pDCAttr->hbrush); };
  374. HBRUSH hbrush(HBRUSH h) { return((HBRUSH)(pDCAttr->hbrush = (HANDLE)h));};
  375. HPEN hpen() { return((HPEN)pDCAttr->hpen); };
  376. HPEN hpen(HPEN h) { return((HPEN)(pDCAttr->hpen = (HANDLE)h)); };
  377. ULONG ulDirty() { return(pDCAttr->ulDirty_); };
  378. ULONG ulDirty(ULONG fl) { return(pDCAttr->ulDirty_ = fl); };
  379. ULONG ulDirtyAdd(ULONG fl) { return(pDCAttr->ulDirty_ |= fl); };
  380. ULONG ulDirtySub(ULONG fl) { return(pDCAttr->ulDirty_ &= ~fl); };
  381. /**************************************************************************\
  382. *
  383. * Font methods
  384. *
  385. \**************************************************************************/
  386. public:
  387. RFONT *prfnt() { return(prfnt_); }
  388. RFONT *prfnt(RFONT *prfnt) { return(prfnt_ = prfnt); }
  389. HLFONT hlfntCur() { return(hlfntCur_); }
  390. HLFONT hlfntCur(HLFONT hlfnt) { return(hlfntCur_ = hlfnt); }
  391. FLONG flSimulationFlags() { return(flSimulationFlags_); }
  392. FLONG flSimulationFlags(FLONG fl) { return(flSimulationFlags_ = fl); }
  393. LONG lEscapement() { return(lEscapement_); }
  394. LONG lEscapement(LONG l) { return(lEscapement_ = l); }
  395. BOOL bXFormChange()
  396. {
  397. return(dclevel.flFontState & DC_DIRTYFONT_XFORM);
  398. }
  399. BOOL bForcedMapping( PUNIVERSAL_FONT_ID pufi )
  400. {
  401. if( dclevel.flFontState & DC_UFI_MAPPING )
  402. {
  403. *pufi = *(&dclevel.ufi);
  404. return(TRUE);
  405. }
  406. else
  407. {
  408. return(FALSE);
  409. }
  410. }
  411. VOID vForceMapping( PUNIVERSAL_FONT_ID pufi )
  412. {
  413. *(&dclevel.ufi) = *pufi;
  414. dclevel.flFontState |= DC_UFI_MAPPING;
  415. }
  416. VOID vXformChange(BOOL bDirty)
  417. {
  418. if (bDirty)
  419. dclevel.flFontState |= DC_DIRTYFONT_XFORM;
  420. else
  421. dclevel.flFontState &= ~DC_DIRTYFONT_XFORM;
  422. }
  423. FLONG flFontMapper() { return(pDCAttr->flFontMapper); }
  424. FLONG flFontMapper(FLONG fl) { return(pDCAttr->flFontMapper = fl); }
  425. // pointer to a currently selected logfont object,
  426. // this is somewhat analogous to pbrFill in how it is ref counted.
  427. PLFONT plfntNew() { return (dclevel.plfntNew_); }
  428. PLFONT plfntNew(PLFONT p) { return (dclevel.plfntNew_ = p); }
  429. VOID vPFFListSet(PFFLIST *pPFFList_) { pPFFList = pPFFList_; }
  430. /**************************************************************************\
  431. *
  432. * Palette methods
  433. *
  434. \**************************************************************************/
  435. public:
  436. VOID hpal(HPAL hpal) { dclevel.hpal = hpal; }
  437. HPAL hpal() { return(dclevel.hpal); }
  438. VOID ppal(PPALETTE ppalNew) { dclevel.ppal = ppalNew; }
  439. PPALETTE ppal() { return(dclevel.ppal); }
  440. HDC hdcPrev() { return(hdcPrev_); }
  441. HDC hdcNext() { return(hdcNext_); }
  442. HDC hdcPrev(HDC hdcTemp) { return(hdcPrev_ = hdcTemp); }
  443. HDC hdcNext(HDC hdcTemp) { return(hdcNext_ = hdcTemp); }
  444. /**************************************************************************\
  445. *
  446. * Path methods
  447. *
  448. \**************************************************************************/
  449. public:
  450. // Current position functions. We keep values for both the logical space
  451. // current position (ptlCurrent) and device space current position
  452. // (ptfxCurrent).
  453. //
  454. // We must keep a logical space CP for Win3.x compatibility, and we keep a
  455. // device space CP for speed in functions like TextOut, which updates the
  456. // CP in device space.
  457. //
  458. // At any one time, either ptlCurrent or ptfxCurrent or both are valid;
  459. // the bValidPtlCurrent() or bValidPtfxCurrent() flags must be checked
  460. // before using the value; if it's not valid, apply the appropriate
  461. // transform to the other value.
  462. BOOL bValidPtlCurrent()
  463. { return(!(pDCAttr->ulDirty_ & DIRTY_PTLCURRENT)); }
  464. BOOL bValidPtfxCurrent()
  465. { return(!(pDCAttr->ulDirty_ & DIRTY_PTFXCURRENT)); }
  466. POINTFIX& ptfxCurrent(POINTFIX& ptfx)
  467. { return(pDCAttr->ptfxCurrent.x = ptfx.x,
  468. pDCAttr->ptfxCurrent.y = ptfx.y,
  469. *((POINTFIX*) &pDCAttr->ptfxCurrent)); }
  470. POINTL& ptlCurrent(POINTL& ptl)
  471. { return(pDCAttr->ptlCurrent.x = ptl.x,
  472. pDCAttr->ptlCurrent.y = ptl.y,
  473. pDCAttr->ptlCurrent); }
  474. VOID vInvalidatePtlCurrent()
  475. { pDCAttr->ulDirty_ |= DIRTY_PTLCURRENT; }
  476. VOID vInvalidatePtfxCurrent()
  477. { pDCAttr->ulDirty_ |= DIRTY_PTFXCURRENT; }
  478. VOID vValidatePtlCurrent()
  479. { pDCAttr->ulDirty_ &= ~DIRTY_PTLCURRENT; }
  480. VOID vValidatePtfxCurrent()
  481. { pDCAttr->ulDirty_ &= ~DIRTY_PTFXCURRENT; }
  482. VOID vCurrentPosition(const POINTL& ptl, const POINTFIX& ptfx)
  483. {
  484. pDCAttr->ulDirty_ &= ~(DIRTY_PTFXCURRENT | DIRTY_PTLCURRENT);
  485. pDCAttr->ptlCurrent.x = ptl.x;
  486. pDCAttr->ptlCurrent.y = ptl.y;
  487. pDCAttr->ptfxCurrent.x = ptfx.x;
  488. pDCAttr->ptfxCurrent.y = ptfx.y;
  489. }
  490. VOID vCurrentPosition(LONG x, LONG y, FIX fxX, FIX fxY)
  491. {
  492. pDCAttr->ulDirty_ &= ~(DIRTY_PTFXCURRENT | DIRTY_PTLCURRENT);
  493. pDCAttr->ptlCurrent.x = x;
  494. pDCAttr->ptlCurrent.y = y;
  495. pDCAttr->ptfxCurrent.x = fxX;
  496. pDCAttr->ptfxCurrent.y = fxY;
  497. }
  498. VOID vPtfxCurrentPosition(FIX fxX, FIX fxY)
  499. {
  500. pDCAttr->ulDirty_ &= ~DIRTY_PTFXCURRENT;
  501. pDCAttr->ulDirty_ |= DIRTY_PTLCURRENT;
  502. pDCAttr->ptfxCurrent.x = fxX;
  503. pDCAttr->ptfxCurrent.y = fxY;
  504. }
  505. // hpath - return or set path handle
  506. HPATH hpath(HPATH hpath)
  507. {
  508. // Private debug code to catch invalid hpath handle in DC
  509. // 6/24/98 - davidx
  510. ASSERTGDI(hpath == HPATH_INVALID || HmgObjtype(hpath) == PATH_TYPE,
  511. "Private debug breakpoint. Please contact ntgdi.");
  512. return(dclevel.hpath = hpath);
  513. }
  514. // Decide if there is no path, or if in path bracket, or if done bracket
  515. BOOL bNone() { return(dclevel.hpath == HPATH_INVALID);}
  516. BOOL bActive() { return(dclevel.flPath & DCPATH_ACTIVE);}
  517. BOOL bInactive() { return(!bNone() && !bActive()); }
  518. VOID vSetActive() { dclevel.flPath |= DCPATH_ACTIVE; }
  519. VOID vClearActive() { dclevel.flPath &= ~DCPATH_ACTIVE; }
  520. VOID vDestroy() { vClearActive(); hpath(HPATH_INVALID);}
  521. // Set direction in which arcs are drawn
  522. BOOL bClockwise() { return(dclevel.flPath & DCPATH_CLOCKWISE);}
  523. VOID vSetClockwise() { dclevel.flPath |= DCPATH_CLOCKWISE; }
  524. VOID vClearClockwise() { dclevel.flPath &= ~DCPATH_CLOCKWISE; }
  525. // Lazy save flag for SaveDC
  526. BOOL bLazySave() { return(dclevel.flPath & DCPATH_SAVE);}
  527. VOID vSetLazySave() { dclevel.flPath |= DCPATH_SAVE; }
  528. VOID vClearLazySave() { dclevel.flPath &= ~DCPATH_SAVE; }
  529. FLOATL l_eMiterLimit(FLOATL& e) { return(dclevel.laPath.eMiterLimit = e);}
  530. FLOATL l_eMiterLimit() { return(dclevel.laPath.eMiterLimit); }
  531. // Line-state type is LONG if pen selected into DC is a styled cosmetic
  532. // pen, and FLOAT if pen selected is a geometric styled pen (undefined
  533. // otherwise):
  534. FLOAT_LONG elStyleState() { return(dclevel.laPath.elStyleState); }
  535. FLOAT_LONG elStyleState(FLOAT_LONG el){ return(dclevel.laPath.elStyleState = el);}
  536. LONG lStyleState() { return(dclevel.laPath.elStyleState.l); }
  537. LONG lStyleState(LONG l) { return(dclevel.laPath.elStyleState.l = l); }
  538. FLOATL l_eStyleState() { return(dclevel.laPath.elStyleState.e); }
  539. FLOATL l_eStyleState(FLOATL e) { return(dclevel.laPath.elStyleState.e = e); }
  540. // LINEATTRS support:
  541. VOID vRealizeLineAttrs(EXFORMOBJ& exo);
  542. BOOL bOldPenNominal(EXFORMOBJ& exo, LONG lPenWidth);
  543. /**************************************************************************\
  544. *
  545. * Region methods
  546. *
  547. \**************************************************************************/
  548. public:
  549. #if DBG || defined(PRERELEASE)
  550. BOOL bValidateVisrgn() { return(bValidateVisrgn_); }
  551. VOID vValidateVisrgn(BOOL b) { bValidateVisrgn_ = b; }
  552. #endif
  553. REGION *prgnVis() { return(prgnVis_); }
  554. REGION *prgnVis(REGION *prgn) { return(prgnVis_ = prgn); }
  555. REGION *prgnRao() { return(prgnRao_); }
  556. REGION *prgnRao(REGION *prgn) { return(prgnRao_ = prgn); }
  557. VOID vReleaseVis();
  558. VOID vReleaseRao();
  559. BOOL bDirtyRao() { return(fs_ & DC_DIRTY_RAO); }
  560. PREGION prgnAPI() { return(prgnAPI_); }
  561. PREGION prgnAPI(PREGION prgn)
  562. {
  563. vReleaseRao();
  564. return(prgnAPI_ = prgn);
  565. }
  566. PREGION prgnMeta() { return(dclevel.prgnMeta); }
  567. PREGION prgnMeta(PREGION prgn) { return(dclevel.prgnMeta = prgn); }
  568. PREGION prgnClip() { return(dclevel.prgnClip); }
  569. PREGION prgnClip(PREGION prgn) { return(dclevel.prgnClip = prgn); }
  570. INT iSelect(HRGN hrgn,int iMode); // Select in a new clip region
  571. INT iSelect(PREGION prgn,int iMode); // Select in a new clip region
  572. INT iSetMetaRgn(); // Combine the clip and meta rgn's
  573. BOOL bCompute();
  574. LONG iCombine(RECTL *, LONG);
  575. LONG iCombine(EXFORMOBJ *, RECTL *, LONG);
  576. VOID vUpdate_VisRect(REGION *prgn);
  577. BOOL bSetDefaultRegion();
  578. BOOL bReset();
  579. PRECTL prclClip() { return(&erclClip_); }
  580. ERECTL& erclClip() { return(erclClip_); }
  581. VOID erclClip(PRECTL prcl) { erclClip_ = *prcl; }
  582. PRECTL prclWindow() { return(&erclWindow_); }
  583. ERECTL& erclWindow() { return(erclWindow_); }
  584. VOID erclWindow(PRECTL prcl) { erclWindow_ = *prcl; }
  585. EPOINTL& eptlOrigin() { return(eptlOrigin_); }
  586. VOID eptlOrigin(PPOINTL pptl) { eptlOrigin_ = *pptl; }
  587. ERECTL& erclBounds() { return(erclBounds_); }
  588. ERECTL& erclBoundsApp() { return(erclBoundsApp_); }
  589. /**************************************************************************\
  590. *
  591. * Saved level methods
  592. *
  593. \**************************************************************************/
  594. public:
  595. DCTYPE dctp() { return(dctp_); }
  596. DCTYPE dctp(DCTYPE dctp) { return(dctp_ = dctp); }
  597. HDC hdcSave(HDC hdc) { return(dclevel.hdcSave = hdc); }
  598. LONG lIncSaveDepth() { return(++(dclevel.lSaveDepth)); }
  599. PDEV *ppdev(PDEV *ppdev) { return(ppdev_ = ppdev); }
  600. PDEV *ppdev() { return(ppdev_); }
  601. HDEV hdev() { return((HDEV)ppdev_); }
  602. FLONG flGraphicsCaps() { return(flGraphicsCaps_); }
  603. VOID flGraphicsCaps(FLONG fl) { flGraphicsCaps_ = fl; }
  604. FLONG flGraphicsCaps2() { return(flGraphicsCaps2_); }
  605. VOID flGraphicsCaps2(FLONG fl) { flGraphicsCaps2_ = fl; }
  606. //
  607. // The following fields may be changed asynchronously by the dynamic
  608. // mode changing code even if an exclusive DC lock is held -- unless
  609. // an appropriate lock is held.
  610. //
  611. // Note that no lock need be held to determine bHasSurface() since
  612. // the dyanmic mode change code will always ensure that pSurface() will
  613. // be non-NULL if it was already non-NULL, and vice versa.
  614. //
  615. // For checked builds, this does a function call to dcobj.cxx. For
  616. // free builds, it compiles to nothing.
  617. //
  618. #if DBG
  619. VOID vAssertDynaLock(BOOL bDcLevelField);
  620. #else
  621. VOID vAssertDynaLock(BOOL bDcLevelField) {}
  622. #endif
  623. BOOL bHasSurface() { return(dclevel.pSurface != NULL); }
  624. SURFACE *pSurface() { vAssertDynaLock(TRUE); return(dclevel.pSurface);}
  625. VOID pSurface(SURFACE *pSurf) { dclevel.pSurface = pSurf; }
  626. DHPDEV dhpdev() { vAssertDynaLock(FALSE); return(dhpdev_); }
  627. VOID dhpdev(DHPDEV dhpdev) { dhpdev_ = dhpdev; }
  628. SIZEL sizl() { vAssertDynaLock(TRUE); return(dclevel.sizl); }
  629. VOID vGet_sizl(PSIZEL psizl) { vAssertDynaLock(TRUE); *psizl = dclevel.sizl; }
  630. VOID sizl(SIZEL sizl) { dclevel.sizl = sizl; }
  631. //
  632. // WARNING: You don't have to hold a lock to access vGet_sizlWindow,
  633. // but unless you do you won't be guaranteed that you have
  634. // read a consitent value because a mode change could happen
  635. // in the middle of copying both dwords.
  636. //
  637. VOID vGet_sizlWindow(SIZEL *psizl) { *psizl = dclevel.sizl; }
  638. //
  639. // bDisplay -- Set the DC_DISPLAY bit. hsemDcDevLock will be set for all
  640. // DC's that are display related whether they are memory or info.
  641. //
  642. VOID vDisplay(BOOL b)
  643. {
  644. if (b)
  645. fs_ |= DC_DISPLAY;
  646. else
  647. fs_ &= ~DC_DISPLAY;
  648. }
  649. BOOL bDisplay() { return(fs() & DC_DISPLAY); }
  650. //
  651. // bInFullScreen -- Set the DC_FULLSCREEN bit.
  652. //
  653. VOID bInFullScreen(BOOL b)
  654. {
  655. if (b)
  656. fs_ |= DC_FULLSCREEN;
  657. else
  658. fs_ &= ~DC_FULLSCREEN;
  659. }
  660. BOOL bInFullScreen() { return(fs() & DC_FULLSCREEN); }
  661. //
  662. // bRedirection -- Set the DC_REDIRECTION bit.
  663. //
  664. VOID bRedirection(BOOL b)
  665. {
  666. if (b)
  667. fs_ |= DC_REDIRECTION;
  668. else
  669. fs_ &= ~DC_REDIRECTION;
  670. }
  671. BOOL bRedirection() { return(fs() & DC_REDIRECTION); }
  672. //
  673. // bStockBitmap -- Set the DC_STOCKBITMAP bit.
  674. //
  675. VOID bStockBitmap(BOOL b)
  676. {
  677. if (b)
  678. fs_ |= DC_STOCKBITMAP;
  679. else
  680. fs_ &= ~DC_STOCKBITMAP;
  681. }
  682. BOOL bStockBitmap() { return(fs() & DC_STOCKBITMAP); }
  683. //
  684. // bDIBSection true only if DC surface is a DIBSection
  685. //
  686. VOID vDIBSection(BOOL b)
  687. {
  688. if (b)
  689. pDCAttr->ulDirty_ |= DC_DIBSECTION;
  690. else
  691. pDCAttr->ulDirty_ &= ~DC_DIBSECTION;
  692. }
  693. BOOL bDIBSection() { return(pDCAttr->ulDirty_ & DC_DIBSECTION);}
  694. //
  695. // vCopyTo -- Xeroxes the contents to somewhere else. This is designed for
  696. // use only by SaveDC and RestoreDC. Only the level dependent
  697. // stuff is copied. Window Manager stuff is preserved.
  698. //
  699. VOID vCopyTo(XDCOBJ& dco);
  700. /**************************************************************************\
  701. *
  702. * Transform methods
  703. *
  704. \**************************************************************************/
  705. public:
  706. SIZEL szlWindowExt() { return(pDCAttr->szlWindowExt); }
  707. LONG lWindowExtCx() { return(pDCAttr->szlWindowExt.cx); }
  708. LONG lWindowExtCy() { return(pDCAttr->szlWindowExt.cy); }
  709. LONG lWindowExtCx(LONG l) { return(pDCAttr->szlWindowExt.cx=l); }
  710. LONG lWindowExtCy(LONG l) { return(pDCAttr->szlWindowExt.cy=l); }
  711. SIZEL szlViewportExt() { return(pDCAttr->szlViewportExt); }
  712. LONG lViewportExtCx() { return(pDCAttr->szlViewportExt.cx); }
  713. LONG lViewportExtCy() { return(pDCAttr->szlViewportExt.cy); }
  714. LONG lViewportExtCx(LONG l) { return(pDCAttr->szlViewportExt.cx=l); }
  715. LONG lViewportExtCy(LONG l) { return(pDCAttr->szlViewportExt.cy=l); }
  716. POINTL ptlWindowOrg() { return(pDCAttr->ptlWindowOrg); }
  717. LONG lWindowOrgX() { return(pDCAttr->ptlWindowOrg.x); }
  718. LONG lWindowOrgY() { return(pDCAttr->ptlWindowOrg.y); }
  719. LONG lWindowOrgX(LONG l) { return(pDCAttr->ptlWindowOrg.x=l); }
  720. LONG lWindowOrgY(LONG l) { return(pDCAttr->ptlWindowOrg.y=l); }
  721. POINTL ptlViewportOrg() { return(pDCAttr->ptlViewportOrg); }
  722. LONG lViewportOrgX() { return(pDCAttr->ptlViewportOrg.x); }
  723. LONG lViewportOrgY() { return(pDCAttr->ptlViewportOrg.y); }
  724. LONG lViewportOrgX(LONG l) { return(pDCAttr->ptlViewportOrg.x=l); }
  725. LONG lViewportOrgY(LONG l) { return(pDCAttr->ptlViewportOrg.y=l); }
  726. SIZEL szlVirtualDevicePixel() { return(pDCAttr->szlVirtualDevicePixel); }
  727. LONG lVirtualDevicePixelCx() { return(pDCAttr->szlVirtualDevicePixel.cx); }
  728. LONG lVirtualDevicePixelCy() { return(pDCAttr->szlVirtualDevicePixel.cy); }
  729. SIZEL szlVirtualDeviceMm() { return(pDCAttr->szlVirtualDeviceMm); }
  730. LONG lVirtualDeviceMmCx() { return(pDCAttr->szlVirtualDeviceMm.cx); }
  731. LONG lVirtualDeviceMmCy() { return(pDCAttr->szlVirtualDeviceMm.cy); }
  732. LONG lVirtualDeviceCx() { return(pDCAttr->szlVirtualDevice.cx); }
  733. LONG lVirtualDeviceCy() { return(pDCAttr->szlVirtualDevice.cy); }
  734. LONG lVirtualDevicePixelCx(LONG l){ return(pDCAttr->szlVirtualDevicePixel.cx=l); }
  735. LONG lVirtualDevicePixelCy(LONG l){ return(pDCAttr->szlVirtualDevicePixel.cy=l); }
  736. LONG lVirtualDeviceMmCx(LONG l) { return(pDCAttr->szlVirtualDeviceMm.cx=l); }
  737. LONG lVirtualDeviceMmCy(LONG l) { return(pDCAttr->szlVirtualDeviceMm.cy=l); }
  738. LONG lVirtualDeviceCx(LONG l) { return(pDCAttr->szlVirtualDevice.cx=l); }
  739. LONG lVirtualDeviceCy(LONG l) { return(pDCAttr->szlVirtualDevice.cy=l); }
  740. ULONG ulMapMode(ULONG ul) { return(pDCAttr->iMapMode = ul); }
  741. MATRIX& mxWorldToDevice() { return(dclevel.mxWorldToDevice); }
  742. MATRIX& mxDeviceToWorld() { return(dclevel.mxDeviceToWorld); }
  743. MATRIX& mxWorldToPage() { return(dclevel.mxWorldToPage); }
  744. MATRIX& mxUserWorldToDevice() { return((MATRIX &)pDCAttr->mxWtoD); }
  745. MATRIX& mxUserDeviceToWorld() { return((MATRIX &)pDCAttr->mxDtoW); }
  746. MATRIX& mxUserWorldToPage() { return((MATRIX &)pDCAttr->mxWtoP); }
  747. EFLOAT efM11() { return(dclevel.mxWorldToDevice.efM11);}
  748. EFLOAT efM12() { return(dclevel.mxWorldToDevice.efM12);}
  749. EFLOAT efM21() { return(dclevel.mxWorldToDevice.efM21);}
  750. EFLOAT efM22() { return(dclevel.mxWorldToDevice.efM22);}
  751. FIX fxDx() { return(dclevel.mxWorldToDevice.fxDx);}
  752. FIX fxDy() { return(dclevel.mxWorldToDevice.fxDy);}
  753. EFLOAT efM11PtoD() { return(dclevel.efM11PtoD); }
  754. EFLOAT efM22PtoD() { return(dclevel.efM22PtoD); }
  755. EFLOAT efDxPtoD() { return(dclevel.efDxPtoD); }
  756. EFLOAT efDyPtoD() { return(dclevel.efDyPtoD); }
  757. EFLOAT efM11_TWIPS() { return(dclevel.efM11_TWIPS); }
  758. EFLOAT efM22_TWIPS() { return(dclevel.efM22_TWIPS); }
  759. EFLOAT& efrM11PtoD() { return(dclevel.efM11PtoD); }
  760. EFLOAT& efrM22PtoD() { return(dclevel.efM22PtoD); }
  761. EFLOAT& efrDxPtoD() { return(dclevel.efDxPtoD); }
  762. EFLOAT& efrDyPtoD() { return(dclevel.efDyPtoD); }
  763. EFLOAT efM11PtoD(EFLOAT ef) {
  764. pDCAttr->efM11PtoD = ef.Base();
  765. return(dclevel.efM11PtoD = ef);
  766. }
  767. EFLOAT efM22PtoD(EFLOAT ef) {
  768. pDCAttr->efM22PtoD = ef.Base();
  769. return(dclevel.efM22PtoD = ef);
  770. }
  771. EFLOAT efDxPtoD(EFLOAT ef) {
  772. pDCAttr->efDxPtoD = ef.Base();
  773. return(dclevel.efDxPtoD = ef);
  774. }
  775. EFLOAT efDyPtoD(EFLOAT ef) {
  776. pDCAttr->efDyPtoD = ef.Base();
  777. return(dclevel.efDyPtoD = ef);
  778. }
  779. EFLOAT efM11_TWIPS(EFLOAT ef) { return(dclevel.efM11_TWIPS = ef); }
  780. EFLOAT efM22_TWIPS(EFLOAT ef) { return(dclevel.efM22_TWIPS = ef); }
  781. EFLOAT efM11PtoD(LONG l) {
  782. EFLOATEXT ef(l);
  783. pDCAttr->efM11PtoD = ef.Base();
  784. return(dclevel.efM11PtoD = ef);
  785. }
  786. EFLOAT efM22PtoD(LONG l) {
  787. EFLOATEXT ef(l);
  788. pDCAttr->efM22PtoD = ef.Base();
  789. return(dclevel.efM22PtoD = ef);
  790. }
  791. EFLOAT efDxPtoD(LONG l) {
  792. EFLOATEXT ef(l);
  793. pDCAttr->efDxPtoD = ef.Base();
  794. return(dclevel.efDxPtoD =ef);
  795. }
  796. EFLOAT efDyPtoD(LONG l) {
  797. EFLOATEXT ef(l);
  798. pDCAttr->efDyPtoD = ef.Base();
  799. return(dclevel.efDyPtoD = ef);
  800. }
  801. EFLOAT efM11_TWIPS(LONG l) { EFLOATEXT ef(l);return(dclevel.efM11_TWIPS = ef); }
  802. EFLOAT efM22_TWIPS(LONG l) { EFLOATEXT ef(l);return(dclevel.efM22_TWIPS = ef); }
  803. EFLOAT efMetaPtoD11() { return(dclevel.efPr11); }
  804. EFLOAT efMetaPtoD22() { return(dclevel.efPr22); }
  805. ULONG ulMapMode() { return(pDCAttr->iMapMode); }
  806. VOID vUpdateWtoDXform();
  807. FLONG flSet_flXform(FLONG fl) { return(pDCAttr->flXform |= fl); }
  808. FLONG flClr_flXform(FLONG fl) { return(pDCAttr->flXform &= ~fl); }
  809. FLONG flXform() { return(pDCAttr->flXform); }
  810. BOOL bAnisoOrIsoMapMode() { return(pDCAttr->flXform & ISO_OR_ANISO_MAP_MODE);}
  811. FLONG flResetflXform(FLONG fl) { return(pDCAttr->flXform = fl); }
  812. BOOL befM11IsNegative() { return(pDCAttr->flXform & PTOD_EFM11_NEGATIVE);}
  813. BOOL befM22IsNegative() { return(pDCAttr->flXform & PTOD_EFM22_NEGATIVE);}
  814. BOOL bYisUp() { return(pDCAttr->flXform & POSITIVE_Y_IS_UP);}
  815. BOOL bPageExtentsChanged() { return(pDCAttr->flXform & PAGE_EXTENTS_CHANGED);}
  816. BOOL bPageXlateChanged() { return(pDCAttr->flXform & PAGE_XLATE_CHANGED);}
  817. BOOL bWorldToPageIdentity() { return(flXform() & WORLD_TO_PAGE_IDENTITY); }
  818. BOOL bPageToDeviceIdentity() { return(flXform() & PAGE_TO_DEVICE_IDENTITY); }
  819. BOOL bPageToDeviceScaleIdentity(){ return(flXform() & PAGE_TO_DEVICE_SCALE_IDENTITY);}
  820. BOOL bUseMetaPtoD()
  821. {
  822. return(!dclevel.efPr11.bIsZero() && !dclevel.efPr22.bIsZero());
  823. }
  824. VOID vSet_MetaPtoD(FLOATL l_eX, FLOATL l_eY)
  825. {
  826. dclevel.efPr11 = l_eX;
  827. dclevel.efPr22 = l_eY;
  828. }
  829. BOOL bWorldToDeviceIdentity()
  830. {
  831. return( (flXform() & (WORLD_TO_PAGE_IDENTITY|PAGE_TO_DEVICE_IDENTITY)) ==
  832. (WORLD_TO_PAGE_IDENTITY|PAGE_TO_DEVICE_IDENTITY));
  833. }
  834. BOOL bYisUp(BOOL b)
  835. {
  836. if (b)
  837. pDCAttr->flXform |= POSITIVE_Y_IS_UP;
  838. else
  839. pDCAttr->flXform &= ~POSITIVE_Y_IS_UP;
  840. return(b);
  841. }
  842. BOOL bDirtyXform()
  843. {
  844. return(pDCAttr->flXform &
  845. (PAGE_XLATE_CHANGED | PAGE_EXTENTS_CHANGED | WORLD_XFORM_CHANGED));
  846. }
  847. BOOL bDirtyXlateOrExt()
  848. {
  849. return(pDCAttr->flXform &
  850. (PAGE_XLATE_CHANGED | PAGE_EXTENTS_CHANGED | WORLD_XFORM_CHANGED));
  851. }
  852. VOID vSetWorldXformIdentity()
  853. {
  854. flSet_flXform(WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID |
  855. INVALIDATE_ATTRIBUTES | WORLD_TO_PAGE_IDENTITY |
  856. WORLD_TRANSFORM_SET);
  857. }
  858. VOID vClrWorldXformIdentity()
  859. {
  860. flSet_flXform(WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID |
  861. INVALIDATE_ATTRIBUTES | WORLD_TRANSFORM_SET);
  862. flClr_flXform(WORLD_TO_PAGE_IDENTITY);
  863. }
  864. VOID vPageExtentsChanged()
  865. {
  866. pDCAttr->flXform |= (INVALIDATE_ATTRIBUTES | PAGE_EXTENTS_CHANGED | DEVICE_TO_WORLD_INVALID);
  867. }
  868. VOID vPageXlateChanged()
  869. {
  870. pDCAttr->flXform |= (PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID);
  871. }
  872. VOID vSetFlagsMM_TEXT()
  873. {
  874. pDCAttr->flXform |= (INVALIDATE_ATTRIBUTES | PAGE_TO_DEVICE_SCALE_IDENTITY | PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID);
  875. pDCAttr->flXform &= ~(PTOD_EFM11_NEGATIVE | PTOD_EFM22_NEGATIVE |
  876. POSITIVE_Y_IS_UP | ISO_OR_ANISO_MAP_MODE);
  877. }
  878. VOID vSetFlagsMM_FIXED_CACHED()
  879. {
  880. pDCAttr->flXform |= (INVALIDATE_ATTRIBUTES | POSITIVE_Y_IS_UP |
  881. PTOD_EFM22_NEGATIVE | PAGE_XLATE_CHANGED |
  882. DEVICE_TO_WORLD_INVALID);
  883. pDCAttr->flXform &= ~(ISO_OR_ANISO_MAP_MODE |
  884. PAGE_TO_DEVICE_SCALE_IDENTITY |
  885. PAGE_TO_DEVICE_IDENTITY |
  886. PTOD_EFM11_NEGATIVE);
  887. }
  888. VOID vSetFlagsMM_FIXED()
  889. {
  890. pDCAttr->flXform |= POSITIVE_Y_IS_UP;
  891. pDCAttr->flXform &= ~(ISO_OR_ANISO_MAP_MODE|PAGE_TO_DEVICE_IDENTITY);
  892. }
  893. VOID vSetFlagsMM_ISO_OR_ANISO()
  894. {
  895. pDCAttr->flXform &= ~(POSITIVE_Y_IS_UP|PAGE_TO_DEVICE_IDENTITY);
  896. pDCAttr->flXform |= ISO_OR_ANISO_MAP_MODE;
  897. }
  898. VOID vGet_szlWindowExt(PSIZEL pSizl) { *pSizl = pDCAttr->szlWindowExt; }
  899. VOID vGet_ptlWindowOrg(PPOINTL pPtl) { *pPtl = pDCAttr->ptlWindowOrg; }
  900. VOID vGet_szlViewportExt(PSIZEL pSizl){ *pSizl = pDCAttr->szlViewportExt;}
  901. VOID vGet_ptlViewportOrg(PPOINTL pPtl){ *pPtl = pDCAttr->ptlViewportOrg;}
  902. VOID vSet_szlWindowExt(PSIZEL pSizl) { pDCAttr->szlWindowExt = *pSizl;}
  903. VOID vSet_ptlWindowOrg(PPOINTL pPtl) { pDCAttr->ptlWindowOrg = *pPtl; }
  904. VOID vSet_szlViewportExt(PSIZEL pSizl){ pDCAttr->szlViewportExt = *pSizl;}
  905. VOID vSet_ptlViewportOrg(PPOINTL pPtl){ pDCAttr->ptlViewportOrg = *pPtl; }
  906. VOID vOffset_ptlWindowOrg(PPOINTL pPtl)
  907. {
  908. pDCAttr->ptlWindowOrg.x += pPtl->x;
  909. pDCAttr->ptlWindowOrg.y += pPtl->y;
  910. }
  911. VOID vOffset_ptlViewportOrg(PPOINTL pPtl)
  912. {
  913. pDCAttr->ptlViewportOrg.x += pPtl->x;
  914. pDCAttr->ptlViewportOrg.y += pPtl->y;
  915. }
  916. VOID vSet_szlWindowExt(LONG x, LONG y)
  917. {
  918. ASSERTGDI((sizeof(LONG) <= sizeof(int)), "LONG assigned to int");
  919. pDCAttr->szlWindowExt.cx = (int)x;
  920. pDCAttr->szlWindowExt.cy = (int)y;
  921. }
  922. VOID vSet_szlViewportExt(LONG x, LONG y)
  923. {
  924. ASSERTGDI((sizeof(LONG) <= sizeof(int)), "LONG assigned to int");
  925. pDCAttr->szlViewportExt.cx = (int)x;
  926. pDCAttr->szlViewportExt.cy = (int)y;
  927. }
  928. VOID vSet_szlVirtualDevicePixel(LONG x, LONG y)
  929. {
  930. pDCAttr->szlVirtualDevicePixel.cx = x;
  931. pDCAttr->szlVirtualDevicePixel.cy = y;
  932. }
  933. VOID vSet_szlVirtualDeviceMm(LONG x, LONG y)
  934. {
  935. pDCAttr->szlVirtualDeviceMm.cx = x;
  936. pDCAttr->szlVirtualDeviceMm.cy = y;
  937. }
  938. BOOL bUseVirtualResolution() { return(pDCAttr->szlVirtualDevicePixel.cx != 0); }
  939. VOID vMakeIso();
  940. VOID vComputePageXform();
  941. int iSetMapMode(int iMode);
  942. DWORD dwSetLayout(LONG wox, DWORD dwLayout);
  943. //get the device surface width.
  944. LONG GetDeviceWidth() { return (erclWindow_.right - erclWindow_.left); }
  945. // If the DC is mirrored the mirror the Window X Org. using the logical one.
  946. // Else set it equal the logical WindowOrg.
  947. VOID MirrorWindowOrg()
  948. {
  949. if (pDCAttr->dwLayout & LAYOUT_RTL) {
  950. LONG lViewportExtCx = pDCAttr->szlViewportExt.cx;
  951. if (lViewportExtCx) {
  952. pDCAttr->ptlWindowOrg.x = ((-(erclWindow_.right - erclWindow_.left - 1) * pDCAttr->szlWindowExt.cx) / \
  953. lViewportExtCx) + pDCAttr->lWindowOrgx;
  954. }
  955. } else {
  956. pDCAttr->ptlWindowOrg.x = pDCAttr->lWindowOrgx;
  957. }
  958. }
  959. // Set the logical WindowOrg. and the mirror the WindowOrg.
  960. VOID SetWindowOrgAndMirror(LONG x)
  961. {
  962. pDCAttr->lWindowOrgx = x;
  963. MirrorWindowOrg();
  964. }
  965. /**************************************************************************\
  966. *
  967. * ICM methods
  968. *
  969. \**************************************************************************/
  970. HANDLE hcmXform() { return(pDCAttr->hcmXform); }
  971. HANDLE hcmXform(HANDLE hcmNew) { pDCAttr->hcmXform = hcmNew;return (hcmNew); }
  972. BOOL bValidIcmBrushColor() { return(pDCAttr->ulDirty_ & ICM_BRUSH_TRANSLATED); }
  973. BOOL bValidIcmPenColor() { return(pDCAttr->ulDirty_ & ICM_PEN_TRANSLATED); }
  974. COLORREF crIcmBrushColor() { return(pDCAttr->IcmBrushColor); }
  975. COLORREF crIcmPenColor() { return(pDCAttr->IcmPenColor); }
  976. COLORREF crIcmBrushColor(COLORREF _crColor) {pDCAttr->IcmBrushColor = _crColor;return (_crColor); }
  977. COLORREF crIcmPenColor(COLORREF _crColor) {pDCAttr->IcmPenColor = _crColor;return (_crColor); }
  978. VOID vCXFListSet(CXFLIST *pCXFList_) {pCXFList = pCXFList_;}
  979. HCOLORSPACE hColorSpace(HCOLORSPACE hColorSpace) { pDCAttr->hColorSpace = hColorSpace;return (hColorSpace); }
  980. HCOLORSPACE hColorSpace() { return(pDCAttr->hColorSpace); }
  981. ULONG_PTR dwDIBColorSpace(ULONG_PTR dwColorSpace) { pDCAttr->dwDIBColorSpace = dwColorSpace;return (dwColorSpace); }
  982. ULONG_PTR dwDIBColorSpace() { return(pDCAttr->dwDIBColorSpace); }
  983. PVOID pColorSpace(PVOID pColorSpace) { dclevel.pColorSpace = pColorSpace; return(pColorSpace); }
  984. PVOID pColorSpace() { return(dclevel.pColorSpace); }
  985. LONG lIcmModeClient(LONG Mode) { pDCAttr->lIcmMode = Mode;return (Mode); }
  986. LONG lIcmModeClient() { return(pDCAttr->lIcmMode); }
  987. LONG lIcmMode(LONG Mode) { dclevel.lIcmMode = Mode;return (Mode); }
  988. LONG lIcmMode() { return(dclevel.lIcmMode); }
  989. LONG GetICMMode() { return(dclevel.lIcmMode); } // SHOULD BE DELETED. AND SHOULD USE lIcmMode()
  990. BOOL bIsAppsICM() { return(IS_ICM_OUTSIDEDC(dclevel.lIcmMode)); }
  991. BOOL bIsHostICM() { return(IS_ICM_HOST(dclevel.lIcmMode)); }
  992. BOOL bIsDeviceICM() { return(IS_ICM_DEVICE(dclevel.lIcmMode)); }
  993. BOOL bIsSoftwareICM() { return(bIsAppsICM() || bIsHostICM()); }
  994. BOOL bIsCMYKColor()
  995. {
  996. return(bIsHostICM() &&
  997. (pDCAttr->hcmXform != NULL) &&
  998. IS_CMYK_COLOR(dclevel.lIcmMode));
  999. }
  1000. /**************************************************************************\
  1001. *
  1002. * Miscellaneous methods
  1003. *
  1004. \**************************************************************************/
  1005. FSHORT fs() { return(fs_); }
  1006. FSHORT fs(FSHORT fs) { return(fs_ = fs); }
  1007. VOID fsSet(FSHORT fs) { fs_ |= fs; }
  1008. VOID fsClr(FSHORT fs) { fs_ &= ~fs; }
  1009. SURFACE *psurfInfo() { return(psurfInfo_); }
  1010. VOID vSavePsurfInfo() { psurfInfo_ = pSurface();
  1011. pSurface(NULL); }
  1012. VOID vRestorePsurfInfo() { pSurface(psurfInfo_);
  1013. psurfInfo_ = NULL; }
  1014. BOOL bMakeInfoDC(BOOL bSet);
  1015. BOOL bTempInfoDC() { return(fs() & DC_TEMPINFODC); }
  1016. VOID vSetTempInfoDC() { fsSet(DC_TEMPINFODC); }
  1017. VOID vClearTempInfoDC() { fsClr(DC_TEMPINFODC); }
  1018. BOOL bAddRemoteFont( PFF *ppff, BOOL bMergeFont );
  1019. BOOL bRemoveMergeFont(UNIVERSAL_FONT_ID ufi);
  1020. };
  1021. typedef DC *PDC;
  1022. /******************************MACRO***************************************\
  1023. * SYNC_DRAWING_ATTRS
  1024. *
  1025. * - sync attributes that can be set in DC_ATTR from user mode
  1026. *
  1027. * Arguments:
  1028. *
  1029. * pdc
  1030. *
  1031. * Return Value:
  1032. *
  1033. * none
  1034. *
  1035. * History:
  1036. *
  1037. * 25-Jan-1996 -by- Mark Enstrom [marke]
  1038. *
  1039. \**************************************************************************/
  1040. #define SYNC_DRAWING_ATTRS(pdc) \
  1041. { \
  1042. ULONG ulDirty = pdc->ulDirty(); \
  1043. \
  1044. if ( ulDirty & DC_BRUSH_DIRTY) \
  1045. { \
  1046. GreDCSelectBrush(pdc,pdc->hbrush()); \
  1047. } \
  1048. \
  1049. if ( ulDirty & DC_PEN_DIRTY) \
  1050. { \
  1051. GreDCSelectPen(pdc,pdc->hpen()); \
  1052. } \
  1053. }
  1054. /*********************************Class************************************\
  1055. * class XDCOBJ
  1056. *
  1057. * User object for DC class.
  1058. *
  1059. * History:
  1060. * Tue 28-Dec-1993 -by- Patrick Haluptzok [patrickh]
  1061. * Make it have do nothing const/destr and derive off it the other classes.
  1062. *
  1063. * Tue 25-Jun-1991 -by- Patrick Haluptzok [patrickh]
  1064. * add all types of locking methods, out of line for now.
  1065. *
  1066. * Sun 09-Jun-1991 -by- Patrick Haluptzok [patrickh]
  1067. * Optimizatize all constructors, destructors via inline.
  1068. *
  1069. * Fri 12-Apr-1991 10:42:06 -by- Donald Sidoroff [donalds]
  1070. * The BIG rewrite
  1071. *
  1072. * Thu 09-Aug-1990 16:05:20 -by- Charles Whitmer [chuckwh]
  1073. * Wrote it.
  1074. \**************************************************************************/
  1075. class XDCOBJ /* dco */
  1076. {
  1077. public:
  1078. PDC pdc;
  1079. public:
  1080. XDCOBJ() {pdc = NULL;}
  1081. ~XDCOBJ() {}
  1082. XDCOBJ(HDC hdc)
  1083. {
  1084. pdc = (PDC) HmgLock((HOBJ)hdc, DC_TYPE);
  1085. }
  1086. VOID vLock(HDC hdc)
  1087. {
  1088. pdc = (PDC) HmgLock((HOBJ)hdc, DC_TYPE);
  1089. }
  1090. // Bug #223129: In GreRestoreDC, we need to get a lock on the saved DC even when
  1091. // the process has reached its handle quota (this is OK because the saved DC is
  1092. // about to be deleted anyway). This can be achieved via a call to HmgLockAllOwners.
  1093. // However, in order to prevent other people from calling vLockAllOwners in the future
  1094. // and making a big mess, we designate this a protected function and only allow
  1095. // GreRestoreDC to call it. Do not call this routine outside of the above scenario
  1096. // unless there's a really good reason!
  1097. protected:
  1098. friend BOOL GreRestoreDC(HDC hdc,int lDC);
  1099. VOID vLockAllOwners(HDC hdc)
  1100. {
  1101. pdc = (PDC) HmgLockAllOwners((HOBJ)hdc, DC_TYPE);
  1102. }
  1103. public:
  1104. VOID vAltLock(HDC hdc)
  1105. {
  1106. pdc = (PDC) HmgShareLock((HOBJ)hdc, DC_TYPE);
  1107. }
  1108. VOID vAltCheckLock(HDC hdc)
  1109. {
  1110. pdc = (PDC) HmgShareCheckLock((HOBJ)hdc, DC_TYPE);
  1111. }
  1112. VOID vDontUnlockDC() { pdc = (PDC) NULL; }
  1113. // There are 3 different AltUnlock. vAltUnlock checks for NULL before
  1114. // unlocking and then sets it to NULL after it's done unlocking so
  1115. // a destructor doesn't try and unlock it. This is done when you need
  1116. // to unlock a DC early and don't want the destructor to get called again
  1117. // later.
  1118. VOID vAltUnlock()
  1119. {
  1120. if (pdc != (PDC) NULL)
  1121. {
  1122. DEC_SHARE_REF_CNT(pdc);
  1123. pdc = (PDC) NULL;
  1124. }
  1125. }
  1126. // This is used by all the destructors because when you go out of scope
  1127. // of the DCOBJ you don't need to set the pdc to NULL because it can't
  1128. // be referenced again.
  1129. VOID vAltUnlockNoNullSet()
  1130. {
  1131. if (pdc != (PDC) NULL)
  1132. {
  1133. DEC_SHARE_REF_CNT(pdc);
  1134. }
  1135. }
  1136. // vAltUnlockFast is used when you have a DCOBJ class with no destructor
  1137. // to worry about firing off and you know you have it locked down and
  1138. // you want to unlock it because your done using it.
  1139. VOID vAltUnlockFast()
  1140. {
  1141. DEC_SHARE_REF_CNT(pdc);
  1142. }
  1143. // The Unlocks have all the same variations as the AltUnlocks for the
  1144. // same reasons and uses.
  1145. VOID vUnlock()
  1146. {
  1147. if (pdc != (PDC) NULL)
  1148. {
  1149. DEC_EXCLUSIVE_REF_CNT(pdc);
  1150. pdc = (PDC) NULL;
  1151. }
  1152. }
  1153. VOID vUnlockNoNullSet()
  1154. {
  1155. if (pdc != (PDC) NULL)
  1156. {
  1157. DEC_EXCLUSIVE_REF_CNT(pdc);
  1158. }
  1159. }
  1160. VOID vUnlockFast()
  1161. {
  1162. DEC_EXCLUSIVE_REF_CNT(pdc);
  1163. }
  1164. HDC hdc() { return((HDC) pdc->hGet()); }
  1165. // bDelete -- Deletes DC memory. Assumes the DC was allocated through
  1166. // DCMEMOBJ.
  1167. BOOL bDeleteDC(BOOL bProcessCleanup = FALSE);
  1168. // Validity testing for DC's is markedly different then most objects. DC's
  1169. // can be valid in different senses. The handle can be valid, the physical
  1170. // device can be valid, the surface can be valid and finally, the surface may
  1171. // not be readable/writable (printers/scanners). This creates the need for
  1172. // several validity checks. Most drawing API's can use bValidSurf, most other
  1173. // API's will use bValid. Only a very few API's (DC management) can use
  1174. // bLocked. Some API's only check bValid upfront and then check bFullScreen
  1175. // later, this is to allow bounds accumulation or current position code to
  1176. // execute that would be too difficult to do up front.
  1177. BOOL bLocked()
  1178. {
  1179. return(pdc != (DC *) NULL);
  1180. }
  1181. BOOL bValid()
  1182. {
  1183. return((pdc != (DC *) NULL));
  1184. }
  1185. VOID bInFullScreen(BOOL b)
  1186. {
  1187. pdc->bInFullScreen(b);
  1188. }
  1189. BOOL bInFullScreen()
  1190. {
  1191. return(pdc->bInFullScreen());
  1192. }
  1193. BOOL bFullScreen()
  1194. {
  1195. return(!pdc->bHasSurface() || pdc->bInFullScreen());
  1196. }
  1197. BOOL bValidSurf()
  1198. {
  1199. return((pdc != (DC *) NULL) &&
  1200. (pdc->bHasSurface()) &&
  1201. !(pdc->bInFullScreen()));
  1202. }
  1203. BOOL bPrinter()
  1204. {
  1205. return(pdc->ppdev()->fl & PDEV_PRINTER);
  1206. }
  1207. BOOL bUMPD()
  1208. {
  1209. return(pdc->ppdev()->fl & PDEV_UMPD);
  1210. }
  1211. BOOL bStockBitmap()
  1212. {
  1213. return(pdc->bStockBitmap());
  1214. }
  1215. // PFFListGet and PFFListSet are used to transfer remote font list across ResetDC
  1216. // calls
  1217. PFFLIST *PFFListGet()
  1218. {
  1219. return(pdc->pPFFList);
  1220. }
  1221. VOID PFFListSet(PFFLIST *pPFFList_)
  1222. {
  1223. pdc->pPFFList = pPFFList_;
  1224. }
  1225. CXFLIST *CXFListGet()
  1226. {
  1227. return(pdc->pCXFList);
  1228. }
  1229. VOID CXFListSet(CXFLIST *pCXFList_)
  1230. {
  1231. pdc->pCXFList = pCXFList_;
  1232. }
  1233. FSHORT fs() { return(pdc->fs()); }
  1234. FSHORT fs(FSHORT fs) { return(pdc->fs(fs)); }
  1235. VOID fsSet(FSHORT fs) { pdc->fsSet(fs); }
  1236. VOID fsClr(FSHORT fs) { pdc->fsClr(fs); }
  1237. // Bounds accumulation.
  1238. VOID vAccumulate(ERECTL& ercl);
  1239. // Returns some commonly used info from the DC
  1240. ECLIPOBJ *pco() { return((ECLIPOBJ *) &(pdc->co_));}
  1241. HDEV hdev() { return(pdc->hdev());}
  1242. FLONG flGraphicsCaps() { return(pdc->flGraphicsCaps());}
  1243. FLONG flGraphicsCaps2() { return(pdc->flGraphicsCaps2());}
  1244. HSEMAPHORE hsemDcDevLock() { return(pdc->hsemDcDevLock_);}
  1245. HSEMAPHORE hsemDcDevLock(HSEMAPHORE hsem) { return(pdc->hsemDcDevLock_ = hsem);}
  1246. DCTYPE dctp() { return(pdc->dctp());}
  1247. // The following fields can change asynchronously by the dynamic-mode-change
  1248. // code. Make sure you're holding the proper locks to access them.
  1249. DHPDEV dhpdev() { return(pdc->dhpdev());}
  1250. BOOL bHasSurface() { return(pdc->bHasSurface());}
  1251. SURFACE *pSurface() { return(pdc->pSurface());}
  1252. SURFACE *pSurfaceEff()
  1253. {
  1254. if (!pdc->bHasSurface())
  1255. return(SURFACE::pdibDefault);
  1256. else
  1257. return(pdc->pSurface());
  1258. }
  1259. // bDisplay is only true for display PDEVS that are direct DC's.
  1260. BOOL bDisplay() { return(pdc->bDisplay());}
  1261. BOOL bRedirection() { return(pdc->bRedirection());}
  1262. // bNeedsSomeExcluding is obsolete since the advent of sprites.
  1263. BOOL bNeedsSomeExcluding() { return(FALSE);}
  1264. BOOL bSynchronizeAccess() { return(fs() & DC_SYNCHRONIZEACCESS);}
  1265. BOOL bShareAccess() { return(fs() & DC_SHAREACCESS);}
  1266. BOOL bKillReset() { return(fs() & DC_RESET);}
  1267. BOOL bAccum() { return(fs() & DC_ACCUM_WMGR);}
  1268. BOOL bAccumApp() { return(fs() & DC_ACCUM_APP);}
  1269. FCHAR fjAccum()
  1270. {
  1271. return(fs() & (DC_ACCUM_WMGR | DC_ACCUM_APP));
  1272. }
  1273. HPAL hpal() { return(pdc->hpal());}
  1274. PPALETTE ppal() { return(pdc->ppal());}
  1275. HPATH hpath() { return(pdc->dclevel.hpath);}
  1276. HDC hdcSave() { return(pdc->dclevel.hdcSave);}
  1277. LONG lSaveDepth() { return(pdc->dclevel.lSaveDepth);}
  1278. LONG lSaveDepthStartDoc() { return(pdc->dclevel.lSaveDepthStartDoc);}
  1279. VOID vSetSaveDepthStartDoc() { pdc->dclevel.lSaveDepthStartDoc = pdc->dclevel.lSaveDepth;}
  1280. COLORADJUSTMENT *pColorAdjustment() { return(&pdc->dclevel.ca);}
  1281. // ulMapMode -- Get the current mapping mode.
  1282. ULONG ulMapMode() { return(pdc->pDCAttr->iMapMode);}
  1283. // Get current position in device or logical coords (note that you must
  1284. // make sure the values are valid by calling pdc->bValidPtfxCurrent()
  1285. // or pdc->bValidPtlCurrent()!)
  1286. POINTFIX& ptfxCurrent() { return(*((POINTFIX*)
  1287. &pdc->pDCAttr->ptfxCurrent));}
  1288. POINTL& ptlCurrent() { return(pdc->pDCAttr->ptlCurrent);}
  1289. // erclBounds -- Gets a reference to the bounding rectangle.
  1290. ERECTL& erclBounds() { return(pdc->erclBounds());}
  1291. ERECTL& erclBoundsApp() { return(pdc->erclBoundsApp());}
  1292. // eptlOrigin -- Gets a reference to the DC origin.
  1293. EPOINTL& eptlOrigin() { return(pdc->eptlOrigin());}
  1294. // erclWindow -- Gets a reference to the Window RECTL.
  1295. ERECTL& erclWindow() { return(pdc->erclWindow());}
  1296. // erclClip -- Get/Set window rectangle
  1297. PRECTL prclClip() { return(pdc->prclClip());}
  1298. ERECTL& erclClip() { return(pdc->erclClip());}
  1299. VOID erclClip(PRECTL prcl) { pdc->erclClip(prcl);}
  1300. // prgnRao -- Get the pointer to the Rao region
  1301. REGION *prgnEffRao()
  1302. {
  1303. if (pdc->prgnRao() != (REGION *) NULL)
  1304. return(pdc->prgnRao());
  1305. else
  1306. return(pdc->prgnVis());
  1307. }
  1308. // plaRealized -- Return the currently realized LINEATTRS.
  1309. LINEATTRS *plaRealized() { return(&pdc->dclevel.laPath);}
  1310. // plaRealize -- Returns the currently realized LINEATTRS. This function
  1311. // duplicates plaRealized() merely for historical reasons.
  1312. LINEATTRS *plaRealize(EXFORMOBJ& exo) {return(plaRealized());}
  1313. // bCleanDC -- Forces the default DCLEVEL into the DC, effectively
  1314. // returning it to a "clean" state (i.e., like one from
  1315. // CreateDC).
  1316. BOOL bIsDeleteable() { return(!(fs() & DC_PERMANANT)); }
  1317. VOID vMakeDeletable() { fsClr(DC_PERMANANT); }
  1318. VOID vMakeUndeletable() { fsSet(DC_PERMANANT); }
  1319. BOOL bCleanDC();
  1320. // In SelectPalette a bool is passed. We save that flag here and use it
  1321. // in RealizePalette.
  1322. BOOL bForceBackground() { return(pdc->dclevel.fl & DC_FL_PAL_BACK); }
  1323. VOID vSetBackground() { pdc->dclevel.fl |= DC_FL_PAL_BACK; }
  1324. VOID vClearBackground() { pdc->dclevel.fl &= ~DC_FL_PAL_BACK; }
  1325. // Methods to get and update dirty flags.
  1326. //
  1327. // Note that these may be called only from the owning process.
  1328. ULONG ulDirty() { return(pdc->ulDirty()); };
  1329. ULONG ulDirty(ULONG fl) { return(pdc->ulDirty(fl)); };
  1330. ULONG ulDirtyAdd(ULONG fl) { return(pdc->ulDirtyAdd(fl)); };
  1331. ULONG ulDirtySub(ULONG fl) { return(pdc->ulDirtySub(fl)); };
  1332. // The following methods act on both the brush flags stored in the
  1333. // user-mode DC_ATTR and the brush flags stored in the DC.
  1334. //
  1335. // In general, drawing APIs should use these methods and not the
  1336. // discrete ulDirty() and flBrush() methods. Both must be used because
  1337. // brushes may be invalidate either in user-mode via API operations, or
  1338. // while in kernel-mode via dynamic mode changes.
  1339. //
  1340. // Note that these may be called only from the owning process.
  1341. BOOL bDirtyBrush(ULONG fl)
  1342. {
  1343. // Note that success is not necessarily a value of '1':
  1344. return((pdc->ulDirty() | pdc->flbrush()) & fl);
  1345. }
  1346. VOID vCleanBrush(ULONG fl)
  1347. {
  1348. pdc->ulDirtySub(fl);
  1349. pdc->flbrushSub(fl);
  1350. }
  1351. // Brushes
  1352. EBRUSHOBJ *peboFill() { return(pdc->peboFill() );}
  1353. EBRUSHOBJ *peboLine() { return(pdc->peboLine() );}
  1354. EBRUSHOBJ *peboText() { return(pdc->peboText() );}
  1355. EBRUSHOBJ *peboBackground() { return(pdc->peboBackground());}
  1356. // OpenGL
  1357. LONG ipfdDevMaxGet();
  1358. int ipfdDevMax(int i) { return((int) (pdc->ipfdDevMax_=(SHORT)i));}
  1359. int ipfdDevMax() { return((pdc->ipfdDevMax_ >= 0
  1360. ? (int) pdc->ipfdDevMax_
  1361. : (int) ipfdDevMaxGet()));}
  1362. // printing
  1363. ULONG ulCopyCount() { return(pdc->ulCopyCount_);}
  1364. ULONG ulCopyCount(ULONG ul) { return(pdc->ulCopyCount_ = ul);}
  1365. VOID vSetPrintBandPos(POINTL *pt) { pdc->ptlBandPosition_ = *pt; }
  1366. VOID vResetPrintBandPos() { pdc->ptlBandPosition_.x = 0;
  1367. pdc->ptlBandPosition_.y = 0; }
  1368. POINTL& ptlPrintBandPos() { return(pdc->ptlBandPosition_); }
  1369. BOOL bEpsPrintingEscape() { return(fs() & DC_EPSPRINTINGESCAPE);}
  1370. VOID vSetEpsPrintingEscape() { fsSet(DC_EPSPRINTINGESCAPE);}
  1371. VOID vClearEpsPrintingEscape() { fsClr(DC_EPSPRINTINGESCAPE);}
  1372. // bSynchronizeAccess -- Set the DC_SYNCHRONIZEACCESS bit when all surface
  1373. // access is to be synchronized by the DEVLOCK.
  1374. BOOL bSynchronizeAccess(BOOL b)
  1375. {
  1376. if (b)
  1377. fsSet(DC_SYNCHRONIZEACCESS);
  1378. else
  1379. fsClr(DC_SYNCHRONIZEACCESS);
  1380. return(b);
  1381. }
  1382. BOOL bShareAccess(BOOL b)
  1383. {
  1384. if(b)
  1385. fsSet(DC_SHAREACCESS);
  1386. else
  1387. fsClr(DC_SHAREACCESS);
  1388. return(b);
  1389. }
  1390. BOOL bAddRemoteFont( PFF *ppff );
  1391. BOOL bRemoveMergeFont(UNIVERSAL_FONT_ID ufi);
  1392. // miscellaneous
  1393. BOOL bModifyWorldTransform(CONST XFORML *pxf,ULONG iMode);
  1394. // bSupportsJPEG -- Only TRUE for direct DCs that have the GCAPS2_JPEGSRC
  1395. // flag set.
  1396. BOOL bSupportsJPEG()
  1397. {
  1398. return ((flGraphicsCaps2() & GCAPS2_JPEGSRC) &&
  1399. (dctp() != DCTYPE_MEMORY));
  1400. }
  1401. // bSupportsPNG -- Only TRUE for direct DCs that have the GCAPS2_PNGSRC
  1402. // flag set.
  1403. BOOL bSupportsPNG()
  1404. {
  1405. return ((flGraphicsCaps2() & GCAPS2_PNGSRC) &&
  1406. (dctp() != DCTYPE_MEMORY));
  1407. }
  1408. // bSupportsPassthroughImage -- TRUE for direct DCs that support the
  1409. // specified passthrough compression
  1410. // format.
  1411. BOOL bSupportsPassthroughImage(ULONG ulCompression)
  1412. {
  1413. ASSERTGDI((ulCompression == BI_JPEG) || (ulCompression == BI_PNG),
  1414. "XDCOBJ::bSupportsPassthroughImage: invalid format\n");
  1415. if (ulCompression == BI_JPEG)
  1416. return bSupportsJPEG();
  1417. else if (ulCompression == BI_PNG)
  1418. return bSupportsPNG();
  1419. return FALSE;
  1420. }
  1421. // The WNDOBJ pointer for printer and memory bitmap is currently kept in pso.
  1422. // We currently do not keep WNDOBJ pointers for display DCs in GDI. They
  1423. // are stored in hwnd in User.
  1424. // XXX In future, we may want to keep pwo in all DC including the display
  1425. // XXX DC. It allows us fast access to pwo but we will need to fix
  1426. // XXX bitmap selection, GetDC, ReleaseDC, DeleteDC, SaveDC, RestoreDC
  1427. // XXX and others to update this field correctly.
  1428. EWNDOBJ *pwo()
  1429. {
  1430. ASSERTGDI(!bDisplay() || (dctp() != DCTYPE_DIRECT) , "XDCOBJ::pwo(): display DC not allowed\n");
  1431. if (bHasSurface())
  1432. return(pSurface()->pwo());
  1433. else
  1434. return((EWNDOBJ *)NULL);
  1435. }
  1436. VOID pwo(EWNDOBJ *pwo)
  1437. {
  1438. ASSERTGDI(!bDisplay(), "XDCOBJ::pwo(pwo): display DC not allowed\n");
  1439. ASSERTGDI(bHasSurface(), "XDCOBJ::pwo(pwo): no pSurface in DC");
  1440. pSurface()->pwo(pwo);
  1441. }
  1442. BOOL bSetLinkedUFIs(PUNIVERSAL_FONT_ID pufis, UINT uNumUFIs);
  1443. UINT uNumberOfLinkedUFIs()
  1444. {
  1445. return(pdc->dclevel.uNumLinkedFonts);
  1446. }
  1447. BOOL bLinkingTurnedOff()
  1448. {
  1449. return(pdc->dclevel.bTurnOffLinking);
  1450. }
  1451. PUNIVERSAL_FONT_ID pufiLinkedFonts()
  1452. {
  1453. return(pdc->dclevel.pufi);
  1454. }
  1455. VOID vSetDefaultFont(BOOL bDisplay);
  1456. // ICM (Image Color Matching)
  1457. BOOL bAddColorTransform(HANDLE hCXform); // in icmobj.cxx
  1458. BOOL bRemoveColorTransform(HANDLE hCXform); // in icmobj.cxx
  1459. VOID vCleanupColorTransform(BOOL bProcessCleanup); // in icmobj.cxx
  1460. };
  1461. typedef XDCOBJ *PXDCOBJ;
  1462. /*********************************class************************************\
  1463. * class DCOBJ
  1464. *
  1465. * DC Multi-Lock object
  1466. *
  1467. * History:
  1468. * Tue 28-Dec-1993 -by- Patrick Haluptzok [patrickh]
  1469. * Wrote it.
  1470. \**************************************************************************/
  1471. class DCOBJ : public XDCOBJ /* mdo */
  1472. {
  1473. public:
  1474. DCOBJ() { pdc = (PDC) NULL; }
  1475. DCOBJ(HDC hdc) { vLock(hdc); }
  1476. ~DCOBJ() { vUnlockNoNullSet(); }
  1477. };
  1478. typedef DCOBJ *PDCOBJ;
  1479. /*********************************class************************************\
  1480. * class MDCOBJ
  1481. *
  1482. * DC Multi-Lock object
  1483. *
  1484. * History:
  1485. * Tue 25-Jun-1991 -by- Patrick Haluptzok [patrickh]
  1486. * Wrote it.
  1487. \**************************************************************************/
  1488. class MDCOBJ : public XDCOBJ /* mdo */
  1489. {
  1490. public:
  1491. MDCOBJ() { pdc = (PDC) NULL; }
  1492. MDCOBJ(HDC hdc) { vLock(hdc); }
  1493. ~MDCOBJ() { vUnlockNoNullSet(); }
  1494. };
  1495. /*********************************class************************************\
  1496. * class DCOBJA
  1497. *
  1498. * DC AltLock object
  1499. *
  1500. * History:
  1501. * Tue 25-Jun-1991 -by- Patrick Haluptzok [patrickh]
  1502. * Wrote it.
  1503. \**************************************************************************/
  1504. class DCOBJA : public XDCOBJ /* doa */
  1505. {
  1506. public:
  1507. DCOBJA() { pdc = (PDC) NULL; }
  1508. DCOBJA(HDC hdc) { vAltLock(hdc); }
  1509. ~DCOBJA() { vAltUnlockNoNullSet(); }
  1510. };
  1511. /*********************************class************************************\
  1512. * class MDCOBJA
  1513. *
  1514. * DC Multi-lock AltLock object
  1515. *
  1516. * History:
  1517. * Tue 25-Jun-1991 -by- Patrick Haluptzok [patrickh]
  1518. * Wrote it.
  1519. \**************************************************************************/
  1520. class MDCOBJA : public XDCOBJ /* doa */
  1521. {
  1522. public:
  1523. MDCOBJA() { pdc = (PDC) NULL; }
  1524. MDCOBJA(HDC hdc) { vAltLock(hdc); }
  1525. ~MDCOBJA() { vAltUnlockNoNullSet(); }
  1526. };
  1527. /*********************************Class************************************\
  1528. * class DCMEMOBJ
  1529. *
  1530. * DC memory object
  1531. *
  1532. * Public Interface:
  1533. *
  1534. * DCMEMOBJ(DCOBJ&) -- Allocate a DC, fill by copying the given one.
  1535. * vKeepIt() -- Don't free the object in the destructor.
  1536. *
  1537. * History:
  1538. * Thu 09-Aug-1990 17:15:27 -by- Charles Whitmer [chuckwh]
  1539. * Replaced the flags with the usual bKeep.
  1540. *
  1541. * Sun 06-Aug-1989 20:20:12 -by- Charles Whitmer [chuckwh]
  1542. * Wrote it.
  1543. \**************************************************************************/
  1544. class DCMEMOBJ : public XDCOBJ /* dcmo */
  1545. {
  1546. private:
  1547. BOOL bKeep;
  1548. public:
  1549. // This constructor is to be used by OpenDC. It allocates memory and
  1550. // copies in default attributes.
  1551. DCMEMOBJ(ULONG iType,BOOL bAltType); // DCOBJ.CXX
  1552. // This constructor is to be used by SaveDC. It copies the contents of
  1553. // the given DC into newly allocated memory.
  1554. DCMEMOBJ(DCOBJ& dcobj); // DCOBJ.CXX
  1555. ~DCMEMOBJ(); // DCOBJ.CXX
  1556. VOID vKeepIt() {bKeep = TRUE;}
  1557. };
  1558. extern DCLEVEL dclevelDefault;
  1559. #if DBG
  1560. VOID ASSERTDEVLOCK(PDC pdc);
  1561. #else
  1562. #define ASSERTDEVLOCK(pdc)
  1563. #endif
  1564. #define _DCOBJ_
  1565. #endif // GDIFLAGS_ONLY used for gdikdx
  1566. #endif