From c60a030b16e408474d2660d4d88644127d402df6 Mon Sep 17 00:00:00 2001
From: Jens-Heiner Rechtien
Date: Thu, 1 Nov 2007 13:48:32 +0000
Subject: INTEGRATION: CWS thbpp9_SRC680 (1.2.84); FILE MERGED 2007/10/17
23:00:21 thb 1.2.84.1: #147378# Merging fixes from CWS basebmp01 - lost when
open-sourcing the headless plugin
---
vcl/unx/headless/svpbmp.cxx | 7 +++++--
vcl/unx/headless/svpgdi.cxx | 33 +++++++++++++++++++++++----------
2 files changed, 28 insertions(+), 12 deletions(-)
(limited to 'vcl')
diff --git a/vcl/unx/headless/svpbmp.cxx b/vcl/unx/headless/svpbmp.cxx
index c2491e91f9ca..2713dd1f5357 100644
--- a/vcl/unx/headless/svpbmp.cxx
+++ b/vcl/unx/headless/svpbmp.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: svpbmp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2007-07-24 10:25:56 $
+ * last change: $Author: hr $ $Date: 2007-11-01 14:48:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -216,6 +216,9 @@ BitmapBuffer* SvpSalBitmap::AcquireBuffer( bool )
pBuf->mnFormat = BMP_FORMAT_1BIT_MSB_PAL;
break;
}
+ if( m_aBitmap->isTopDown() )
+ pBuf->mnFormat |= BMP_FORMAT_TOP_DOWN;
+
B2IVector aSize = m_aBitmap->getSize();
pBuf->mnWidth = aSize.getX();
pBuf->mnHeight = aSize.getY();
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index 488ee62ccdca..afab14934422 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: svpgdi.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2007-07-24 10:27:28 $
+ * last change: $Author: hr $ $Date: 2007-11-01 14:48:32 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -461,8 +461,8 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect*,
}
void SvpSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
- const SalBitmap& rSalBitmap,
- const SalBitmap& rTransparentBitmap )
+ const SalBitmap& rSalBitmap,
+ const SalBitmap& rTransparentBitmap )
{
const SvpSalBitmap& rSrc = static_cast(rSalBitmap);
const SvpSalBitmap& rSrcTrans = static_cast(rTransparentBitmap);
@@ -477,28 +477,41 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
}
void SvpSalGraphics::drawMask( const SalTwoRect* pPosAry,
- const SalBitmap& rSalBitmap,
- SalColor nMaskColor )
+ const SalBitmap& rSalBitmap,
+ SalColor nMaskColor )
{
const SvpSalBitmap& rSrc = static_cast(rSalBitmap);
B2IRange aSrcRect( pPosAry->mnSrcX, pPosAry->mnSrcY,
pPosAry->mnSrcX+pPosAry->mnSrcWidth,
pPosAry->mnSrcY+pPosAry->mnSrcHeight );
B2IPoint aDestPoint( pPosAry->mnDestX, pPosAry->mnDestY );
+
+ // BitmapDevice::drawMaskedColor works with 0==transparent,
+ // 255==opaque. drawMask() semantic is the other way
+ // around. Therefore, invert mask.
+ BitmapDeviceSharedPtr aCopy =
+ cloneBitmapDevice( B2IVector( pPosAry->mnSrcWidth, pPosAry->mnSrcHeight ),
+ rSrc.getBitmap() );
+ basebmp::Color aBgColor( COL_WHITE );
+ aCopy->clear(aBgColor);
+ basebmp::Color aFgColor( COL_BLACK );
+ aCopy->drawMaskedColor( aFgColor, rSrc.getBitmap(), aSrcRect, B2IPoint() );
+
basebmp::Color aColor( nMaskColor );
- m_aDevice->drawMaskedColor( aColor, rSrc.getBitmap(), aSrcRect, aDestPoint, m_aClipMap );
+ B2IRange aSrcRect2( 0, 0, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight );
+ m_aDevice->drawMaskedColor( aColor, aCopy, aSrcRect, aDestPoint, m_aClipMap );
dbgOut( m_aDevice );
}
SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight )
{
BitmapDeviceSharedPtr aCopy =
- createBitmapDevice( B2IVector( nWidth, nHeight ),
- m_aDevice->isTopDown(),
- m_aDevice->getScanlineFormat() );
+ cloneBitmapDevice( B2IVector( nWidth, nHeight ),
+ m_aDevice );
B2IRange aSrcRect( nX, nY, nX+nWidth, nY+nHeight );
B2IRange aDestRect( 0, 0, nWidth, nHeight );
aCopy->drawBitmap( m_aDevice, aSrcRect, aDestRect, DrawMode_PAINT );
+
SvpSalBitmap* pBitmap = new SvpSalBitmap();
pBitmap->setBitmap( aCopy );
return pBitmap;
--
cgit