1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright 1998 - 2003 Microsoft Corporation. All Rights Reserved.
//
// FILE: DDIHook.cpp
//
//
// PURPOSE: DDI Hook routines for User Mode COM Customization DLL.
//
// This module implements the following functions defined in printoem.h:
// OEMCopyBits
// OEMBitBlt
// OEMStretchBlt
// OEMDitherColor
// OEMStretchBltROP
// OEMPlgBlt
// OEMPaint
// OEMRealizeBrush
// OEMStrokePath
// OEMFillPath
// OEMStrokeAndFillPath
// OEMLineTo
// OEMAlphaBlend
// OEMGradientFill
// OEMTransparentBlt
// OEMTextOut
// OEMQueryFont
// OEMQueryFontTree
// OEMQueryFontData
// OEMFontManagement
// OEMQueryAdvanceWidths
// OEMGetGlyphMode
// OEMStartDoc
// OEMEndDoc
// OEMStartPage
// OEMSendPage
// OEMStartBanding
// OEMNextBand
// OEMEscape
//
// History:
// 06/24/03 xxx created.
//
//
#include "precomp.h"
#include "oemprean.h"
#include "debug.h"
// This indicates to Prefast that this is a usermode driver file.
_Analysis_mode_(_Analysis_code_type_user_driver_);
BOOL APIENTRY
OEMCopyBits(
SURFOBJ *psoDst,
SURFOBJ *psoSrc,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
RECTL *prclDst,
POINTL *pptlSrc
)
/*++
Routine Description:
Implementation of DDI hook for DrvCopyBits.
DrvCopyBits translates between device-managed
raster surfaces and GDI standard-format bitmaps.
GDI will call DrvCopyBits when it needs to copy from
one surface to another and at least one of the
surfaces is device-managed.
Please refer to DDK documentation for more details.
Arguments:
psoDst - Points to the Dstination surface
psoSrc - Points to the source surface
pxlo - XLATEOBJ provided by the engine
pco - Defines a clipping region on the Dstination surface
pxlo - Defines the translation of color indices
between the source and target surfaces
prclDst - Defines the area to be modified
pptlSrc - Defines the upper-left corner of the source rectangle
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMCopyBits entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMCopyBits: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMCopyBits: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvCopyBits)(psoDst,
psoSrc,
pco,
pxlo,
prclDst,
pptlSrc);
}
BOOL APIENTRY
OEMBitBlt(
SURFOBJ *psoDst,
SURFOBJ *psoSrc,
SURFOBJ *psoMask,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
RECTL *prclDst,
POINTL *pptlSrc,
POINTL *pptlMask,
BRUSHOBJ *pbo,
POINTL *pptlBrush,
ROP4 rop4
)
/*++
Routine Description:
Implementation of DDI hook for DrvBitBlt.
DrvBitBlt provides general bit-block transfer capabilities
between device-managed surfaces, between GDI-managed
standard-format bitmaps, or between a device-managed
surface and a GDI-managed standard-format bitmap.
Please refer to DDK documentation for more details.
Arguments:
psoDst - Describes the target surface
psoSrc - Describes the source surface
psoMask - Describes the mask for rop4
pco - Limits the area to be modified
pxlo - Specifies how color indices are translated
between the source and target surfaces
prclDst - Defines the area to be modified
pptlSrc - Defines the upper left corner of the source rectangle
pptlMask - Defines which pixel in the mask corresponds to
the upper left corner of the source rectangle
pbo - Defines the pattern for bitblt
pptlBrush - Defines the origin of the brush in the Dstination surface
rop4 - ROP code that defines how the mask, pattern, source, and
Dstination pixels are combined to write to the Dstination surface
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMBitBlt entry.");
DBG_SURFOBJ(DBG_VERBOSE, L"psoDst", psoDst);
DBG_SURFOBJ(DBG_VERBOSE, L"psoSrc", psoSrc);
DBG_SURFOBJ(DBG_VERBOSE, L"psoMask", psoMask);
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
DBG_XLATEOBJ(DBG_VERBOSE, L"pxlo", pxlo);
DBG_RECTL(DBG_VERBOSE, L"prclDst", prclDst);
DBG_POINTL(DBG_VERBOSE, L"pptlSrc", pptlSrc);
DBG_POINTL(DBG_VERBOSE, L"pptlMask", pptlMask);
DBG_BRUSHOBJ(DBG_VERBOSE, L"pbo", pbo);
DBG_POINTL(DBG_VERBOSE, L"pptlBrush", pptlBrush);
VERBOSE(TEXT("\nrop4: %#x\r\n\n"), rop4);
PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMBitBlt: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMBitBlt: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvBitBlt)(psoDst,
psoSrc,
psoMask,
pco,
pxlo,
prclDst,
pptlSrc,
pptlMask,
pbo,
pptlBrush,
rop4);
}
BOOL APIENTRY
OEMStretchBlt(
SURFOBJ *psoDst,
SURFOBJ *psoSrc,
SURFOBJ *psoMask,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
COLORADJUSTMENT *pca,
POINTL *pptlHTOrg,
RECTL *prclDst,
RECTL *prclSrc,
POINTL *pptlMask,
ULONG iMode
)
/*++
Routine Description:
Implementation of DDI hook for DrvStretchBlt.
DrvStretchBlt provides stretching bit-block transfer
capabilities between any combination of device-managed
and GDI-managed surfaces. DrvStretchBlt enables the
device driver to write to GDI bitmaps, especially when the
driver can do halftoning. This function allows the same
halftoning algorithm to be applied to GDI bitmaps and
device surfaces. This function can be provided to handle
only certain forms of stretching, such as by integer multiples.
Please refer to DDK documentation for more details.
Arguments:
psoDst - Defines the surface on which to draw
psoSrc - Defines the source for blt operation
psoMask - Defines a surface that provides a mask for the source
pco - Limits the area to be modified on the Dstination
pxlo - Specifies how color dwIndexes are to be translated
between the source and target surfaces
pca - Defines color adjustment values to be applied to the source bitmap
pptlHTOrg - Specifies the origin of the halftone brush
prclDst - Defines the area to be modified on the Dstination surface
prclSrc - Defines the area to be copied from the source surface
pptlMask - Specifies which pixel in the given mask corresponds to
the upper left pixel in the source rectangle
iMode - Specifies how source pixels are combined to get output pixels
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMStretchBlt entry.");
DBG_SURFOBJ(DBG_VERBOSE, L"psoDst", psoDst);
DBG_SURFOBJ(DBG_VERBOSE, L"psoSrc", psoSrc);
DBG_SURFOBJ(DBG_VERBOSE, L"psoMask", psoMask);
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
DBG_XLATEOBJ(DBG_VERBOSE, L"pxlo", pxlo);
DBG_COLORADJUSTMENT(DBG_VERBOSE, L"pca", pca);
DBG_POINTL(DBG_VERBOSE, L"pptlHTOrg", pptlHTOrg);
DBG_RECTL(DBG_VERBOSE, L"prclDst", prclDst);
DBG_RECTL(DBG_VERBOSE, L"prclSrc", prclSrc);
DBG_POINTL(DBG_VERBOSE, L"pptlMask", pptlMask);
VERBOSE(TEXT("\niMode: %#x\r\n\n"), iMode);
PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMStretchBlt: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMStretchBlt: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStretchBlt)(psoDst,
psoSrc,
psoMask,
pco,
pxlo,
pca,
pptlHTOrg,
prclDst,
prclSrc,
pptlMask,
iMode);
}
ULONG APIENTRY
OEMDitherColor(
DHPDEV dhpdev,
ULONG iMode,
ULONG rgbColor,
ULONG *pulDither
)
/*++
Routine Description:
Implementation of DDI hook for DrvDitherColor.
DrvDitherColor requests the device to create a
brush dithered against a device palette.
Please refer to DDK documentation for more details.
Arguments:
dhpdev - DHPDEV passed, it is our pDEV
iMode - Not used
rgbColor - Solid rgb color to be used
pulDither - buffer to put the halftone brush.
Return Value:
Returns halftone method.
DCR_DRIVER if the dither values have been calculated by the driver.
DCR_SOLID if the engine should use the best solid color approximation of the color.
DCR_HALFTONE if the engine should create a halftone approximation for the driver.
--*/
{
VERBOSE(L"OEMDitherColor entry.");
PDEVOBJ pDevObj = (PDEVOBJ)dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvDitherColor)(dhpdev,
iMode,
rgbColor,
pulDither);
}
BOOL APIENTRY
OEMStretchBltROP(
SURFOBJ *psoDst,
SURFOBJ *psoSrc,
SURFOBJ *psoMask,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
COLORADJUSTMENT *pca,
POINTL *pptlHTOrg,
RECTL *prclDst,
RECTL *prclSrc,
POINTL *pptlMask,
ULONG iMode,
BRUSHOBJ *pbo,
ROP4 rop4
)
/*++
Routine Description:
Implementation of DDI hook for DrvStretchBltROP.
DrvStretchBltROP performs a stretching bit-block transfer
using a ROP.
Please refer to DDK documentation for more details.
Arguments:
psoDst - Specifies the target surface
psoSrc - Specifies the source surface
psoMask - Specifies the mask surface
pco - Limits the area to be modified
pxlo - Specifies how color indices are translated
between the source and target surfaces
pca - Defines color adjustment values to be applied to the source bitmap
pptlHTOrg - Specifies the halftone origin
prclDst - Area to be modified on the destination surface
prclSrc - Rectangle area on the source surface
pptlMask - Defines which pixel in the mask corresponds to
the upper left corner of the source rectangle
iMode - Specifies how source pixels are combined to get output pixels
pbo - Defines the pattern for bitblt
rop4 - ROP code that defines how the mask, pattern, source, and
destination pixels are combined on the destination surface
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMStretchBltROP entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMStretchBltROP: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMStretchBltROP: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStretchBltROP)(psoDst,
psoSrc,
psoMask,
pco,
pxlo,
pca,
pptlHTOrg,
prclDst,
prclSrc,
pptlMask,
iMode,
pbo,
rop4);
}
BOOL APIENTRY
OEMPlgBlt(
SURFOBJ *psoDst,
SURFOBJ *psoSrc,
SURFOBJ *psoMask,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
COLORADJUSTMENT *pca,
POINTL *pptlBrushOrg,
POINTFIX *pptfixDest,
RECTL *prclSrc,
POINTL *pptlMask,
ULONG iMode
)
/*++
Routine Description:
Implementation of DDI hook for DrvPlgBlt.
DrvPlgBlt provides rotate bit-block transfer capabilities between
combinations of device-managed and GDI-managed surfaces.
Please refer to DDK documentation for more details.
Arguments:
psoDst - Defines the surface on which to draw
psoSrc - Defines the source for blt operation
psoMask - Defines a surface that provides a mask for the source
pco - Limits the area to be modified on the Dstination
pxlo - Specifies how color dwIndexes are to be translated
between the source and target surfaces
pca - Defines color adjustment values to be applied to the source bitmap
pptlBrushOrg - Specifies the origin of the halftone brush
pptfixDest - Defines the area to be modified on the Dstination surface
prclSrc - Defines the area to be copied from the source surface
pptlMask - Specifies which pixel in the given mask corresponds to
the upper left pixel in the source rectangle
iMode - Specifies how source pixels are combined to get output pixels
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMPlgBlt entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMPlgBlt: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMPlgBlt: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvPlgBlt)(psoDst,
psoSrc,
psoMask,
pco,
pxlo,
pca,
pptlBrushOrg,
pptfixDest,
prclSrc,
pptlMask,
iMode);
}
BOOL APIENTRY
OEMPaint(
SURFOBJ *pso,
CLIPOBJ *pco,
BRUSHOBJ *pbo,
POINTL *pptlBrushOrg,
MIX mix
)
/*++
Routine Description:
Implementation of DDI hook for DrvPaint.
DrvPaint is an obsolete function.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface on which to draw
pco - Limits the area to be modified on the Dstination
pbo - Points to a BRUSHOBJ which defined the pattern and colors to fill with
pptlBrushOrg - Specifies the origin of the halftone brush
mix - Defines the foreground and background raster operations to use for
the brush
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMPaint entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMPaint: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMPaint: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvPaint)(pso,
pco,
pbo,
pptlBrushOrg,
mix);
}
BOOL APIENTRY
OEMRealizeBrush(
BRUSHOBJ *pbo,
SURFOBJ *psoTarget,
SURFOBJ *psoPattern,
SURFOBJ *psoMask,
XLATEOBJ *pxlo,
ULONG iHatch
)
/*++
Routine Description:
Implementation of DDI hook for DrvRealizeBrush.
DrvRealizeBrush requests that the driver realize a specified brush
for a specified surface. To realize a brush, the driver converts a
GDI brush into a form that can be used internally. A realized brush
contains device-specific information needed by the device to
accelerate drawing using the brush. The driver's realization of a brush
is written into the buffer allocated by a call to BRUSHOBJ_pvAllocRBrush.
Please refer to DDK documentation for more details.
Arguments:
pbo - BRUSHOBJ to be realized
psoTarget - Defines the surface for which the brush is to be realized
psoPattern - Defines the pattern for the brush
psoMask - Transparency mask for the brush
pxlo - Defines the interpretration of colors in the pattern
iHatch - Specifies whether psoPattern is one of the hatch brushes
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMRealizeBrush entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoTarget->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvRealizeBrush)(pbo,
psoTarget,
psoPattern,
psoMask,
pxlo,
iHatch);
}
BOOL APIENTRY
OEMStrokePath(
SURFOBJ *pso,
PATHOBJ *ppo,
CLIPOBJ *pco,
XFORMOBJ *pxo,
BRUSHOBJ *pbo,
POINTL *pptlBrushOrg,
LINEATTRS *plineattrs,
MIX mix
)
/*++
Routine Description:
Implementation of DDI hook for DrvStrokePath.
DrvStrokePath strokes a path when called by GDI.
Please refer to DDK documentation for more details.
Arguments:
pso - Identifies the surface on which to draw
ppo - Defines the path to be stroked
pco - Defines the clipping path
pxo - Specifies the world to device coordinate transformation
pbo - Specifies the brush to be used when drawing the path
pptlBrushOrg - Defines the brush origin
plineattrs - Defines the line attributes
mix - Specifies how to combine the brush with the destination
Return Value:
TRUE if successful
FALSE if driver cannot handle the path
DDI_ERROR if there is an error
--*/
{
VERBOSE(L"OEMStrokePath entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMStrokePath: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMStrokePath: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStrokePath)(pso,
ppo,
pco,
pxo,
pbo,
pptlBrushOrg,
plineattrs,
mix);
}
BOOL APIENTRY
OEMFillPath(
SURFOBJ *pso,
PATHOBJ *ppo,
CLIPOBJ *pco,
BRUSHOBJ *pbo,
POINTL *pptlBrushOrg,
MIX mix,
FLONG flOptions
)
/*++
Routine Description:
Implementation of DDI hook for DrvFillPath.
DrvFillPath is an optional entry point to handle the filling of closed paths.
GDI can call DrvFillPath to fill a path on a device-managed surface.
When deciding whether to call this function, GDI compares the fill
requirements with the following flags in the flGraphicsCaps member of
the DEVINFO structure: GCAPS_BEZIERS, GCAPS_ALTERNATEFILL,
and GCAPS_WINDINGFILL.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface on which to draw.
ppo - Defines the path to be filled
pco - Defines the clipping path
pbo - Defines the pattern and colors to fill with
pptlBrushOrg - Defines the brush origin
mix - Defines the foreground and background ROPs to use for the brush
flOptions - Whether to use zero-winding or odd-even rule
Return Value:
TRUE if successful
FALSE if driver cannot handle the path
DDI_ERROR if there is an error
--*/
{
VERBOSE(L"OEMFillPath entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMFillPath: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMFillPath: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvFillPath)(pso,
ppo,
pco,
pbo,
pptlBrushOrg,
mix,
flOptions);
}
BOOL APIENTRY
OEMStrokeAndFillPath(
SURFOBJ *pso,
PATHOBJ *ppo,
CLIPOBJ *pco,
XFORMOBJ *pxo,
BRUSHOBJ *pboStroke,
LINEATTRS *plineattrs,
BRUSHOBJ *pboFill,
POINTL *pptlBrushOrg,
MIX mixFill,
FLONG flOptions
)
/*++
Routine Description:
Implementation of DDI hook for DrvStrokeAndFillPath.
DrvStrokeAndFillPath strokes and fills a path concurrently.
The driver can return FALSE if the path or the clipping is too
complex for the device to handle; in that case, GDI converts
to a simpler call. For example, if the device driver has set the
GCAPS_BEZIERS flag in the flGraphicsCaps member of the
DEVINFO structure and then receives a path with Bezier curves,
it can return FALSE; GDI will then convert the Bezier curves to
lines and call DrvStrokeAndFillPath again. If the device driver
returns FALSE again, GDI will further simplify the call, making
calls to DrvStrokePath and DrvFillPath, or to DrvBitBlt, depending
on the mix and width of the lines making up the path.
Please refer to DDK documentation for more details.
Arguments:
pso - Describes the surface on which to draw
ppo - Describes the path to be filled
pco - Defines the clipping path
pxo - Specifies the world to device coordinate transformation
pboStroke - Specifies the brush to use when stroking the path
plineattrs - Specifies the line attributes
pboFill - Specifies the brush to use when filling the path
pptlBrushOrg - Specifies the brush origin for both brushes
mixFill - Specifies the foreground and background ROPs to use
for the fill brush
flOptions - Whether to use zero-winding or odd-even rule
Return Value:
TRUE if successful
FALSE if driver cannot handle the path
DDI_ERROR if there is an error
--*/
{
VERBOSE(L"OEMStrokeAndFillPath entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMStrokeAndFillPath: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMStrokeAndFillPath: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStrokeAndFillPath)(pso,
ppo,
pco,
pxo,
pboStroke,
plineattrs,
pboFill,
pptlBrushOrg,
mixFill,
flOptions);
}
BOOL APIENTRY
OEMLineTo(
SURFOBJ *pso,
CLIPOBJ *pco,
BRUSHOBJ *pbo,
LONG x1,
LONG y1,
LONG x2,
LONG y2,
RECTL *prclBounds,
MIX mix
)
/*++
Routine Description:
Implementation of DDI hook for DrvLineTo.
DrvLineTo draws a single, solid, integer-only cosmetic line.
Please refer to DDK documentation for more details.
Arguments:
pso - Describes the surface on which to draw
pco - Defines the clipping path
pbo - Defines the brush used to draw the line
x1,y1 - Specifies the line's starting point
x2,y2 - Specifies the line's ending point
prclBounds - Defines a rectangle that bounds the unclipped line.
mix - Specifies the foreground and background ROP
Return Value:
TRUE if successful
FALSE if driver cannot handle the path
DDI_ERROR if there is an error
--*/
{
VERBOSE(L"OEMLineTo entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMLineTo: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMLineTo: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvLineTo)(pso,
pco,
pbo,
x1,
y1,
x2,
y2,
prclBounds,
mix);
}
BOOL APIENTRY
OEMAlphaBlend(
SURFOBJ *psoDest,
SURFOBJ *psoSrc,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
RECTL *prclDest,
RECTL *prclSrc,
BLENDOBJ *pBlendObj
)
/*++
Routine Description:
Implementation of DDI hook for DrvAlphaBlend.
DrvAlphaBlend provides bit-block transfer capabilities with alpha blending.
Please refer to DDK documentation for more details.
Arguments:
psoDest - Defines the surface on which to draw
psoSrc - Defines the source
pco - Limits the area to be modified on the Destination
pxlo - Specifies how color dwIndexes are to be translated
between the source and target surfaces
prclDest - Defines the area to be modified on the Destination surface
prclSrc - Defines the area to be copied from the source surface
BlendFunction - Specifies the blend function to be used
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMAlphaBlend entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoDest->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMAlphaBlend: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMAlphaBlend: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvAlphaBlend)(psoDest,
psoSrc,
pco,
pxlo,
prclDest,
prclSrc,
pBlendObj);
}
BOOL APIENTRY
OEMGradientFill(
SURFOBJ *psoDest,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
TRIVERTEX *pVertex,
ULONG nVertex,
PVOID pMesh,
ULONG nMesh,
RECTL *prclExtents,
POINTL *pptlDitherOrg,
ULONG ulMode
)
/*++
Routine Description:
Implementation of DDI hook for DrvGradientFill.
DrvGradientFill shades the specified primitives.
Please refer to DDK documentation for more details.
Arguments:
psoDest - Defines the surface on which to draw
pco - Limits the area to be modified on the Destination
pxlo - Should be ignored by the driver
pVertex - Pointer to an array of TRIVERTEX structures,
with each entry containing position and color information
nVertex - Specifies the number of TRIVERTEX structures in the
array to which pVertex points
pMesh - Pointer to an array of structures that define the connectivity
of the TRIVERTEX elements to which pVertex points
nMesh - Specifies the number of elements in the array to which
pMesh points
prclExtents - Pointer to a RECTL structure that defines the area in
which the gradient drawing is to occur
pptlDitherOrg - Pointer to a POINTL structure that defines the origin
on the surface for dithering
ulMode - Specifies the current drawing mode and how to interpret
the array to which pMesh points
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMGradientFill entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoDest->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMGradientFill: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMGradientFill: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvGradientFill)(psoDest,
pco,
pxlo,
pVertex,
nVertex,
pMesh,
nMesh,
prclExtents,
pptlDitherOrg,
ulMode);
}
BOOL APIENTRY
OEMTransparentBlt(
SURFOBJ *psoDst,
SURFOBJ *psoSrc,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
RECTL *prclDst,
RECTL *prclSrc,
ULONG iTransColor,
ULONG ulReserved
)
/*++
Routine Description:
Implementation of DDI hook for DrvTransparentBlt.
DrvTransparentBlt provides bit-block transfer capabilities with
transparency.
Please refer to DDK documentation for more details.
Arguments:
psoDst - Defines the surface on which to draw
psoSrc - Defines the source
pco - Limits the area to be modified on the Destination
pxlo - Specifies how color dwIndexes are to be translated
between the source and target surfaces
prclDst - Defines the area to be modified on the Destination surface
prclSrc - Defines the area to be copied from the source surface
iTransColor - Specifies the transparent color
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMTransparentBlt entry.");
PDEVOBJ pDevObj = (PDEVOBJ)psoDst->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMTransparentBlt: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMTransparentBlt: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvTransparentBlt)(psoDst,
psoSrc,
pco,
pxlo,
prclDst,
prclSrc,
iTransColor,
ulReserved);
}
BOOL APIENTRY
OEMTextOut(
SURFOBJ *pso,
STROBJ *pstro,
FONTOBJ *pfo,
CLIPOBJ *pco,
RECTL *prclExtra,
RECTL *prclOpaque,
BRUSHOBJ *pboFore,
BRUSHOBJ *pboOpaque,
POINTL *pptlOrg,
MIX mix
)
/*++
Routine Description:
Implementation of DDI hook for DrvTextOut.
DrvTextOut is the entry point from GDI that calls for the
driver to render a set of glyphs at specified positions.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface on which to be written.
pstro - Defines the glyphs to be rendered and their positions
pfo - Specifies the font to be used
pco - Defines the clipping path
prclExtra - A NULL-terminated array of rectangles to be filled
prclOpaque - Specifies an opaque rectangle
pboFore - Defines the foreground brush
pboOpaque - Defines the opaque brush
pptlOrg - Pointer to POINT struct , defining th origin
mix - Specifies the foreground and background ROPs for pboFore
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMTextOut entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
DBG_SURFOBJ(DBG_VERBOSE, L"pso", pso);
DBG_STROBJ(DBG_VERBOSE, L"pstro", pstro);
DBG_FONTOBJ(DBG_VERBOSE, L"pfo", pfo);
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
DBG_BRUSHOBJ(DBG_VERBOSE, L"pboFore", pboFore);
DBG_BRUSHOBJ(DBG_VERBOSE, L"pboOpaque", pboOpaque);
if (pOemPDEV->bPreAnalysis)
{
VERBOSE(TEXT("OEMTextOut: Begin pre-analysis...\r\n"));
// Since the bPreAnalysis flag is set, this indicates that the current pass is the pre-analysis pass.
// Perform any pre-analysis tasks here. Note that the surface used during pre-analysis might
// differ from the surface passed in during the rendering pass.
// Dump the bounds of the clip window available for pre-analysis.
DBG_CLIPOBJ(DBG_VERBOSE, L"pco", pco);
// Although unidrv calls the hooked drawing functions, it will return before any drawing is done.
// So we should not perform any drawing on the surface. But all other pre-analysis tasks should
// be performed here. For example, certain printers need to handle black objects differently if
// they intersect with any color objects versus being stand alone. Another task could be to halftone
// stretchblt objects differently from bitblt objects. Basically, the plug-in can analyze the objects on the page.
// During the pre-analysis pass, drawing functions should not call back into Unidrv.
// So we return here.
VERBOSE(TEXT("OEMTextOut: End pre-analysis...\r\n"));
return TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvTextOut)(pso,
pstro,
pfo,
pco,
prclExtra,
prclOpaque,
pboFore,
pboOpaque,
pptlOrg,
mix);
}
PIFIMETRICS APIENTRY
OEMQueryFont(
DHPDEV dhpdev,
ULONG_PTR iFile,
ULONG iFace,
ULONG_PTR *pid
)
/*++
Routine Description:
Implementation of DDI hook for DrvQueryFont.
DrvQueryFont is used by GDI to get the IFIMETRICS structure
for a given font.
Please refer to DDK documentation for more details.
Arguments:
dhpdev - Driver device handle
iFile - Identifies the driver font file
iFace - One-based index of the driver font
pid - Points to a LONG variable for returning an identifier
which GDI will pass to DrvFree
Return Value:
Pointer to an IFIMETRICS structure for the given font.
NULL if there is an error
--*/
{
VERBOSE(L"OEMQueryFont entry.");
PDEVOBJ pDevObj = (PDEVOBJ)dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvQueryFont)(dhpdev,
iFile,
iFace,
pid);
}
PVOID APIENTRY
OEMQueryFontTree(
DHPDEV dhpdev,
ULONG_PTR iFile,
ULONG iFace,
ULONG iMode,
ULONG_PTR *pid
)
/*++
Routine Description:
Implementation of DDI hook for DrvQueryFontTree.
DrvQueryFontTree provides GDI with a pointer to a structure that
defines one of the following:
- A mapping from Unicode to glyph handles, including glyph variants
- A mapping of kerning pairs to kerning handles
Please refer to DDK documentation for more details.
Arguments:
dhpdev - Driver device handle
iFile - Identifies the driver font file
iFace - One-based index of the driver font
iMode - Specifies the type of information to be provided
pid - Points to a LONG variable for returning an identifier
which GDI will pass to DrvFree
Return Value:
Pointer to the structure requested based on iMode.
NULL if there is an error
--*/
{
VERBOSE(L"OEMQueryFontTree entry.");
PDEVOBJ pDevObj = (PDEVOBJ)dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvQueryFontTree)(dhpdev,
iFile,
iFace,
iMode,
pid);
}
LONG APIENTRY
OEMQueryFontData(
DHPDEV dhpdev,
FONTOBJ *pfo,
ULONG iMode,
HGLYPH hg,
GLYPHDATA *pgd,
_Out_writes_bytes_(cjSize) PVOID pv,
ULONG cjSize
)
/*++
Routine Description:
Implementation of DDI hook for DrvQueryFontData.
DrvQueryFontData retrieves information about a realized font.
GDI provides a pointer to an array of glyph or kerning handles,
and the driver returns information about the glyphs or kerning
pairs. The driver can assume that all handles in the array are valid.
Please refer to DDK documentation for more details.
Arguments:
dhpdev - Driver device handle
pfo - Points to a FONTOBJ structure
iMode - Type of information requested
hg - A glyph handle
pgd - Points to a GLYPHDATA structure
pv - Points to output buffer
cjSize - Size of output buffer
Return Value:
Depends on iMode. FD_ERROR if there is an error
--*/
{
VERBOSE(L"OEMQueryFontData entry.");
PDEVOBJ pDevObj = (PDEVOBJ)dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvQueryFontData)(dhpdev,
pfo,
iMode,
hg,
pgd,
pv,
cjSize);
}
ULONG APIENTRY
OEMFontManagement(
SURFOBJ *pso,
FONTOBJ *pfo,
ULONG iMode,
ULONG cjIn,
_In_reads_bytes_(cjIn) PVOID pvIn,
ULONG cjOut,
_Out_writes_bytes_(cjOut) PVOID pvOut
)
/*++
Routine Description:
Implementation of DDI hook for DrvFontManagement.
Is this function valid for Unidrv drivers?
Please refer to DDK documentation for more details.
Arguments:
pso - Points to a SURFOBJ structure
pfo - Points to a FONTOBJ structure
iMode - Escape number
cjIn - Size of input buffer
pvIn - Points to input buffer
cjOut - Size of output buffer
pvOut - Points to output buffer
Return Value:
0x00000001 to 0x7fffffff for success
0x80000000 to 0xffffffff for failure
0 if the specified escape number if not supported
--*/
{
VERBOSE(L"OEMFontManagement entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvFontManagement)(pso,
pfo,
iMode,
cjIn,
pvIn,
cjOut,
pvOut);
}
BOOL APIENTRY
OEMQueryAdvanceWidths(
DHPDEV dhpdev,
FONTOBJ *pfo,
ULONG iMode,
_In_reads_(cGlyphs) HGLYPH *phg,
_Out_writes_bytes_(cGlyphs*sizeof(USHORT)) PVOID pvWidths,
ULONG cGlyphs
)
/*++
Routine Description:
Implementation of DDI hook for DrvQueryAdvanceWidths.
DrvQueryAdvanceWidths returns character advance widths
for a specified set of glyphs.
Please refer to DDK documentation for more details.
Arguments:
dhpdev - Driver device handle
pfo - Points to a FONTOBJ structure
iMode - Type of information to be provided
phg - Points to an array of HGLYPHs for which the driver will
provide character advance widths
pvWidths - Points to a buffer for returning width data
cGlyphs - Number of glyphs in the phg array
Return Value:
Depends on iMode
--*/
{
VERBOSE(L"OEMQueryAdvanceWidths entry.");
PDEVOBJ pDevObj = (PDEVOBJ)dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvQueryAdvanceWidths)(dhpdev,
pfo,
iMode,
phg,
pvWidths,
cGlyphs);
}
ULONG APIENTRY
OEMGetGlyphMode(
DHPDEV dhpdev,
FONTOBJ *pfo
)
/*++
Routine Description:
Implementation of DDI hook for DrvGetGlyphMode.
DrvGetGlyphMode tells GDI how to cache glyph information.
GDI calls a driver's DrvGetGlyphMode routine to determine the
range of font information that should be cached for a particular
font; that is, DrvGetGlyphMode determines what GDI stores in
its font cache. A device that caches fonts on its own should return
FO_HGLYPHS to minimize the storage requirements for the font.
GDI calls DrvGetGlyphMode for each font realization. For example,
a driver might want to download outlines for point sizes larger than
12 point, but raster images for smaller fonts. However, GDI reserves
the right to refuse this request.
Please refer to DDK documentation for more details.
Arguments:
dhpdev - Driver device handle
pfo - Points to a FONTOBJ structure
Return Value:
The glyph mode or FO_GLYPHMODE, which is the default.
--*/
{
VERBOSE(L"OEMGetGlyphMode entry.");
PDEVOBJ pDevObj = (PDEVOBJ)dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvGetGlyphMode)(dhpdev,
pfo);
}
BOOL APIENTRY
OEMStartDoc(
SURFOBJ *pso,
_In_ PWSTR pwszDocName,
DWORD dwJobId
)
/*++
Routine Description:
Implementation of DDI hook for DrvStartDoc.
DrvStartDoc is called by GDI when it is ready to
start sending a document to the driver for rendering.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface object
pDocName - Specifies a Unicode document name
jobId - Identifies the print job
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMStartDoc entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStartDoc)(pso,
pwszDocName,
dwJobId);
}
BOOL APIENTRY
OEMEndDoc(
SURFOBJ *pso,
FLONG fl
)
/*++
Routine Description:
Implementation of DDI hook for DrvEndDoc.
DrvEndDoc is called by GDI when it has finished
sending a document to the driver for rendering.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface object
flags - A set of flag bits
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMEndDoc entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvEndDoc)(pso,
fl);
}
BOOL APIENTRY
OEMStartPage(
SURFOBJ *pso
)
/*++
Routine Description:
Implementation of DDI hook for DrvStartPage.
DrvStartPage is called by GDI when it is ready to
start sending the contents of a physical page to the
driver for rendering.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface object
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMStartPage entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStartPage)(pso);
}
BOOL APIENTRY
OEMSendPage(
SURFOBJ *pso
)
/*++
Routine Description:
Implementation of DDI hook for DrvSendPage.
DrvSendPage is called by GDI when it has finished
drawing a physical page, so the driver can send
the page to the printer.
Please refer to DDK documentation for more details.
NOTE: OEMSendPage will not be called in any driver that enables
pre-analysis. But the reason we implement this is that the driver
might be pushed to a down-level client and thereby have to run
without pre-analysis support. In this case, it might have to support
OEMSendPage.
Arguments:
pso - Defines the surface object
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMSendPage entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvSendPage)(pso);
}
BOOL APIENTRY
OEMStartBanding(
SURFOBJ *pso,
POINTL *pptl
)
/*++
Routine Description:
Implementation of DDI hook for DrvStartBanding.
DrvStartBanding is called by GDI when it is ready to start
sending bands of a physical page to the driver for rendering.
Note: DrvStartBanding is called to prepare the driver
for banding, call only once per page (not at everyband!!)
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface object
pptl - Pointer to origin of next band (to return to GDI)
Return Value:
Fill out pptl to contain the origin of the first band
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMStartBanding entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
DBG_POINTL(DBG_VERBOSE, L"pptl", pptl);
if (pptl == NULL)
{
VERBOSE(TEXT("OEMStartBanding: Start of OEM Pre-analysis pass...\r\n"));
VERBOSE(TEXT("\tOEM Pre-analysis pass...no drawing on surface in this pass.\r\n"));
pOemPDEV->bPreAnalysis = TRUE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvStartBanding)(pso,
pptl);
}
BOOL APIENTRY
OEMNextBand(
SURFOBJ *pso,
POINTL *pptl
)
/*++
Routine Description:
Implementation of DDI hook for DrvNextBand.
DrvNextBand is called by GDI when it has finished
drawing a band for a physical page, so the driver
can send the band to the printer.
Please refer to DDK documentation for more details.
Arguments:
pso - Defines the surface object
pptl - Pointer to origin of next band (to return to GDI)
Return Value:
TRUE if successful, FALSE if there is an error
--*/
{
VERBOSE(L"OEMNextBand entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
DBG_POINTL(DBG_VERBOSE, L"pptl", pptl);
if (pOemPDEV->bPreAnalysis)
{
//
// First call into OEMNextBand indicates end of pre-analysis path.
//
VERBOSE(TEXT("OEMNextBand: End of OEM Pre-analysis pass...\r\n"));
pOemPDEV->bPreAnalysis = FALSE;
}
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvNextBand)(pso,
pptl);
}
ULONG APIENTRY
OEMEscape(
SURFOBJ *pso,
ULONG iEsc,
ULONG cjIn,
_In_reads_bytes_(cjIn) PVOID pvIn,
ULONG cjOut,
_Out_writes_bytes_(cjOut) PVOID pvOut
)
/*++
Routine Description:
Implementation of DDI entry point DrvEscape.
DrvEscape is used for retrieving information from a device
that is not available in a device-independent device driver
interface; the particular query depends on the value of the
iEsc parameter.
Please refer to DDK documentation for more details.
Arguments:
pso - Describes the surface the call is directed to
iEsc - Specifies a query
cjIn - Specifies the size in bytes of the buffer pointed to by pvIn
pvIn - Points to input data buffer
cjOut - Specifies the size in bytes of the buffer pointed to by pvOut
pvOut - Points to the output buffer
Return Value:
Depends on the query specified by iEsc parameter.
Zero if the function specified by the query is not supported.
--*/
{
VERBOSE(L"OEMEscape entry.");
PDEVOBJ pDevObj = (PDEVOBJ)pso->dhpdev;
POEMPDEV pOemPDEV = (POEMPDEV)pDevObj->pdevOEM;
// Punt call back to UNIDRV.
//
return (pOemPDEV->m_pfnDrvEscape)(pso,
iEsc,
cjIn,
pvIn,
cjOut,
pvOut);
}
|