mbrady@mmm.UUCP (Mark W. Brady) (03/22/89)
I am having problems with a call to OpenCPort. In particular, it is
causing my mac to crash. The relevant code segment looks like:
{ Initialize for offscreen pixel map. }
devHandle := NewGDevice( LongInt(-1), LongInt(-1) );
IF devHandle = GDHandle(0) THEN SysBeep(5);
SetDeviceAttribute( DevHandle, 0, TRUE ); { sets gdDevType (ie 0) to color }
devHandle^^.gdType := 2; { direct color device }
WITH devHandle^^.gdPMap^^ DO BEGIN
rowBytes := 4*640;
SetRect( bounds, 0, 0, 640, 480 );
pmVersion := 0;
packType := 1;
packSize := 0;
hRes := 72; { This is just a guess!!! }
vRes := 72; { This is just a guess!!! }
pixelType := 16;
pixelSize := 32;
cmpCount := 3;
cmpSize := 8;
planeBytes := 0;
pmTable := CTabHandle(0);
pmReserved := 0
END;
{ WZ1 }
saveDevice := GetGDevice;
SetGDevice( devHandle );
offPort := CGrafPtr( NewPtr( SizeOf( CGrafPtr ) ) );
Debugger;
OpenCPort( offPort );
SetGDevice( saveDevice );
The crash occurs at the call to OpenCPort. As you may know, OpenCPort
creates a port for the current device. I am setting the current device
to one used as an off screen pix map. This may be a wierd device but it
is probably not my problem since when I delete the call to SetGDevice
( hence allowing the screen be the device ) I still get a crash? Does
anyone have some experience here which could shed some light on this
problem?
Another question regarding this code segment: what meaning do vRes and
hRes have in an off screen pix map?
Thanks for your advice.skip@claris.com (Brian Schipper) (03/23/89)
In article <1244@mmm.UUCP> mbrady@mmm.UUCP (Mark W. Brady) writes: >I am having problems with a call to OpenCPort. In particular, it is >causing my mac to crash. The relevant code segment looks like: > offPort := CGrafPtr( NewPtr( SizeOf( CGrafPtr ) ) ); ^^^^^^^^ Oops, I think you want SizeOf( CGrafPort ). Brian -- Internet: skip@claris.com Applelink: SCHIPPER1 UUCP: {ames,apple,decwrl,sun}!claris!skip Phone: 415-960-2618