diff options
-rw-r--r-- | vcl/aqua/inc/salgdi.h | 16 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 27 | ||||
-rwxr-xr-x | vcl/aqua/source/gdi/salgdiutils.cxx | 43 | ||||
-rwxr-xr-x | vcl/aqua/source/gdi/salpixmaputils.cxx | 114 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salvd.cxx | 16 |
5 files changed, 145 insertions, 71 deletions
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 0ceb92ce254f..cc72e6d6c312 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -2,9 +2,9 @@ * * $RCSfile: salgdi.h,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:47 $ + * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,6 +93,8 @@ struct SalGraphicsData // Graph port pixels, state and flags BOOL mbGWorldPixelsLocked; // GWorld pixels locked? + BOOL mbGWorldPixelsCopy; // GWorld pixels was a copy of the original? + BOOL mbGWorldPixelsNew; // GWorld pixels is brand new? GWorldFlags mnGWorldFlags; // GWorld pixels status flags PixMapHandle mhGWorldPixMap; // GWorld pixels @@ -111,10 +113,16 @@ struct SalGraphicsData // Pen attributes and status BOOL mbPenTransparent; // Is pen transparent? - short mnPenMode; // Pen Mode - short mnPenModePort; // Port pen Mode + SInt32 mnPenMode; // Pen Mode RGBColor maPenColor; // Pen Color + // Port's pen attributes + + SInt32 mnPortPenMode; // Port's pen mode + MacOSPoint maPortPenSize; // Port's pen size; + MacOSPoint maPortPenLocation; // Port's pen location + PixPatHandle mhPortPenPattern; // Port's pen pattern + // Brush attributes and status BOOL mbBrushTransparent; // Is brush transparent? diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 52e9528e041e..f3529a7ee632 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -2,8 +2,8 @@ * * $RCSfile: salgdi.cxx,v $ * - * $Revision: 1.51 $ - * last change: $Author: pluby $ $Date: 2001-02-21 01:18:26 $ + * $Revision: 1.52 $ + * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,6 +139,17 @@ SalGraphics::~SalGraphics() // Release memory taken up by clip region, off-screen // graph world, and colour graph port + if ( ( ( maGraphicsData.mbGWorldPixelsCopy == TRUE ) + || ( maGraphicsData.mbGWorldPixelsNew == TRUE ) + ) + && ( maGraphicsData.mhGWorldPixMap != NULL ) + ) + { + DisposePixMap( maGraphicsData.mhGWorldPixMap ); + + maGraphicsData.mhGWorldPixMap = NULL; + } // if + if ( maGraphicsData.mhClipRgn != NULL ) { DisposeRgn( maGraphicsData.mhClipRgn ); @@ -162,7 +173,7 @@ SalGraphics::~SalGraphics() // Initialize the rest of the fields to zero - memset ( &maGraphicsData, 0, sizeof(SalGraphicsData) ); + memset( &maGraphicsData, 0, sizeof(SalGraphicsData) ); } // SalGraphics Class Destructor // ======================================================================= @@ -1201,8 +1212,6 @@ void SalGraphics::Invert( ULONG nPoints, } // if } // if - maGraphicsData.mnPenModePort = patCopy; - EndGraphics( &maGraphicsData ); } // if } // if @@ -1259,8 +1268,11 @@ long SalGraphics::GetCharWidth( sal_Unicode nChar1, // both of the two Unicode characters and all characters between them. // The width of nChar1 is put in element 0 of pWidthAry and the width // of nChar2 is put in element nChar2 - nChar1 of pWidthAry + for ( i = 0 ; i < nCharCount ; i++ ) + { pWidthAry[i] = 10; + } // for fprintf( stderr, "<<WARNING>> SalGraphics::GetCharWidth not yet implemented!\n" @@ -1275,7 +1287,7 @@ void SalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) { // Stub Code - pMetric->mnAscent = 10; + pMetric->mnAscent = 10; pMetric->mnDescent = 10; fprintf( stderr, @@ -1302,8 +1314,9 @@ void SalGraphics::GetDevFontList( ImplDevFontList* pList ) { ImplFontData *pFontData = new ImplFontData; - pFontData->mnWidth = 10; + pFontData->mnWidth = 10; pFontData->mnHeight = 10; + pList->Add( pFontData ); fprintf( stderr, diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index 503a6426f504..4a000a8641f3 100755 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -2,8 +2,8 @@ * * $RCSfile: salgdiutils.cxx,v $ * - * $Revision: 1.2 $ - * last change: $Author: pluby $ $Date: 2001-02-20 05:52:44 $ + * $Revision: 1.3 $ + * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -321,9 +321,21 @@ BOOL BeginGraphics ( SalGraphicsDataPtr rSalGraphicsData ) if ( rSalGraphicsData->mpCGrafPort != NULL ) { - // Get the port pen attributes + // Get the port's pen attributes - rSalGraphicsData->mnPenModePort + GetPortPenPixPat( rSalGraphicsData->mpCGrafPort, + rSalGraphicsData->mhPortPenPattern + ); + + GetPortPenSize( rSalGraphicsData->mpCGrafPort, + &(rSalGraphicsData->maPortPenSize) + ); + + GetPortPenLocation( rSalGraphicsData->mpCGrafPort, + &(rSalGraphicsData->maPortPenLocation) + ); + + rSalGraphicsData->mnPortPenMode = GetPortPenMode( rSalGraphicsData->mpCGrafPort ); // Set the port pen mode to its new value @@ -443,10 +455,18 @@ BOOL EndGraphics ( SalGraphicsDataPtr rSalGraphicsData ) rSalGraphicsData->mbGWorldPixelsLocked = FALSE; } // if - // Reset the port to its original attributes + // Reset the port's pen to its original attributes + + SetPortPenPixPat( rSalGraphicsData->mpCGrafPort, + rSalGraphicsData->mhPortPenPattern + ); + + SetPortPenSize( rSalGraphicsData->mpCGrafPort, + rSalGraphicsData->maPortPenSize + ); SetPortPenMode( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mnPenModePort + rSalGraphicsData->mnPortPenMode ); // Unlock focus on the current NSView @@ -505,6 +525,8 @@ void InitFont ( SalGraphicsDataPtr rSalGraphicsData ) void InitGWorld ( SalGraphicsDataPtr rSalGraphicsData ) { rSalGraphicsData->mbGWorldPixelsLocked = FALSE; + rSalGraphicsData->mbGWorldPixelsCopy = FALSE; + rSalGraphicsData->mbGWorldPixelsNew = FALSE; rSalGraphicsData->mnGWorldFlags = noErr; rSalGraphicsData->mhGWorldPixMap = NULL; } // InitGWorld @@ -513,10 +535,17 @@ void InitGWorld ( SalGraphicsDataPtr rSalGraphicsData ) void InitPen ( SalGraphicsDataPtr rSalGraphicsData ) { + long nMacOSPointSize = sizeof(MacOSPoint); + rSalGraphicsData->maPenColor = GetBlackColor(); rSalGraphicsData->mnPenMode = patCopy; - rSalGraphicsData->mnPenModePort = patCopy; rSalGraphicsData->mbPenTransparent = FALSE; + + rSalGraphicsData->mnPortPenMode = patCopy; + rSalGraphicsData->mhPortPenPattern = NULL; + + memset( &(rSalGraphicsData->maPortPenSize), 0, nMacOSPointSize ); + memset( &(rSalGraphicsData->maPortPenLocation), 0, nMacOSPointSize ); } // InitPen // ----------------------------------------------------------------------- diff --git a/vcl/aqua/source/gdi/salpixmaputils.cxx b/vcl/aqua/source/gdi/salpixmaputils.cxx index 5807093c52ed..2f17ec765d16 100755 --- a/vcl/aqua/source/gdi/salpixmaputils.cxx +++ b/vcl/aqua/source/gdi/salpixmaputils.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salpixmaputils.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:49 $ + * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -488,53 +488,71 @@ PixMapHandle CopyPixMap ( PixMapHandle hPixMap ) { if ( LockPixels( hPixMap ) ) { - hPixMapCopy = NewPixMap(); + OSStatus nOSStatus = noErr; - if ( ( hPixMapCopy != NULL ) && ( *hPixMapCopy != NULL ) ) - { - const Rect aPixMapBoundsRect = (**hPixMap).bounds; - const long nPixMapBitDepth = (**hPixMap).pixelSize; - const long nPixMapWidth = GetPixMapWidth( &aPixMapBoundsRect ); - const long nPixMapHeight = GetPixMapHeight( &aPixMapBoundsRect ); - const long nPixMapRowOffset = GetPixMapOffset( nPixMapBitDepth, nPixMapWidth ); - const long nPixMapImageSize = GetPixMapImageSize( nPixMapHeight, nPixMapRowOffset ); - char *pPixMapDataCopy = NewPtrClear( nPixMapImageSize ); - - if ( pPixMapDataCopy != NULL ) - { - GWorldFlags nPixMapCopyFlags = noErr; - - nPixMapCopyFlags = GetPixelsState( hPixMapCopy ); - - if ( nPixMapCopyFlags == noErr ) - { - if ( LockPixels( hPixMapCopy ) ) - { - const char *pPixMapData = (**hPixMap).baseAddr; - - // Copy the data from the original port + CopyPixMap( hPixMap, hPixMapCopy ); - BlockMoveData( pPixMapData, pPixMapDataCopy, nPixMapImageSize ); + nOSStatus = QDErr(); - (**hPixMapCopy).rowBytes = (**hPixMap).rowBytes; // Offset to next line - (**hPixMapCopy).bounds = (**hPixMap).bounds; // Bounding bitmap rectangle - (**hPixMapCopy).pmVersion = (**hPixMap).pmVersion; // PixMap version number - (**hPixMapCopy).packType = (**hPixMap).packType; // Defines packing format - (**hPixMapCopy).packSize = (**hPixMap).packSize; // Length of pixel data - (**hPixMapCopy).hRes = (**hPixMap).hRes; // Horizontal resolution (ppi) - (**hPixMapCopy).vRes = (**hPixMap).vRes; // Vertical resolution (ppi) - (**hPixMapCopy).pixelType = (**hPixMap).pixelType; // Defines pixel type - (**hPixMapCopy).pixelSize = (**hPixMap).pixelSize; // Number of bits in a pixel - (**hPixMapCopy).cmpCount = (**hPixMap).cmpCount; // Number of components in a pixel - (**hPixMapCopy).cmpSize = (**hPixMap).cmpSize; // Number of bits per component - (**hPixMapCopy).pixelFormat = (**hPixMap).pixelFormat; // Four character code representation - (**hPixMapCopy).pmExt = (**hPixMap).pmExt; // Handle to PixMap extension + if ( ( nOSStatus == noErr ) + && ( hPixMapCopy != NULL ) + && ( *hPixMapCopy != NULL ) + ) + { + hPixMapCopy = NewPixMap(); - // Copy the color table from the original port + if ( ( hPixMapCopy != NULL ) && ( *hPixMapCopy != NULL ) ) + { + const Rect aPixMapBoundsRect = (**hPixMap).bounds; + const long nPixMapBitDepth = (**hPixMap).pixelSize; + const long nPixMapWidth = GetPixMapWidth( &aPixMapBoundsRect ); + const long nPixMapHeight = GetPixMapHeight( &aPixMapBoundsRect ); + const long nPixMapRowOffset = GetPixMapOffset( nPixMapBitDepth, nPixMapWidth ); + const long nPixMapImageSize = GetPixMapImageSize( nPixMapHeight, nPixMapRowOffset ); + char *pPixMapDataCopy = NewPtrClear( nPixMapImageSize ); + + if ( pPixMapDataCopy != NULL ) + { + GWorldFlags nPixMapCopyFlags = noErr; - (**hPixMapCopy).pmTable = CopyPixMapCTab( hPixMap ); + nPixMapCopyFlags = GetPixelsState( hPixMapCopy ); - SetPixelsState( hPixMapCopy, nPixMapCopyFlags ); + if ( nPixMapCopyFlags == noErr ) + { + if ( LockPixels( hPixMapCopy ) ) + { + const char *pPixMapData = (**hPixMap).baseAddr; + + // Copy the data from the original port + + BlockMoveData( pPixMapData, pPixMapDataCopy, nPixMapImageSize ); + + (**hPixMapCopy).rowBytes = (**hPixMap).rowBytes; // Offset to next line + (**hPixMapCopy).bounds = (**hPixMap).bounds; // Bounding bitmap rectangle + (**hPixMapCopy).pmVersion = (**hPixMap).pmVersion; // PixMap version number + (**hPixMapCopy).packType = (**hPixMap).packType; // Defines packing format + (**hPixMapCopy).packSize = (**hPixMap).packSize; // Length of pixel data + (**hPixMapCopy).hRes = (**hPixMap).hRes; // Horizontal resolution (ppi) + (**hPixMapCopy).vRes = (**hPixMap).vRes; // Vertical resolution (ppi) + (**hPixMapCopy).pixelType = (**hPixMap).pixelType; // Defines pixel type + (**hPixMapCopy).pixelSize = (**hPixMap).pixelSize; // Number of bits in a pixel + (**hPixMapCopy).cmpCount = (**hPixMap).cmpCount; // Number of components in a pixel + (**hPixMapCopy).cmpSize = (**hPixMap).cmpSize; // Number of bits per component + (**hPixMapCopy).pixelFormat = (**hPixMap).pixelFormat; // Four character code representation + (**hPixMapCopy).pmExt = (**hPixMap).pmExt; // Handle to PixMap extension + + // Copy the color table from the original port + + (**hPixMapCopy).pmTable = CopyPixMapCTab( hPixMap ); + + SetPixelsState( hPixMapCopy, nPixMapCopyFlags ); + } // if + else + { + DisposePtr( pPixMapDataCopy ); + + pPixMapDataCopy = NULL; + } // else } // if else { @@ -545,17 +563,11 @@ PixMapHandle CopyPixMap ( PixMapHandle hPixMap ) } // if else { - DisposePtr( pPixMapDataCopy ); + DisposePixMap( hPixMapCopy ); - pPixMapDataCopy = NULL; + hPixMapCopy = NULL; } // else } // if - else - { - DisposePixMap( hPixMapCopy ); - - hPixMapCopy = NULL; - } // else } // if SetPixelsState( hPixMap, nPixMapFlags ); diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index b651a745c5e4..a06fcdf57186 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salvd.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: pluby $ $Date: 2001-02-20 22:01:10 $ + * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,6 +116,7 @@ static BOOL InitVirtualDeviceGWorld ( SalVirDevDataPtr rSalVirDevData ) if ( nOSStatus != noErr ) { nFlags = noErr; + nOSStatus = NewGWorld( &pGWorld, nPixelDepth, &aBoundsRect, @@ -157,6 +158,8 @@ static BOOL InitVirtualDeviceGWorld ( SalVirDevDataPtr rSalVirDevData ) // Initialize virtual port's GWorld attributes rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsLocked = FALSE; + rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsCopy = FALSE; + rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsNew = FALSE; rSalVirDevData->mpGraphics->maGraphicsData.mnGWorldFlags = noErr; // Initialize the virtual port's brush attributes @@ -258,6 +261,15 @@ BOOL SalVirtualDevice::SetSize( long nDX, long nDY ) // by deleting exisiting clip regions, offscreen graphic worlds, // and its associated colour graph port + if ( ( ( maVirDevData.mpGraphics->maGraphicsData.mbGWorldPixelsCopy == TRUE ) + || ( maVirDevData.mpGraphics->maGraphicsData.mbGWorldPixelsNew == TRUE ) + ) + && ( maVirDevData.mpGraphics->maGraphicsData.mhGWorldPixMap != NULL ) + ) + { + DisposePixMap( maVirDevData.mpGraphics->maGraphicsData.mhGWorldPixMap ); + } // if + if ( maVirDevData.mpGraphics->maGraphicsData.mhClipRgn != NULL ) { DisposeRgn( maVirDevData.mpGraphics->maGraphicsData.mhClipRgn ); |