summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorBabak Mahbod <bmahbod@openoffice.org>2001-01-31 00:23:34 +0000
committerBabak Mahbod <bmahbod@openoffice.org>2001-01-31 00:23:34 +0000
commit78515f014e3572af913ab09094c731ceb30d5693 (patch)
treef99bf90e1c0a0d16b9fc2791721c9fd58c748b05 /vcl
parent6d2addfe5699d80b6adb87c68601b6be2614e45b (diff)
Lock and unlock APIs modified. Begin and end graphics APIs modified.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx155
1 files changed, 53 insertions, 102 deletions
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index aebaac543f86..e3b1bdcc4604 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.46 $
- * last change: $Author: bmahbod $ $Date: 2001-01-25 05:25:58 $
+ * $Revision: 1.47 $
+ * last change: $Author: bmahbod $ $Date: 2001-01-31 01:23:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -729,26 +729,7 @@ static BOOL LockGraphics ( SalGraphics *rSalGraphics )
rSalGraphics->maGraphicsData.mnOSStatus = QDErr();
- if ( ( rSalGraphics->maGraphicsData.mnOSStatus == noErr )
- && ( rSalGraphics->maGraphicsData.mhGWorldPixMap != NULL )
- )
- {
- rSalGraphics->maGraphicsData.mnGWorldFlags
- = GetPixelsState( rSalGraphics->maGraphicsData.mhGWorldPixMap );
-
- if ( rSalGraphics->maGraphicsData.mnGWorldFlags == noErr )
- {
- Boolean bGWorldPixelsLocked = false;
-
- bGWorldPixelsLocked
- = LockPixels( rSalGraphics->maGraphicsData.mhGWorldPixMap );
-
- rSalGraphics->maGraphicsData.mbGWorldPixelsLocked
- = Boolean2BOOL( bGWorldPixelsLocked );
-
- bCGrafPortLocked = TRUE;
- } // if
- } // if
+ bCGrafPortLocked = TRUE;
} // if
} // if
@@ -761,26 +742,14 @@ static BOOL UnlockGraphics ( SalGraphics *rSalGraphics )
{
BOOL bCGrafPortUnlocked = FALSE;
- if ( ( rSalGraphics->maGraphicsData.mhGWorldPixMap != NULL )
- && ( rSalGraphics->maGraphicsData.mnGWorldFlags == noErr )
- && ( rSalGraphics->maGraphicsData.mbGWorldPixelsLocked )
+ if ( ( rSalGraphics->maGraphicsData.mpCGrafPort != NULL )
+ && ( rSalGraphics->maGraphicsData.mnOSStatus == noErr )
)
{
- SetPixelsState( rSalGraphics->maGraphicsData.mhGWorldPixMap,
- rSalGraphics->maGraphicsData.mnGWorldFlags
- );
-
- rSalGraphics->maGraphicsData.mnOSStatus = QDErr();
-
- if ( ( rSalGraphics->maGraphicsData.mpCGrafPort != NULL )
- && ( rSalGraphics->maGraphicsData.mnOSStatus == noErr )
- )
- {
- rSalGraphics->maGraphicsData.mnOSStatus
- = UnlockPortBits( rSalGraphics->maGraphicsData.mpCGrafPort );
+ rSalGraphics->maGraphicsData.mnOSStatus
+ = UnlockPortBits( rSalGraphics->maGraphicsData.mpCGrafPort );
- bCGrafPortUnlocked = TRUE;
- } // if
+ bCGrafPortUnlocked = TRUE;
} // if
return bCGrafPortUnlocked;
@@ -830,78 +799,70 @@ static BOOL BeginGraphics ( SalGraphicsDataPtr rSalGraphicsData )
if ( rSalGraphicsData->mnOSStatus == noErr )
{
- // Lock our CGrafPort bits
+ // Get the PixMap associated with this particular CGrafPort
- rSalGraphicsData->mnOSStatus
- = LockPortBits( rSalGraphicsData->mpCGrafPort );
+ rSalGraphicsData->mhGWorldPixMap
+ = GetPortPixMap( rSalGraphicsData->mpCGrafPort );
- if ( rSalGraphicsData->mnOSStatus == noErr )
- {
- // Get the PixMap associated with this particular CGrafPort
+ rSalGraphicsData->mnOSStatus = QDErr();
- rSalGraphicsData->mhGWorldPixMap
- = GetPortPixMap( rSalGraphicsData->mpCGrafPort );
+ if ( ( rSalGraphicsData->mnOSStatus == noErr )
+ && ( rSalGraphicsData->mhGWorldPixMap != NULL )
+ )
+ {
+ // Get the current PixMap state, i.e.,
+ // is it the memory associated with this
+ // PixMap is marked to be moved?
- rSalGraphicsData->mnOSStatus = QDErr();
+ rSalGraphicsData->mnGWorldFlags
+ = GetPixelsState( rSalGraphicsData->mhGWorldPixMap );
- if ( ( rSalGraphicsData->mnOSStatus == noErr )
- && ( rSalGraphicsData->mhGWorldPixMap != NULL )
- )
+ if ( rSalGraphicsData->mnGWorldFlags == noErr )
{
- // Get the current PixMap state, i.e.,
- // is it the memory associated with this
- // PixMap is marked to be moved?
-
- rSalGraphicsData->mnGWorldFlags
- = GetPixelsState( rSalGraphicsData->mhGWorldPixMap );
+ Boolean bGWorldPixelsLocked = false;
- if ( rSalGraphicsData->mnGWorldFlags == noErr )
- {
- Boolean bGWorldPixelsLocked = false;
+ // if the PixMap is a relocatable block,
+ // then mark it as locked.
- // if the PixMap is a relocatable block,
- // then mark it as locked.
+ bGWorldPixelsLocked
+ = LockPixels( rSalGraphicsData->mhGWorldPixMap );
- bGWorldPixelsLocked
- = LockPixels( rSalGraphicsData->mhGWorldPixMap );
+ // convert the locked flag from C boolean
+ // to C++ BOOL
- // convert the locked flag from C boolean
- // to C++ BOOL
+ rSalGraphicsData->mbGWorldPixelsLocked
+ = Boolean2BOOL( bGWorldPixelsLocked );
- rSalGraphicsData->mbGWorldPixelsLocked
- = Boolean2BOOL( bGWorldPixelsLocked );
+ // Set background color to white on this GWorld
- // Set background color to white on this GWorld
+ SetWhiteBackColor();
- SetWhiteBackColor();
+ // Set foreground color to black on this GWorld
- // Set foreground color to black on this GWorld
+ SetBlackForeColor();
- SetBlackForeColor();
+ // If we get here then we may safely start drawing
+ // to our GWorld
- // If we get here then we may safely start drawing
- // to our GWorld
+ bStartGraphics = TRUE;
- bStartGraphics = TRUE;
+ // Now begin to set the clip region
- // Now begin to set the clip region
-
- if ( ( rSalGraphicsData->mbClipRgnChanged == TRUE )
- && ( rSalGraphicsData->mhClipRgn != NULL )
- )
- {
- // Set to the clip region
+ if ( ( rSalGraphicsData->mbClipRgnChanged == TRUE )
+ && ( rSalGraphicsData->mhClipRgn != NULL )
+ )
+ {
+ // Set to the clip region
- SetClip( rSalGraphicsData->mhClipRgn );
+ SetClip( rSalGraphicsData->mhClipRgn );
- // Was there an error after setting the clip region?
+ // Was there an error after setting the clip region?
- rSalGraphicsData->mnOSStatus = QDErr();
+ rSalGraphicsData->mnOSStatus = QDErr();
- // Set the new status flag for our port
+ // Set the new status flag for our port
- rSalGraphicsData->mbClipRgnChanged = FALSE;
- } // if
+ rSalGraphicsData->mbClipRgnChanged = FALSE;
} // if
} // if
} // if
@@ -937,16 +898,6 @@ static BOOL EndGraphics ( SalGraphicsDataPtr rSalGraphicsData )
);
rSalGraphicsData->mnOSStatus = QDErr();
-
- if ( ( rSalGraphicsData->mpCGrafPort != NULL )
- && ( rSalGraphicsData->mnOSStatus == noErr )
- )
- {
- // Unlock the CGrafPort bits
-
- rSalGraphicsData->mnOSStatus
- = UnlockPortBits( rSalGraphicsData->mpCGrafPort );
- } // if
} // if
// Reset the port to its original attributes
@@ -1727,9 +1678,9 @@ void SalGraphics::CopyArea( long nDstX,
Rect aDstRect;
Rect aPortBoundsRect;
- GetQDRect ( nSrcX, nSrcY, nSrcWidth, nSrcHeight, &aSrcRect );
+ GetQDRect( nSrcX, nSrcY, nSrcWidth, nSrcHeight, &aSrcRect );
- GetQDRect ( nDstX, nDstY, nDstWidth, nDstHeight, &aDstRect );
+ GetQDRect( nDstX, nDstY, nDstWidth, nDstHeight, &aDstRect );
GetPortBounds( maGraphicsData.mpCGrafPort, &aPortBoundsRect );
@@ -1828,7 +1779,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
{
SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics();
- if ( UnlockGraphics( pSrcGraphics ) )
+ if ( LockGraphics( pSrcGraphics ) )
{
const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort );
@@ -1939,7 +1890,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
::CopyDeepMask( pSrcBitMap,
pMskBitMap,
pDstBitMap,
- &aSrcRect,
+ &aSrcRect,
&aSrcRect,
&aDstRect,
nCopyMode,