Release 980913
Fri Sep 11 13:14:35 1998 Andreas Mohr <100.30936@germany.net>
* [files/file.c] [include/file.h]
Fixed SetFilePointer to allow negative positions as in DOS.
* [graphics/ddraw.c]
Added some methods to IDirect3D.
* [ole/compobj.c] [if1632/compobj.spec]
Added/implemented CoCreateStandardMalloc16,
CoGetClassObject, CoCreateInstance,
LookupETask, SetETask, CoGetState16.
* [loader/task.c]
MakeProcInstance: return 0 if func == NULL.
* [*/*] [tools/winapi-check]
Added zillions of missing WINAPI's and __cdecl's.
(oops, several caused by myself)
Wrote script for automated checking.
* [if1632/compobj.spec]
Many stub names.
* [misc/ddeml.c] [ole/compobj.c]
Some stubs.
Tue Sep 9 21:36:48 1998 Anders Carlsson <anders.carlsson@linux.nu>
* [dlls/comctl32/Makefile.in] [dlls/comctl32/commctrl.c]
[dlls/comctl32/tab.c] [include/commctrl.h] [include/tab.h]
Added preliminary tab control support.
Sat Sep 5 16:27:20 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>
* [graphics/psdrv/*]
More changes to the PostScript driver:
Implemented pens and solid brushes.
Colour/greyscale for fonts, pens and brushes.
To get coloured output you need to have *ColorDevice set to true
in your PPD, otherwise you'll get greyscale.
Landscape mode now works, as does non-A4 page sizes.
Encoding of fonts to ANSI is better, Symbol works again.
* [objects/dc.c] [include/gdi.h] [*/*]
Moved dc->w.{text,background}Pixel to X11DRV_PDEVICE where they
belong.
Sat Sep 5 05:12:09 1998 Ove Kaaven <ovek@arcticnet.no>
* [include/dosexe.h] [include/miscemu.h] [include/msdos.h]
[loader/dos/dosvm.c] [loader/dos/module.c] [msdos/dpmi.c]
[msdos/int2f.c] [msdos/interrupts.c]
Fixed portability. Adapted some code to make it easier to
integrate the DOS subsystem with the DPMI subsystem, made
the DPMI simulated real-mode interrupts be handled the V86
way. Added support for .COM files. Made int2f DPMI check
fail, to avoid pkunzip crashing in attempting to use DPMI.
Generally moved stuff around a little.
It is now technically possible to load several DOS programs
into the same memory space. Not tested, though.
Fri Sep 4 21:40:45 1998 Marcus Meissner <marcus@jet.franken.de>
* [if1632/kernel.spec]
Changed 500-53x stubnames accordingly to nt3.51 krnl386.exe.
* [win32/except.c]
Fixed one bad program behaviour, (deleting SEH while in
first walk). RtlUnwind is broken too I think (it should unwind
on success, not while walking the exception chain).
* [ole/ole2nls.c]
Get*DefaultLCID returns 0x400|id. expected by one application.
* [if1632/snoop.c]
Handle non-standard SP returns more graceful.
* [windows/class.c]
hinstances are mostly irrelevant for win32.
* [memory/string.c] [misc/registry.c]
lstrcmpi32W: use toupper for characters < 0x100. (speedup hack
for registry.c)
Some small speedup hacks for registry.c
Thu Sep 3 20:40:16 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [Makefile.in][configure][configure.in][dlls/Makefile.in]
[dlls/comctl32/Makefile.in]
Created dlls/comctl32 and moved the common controls stuff to it.
* [misc/version.c]
Removed COMCTL32_DllGetVersion. The fixed function is part
of the common controls stuff.
* [dlls/comctl32/*.c][include/commctrl.h]
Added structure size tests.
* [dlls/comctl32/toolbar.c]
Fixed a bug in TOOLBAR_GetMaxWidth().
* [dlls/comctl32/animate.c][include/animate.h]
[dlls/comctl32/comboex.c][include/comboex.h]
[dlls/comctl32/hotkey.c][include/hotkey.h]
[dlls/comctl32/listview.c][include/listview.h]
[dlls/comctl32/commctrl.c][include/commctrl.h]
New files. Added Animation, ComboBoxEx, Hotkey and
Listview control dummies.
* [dlls/comctl32/tooltips.c]
Fixed a display bug and font selection.
* [dlls/comctl32/comctl32undoc.c][include/commctrl.h]
Added missing DPA functions. Fixed bugs and published the
function prototypes.
* [documentation/common_controls]
Updated.
Wed Sep 2 15:43:45 1998 Patrik Stridvall <ps@leissner.se>
* [AUTHORS] [include/authors.h]
Added myself as a Wine author.
* [memory/virtual.c] [objects/dc.c]
Fixed runtime errors for Solaris.
* [misc/ddeml.c] [objects/gdiobj.c]
Minor fixes.
* [win32/device.c]
Added stubs for IFSMgr VxDCall and
a partial implementation of IFSMgr DeviceIo.
* [relay32/Makefile.in] [relay32/builtin32.c] [relay32/imm32.spec]
[relay32/msnet32.spec] [relay32/oledlg.spec]
Added new spec files for IMM32.DLL, MSNET32.DLL, OLEDLG.DLL.
* [misc/Makefile.in] [misc/imm.c] [include/imm.h]
Added news files for implementation of IMM32.DLL.
All functions return 0 as is correct for all Western Languages.
* [ole/Makefile.in] [ole/oledlg.c] [include/oledlg.h]
Added new files for implementation of OLEDLG.DLL.
Added stubs with FIXME:s for all functions.
Wed Sep 2 10:50:00 1998 Juergen Schmied <juergen.schmied@metronet.de>
* [dlls/shell32/contmenu.c][dlls/shell32/shellole.c]
[dlls/shell32/shlfolder.c][dlls/shell32/shlview.c]
[documentation/shell32][include/shell.h]
Clean up, bugfixes.
* [dlls/shell32/enumidlist.c]
Fileattributes implemented.
* [dlls/shell32/pidl.c]
Class pidlmgr splited into functions, structures changed,
some functions rewritten.
* [dlls/shell32/shell32_main.c]
Small changes and bugfixes SHGetFileInfoA, SHGetSpecialFolderLocation.
* [dlls/shell32/shellord.c][relay32/shell32.spec]
Parameter documented, implemented SHCloneSpecialIDList.
Stub improved ShellExecuteEx32A.
New stubs SHFind_InitMenuPopup, FileMenu_InitMenuPopup,
FileMenu_Create, FileMenu_TrackPopupMenuEx, SHWinHelp,
SHRunConrolPanel, DAD_ShowDragImage, FileMenu_Destroy,
SHGetDataFromIDListA, SHFileOperationA.
* [include/winnls.h][include/ole2nls.c]
TIME_FORCE24HOURFORMAT, TIME_NOTIMEMARKER implemented
in OLE_GetFormatA, GetTimeFormat32A.
* [win32/code_page.c]
WideCharToMultiByte: parameter checking and returning of strlen
implemented.
* [windows/keyboard.c][windows/defwnd.c]
Debug messages added.
* [windows/win.c]
WIN_SetWindowLong GWL_STYLE and GWL_EXSTYLE implemented.
* [controls/menu.c]
Missing line added.
* [include/winerror.h]
Macros for SUCCEEDED and FAILED added.
Mon Aug 31 00:55:31 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [loader/module.c]
Bugfix: LoadModule16 should *not* call LoadModule32.
* [files/dos_fs.c]
Bugfix: don't crash if given directory doesn't exist.
Sat Aug 29 15:00:49 1998 Turchanov Sergey <turchanov@usa.net>
* [include/mmsystem.h][multimedia/mmsystem.c][relay32/winmm.spec]
Almost completed implementation of [snd]PlaySound (except
flags SND_ALIAS_ID and SND_APPLICATION).
* [if1632/user.spec][windows/winpos.c]
Added SetWindowRgn16 stub.
Sat Aug 29 02:53:31 1998 Alexander Lukyanov <lav@long.yar.ru>
* [files/drive.c]
GetDriveType32A: return DRIVE_DOESNOTEXIST in case of non
existent drive.
* [msdos/int21.c]
INT21_FindFirstFCB: check drive validity to prevent oops.
* [win32/file.c]
CreateFile32A: duplicate STD_{INPUT,OUTPUT}_HANDLE.
* [files/dos_fs.c]
Make DOSFS_OpenDir treat "" as "/".
DOSFS_OpenDevice: duplicate STD_{INPUT,OUTPUT}_HANDLE.
* [windows/dialog.c]
GetNextDlgTabItem32: use last/first item instead of first/last
when hwndCtrl==0. This fixes initial focus.
Sat Aug 29 02:46:32 1998 Adrian Harvey <adrian@select.com.au>
* [include/process.h] [include/process.c]
Renamed PROCESS_SELF to CURRENT_PROCESS_PSEUDOHANDLE in line
with thread constant, and Win32 documentation (which calls it
a pseudohandle.) Made GetCurrentProcess actually use this
constant instead of the value.
* [include/process.h] [include/thread.h] [scheduler/thread.c]
[scheduler/process.c] [scheduler/handle.c]
Modify HANDLE_GetObjPtr to understand about
CURRENT_THREAD_PSEUDOHANDLE and CURRENT_PROCESS_PSEUDOHANDLE.
This allows DuplicateHandle to do the correct thing with these
handles. Removed now duplicate functionality from THREAD_GetPtr
and PROCESS_GetPtr.
* [loader/ne/segment.c]
Fixed two places where HFILE32s were being created and passed to
16-bit code. This should unbreak NE self-loading code.
Added two casts to remove compile time warnings.
Fri Aug 28 21:04:13 1998 Joseph Pranevich <knight@baltimore.wwaves.com>
* [msdos/dosmem.c] [msdos/int2f.c]
Added beginnings of DOS error table.
* [msdos/int1a.c]
Stub for subfunction 0xb0.
* [msdos/int10.c] [loader/dos/dosvm.c]
INT 10 support completely rewritten and lots of debugging
added. Now, DOS apps that use INT 10 to write to the screen will
work. (Beyond Zork does, at least. Somewhat.)
* [include/miscemu.h] [msdos/dosmem.c] [msdos/int21.c]
Another shot at getting MS's generic error message facility
right.
* [msdos/int21.c]
Command.Com wanted to set its own PSP address. I let it.
Wed Aug 26 12:26:20 1998 Matthew Toseland <Matthew.Toseland@btinternet.com>
* [include/file.h] [misc/lzexpand.c]
Fixed LZCopy16 by fixing HFILE16/HFILE32 convertor macros so don't
convert lzw handles.
Tue Aug 25 22:22:55 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
* [misc/registry.c]
In RegEnumvalue, ivalue == 0 is a legal request and should
return the first entry.
* [msdos/int21.c]
Add handling for Int21-48/49 in Win16. Makes blinker demo work.
* [windows/winproc.c]
Add Msg32A<->Msg32W translation for LB_ADDSTRING.
Tue Aug 25 21:03:31 1998 Kristian Nielsen <kristian.nielsen@risoe.dk>
* [windows/win.c]
Fix for SetParent(): MS Windows 3.11 does not clear the WS_CHILD
flag when a child window is reparented to the desktop window.
Mon Aug 24 20:55:22 1998 Berend Reitsma <berend at asset-control dot com>
* [controls/menu.c]
Menus created with SetMenuItemInfo and InsertMenuItem should
work now.
Sun Aug 23 23:23:23 1998 Alex Korobka <korobka@ams.sunysb.edu>
* [controls/combo.c]
Added CB_GETITEMHEIGHT.
* [windows/winpos.c]
WM_NCHITTEST, SWP_FRAMECHANGED bugfixes.
Sat Aug 22 21:15:29 1998 Alex Priem <alexp@sci.kun.nl>
* [files/profile.c] [include/windows.h]
Added GetPrivateProfileSectionNames[AW],GetPrivateProfileSectionW,
GetPrivateProfileStructW, GetProfileSectionW,
WriteProfileSection[AW], WritePrivateProfileStructW.
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index 3c64fcc..3e00742 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -369,6 +369,7 @@
this->t.xlib.image->width,
this->t.xlib.image->height
);
+ TSXSetWindowColormap(display,this->s.ddraw->e.xlib.drawable,this->s.palette->cm);
return 0;
}
@@ -995,13 +996,67 @@
Xlib_IDirectDrawPalette_SetEntries
};
+static HRESULT WINAPI IDirect3D_QueryInterface(
+ LPDIRECT3D this,REFIID refiid,LPVOID *obj
+) {
+ /* FIXME: Not sure if this is correct */
+ char xrefiid[50];
+
+ WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+ TRACE(ddraw,"(%p)->(%s,%p)\n",this,xrefiid,obj);
+ if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
+ *obj = this;
+ this->lpvtbl->fnAddRef(this);
+ return 0;
+ }
+ if (!memcmp(&IID_IDirect3D,refiid,sizeof(IID_IDirect3D))) {
+ LPDIRECT3D d3d;
+
+ d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
+ d3d->ref = 1;
+ d3d->ddraw = (LPDIRECTDRAW)this;
+ this->lpvtbl->fnAddRef(this);
+ d3d->lpvtbl = &d3dvt;
+ *obj = d3d;
+ return 0;
+ }
+ if (!memcmp(&IID_IDirect3D2,refiid,sizeof(IID_IDirect3D))) {
+ LPDIRECT3D2 d3d;
+
+ d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
+ d3d->ref = 1;
+ d3d->ddraw = (LPDIRECTDRAW)this;
+ this->lpvtbl->fnAddRef(this);
+ d3d->lpvtbl = &d3d2vt;
+ *obj = d3d;
+ return 0;
+ }
+ FIXME(ddraw,"(%p):interface for IID %s NOT found!\n",this,xrefiid);
+ return OLE_E_ENUM_NOMORE;
+}
+
+static ULONG WINAPI IDirect3D_AddRef(LPDIRECT3D this) {
+ return ++(this->ref);
+}
+
+static ULONG WINAPI IDirect3D_Release(LPDIRECT3D this)
+{
+ TRACE(ddraw,"(%p)->Release()\n",this);
+ if (!--(this->ref)) {
+ this->ddraw->lpvtbl->fnRelease(this->ddraw);
+ HeapFree(GetProcessHeap(),0,this);
+ return 0;
+ }
+ return this->ref;
+}
+
/*******************************************************************************
* IDirect3D
*/
static struct IDirect3D_VTable d3dvt = {
- (void*)1,
- (void*)2,
- (void*)3,
+ (void*)IDirect3D_QueryInterface,
+ (void*)IDirect3D_AddRef,
+ (void*)IDirect3D_Release,
(void*)4,
(void*)5,
(void*)6,
@@ -1014,8 +1069,7 @@
* IDirect3D2
*/
static ULONG WINAPI IDirect3D2_Release(LPDIRECT3D2 this) {
- this->ref--;
- if (!this->ref) {
+ if (!--(this->ref)) {
this->ddraw->lpvtbl->fnRelease(this->ddraw);
HeapFree(GetProcessHeap(),0,this);
return 0;
diff --git a/graphics/metafiledrv/graphics.c b/graphics/metafiledrv/graphics.c
index f6615ff..4afe965 100644
--- a/graphics/metafiledrv/graphics.c
+++ b/graphics/metafiledrv/graphics.c
@@ -202,3 +202,23 @@
return MF_MetaParam1( dc, META_PAINTREGION, index );
}
+
+/**********************************************************************
+ * MFDRV_SetBkColor
+ */
+COLORREF
+MFDRV_SetBkColor( DC *dc, COLORREF color )
+{
+ return MF_MetaParam2(dc, META_SETBKCOLOR, HIWORD(color), LOWORD(color));
+}
+
+
+/**********************************************************************
+ * MFDRV_SetTextColor
+ */
+COLORREF
+MFDRV_SetTextColor( DC *dc, COLORREF color )
+{
+ return MF_MetaParam2(dc, META_SETTEXTCOLOR, HIWORD(color), LOWORD(color));
+}
+
diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c
index a9b5d2e..3869520 100644
--- a/graphics/metafiledrv/init.c
+++ b/graphics/metafiledrv/init.c
@@ -57,7 +57,7 @@
NULL, /* pSelectClipRgn */
MFDRV_SelectObject, /* pSelectObject */
NULL, /* pSelectPalette */
- NULL, /* pSetBkColor */
+ MFDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetDeviceClipping */
NULL, /* pSetDIBitsToDevice */
@@ -70,7 +70,7 @@
NULL, /* pSetStretchBltMode */
NULL, /* pSetTextAlign */
NULL, /* pSetTextCharacterExtra */
- NULL, /* pSetTextColor */
+ MFDRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetTextJustification */
MFDRV_SetViewportExt, /* pSetViewportExt */
MFDRV_SetViewportOrg, /* pSetViewportOrg */
@@ -310,7 +310,7 @@
/*
need wide version as well
*/
-HDC32 CreateEnhMetaFile32A(
+HDC32 WINAPI CreateEnhMetaFile32A(
HDC32 hdc, /* optional reference DC */
LPCSTR filename, /* optional filename for disk metafiles */
const RECT32 *rect, /* optional bounding rectangle */
@@ -351,7 +351,7 @@
return 0;
}
-HENHMETAFILE32 CloseEnhMetaFile32(
+HENHMETAFILE32 WINAPI CloseEnhMetaFile32(
HDC32 hdc /* metafile DC */
)
{
diff --git a/graphics/psdrv/Makefile.in b/graphics/psdrv/Makefile.in
index c829559..aa3ddde 100644
--- a/graphics/psdrv/Makefile.in
+++ b/graphics/psdrv/Makefile.in
@@ -7,12 +7,15 @@
C_SRCS = \
afm.c \
+ brush.c \
+ color.c \
driver.c \
escape.c \
font.c \
graphics.c \
init.c \
objects.c \
+ pen.c \
ppd.c \
ps.c \
text.c
diff --git a/graphics/psdrv/README b/graphics/psdrv/README
index 33a0a1b..458b443 100644
--- a/graphics/psdrv/README
+++ b/graphics/psdrv/README
@@ -1,8 +1,8 @@
-Wine Postscript Driver
+Wine PostScript Driver
======================
-When complete this will allow Wine to generate Postscript files without needing
-an external printer driver. It should be possible to print to a non Postscript
+When complete this will allow Wine to generate PostScript files without needing
+an external printer driver. It should be possible to print to a non PostScript
printer by filtering the output through ghostscript.
@@ -14,15 +14,15 @@
if it were a DRV file called WINEPS.DRV . To install it as the default printer
driver add
-device=Wine Postscript Driver,WINEPS,LPT1:
+device=Wine PostScript Driver,WINEPS,LPT1:
to the [windows] section of win.ini . You may prefer to add
-Wine Postscript Driver=WINEPS,LPT1:
+Wine PostScript Driver=WINEPS,LPT1:
to the [devices] section of win.ini instead.
-You will need Adobe Font Metric (AFM) files for the (type 1 Postscript) fonts
+You will need Adobe Font Metric (AFM) files for the (type 1 PostScript) fonts
that you wish to use. You can get these from
ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles . The directories base17 or
@@ -39,13 +39,16 @@
for each AFM file that you wish to use. [This might change in the future]
-You also require a ppd file for your printer. This describes certain
+You also require a PPD file for your printer. This describes certain
characteristics of the printer such as which fonts are installed, how to select
manual feed etc. Adobe also has many of these on its website, have a look in
ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/
-Put the ppd in the directory from which you start wine and call it default.ppd
+Put the PPD in the directory from which you start wine and call it default.ppd
[this will definitely change soon].
+To enable colour printing you need to have the *ColorDevice entry in the PPD
+set to true, otherwise the driver will generate greyscale.
+
Note that you need not set printer=on in the [wine] section of wine.conf, this
enables printing via external printer drivers and does not affect wineps.
@@ -63,21 +66,21 @@
therefore find a larger than normal selection of input bins in the print setup
dialog box. I've only really tested ppd parsing on the hp4m6_v1.ppd file.
-Landscape mode probably doesn't quite work yet (this is easy to fix).
-
-Graphics are basically non-existent. Only MoveTo/LineTo/Rectangle with a thin
-black pen.
-
-No colour.
-
-AFM parsing is not finished (or ideal).
+Many graphics functions to do.
No TrueType download.
+AdvancedSetup dialog box.
+
Many partially implemented functions.
ps.c is becoming messy.
+No clipping.
+
+Notepad often starts text too far to the left depending on the margin
+settings. However the win3.1 pscript.drv (under wine) also does this.
+
Probably many more...
Since the driver is very alpha, things are likely to change quickly.
diff --git a/graphics/psdrv/afm.c b/graphics/psdrv/afm.c
index 4477c27..dbbc60d 100644
--- a/graphics/psdrv/afm.c
+++ b/graphics/psdrv/afm.c
@@ -30,66 +30,81 @@
*/
static void PSDRV_AFMGetCharMetrics(AFM *afm, FILE *fp)
{
- char buf[256];
- char *cp, *item, *value;
- int i, charno;
+ char line[256], valbuf[256];
+ char *cp, *item, *value, *curpos, *endpos;
+ int i;
+ AFMMETRICS **insert = &afm->Metrics, *metric;
for(i = 0; i < afm->NumofMetrics; i++) {
- char *name = NULL;
- if(!fgets(buf, sizeof(buf), fp)) {
+ if(!fgets(line, sizeof(line), fp)) {
ERR(psdrv, "Unexpected EOF\n");
return;
}
- cp = buf + strlen(buf);
+
+ metric = *insert = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY,
+ sizeof(AFMMETRICS) );
+ insert = &metric->next;
+
+ cp = line + strlen(line);
do {
*cp = '\0';
cp--;
- } while(cp > buf && isspace(*cp));
+ } while(cp > line && isspace(*cp));
- item = strtok(buf, ";");
- if(!strncmp(item, "C ", 2)) {
- value = strchr(item, ' ');
- sscanf(value, " %d", &charno);
- } else if(!strncmp(item, "CH ", 3)) {
- value = strrchr(item, ' ');
- sscanf(value, " %x", &charno);
- } else {
- WARN(psdrv, "Don't understand '%s'\n", item);
- return;
- }
-
- while((item = strtok(NULL, ";"))) {
+ curpos = line;
+ while(*curpos) {
+ item = curpos;
while(isspace(*item))
item++;
- value = strchr(item, ' ');
- if(!value) /* last char maybe a ';' but no white space after it */
- break;
- value++;
+ value = strpbrk(item, " \t");
+ while(isspace(*value))
+ value++;
+ cp = endpos = strchr(value, ';');
+ while(isspace(*--cp))
+ ;
+ memcpy(valbuf, value, cp - value + 1);
+ valbuf[cp - value + 1] = '\0';
+ value = valbuf;
- if(!strncmp("WX ", item, 3) || !strncmp("W0X ", item, 4)) {
- if(charno >= 0 && charno <= 0xff)
- sscanf(value, "%f", &(afm->CharWidths[charno]));
+ if(!strncmp(item, "C ", 2)) {
+ value = strchr(item, ' ');
+ sscanf(value, " %d", &metric->C);
+
+ } else if(!strncmp(item, "CH ", 3)) {
+ value = strrchr(item, ' ');
+ sscanf(value, " %x", &metric->C);
}
- /* would carry on here to scan in BBox, name and ligs */
- /* Carry on to find BBox (or actually just ascent) of Aring. This
- will provide something like the lfHeight value */
+ else if(!strncmp("WX ", item, 3) || !strncmp("W0X ", item, 4)) {
+ sscanf(value, "%f", &metric->WX);
+ if(metric->C >= 0 && metric->C <= 0xff)
+ afm->CharWidths[metric->C] = metric->WX;
+ }
else if(!strncmp("N ", item, 2)) {
- name = value; /* may end in space */
+ metric->N = HEAP_strdupA( PSDRV_Heap, 0, value);
}
else if(!strncmp("B ", item, 2)) {
- if(name && !strncmp("Aring", name, 5)) {
- float llx, lly, urx, ury;
- llx = lly = urx = ury = 0.0;
- sscanf(value, "%f%f%f%f", &llx, &lly, &urx, &ury);
- afm->FullAscender = ury;
- }
+ sscanf(value, "%f%f%f%f", &metric->B.llx, &metric->B.lly,
+ &metric->B.urx, &metric->B.ury);
+
+ /* Store height of Aring to use as lfHeight */
+ if(metric->N && !strncmp(metric->N, "Aring", 5))
+ afm->FullAscender = metric->B.ury;
}
+ /* Ligatures go here... */
+
+ curpos = endpos + 1;
}
+
+#if 0
+ TRACE(psdrv, "Metrics for '%s' WX = %f B = %f,%f - %f,%f\n",
+ metric->N, metric->WX, metric->B.llx, metric->B.lly,
+ metric->B.urx, metric->B.ury);
+#endif
}
return;
@@ -113,6 +128,8 @@
AFM *afm;
char *cp;
+ TRACE(psdrv, "parsing '%s'\n", file);
+
if((fp = fopen(file, "r")) == NULL) {
MSG("Can't open AFM file '%s'. Please check wine.conf .\n", file);
return NULL;
@@ -133,7 +150,8 @@
value = strchr(buf, ' ');
if(value)
- value++;
+ while(isspace(*value))
+ value++;
if(!strncmp("FontName", buf, 8)) {
afm->FontName = HEAP_strdupA(PSDRV_Heap, 0, value);
@@ -223,8 +241,10 @@
continue;
}
-
-
+ if(!strncmp("EncodingScheme", buf, 14)) {
+ afm->EncodingScheme = HEAP_strdupA(PSDRV_Heap, 0, value);
+ continue;
+ }
}
fclose(fp);
@@ -324,12 +344,49 @@
return;
}
-
+
+/**********************************************************
+ *
+ * PSDRV_ReencodeCharWidths
+ *
+ * Re map the CharWidths field of the afm to correspond to an ANSI encoding
+ *
+ */
+static void PSDRV_ReencodeCharWidths(AFM *afm)
+{
+ int i;
+ AFMMETRICS *metric;
+
+ for(i = 0; i < 256; i++) {
+ if(isalnum(i))
+ continue;
+ if(PSDRV_ANSIVector[i] == NULL) {
+ afm->CharWidths[i] = 0.0;
+ continue;
+ }
+ for(metric = afm->Metrics; metric; metric = metric->next) {
+ if(!strcmp(metric->N, PSDRV_ANSIVector[i])) {
+ afm->CharWidths[i] = metric->WX;
+ break;
+ }
+ }
+ if(!metric) {
+ WARN(psdrv, "Couldn't find glyph '%s' in font '%s'\n",
+ PSDRV_ANSIVector[i], afm->FontName);
+ afm->CharWidths[i] = 0.0;
+ }
+ }
+ return;
+}
+
/***********************************************************
*
* PSDRV_afmfilesCallback
*
* Callback for PROFILE_EnumerateWineIniSection
+ * Try to parse AFM file `value', alter the CharWidths field of afm struct if
+ * the font is using AdobeStandardEncoding to correspond to WinANSI, then add
+ * afm to system font list.
*/
static void PSDRV_afmfilesCallback(char const *key, char const *value,
void *user)
@@ -337,8 +394,13 @@
AFM *afm;
afm = PSDRV_AFMParse(value);
- if(afm)
+ if(afm) {
+ if(afm->EncodingScheme &&
+ !strcmp(afm->EncodingScheme, "AdobeStandardEncoding")) {
+ PSDRV_ReencodeCharWidths(afm);
+ }
PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm);
+ }
return;
}
diff --git a/graphics/psdrv/brush.c b/graphics/psdrv/brush.c
new file mode 100644
index 0000000..8a82afd
--- /dev/null
+++ b/graphics/psdrv/brush.c
@@ -0,0 +1,73 @@
+/*
+ * PostScript brush handling
+ *
+ * Copyright 1998 Huw D M Davies
+ *
+ */
+
+#include "windows.h"
+#include "psdrv.h"
+#include "brush.h"
+#include "debug.h"
+
+
+/***********************************************************************
+ * PSDRV_BRUSH_SelectObject
+ */
+HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
+{
+ HBRUSH32 prevbrush = dc->w.hBrush;
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+
+ TRACE(psdrv, "hbrush = %08x\n", hbrush);
+ dc->w.hBrush = hbrush;
+
+ switch(brush->logbrush.lbStyle) {
+
+ case BS_SOLID:
+ physDev->brush.style = BS_SOLID;
+ PSDRV_CreateColor(physDev, &physDev->brush.color,
+ brush->logbrush.lbColor);
+ break;
+
+ case BS_NULL:
+ physDev->brush.style = BS_NULL;
+ break;
+
+ case BS_HATCHED:
+ case BS_PATTERN:
+ FIXME(psdrv, "Unsupported brush style %d\n", brush->logbrush.lbStyle);
+ break;
+
+ default:
+ FIXME(psdrv, "Unrecognized brush style %d\n", brush->logbrush.lbStyle);
+ break;
+ }
+
+ physDev->brush.set = FALSE;
+ return prevbrush;
+}
+
+
+/**********************************************************************
+ *
+ * PSDRV_SetBrush
+ *
+ */
+BOOL32 PSDRV_SetBrush(DC *dc)
+{
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+
+ switch (physDev->brush.style) {
+ case BS_SOLID:
+ PSDRV_WriteSetColor(dc, &physDev->brush.color);
+ break;
+
+ default:
+ return FALSE;
+ break;
+
+ }
+ physDev->brush.set = TRUE;
+ return TRUE;
+}
diff --git a/graphics/psdrv/color.c b/graphics/psdrv/color.c
new file mode 100644
index 0000000..f53e037
--- /dev/null
+++ b/graphics/psdrv/color.c
@@ -0,0 +1,135 @@
+/*
+ * PostScript colour functions
+ *
+ * Copyright 1998 Huw D M Davies
+ *
+ */
+
+#include "windows.h"
+#include "psdrv.h"
+#include "debug.h"
+
+/**********************************************************************
+ * PSDRV_CmpColor
+ *
+ * Return TRUE if col1 == col2
+ */
+BOOL32 PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2)
+{
+ if(col1->type != col2->type)
+ return FALSE;
+
+ switch(col1->type) {
+ case PSCOLOR_GRAY:
+ if(col1->value.gray.i == col2->value.gray.i)
+ return TRUE;
+ break;
+ case PSCOLOR_RGB:
+ if( col1->value.rgb.r == col2->value.rgb.r &&
+ col1->value.rgb.g == col2->value.rgb.g &&
+ col1->value.rgb.b == col2->value.rgb.b )
+ return TRUE;
+ break;
+ default:
+ ERR(psdrv, "Unknown colour type %d\n", col1->type);
+ }
+ return FALSE;
+}
+
+
+/**********************************************************************
+ * PSDRV_CopyColor
+ *
+ * Copies col2 into col1. Return FALSE on error.
+ */
+BOOL32 PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2)
+{
+
+ switch(col2->type) {
+ case PSCOLOR_GRAY:
+ col1->value.gray.i = col2->value.gray.i;
+ break;
+
+ case PSCOLOR_RGB:
+ col1->value.rgb.r = col2->value.rgb.r;
+ col1->value.rgb.g = col2->value.rgb.g;
+ col1->value.rgb.b = col2->value.rgb.b;
+ break;
+
+ default:
+ ERR(psdrv, "Unknown colour type %d\n", col1->type);
+ return FALSE;
+ }
+
+ col1->type = col2->type;
+ return TRUE;
+}
+
+
+/**********************************************************************
+ * PSDRV_CreateColor
+ *
+ * Creates a PostScript colour from a COLORREF.
+ * Result is grey scale if ColorDevice field of ppd is FALSE else an
+ * rgb colour is produced.
+ */
+void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
+ COLORREF wincolor )
+{
+ int ctype = wincolor >> 24;
+ float r, g, b;
+
+ if(ctype != 0)
+ FIXME(psdrv, "Colour is %08lx\n", wincolor);
+
+ r = (wincolor & 0xff) / 256.0;
+ g = ((wincolor >> 8) & 0xff) / 256.0;
+ b = ((wincolor >> 16) & 0xff) / 256.0;
+
+ if(physDev->pi->ppd->ColorDevice) {
+ pscolor->type = PSCOLOR_RGB;
+ pscolor->value.rgb.r = r;
+ pscolor->value.rgb.g = g;
+ pscolor->value.rgb.b = b;
+ } else {
+ pscolor->type = PSCOLOR_GRAY;
+ /* FIXME configurable */
+ pscolor->value.gray.i = r * 0.3 + g * 0.59 + b * 0.11;
+ }
+ return;
+}
+
+
+/***********************************************************************
+ * PSDRV_SetBkColor
+ */
+COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color )
+{
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+ COLORREF oldColor;
+
+ oldColor = dc->w.backgroundColor;
+ dc->w.backgroundColor = color;
+
+ PSDRV_CreateColor(physDev, &physDev->bkColor, color);
+
+ return oldColor;
+}
+
+
+/***********************************************************************
+ * PSDRV_SetTextColor
+ */
+COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color )
+{
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+ COLORREF oldColor;
+
+ oldColor = dc->w.textColor;
+ dc->w.textColor = color;
+
+ PSDRV_CreateColor(physDev, &physDev->font.color, color);
+ physDev->font.set = FALSE;
+ return oldColor;
+}
+
diff --git a/graphics/psdrv/driver.c b/graphics/psdrv/driver.c
index ee62d63..3c456aa 100644
--- a/graphics/psdrv/driver.c
+++ b/graphics/psdrv/driver.c
@@ -9,13 +9,13 @@
*
*/
-#include <windows.h>
-#include <psdrv.h>
-#include <debug.h>
-#include <resource.h>
#include <string.h>
-#include <win.h>
-#include <print.h>
+#include "windows.h"
+#include "psdrv.h"
+#include "debug.h"
+#include "resource.h"
+#include "win.h"
+#include "print.h"
static LONG Resolutions[][2] = { {600,600} };
diff --git a/graphics/psdrv/font.c b/graphics/psdrv/font.c
index 6abab35..6a05880 100644
--- a/graphics/psdrv/font.c
+++ b/graphics/psdrv/font.c
@@ -37,7 +37,7 @@
it = TRUE;
if(lf->lfWeight > 550)
bd = TRUE;
- lstrcpy32A(FaceName, lf->lfFaceName);
+ strcpy(FaceName, lf->lfFaceName);
if(FaceName[0] == '\0') {
switch(lf->lfPitchAndFamily & 0xf0) {
@@ -45,16 +45,16 @@
break;
case FF_ROMAN:
case FF_SCRIPT:
- lstrcpy32A(FaceName, "Times");
+ strcpy(FaceName, "Times");
break;
case FF_SWISS:
- lstrcpy32A(FaceName, "Helvetica");
+ strcpy(FaceName, "Helvetica");
break;
case FF_MODERN:
- lstrcpy32A(FaceName, "Courier");
+ strcpy(FaceName, "Courier");
break;
case FF_DECORATIVE:
- lstrcpy32A(FaceName, "Symbol");
+ strcpy(FaceName, "Symbol");
break;
}
}
@@ -62,23 +62,25 @@
if(FaceName[0] == '\0') {
switch(lf->lfPitchAndFamily & 0x0f) {
case VARIABLE_PITCH:
- lstrcpy32A(FaceName, "Times");
+ strcpy(FaceName, "Times");
break;
default:
- lstrcpy32A(FaceName, "Courier");
+ strcpy(FaceName, "Courier");
break;
}
}
+ TRACE(psdrv, "Trying to find facename '%s'\n", FaceName);
+
for(family = physDev->pi->Fonts; family; family = family->next) {
- if(!lstrncmp32A(FaceName, family->FamilyName,
- strlen(family->FamilyName)))
+ if(!strcmp(FaceName, family->FamilyName))
break;
}
if(!family)
family = physDev->pi->Fonts;
-
+ TRACE(psdrv, "Got family '%s'\n", family->FamilyName);
+
for(afmle = family->afmlist; afmle; afmle = afmle->next) {
if( (bd == (afmle->afm->Weight == FW_BOLD)) &&
(it == (afmle->afm->ItalicAngle != 0.0)) )
@@ -165,8 +167,8 @@
width = 0.0;
for(i = 0; i < count && str[i]; i++) {
- width += physDev->font.afm->CharWidths[ (UINT32)str[i] ];
- TRACE(psdrv, "Width after %dth char '%c' = %f\n", i, str[i], width);
+ width += physDev->font.afm->CharWidths[ *((unsigned char *)str + i) ];
+/* TRACE(psdrv, "Width after %dth char '%c' = %f\n", i, str[i], width);*/
}
width *= physDev->font.scale;
TRACE(psdrv, "Width after scale (%f) is %f\n", physDev->font.scale, width);
@@ -182,11 +184,17 @@
BOOL32 PSDRV_SetFont( DC *dc )
{
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+ BOOL32 ReEncode = FALSE;
+ PSDRV_WriteSetColor(dc, &physDev->font.color);
if(physDev->font.set) return TRUE;
- PSDRV_WriteReencodeFont(dc);
- PSDRV_WriteSetFont(dc);
+ if(physDev->font.afm->EncodingScheme &&
+ !strcmp(physDev->font.afm->EncodingScheme, "AdobeStandardEncoding"))
+ ReEncode = TRUE;
+ if(ReEncode)
+ PSDRV_WriteReencodeFont(dc);
+ PSDRV_WriteSetFont(dc, ReEncode);
physDev->font.set = TRUE;
return TRUE;
}
@@ -218,7 +226,7 @@
pTM->tmPitchAndFamily |= TMPF_DEVICE;
plf->lfPitchAndFamily = 0;
- lstrcpyn32A( plf->lfFaceName, pafm->FamilyName, LF_FACESIZE );
+ strncpy( plf->lfFaceName, pafm->FamilyName, LF_FACESIZE );
#undef plf
pTM->tmAscent = pafm->FullAscender * scale;
@@ -252,7 +260,7 @@
if( plf->lfFaceName[0] ) {
TRACE(psdrv, "lfFaceName = '%s'\n", plf->lfFaceName);
for(family = physDev->pi->Fonts; family; family = family->next) {
- if(!lstrncmp32A(plf->lfFaceName, family->FamilyName,
+ if(!strncmp(plf->lfFaceName, family->FamilyName,
strlen(family->FamilyName)))
break;
}
diff --git a/graphics/psdrv/graphics.c b/graphics/psdrv/graphics.c
index 9b0e02d..70a84ce 100644
--- a/graphics/psdrv/graphics.c
+++ b/graphics/psdrv/graphics.c
@@ -3,7 +3,6 @@
*
* Copyright 1998 Huw D M Davies
*
- * Not much here yet...
*/
#include <string.h>
#include "windows.h"
@@ -25,7 +24,7 @@
dc->w.CursPosX = x;
dc->w.CursPosY = y;
- return PSDRV_WriteMoveTo(dc, XLPTODP(dc, x), YLPTODP(dc, y));
+ return TRUE;
}
/***********************************************************************
@@ -35,6 +34,9 @@
{
TRACE(psdrv, "%d %d\n", x, y);
+ PSDRV_SetPen(dc);
+ PSDRV_WriteMoveTo(dc, XLPTODP(dc, dc->w.CursPosX),
+ YLPTODP(dc, dc->w.CursPosY));
PSDRV_WriteLineTo(dc, XLPTODP(dc, x), YLPTODP(dc, y));
PSDRV_WriteStroke(dc);
@@ -56,7 +58,13 @@
TRACE(psdrv, "%d %d - %d %d\n", left, top, right, bottom);
PSDRV_WriteRectangle(dc, XLPTODP(dc, left), YLPTODP(dc, top),
- width, height);
+ width, height);
+
+ PSDRV_SetBrush(dc);
+ PSDRV_Writegsave(dc);
+ PSDRV_WriteFill(dc);
+ PSDRV_Writegrestore(dc);
+ PSDRV_SetPen(dc);
PSDRV_WriteStroke(dc);
return TRUE;
}
@@ -65,10 +73,25 @@
/***********************************************************************
* PSDRV_Ellipse
*/
-BOOL32 PSDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
+BOOL32 PSDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
{
+ INT32 x, y, a, b;
+
TRACE(psdrv, "%d %d - %d %d\n", left, top, right, bottom);
-
+
+ x = XLPTODP(dc, (left + right)/2);
+ y = YLPTODP(dc, (top + bottom)/2);
+
+ a = XLSTODS(dc, (right - left)/2);
+ b = YLSTODS(dc, (bottom - top)/2);
+
+ PSDRV_WriteEllispe(dc, x, y, a, b);
+ PSDRV_SetBrush(dc);
+ PSDRV_Writegsave(dc);
+ PSDRV_WriteFill(dc);
+ PSDRV_Writegrestore(dc);
+ PSDRV_SetPen(dc);
+ PSDRV_WriteStroke(dc);
return TRUE;
}
@@ -81,6 +104,7 @@
INT32 i;
TRACE(psdrv, "count = %d\n", count);
+ PSDRV_SetPen(dc);
PSDRV_WriteMoveTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y));
for(i = 1; i < count; i++)
PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[i].x), YLPTODP(dc, pt[i].y));
@@ -97,6 +121,8 @@
INT32 i;
TRACE(psdrv, "count = %d\n", count);
FIXME(psdrv, "Hack!\n");
+
+ PSDRV_SetPen(dc);
PSDRV_WriteMoveTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y));
for(i = 1; i < count; i++)
PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[i].x), YLPTODP(dc, pt[i].y));
@@ -108,4 +134,3 @@
return TRUE;
}
-
diff --git a/graphics/psdrv/init.c b/graphics/psdrv/init.c
index 6a62a5a..cc43a6d 100644
--- a/graphics/psdrv/init.c
+++ b/graphics/psdrv/init.c
@@ -5,14 +5,14 @@
*
*/
-#include <windows.h>
-#include <gdi.h>
-#include <psdrv.h>
-#include <debug.h>
-#include <heap.h>
-#include <winreg.h>
-#include <print.h>
-#include <winerror.h>
+#include "windows.h"
+#include "gdi.h"
+#include "psdrv.h"
+#include "debug.h"
+#include "heap.h"
+#include "winreg.h"
+#include "print.h"
+#include "winerror.h"
static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODE16* initData );
@@ -62,7 +62,7 @@
NULL, /* pSelectClipRgn */
PSDRV_SelectObject, /* pSelectObject */
NULL, /* pSelectPalette */
- NULL, /* pSetBkColor */
+ PSDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetDeviceClipping */
NULL, /* pSetDIBitsToDevice */
@@ -75,7 +75,7 @@
NULL, /* pSetStretchBltMode */
NULL, /* pSetTextAlign */
NULL, /* pSetTextCharacterExtra */
- NULL, /* pSetTextColor */
+ PSDRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetTextJustification */
NULL, /* pSetViewportExt (optional) */
NULL, /* pSetViewportOrg (optional) */
@@ -202,6 +202,8 @@
TRACE(psdrv, "(%s %s %s %p)\n", driver, device, output, initData);
+ if(!pi) return FALSE;
+
if(!pi->Fonts) {
MSG("To use WINEPS you need to install some AFM files.\n");
return FALSE;
@@ -252,6 +254,13 @@
physDev->pi->ppd->DefaultResolution;
devCaps->aspectXY = (int)hypot( (double)devCaps->aspectX,
(double)devCaps->aspectY );
+
+ if(physDev->pi->ppd->ColorDevice) {
+ devCaps->bitsPixel = 8;
+ devCaps->numColors = 256;
+ /* FIXME are these values OK? */
+ }
+
/* etc */
dc->w.devCaps = devCaps;
@@ -324,6 +333,14 @@
}
pi->ppd = PSDRV_ParsePPD(pi->Devmode->dmDrvPrivate.ppdFileName);
+ if(!pi->ppd) {
+ HeapFree(PSDRV_Heap, 0, pi->FriendlyName);
+ HeapFree(PSDRV_Heap, 0, pi->Devmode);
+ HeapFree(PSDRV_Heap, 0, pi);
+ *last = NULL;
+ return NULL;
+ }
+
pi->next = NULL;
pi->Fonts = NULL;
diff --git a/graphics/psdrv/objects.c b/graphics/psdrv/objects.c
index b8d8d47..187161e 100644
--- a/graphics/psdrv/objects.c
+++ b/graphics/psdrv/objects.c
@@ -25,27 +25,6 @@
/***********************************************************************
- * PSDRV_BRUSH_SelectObject
- */
-static HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
- BRUSHOBJ * brush )
-{
- FIXME(psdrv, "stub\n");
- return 0;
-}
-
-
-/***********************************************************************
- * PSDRV_PEN_SelectObject
- */
-static HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
-{
- FIXME(psdrv, "stub\n");
- return 0;
-}
-
-
-/***********************************************************************
* PSDRV_SelectObject
*/
HGDIOBJ32 PSDRV_SelectObject( DC *dc, HGDIOBJ32 handle )
diff --git a/graphics/psdrv/pen.c b/graphics/psdrv/pen.c
new file mode 100644
index 0000000..958ffda
--- /dev/null
+++ b/graphics/psdrv/pen.c
@@ -0,0 +1,90 @@
+/*
+ * PostScript pen handling
+ *
+ * Copyright 1998 Huw D M Davies
+ *
+ */
+
+#include "windows.h"
+#include "pen.h"
+#include "psdrv.h"
+#include "debug.h"
+
+static char PEN_dash[] = "50 30"; /* ----- ----- ----- */
+static char PEN_dot[] = "20"; /* -- -- -- -- -- -- */
+static char PEN_dashdot[] = "40 30 20 30"; /* ---- -- ---- -- */
+static char PEN_dashdotdot[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */
+static char PEN_alternate[] = "1";
+
+/***********************************************************************
+ * PSDRV_PEN_SelectObject
+ */
+extern HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
+{
+ HPEN32 prevpen = dc->w.hPen;
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+
+ TRACE(psdrv, "hpen = %08x colour = %08lx\n", hpen, pen->logpen.lopnColor);
+ dc->w.hPen = hpen;
+
+ physDev->pen.width = XLSTODS(dc, pen->logpen.lopnWidth.x);
+ if(physDev->pen.width < 0)
+ physDev->pen.width = -physDev->pen.width;
+
+ PSDRV_CreateColor(physDev, &physDev->pen.color, pen->logpen.lopnColor);
+
+ if(physDev->pen.width > 1) { /* dashes only for 0 or 1 pixel pens */
+ physDev->pen.dash = NULL;
+ } else {
+ switch(pen->logpen.lopnStyle & PS_STYLE_MASK) {
+ case PS_DASH:
+ physDev->pen.dash = PEN_dash;
+ break;
+
+ case PS_DOT:
+ physDev->pen.dash = PEN_dot;
+ break;
+
+ case PS_DASHDOT:
+ physDev->pen.dash = PEN_dashdot;
+ break;
+
+ case PS_DASHDOTDOT:
+ physDev->pen.dash = PEN_dashdotdot;
+ break;
+
+ case PS_ALTERNATE:
+ physDev->pen.dash = PEN_alternate;
+ break;
+
+ default:
+ physDev->pen.dash = NULL;
+ break;
+ }
+ }
+
+ physDev->pen.set = FALSE;
+ return prevpen;
+}
+
+
+/**********************************************************************
+ *
+ * PSDRV_SetPen
+ *
+ */
+BOOL32 PSDRV_SetPen(DC *dc)
+{
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+
+ PSDRV_WriteSetColor(dc, &physDev->pen.color);
+
+ if(!physDev->pen.set) {
+ PSDRV_WriteSetPen(dc);
+ physDev->pen.set = TRUE;
+ }
+
+ return TRUE;
+}
+
+
diff --git a/graphics/psdrv/ppd.c b/graphics/psdrv/ppd.c
index 8364d72..8f8d5c8 100644
--- a/graphics/psdrv/ppd.c
+++ b/graphics/psdrv/ppd.c
@@ -5,14 +5,14 @@
* Copyright 1998 Huw D M Davies
*/
-#include <windows.h>
-#include <winnt.h> /* HEAP_ZERO_MEMORY */
-#include <heap.h>
-#include <debug.h>
-#include <psdrv.h>
#include <string.h>
#include <ctype.h>
-#include <print.h>
+#include "windows.h"
+#include "winnt.h" /* HEAP_ZERO_MEMORY */
+#include "heap.h"
+#include "debug.h"
+#include "psdrv.h"
+#include "print.h"
typedef struct {
char *key;
@@ -400,8 +400,10 @@
TRACE(psdrv, "%s\n", fname);
- if((fp = fopen(fname, "r")) == NULL)
+ if((fp = fopen(fname, "r")) == NULL) {
+ WARN(psdrv, "Couldn't open ppd file '%s'\n", fname);
return NULL;
+ }
ppd = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*ppd));
if(!ppd) {
@@ -551,7 +553,7 @@
if(!strcmp(tuple.value, "Plus90"))
ppd->LandscapeOrientation = 90;
else if(!strcmp(tuple.value, "Minus90"))
- ppd->LandscapeOrientation = 270;
+ ppd->LandscapeOrientation = -90;
/* anything else, namely 'any', leaves value at 0 */
diff --git a/graphics/psdrv/ps.c b/graphics/psdrv/ps.c
index 0893ee6..d301c36 100644
--- a/graphics/psdrv/ps.c
+++ b/graphics/psdrv/ps.c
@@ -5,92 +5,197 @@
*
*/
-#include <windows.h>
-#include <psdrv.h>
-#include <print.h>
-#include <debug.h>
#include <ctype.h>
+#include <string.h>
+#include "windows.h"
+#include "psdrv.h"
+#include "print.h"
+#include "debug.h"
-char psheader[] = /* title llx lly urx ury */
-"%%!PS-Adobe-3.0 (not quite)\n"
+static char psheader[] = /* title llx lly urx ury orientation */
+"%%!PS-Adobe-3.0\n"
"%%%%Creator: Wine PostScript Driver\n"
"%%%%Title: %s\n"
"%%%%BoundingBox: %d %d %d %d\n"
"%%%%Pages: (atend)\n"
-"%%%%EndComments\n"
-"%%%%BeginProlog\n"
+"%%%%Orientation: %s\n"
+"%%%%EndComments\n";
+
+static char psbeginprolog[] =
+"%%BeginProlog\n";
+
+static char psendprolog[] =
+"%%EndProlog\n";
+
+static char psvectorstart[] =
+"/ANSIEncoding [\n";
+
+static char psvectorend[] =
+"] def\n";
+
+static char psprolog[] = /* output ANSIEncoding vector first */
"/reencodefont {\n"
"findfont\n"
"dup length dict begin\n"
"{1 index /FID ne {def} {pop pop} ifelse} forall\n"
-"/Encoding ISOLatin1Encoding def\n"
+"/Encoding ANSIEncoding def\n"
"currentdict\n"
"end\n"
"definefont pop\n"
"} bind def\n"
-"%%%%EndProlog\n";
+"/tmpmtrx matrix def\n";
-char psbeginsetup[] =
+static char psbeginsetup[] =
"%%BeginSetup\n";
-char psendsetup[] =
+static char psendsetup[] =
"%%EndSetup\n";
-char psbeginfeature[] = /* feature, value */
+static char psbeginfeature[] = /* feature, value */
"mark {\n"
"%%%%BeginFeature: %s %s\n";
-char psendfeature[] =
+static char psendfeature[] =
"\n%%EndFeature\n"
"} stopped cleartomark\n";
-char psnewpage[] = /* name, number */
+static char psnewpage[] = /* name, number, xres, yres, xtrans, ytrans, rot */
"%%%%Page: %s %d\n"
"%%%%BeginPageSetup\n"
"/pgsave save def\n"
-"72 600 div dup scale\n"
-"0 7014 translate\n"
+"72 %d div 72 %d div scale\n"
+"%d %d translate\n"
"1 -1 scale\n"
+"%d rotate\n"
"%%%%EndPageSetup\n";
-char psendpage[] =
+static char psendpage[] =
"pgsave restore\n"
"showpage\n";
-char psfooter[] = /* pages */
+static char psfooter[] = /* pages */
"%%%%Trailer\n"
"%%%%Pages: %d\n"
"%%%%EOF\n";
-char psmoveto[] = /* x, y */
+static char psmoveto[] = /* x, y */
"%d %d moveto\n";
-char pslineto[] = /* x, y */
+static char pslineto[] = /* x, y */
"%d %d lineto\n";
-char psrlineto[] = /* dx, dy */
-"%d %d rlineto\n";
-
-char psstroke[] =
+static char psstroke[] =
"stroke\n";
-char psrectangle[] = /* x, y, width, height, -width */
+static char psrectangle[] = /* x, y, width, height, -width */
"%d %d moveto\n"
"%d 0 rlineto\n"
"0 %d rlineto\n"
"%d 0 rlineto\n"
"closepath\n";
-char psshow[] = /* string */
+static char psshow[] = /* string */
"(%s) show\n";
-char pssetfont[] = /* fontname, xscale, yscale, ascent, escapement */
+static char pssetfont[] = /* fontname, xscale, yscale, ascent, escapement */
"/%s findfont\n"
"[%d 0 0 %d 0 0]\n"
"%d 10 div matrix rotate\n"
"matrix concatmatrix\n"
"makefont setfont\n";
+static char pssetlinewidth[] = /* width */
+"%d setlinewidth\n";
+
+static char pssetdash[] = /* dash, offset */
+"[%s] %d setdash\n";
+
+static char pssetgray[] = /* gray */
+"%.2f setgray\n";
+
+static char pssetrgbcolor[] = /* r, g, b */
+"%.2f %.2f %.2f setrgbcolor\n";
+
+static char psellipse[] = /* x, y, a, b */
+"tmpmtrx currentmatrix pop\n"
+"%d %d translate\n"
+"%d %d scale\n"
+"0 0 1 0 360 arc\n"
+"tmpmtrx setmatrix\n";
+
+static char psgsave[] =
+"gsave\n";
+
+static char psgrestore[] =
+"grestore\n";
+
+static char psfill[] =
+"fill\n";
+
+char *PSDRV_ANSIVector[256] = {
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+"space", "exclam", "quotedbl", "numbersign",
+"dollar", "percent", "ampersand", "quotesingle",
+"parenleft", "parenright", "asterisk", "plus",
+"comma", "hyphen", "period", "slash",
+"zero", "one", "two", "three",
+"four", "five", "six", "seven",
+"eight", "nine", "colon", "semicolon",
+"less", "equal", "greater", "question",
+"at", "A", "B", "C",
+"D", "E", "F", "G",
+"H", "I", "J", "K",
+"L", "M", "N", "O",
+"P", "Q", "R", "S",
+"T", "U", "V", "W",
+"X", "Y", "Z", "bracketleft",
+"backslash", "bracketright", "asciicircum", "underscore",
+"grave", "a", "b", "c",
+"d", "e", "f", "g",
+"h", "i", "j", "k",
+"l", "m", "n", "o",
+"p", "q", "r", "s",
+"t", "u", "v", "w",
+"x", "y", "z", "braceleft",
+"bar", "braceright", "asciitilde", NULL,
+NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL,
+NULL, "quoteleft", "quoteright", NULL,
+NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL,
+NULL, "exclamdown", "cent", "sterling",
+"currency", "yen", "brokenbar", "section",
+"dieresis", "copyright", "ordfeminine", "guillemotleft",
+"logicalnot", "hyphen", "registered", "macron",
+"degree", "plusminus", "twosuperior", "threesuperior",
+"acute", "mu", "paragraph", "periodcentered",
+"cedilla", "onesuperior", "ordmasculine", "guillemotright",
+"onequarter", "onehalf", "threequarters","questiondown",
+"Agrave", "Aacute", "Acircumflex", "Atilde",
+"Adieresis", "Aring", "AE", "Ccedilla",
+"Egrave", "Eacute", "Ecircumflex", "Edieresis",
+"Igrave", "Iacute", "Icircumflex", "Idieresis",
+"Eth", "Ntilde", "Ograve", "Oacute",
+"Ocircumflex", "Otilde", "Odieresis", "multiply",
+"Oslash", "Ugrave", "Uacute", "Ucircumflex",
+"Udieresis", "Yacute", "Thorn", "germandbls",
+"agrave", "aacute", "acircumflex", "atilde",
+"adieresis", "aring", "ae", "ccedilla",
+"egrave", "eacute", "ecircumflex", "edieresis",
+"igrave", "iacute", "icircumflex", "idieresis",
+"eth", "ntilde", "ograve", "oacute",
+"ocircumflex", "otilde", "odieresis", "divide",
+"oslash", "ugrave", "uacute", "ucircumflex",
+"udieresis", "yacute", "thorn", "ydieresis"
+};
+
+
char psreencodefont[] = /* newfontname basefontname*/
"/%s /%s reencodefont\n";
@@ -117,7 +222,7 @@
strlen(feature) + strlen(value));
- wsprintf32A(buf, psbeginfeature, feature, value);
+ sprintf(buf, psbeginfeature, feature, value);
WriteSpool( hJob, buf, strlen(buf) );
WriteSpool( hJob, invocation, strlen(invocation) );
@@ -133,9 +238,10 @@
INT32 PSDRV_WriteHeader( DC *dc, char *title, int len )
{
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
- char *buf, *titlebuf;
+ char *buf, *titlebuf, *orient, vectbuf[256];
INPUTSLOT *slot;
PAGESIZE *page;
+ int urx, ury, i, j;
titlebuf = (char *)HeapAlloc( PSDRV_Heap, 0, len+1 );
if(!titlebuf) {
@@ -145,16 +251,28 @@
memcpy(titlebuf, title, len);
titlebuf[len] = '\0';
- buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) + len + 20);
+ buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) + len + 30);
if(!buf) {
WARN(psdrv, "HeapAlloc failed\n");
HeapFree( PSDRV_Heap, 0, titlebuf );
return 0;
}
- wsprintf32A(buf, psheader, title, 0, 0,
- (int) (dc->w.devCaps->horzSize * 72.0 / 25.4),
- (int) (dc->w.devCaps->vertSize * 72.0 / 25.4) );
+ if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) {
+ /* BBox co-ords are in default user co-ord system so urx < ury even in
+ landscape mode */
+ urx = (int) (dc->w.devCaps->vertSize * 72.0 / 25.4);
+ ury = (int) (dc->w.devCaps->horzSize * 72.0 / 25.4);
+ orient = "Landscape";
+ } else {
+ urx = (int) (dc->w.devCaps->horzSize * 72.0 / 25.4);
+ ury = (int) (dc->w.devCaps->vertSize * 72.0 / 25.4);
+ orient = "Portrait";
+ }
+
+ /* FIXME should do something better with BBox */
+
+ sprintf(buf, psheader, title, 0, 0, urx, ury, orient);
if( WriteSpool( physDev->job.hJob, buf, strlen(buf) ) !=
strlen(buf) ) {
@@ -166,6 +284,28 @@
HeapFree( PSDRV_Heap, 0, titlebuf );
HeapFree( PSDRV_Heap, 0, buf );
+ WriteSpool( physDev->job.hJob, psbeginprolog, strlen(psbeginprolog) );
+ WriteSpool( physDev->job.hJob, psvectorstart, strlen(psvectorstart) );
+
+ for(i = 0; i < 256; i += 8) {
+ vectbuf[0] = '\0';
+ for(j = 0; j < 8; j++) {
+ strcat(vectbuf, "/");
+ if(PSDRV_ANSIVector[i+j]) {
+ strcat(vectbuf, PSDRV_ANSIVector[i+j]);
+ strcat(vectbuf, " ");
+ } else {
+ strcat(vectbuf, ".notdef ");
+ }
+ }
+ strcat(vectbuf, "\n");
+ WriteSpool( physDev->job.hJob, vectbuf, strlen(vectbuf) );
+ }
+
+ WriteSpool( physDev->job.hJob, psvectorend, strlen(psvectorend) );
+ WriteSpool( physDev->job.hJob, psprolog, strlen(psprolog) );
+ WriteSpool( physDev->job.hJob, psendprolog, strlen(psendprolog) );
+
WriteSpool( physDev->job.hJob, psbeginsetup, strlen(psbeginsetup) );
@@ -189,7 +329,6 @@
}
}
-
WriteSpool( physDev->job.hJob, psendsetup, strlen(psendsetup) );
@@ -208,7 +347,7 @@
return 0;
}
- wsprintf32A(buf, psfooter, physDev->job.PageNo);
+ sprintf(buf, psfooter, physDev->job.PageNo);
if( WriteSpool( physDev->job.hJob, buf, strlen(buf) ) !=
strlen(buf) ) {
@@ -242,16 +381,35 @@
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf;
char name[100];
-
- wsprintf32A(name, "%d", physDev->job.PageNo);
+ signed int xtrans, ytrans, rotation;
- buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psnewpage) + 100 );
+ sprintf(name, "%d", physDev->job.PageNo);
+
+ buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psnewpage) + 200 );
if(!buf) {
WARN(psdrv, "HeapAlloc failed\n");
return 0;
}
- wsprintf32A(buf, psnewpage, name, physDev->job.PageNo);
+ if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) {
+ if(physDev->pi->ppd->LandscapeOrientation == -90) {
+ xtrans = dc->w.devCaps->vertRes;
+ ytrans = dc->w.devCaps->horzRes;
+ rotation = 90;
+ } else {
+ xtrans = ytrans = 0;
+ rotation = -90;
+ }
+ } else {
+ xtrans = 0;
+ ytrans = dc->w.devCaps->vertRes;
+ rotation = 0;
+ }
+
+ sprintf(buf, psnewpage, name, physDev->job.PageNo,
+ dc->w.devCaps->logPixelsX, dc->w.devCaps->logPixelsY,
+ xtrans, ytrans, rotation);
+
if( WriteSpool( physDev->job.hJob, buf, strlen(buf) ) !=
strlen(buf) ) {
WARN(psdrv, "WriteSpool error\n");
@@ -267,7 +425,7 @@
{
char buf[100];
- wsprintf32A(buf, psmoveto, x, y);
+ sprintf(buf, psmoveto, x, y);
return PSDRV_WriteSpool(dc, buf, strlen(buf));
}
@@ -275,7 +433,7 @@
{
char buf[100];
- wsprintf32A(buf, pslineto, x, y);
+ sprintf(buf, pslineto, x, y);
return PSDRV_WriteSpool(dc, buf, strlen(buf));
}
@@ -292,13 +450,21 @@
{
char buf[100];
- wsprintf32A(buf, psrectangle, x, y, width, height, -width);
+ sprintf(buf, psrectangle, x, y, width, height, -width);
return PSDRV_WriteSpool(dc, buf, strlen(buf));
}
-static char encodingext[] = "-ISOLatin1";
+BOOL32 PSDRV_WriteEllispe(DC *dc, INT32 x, INT32 y, INT32 a, INT32 b)
+{
+ char buf[256];
-BOOL32 PSDRV_WriteSetFont(DC *dc)
+ sprintf(buf, psellipse, x, y, a, b);
+ return PSDRV_WriteSpool(dc, buf, strlen(buf));
+}
+
+static char encodingext[] = "-ANSI";
+
+BOOL32 PSDRV_WriteSetFont(DC *dc, BOOL32 UseANSI)
{
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf, *newbuf;
@@ -320,9 +486,12 @@
return FALSE;
}
- wsprintf32A(newbuf, "%s%s", physDev->font.afm->FontName, encodingext);
+ if(UseANSI)
+ sprintf(newbuf, "%s%s", physDev->font.afm->FontName, encodingext);
+ else
+ strcpy(newbuf, physDev->font.afm->FontName);
- wsprintf32A(buf, pssetfont, newbuf,
+ sprintf(buf, pssetfont, newbuf,
physDev->font.size, -physDev->font.size,
-physDev->font.escapement);
@@ -331,6 +500,49 @@
return TRUE;
}
+BOOL32 PSDRV_WriteSetColor(DC *dc, PSCOLOR *color)
+{
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+ char buf[256];
+
+ if(PSDRV_CmpColor(&physDev->inkColor, color))
+ return TRUE;
+
+ PSDRV_CopyColor(&physDev->inkColor, color);
+ switch(color->type) {
+ case PSCOLOR_RGB:
+ sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
+ color->value.rgb.b);
+ return PSDRV_WriteSpool(dc, buf, strlen(buf));
+
+ case PSCOLOR_GRAY:
+ sprintf(buf, pssetgray, color->value.gray.i);
+ return PSDRV_WriteSpool(dc, buf, strlen(buf));
+
+ default:
+ ERR(psdrv, "Unkonwn colour type %d\n", color->type);
+ break;
+ }
+
+ return FALSE;
+}
+
+BOOL32 PSDRV_WriteSetPen(DC *dc)
+{
+ PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
+ char buf[256];
+
+ sprintf(buf, pssetlinewidth, physDev->pen.width);
+ PSDRV_WriteSpool(dc, buf, strlen(buf));
+
+ if(physDev->pen.dash) {
+ sprintf(buf, pssetdash, physDev->pen.dash, 0);
+ PSDRV_WriteSpool(dc, buf, strlen(buf));
+ }
+
+ return TRUE;
+}
+
BOOL32 PSDRV_WriteReencodeFont(DC *dc)
{
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
@@ -354,8 +566,8 @@
return FALSE;
}
- wsprintf32A(newbuf, "%s%s", physDev->font.afm->FontName, encodingext);
- wsprintf32A(buf, psreencodefont, newbuf, physDev->font.afm->FontName);
+ sprintf(newbuf, "%s%s", physDev->font.afm->FontName, encodingext);
+ sprintf(buf, psreencodefont, newbuf, physDev->font.afm->FontName);
PSDRV_WriteSpool(dc, buf, strlen(buf));
@@ -392,7 +604,7 @@
buf1 = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psshow) + done);
- wsprintf32A(buf1, psshow, buf);
+ sprintf(buf1, psshow, buf);
PSDRV_WriteSpool(dc, buf1, strlen(buf1));
HeapFree(PSDRV_Heap, 0, buf);
@@ -401,6 +613,21 @@
return TRUE;
}
+BOOL32 PSDRV_WriteFill(DC *dc)
+{
+ return PSDRV_WriteSpool(dc, psfill, sizeof(psfill)-1);
+}
+
+BOOL32 PSDRV_Writegsave(DC *dc)
+{
+ return PSDRV_WriteSpool(dc, psgsave, sizeof(psgsave)-1);
+}
+
+BOOL32 PSDRV_Writegrestore(DC *dc)
+{
+ return PSDRV_WriteSpool(dc, psgrestore, sizeof(psgrestore)-1);
+}
+
diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c
index 053a2f3..d389b98 100644
--- a/graphics/win16drv/init.c
+++ b/graphics/win16drv/init.c
@@ -660,9 +660,8 @@
nRet = cch;
if (pPrintJob->hDC == 0) {
ERR(print, "hDC == 0 !\n");
- return SP_ERROR;
}
- if (!(QueryAbort(pPrintJob->hDC, (nRet == SP_OUTOFDISK) ? nRet : 0 )))
+ else if (!(QueryAbort(pPrintJob->hDC, (nRet == SP_OUTOFDISK) ? nRet : 0 )))
{
CloseJob(hJob); /* printing aborted */
nRet = SP_APPABORT;
diff --git a/graphics/wing.c b/graphics/wing.c
index a68cacf..0216670 100644
--- a/graphics/wing.c
+++ b/graphics/wing.c
@@ -1,5 +1,5 @@
/*
- * WingG support
+ * WinG support
*
* Started by Robert Pouliot <krynos@clic.net>
*/
@@ -55,7 +55,7 @@
return;
}
}
- FIXME(wing,"WinG: no joy.\n");
+ FIXME(wing,"WinG: incorrect depth or unsupported card.\n");
__WinGOK = False;
}
}
diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c
index 6cc8994..87ddb15 100644
--- a/graphics/x11drv/bitblt.c
+++ b/graphics/x11drv/bitblt.c
@@ -837,8 +837,9 @@
rectDst.bottom - rectDst.top, dcDst->w.bitsPerPixel );
BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc,
widthDst, heightDst, &rectSrc, &rectDst,
- dcDst->w.textPixel, dcDst->w.bitsPerPixel != 1 ?
- dcDst->w.backgroundPixel : dcSrc->w.backgroundPixel,
+ dcDst->u.x.textPixel, dcDst->w.bitsPerPixel != 1 ?
+ dcDst->u.x.backgroundPixel :
+ dcSrc->u.x.backgroundPixel,
dcDst->w.stretchBltMode );
XPutImage( display, pixmap, gc, imageDst, 0, 0, 0, 0,
rectDst.right - rectDst.left, rectDst.bottom - rectDst.top );
@@ -900,14 +901,14 @@
if (COLOR_PixelToPalette)
{
XSetBackground( display, gc,
- COLOR_PixelToPalette[dcDst->w.textPixel] );
+ COLOR_PixelToPalette[dcDst->u.x.textPixel] );
XSetForeground( display, gc,
- COLOR_PixelToPalette[dcDst->w.backgroundPixel]);
+ COLOR_PixelToPalette[dcDst->u.x.backgroundPixel]);
}
else
{
- XSetBackground( display, gc, dcDst->w.textPixel );
- XSetForeground( display, gc, dcDst->w.backgroundPixel );
+ XSetBackground( display, gc, dcDst->u.x.textPixel );
+ XSetForeground( display, gc, dcDst->u.x.backgroundPixel );
}
XCopyPlane( display, dcSrc->u.x.drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top,
@@ -923,7 +924,7 @@
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
XPutPixel(imageDst, x, y, (XGetPixel(imageSrc,x,y) ==
- dcSrc->w.backgroundPixel) );
+ dcSrc->u.x.backgroundPixel) );
XPutImage( display, pixmap, gc, imageDst,
0, 0, 0, 0, width, height );
XDestroyImage( imageSrc );
@@ -1239,8 +1240,8 @@
}
if (dcSrc->w.bitsPerPixel == 1)
{
- XSetBackground( display, dcDst->u.x.gc, dcDst->w.textPixel );
- XSetForeground( display, dcDst->u.x.gc, dcDst->w.backgroundPixel );
+ XSetBackground( display, dcDst->u.x.gc, dcDst->u.x.textPixel );
+ XSetForeground( display, dcDst->u.x.gc, dcDst->u.x.backgroundPixel );
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetGraphicsExposures( display, dcDst->u.x.gc, True );
XCopyPlane( display, dcSrc->u.x.drawable,
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index 3e5f189..e60fed8 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -1099,3 +1099,37 @@
free(xpoints);
return TRUE;
}
+
+/**********************************************************************
+ * X11DRV_SetBkColor
+ */
+COLORREF
+X11DRV_SetBkColor( DC *dc, COLORREF color )
+{
+ X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
+ COLORREF oldColor;
+
+ oldColor = dc->w.backgroundColor;
+ dc->w.backgroundColor = color;
+
+ physDev->backgroundPixel = COLOR_ToPhysical( dc, color );
+
+ return oldColor;
+}
+
+/**********************************************************************
+ * X11DRV_SetTextColor
+ */
+COLORREF
+X11DRV_SetTextColor( DC *dc, COLORREF color )
+{
+ X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
+ COLORREF oldColor;
+
+ oldColor = dc->w.textColor;
+ dc->w.textColor = color;
+
+ physDev->textPixel = COLOR_ToPhysical( dc, color );
+
+ return oldColor;
+}
diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c
index cf91c6d..89c2936 100644
--- a/graphics/x11drv/init.c
+++ b/graphics/x11drv/init.c
@@ -61,7 +61,7 @@
NULL, /* pSelectClipRgn */
X11DRV_SelectObject, /* pSelectObject */
NULL, /* pSelectPalette */
- NULL, /* pSetBkColor */
+ X11DRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */
X11DRV_SetDeviceClipping, /* pSetDeviceClipping */
NULL, /* pSetDIBitsToDevice */
@@ -74,7 +74,7 @@
NULL, /* pSetStretchBltMode */
NULL, /* pSetTextAlign */
NULL, /* pSetTextCharacterExtra */
- NULL, /* pSetTextColor */
+ X11DRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetTextJustification */
NULL, /* pSetViewportExt (optional) */
NULL, /* pSetViewportOrg (optional) */
diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c
index 09c78b0..0b93e10 100644
--- a/graphics/x11drv/text.c
+++ b/graphics/x11drv/text.c
@@ -103,7 +103,7 @@
if (flags & ETO_OPAQUE)
{
- TSXSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
+ TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel );
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + rect.left, dc->w.DCOrgY + rect.top,
rect.right-rect.left, rect.bottom-rect.top );
@@ -196,7 +196,7 @@
(y - ascent < rect.top) ||
(y + descent >= rect.bottom))
{
- TSXSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
+ TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel );
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x,
dc->w.DCOrgY + y - ascent,
@@ -208,7 +208,7 @@
/* Draw the text (count > 0 verified) */
- TSXSetForeground( display, dc->u.x.gc, dc->w.textPixel );
+ TSXSetForeground( display, dc->u.x.gc, dc->u.x.textPixel );
if (!dc->w.charExtra && !dc->w.breakExtra && !lpDx)
{
if(!rotated)