summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-12-09 13:22:21 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-12-09 13:22:21 +0000
commit08dd93a4b70962aed0d2b1923b1a73d1d33e0bf3 (patch)
tree71741e6246bc9e4115770a4872a2f01906461feb /vcl
parentCWS-TOOLING: integrate CWS sjfixes11_DEV300 (diff)
downloadcore-08dd93a4b70962aed0d2b1923b1a73d1d33e0bf3.tar.gz
core-08dd93a4b70962aed0d2b1923b1a73d1d33e0bf3.zip
CWS-TOOLING: integrate CWS canvas06
2008-11-14 18:59:03 +0100 thb r263697 : Reverted fAlpha setup to previous state, as this was bogus as well - code path is apparently not taken for test, but anyway 2008-11-13 21:32:45 +0100 thb r263663 : WaE fix (and a bad bug as well - int color would have overflown) 2008-11-13 16:51:37 +0100 pl r263654 : remove warnings 2008-11-13 09:46:28 +0100 thb r263623 : #i95317# Fixed typo (thx WaE for finding) 2008-11-12 21:25:19 +0100 thb r263617 : #i96047# call update() on hidden sprite shape as well, to force actual hiding 2008-11-12 21:23:31 +0100 thb r263616 : #i95209# Merge from CWS thb11 - revives canvasbitmap unit tests, fixes nasty corner case in x11 salbmp (for 16bpp) 2008-11-12 21:21:46 +0100 thb r263615 : #i95197# Shuffled code to make valgrind quiet during bmp loading 2008-11-12 21:18:06 +0100 thb r263614 : #i93382# Make --disable-moz build work 2008-11-12 21:16:55 +0100 thb r263613 : #i95317# Fixed mis-named traits methods for min and max numbers 2008-11-12 20:59:01 +0100 thb r263612 : #i95317#, #i92902#: migrate CWS canvas06 to SVN.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/canvasbitmap.hxx4
-rw-r--r--vcl/source/gdi/bitmap2.cxx18
-rw-r--r--vcl/source/gdi/cvtsvm.cxx13
-rw-r--r--vcl/source/gdi/impgraph.cxx2
-rw-r--r--vcl/source/helper/canvasbitmap.cxx219
-rw-r--r--vcl/source/helper/canvastools.cxx97
-rw-r--r--vcl/test/canvasbitmaptest.cxx224
-rwxr-xr-xvcl/test/dndtest.cxx26
-rw-r--r--vcl/test/makefile.mk9
-rw-r--r--vcl/unx/source/gdi/salbmp.cxx12
10 files changed, 467 insertions, 157 deletions
diff --git a/vcl/inc/vcl/canvasbitmap.hxx b/vcl/inc/vcl/canvasbitmap.hxx
index 0d3512874a5c..b96afd9084c0 100644
--- a/vcl/inc/vcl/canvasbitmap.hxx
+++ b/vcl/inc/vcl/canvasbitmap.hxx
@@ -99,8 +99,10 @@ namespace unotools
virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertColorSpace( const ::com::sun::star::uno::Sequence< double >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace >& targetColorSpace ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertToRGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToPARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (::com::sun::star::uno::RuntimeException);
@@ -108,8 +110,10 @@ namespace unotools
virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertIntegerToRGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
/** Create API wrapper for given BitmapEx
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx
index de9da1fb638f..39aa9da8c470 100644
--- a/vcl/source/gdi/bitmap2.cxx
+++ b/vcl/source/gdi/bitmap2.cxx
@@ -756,18 +756,18 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre
// MapMode is integer-based, and suffers from roundoffs,
// especially if maPrefSize is small. Trying to circumvent
// that by performing part of the math in floating point.
- const Size aScale10000(
+ const Size aScale100000(
OutputDevice::LogicToLogic( Size(100000L,
100000L),
- maPrefMapMode,
- MAP_100TH_MM ) );
- const double fScaleX((double)aScale10000.Width() * maPrefSize.Width());
- const double fScaleY((double)aScale10000.Height() * maPrefSize.Height());
- if( fabs(fScaleX) > 0.000000001 &&
- fabs(fScaleY) > 0.000000001 )
+ MAP_100TH_MM,
+ maPrefMapMode ) );
+ const double fBmpWidthM((double)maPrefSize.Width() / aScale100000.Width() );
+ const double fBmpHeightM((double)maPrefSize.Height() / aScale100000.Height() );
+ if( fabs(fBmpWidthM) > 0.000000001 &&
+ fabs(fBmpHeightM) > 0.000000001 )
{
- aHeader.nXPelsPerMeter = (UINT32)(rAcc.Width() / fScaleX + .5);
- aHeader.nYPelsPerMeter = (UINT32)(rAcc.Height() / fScaleY + .5);
+ aHeader.nXPelsPerMeter = (UINT32)(rAcc.Width() / fBmpWidthM + .5);
+ aHeader.nYPelsPerMeter = (UINT32)(rAcc.Height() / fBmpHeightM + .5);
}
}
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index fce0a042a12f..0f999573ef89 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -408,9 +408,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
char aCode[ 5 ];
- MapMode aMapMode;
Size aPrefSz;
- INT32 nActions;
INT16 nSize;
INT16 nVersion;
@@ -420,11 +418,11 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm >> nVersion; // Version
rIStm >> aPrefSz.Width(); // PrefSize.Width()
rIStm >> aPrefSz.Height(); // PrefSize.Height()
- ImplReadMapMode( rIStm, aMapMode ); // MapMode
- rIStm >> nActions; // Action count
// Header-Kennung und Versionsnummer pruefen
- if( ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 ) || ( nVersion != 200 ) )
+ if( rIStm.GetError()
+ || ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 )
+ || ( nVersion != 200 ) )
{
rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
rIStm.SetNumberFormatInt( nOldFormat );
@@ -432,17 +430,22 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
else
{
+ MapMode aMapMode;
Polygon aActionPoly;
Rectangle aRect;
Point aPt, aPt1;
Size aSz;
Color aActionColor;
INT32 nTmp, nTmp1, nActionSize;
+ INT32 nActions;
INT16 nType;
sal_uInt32 nUnicodeCommentStreamPos = 0;
INT32 nUnicodeCommentActionNumber = 0;
+ ImplReadMapMode( rIStm, aMapMode ); // MapMode
+ rIStm >> nActions; // Action count
+
rMtf.SetPrefSize( aPrefSz );
rMtf.SetPrefMapMode( aMapMode );
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 8525d17ea041..6291c011fee1 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1504,7 +1504,7 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic )
// read Id
rIStm >> nTmp;
- if( NATIVE_FORMAT_50 == nTmp )
+ if( !rIStm.GetError() && NATIVE_FORMAT_50 == nTmp )
{
Graphic aGraphic;
GfxLink aLink;
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index 7b450f6c0fa9..1e487b141d80 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -150,9 +150,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
m_aLayout.ScanLineStride = m_pBmpAcc->GetScanlineSize();
m_aLayout.PlaneStride = 0;
- if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
- m_aLayout.ScanLineStride *= -1;
-
switch( m_pBmpAcc->GetScanlineFormat() )
{
case BMP_FORMAT_1BIT_MSB_PAL:
@@ -436,8 +433,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
const Size aSize = m_aBitmap.GetSizePixel();
m_aLayout.ScanLineBytes =
m_aLayout.ScanLineStride = (aSize.Width()*m_nBitsPerOutputPixel + 7)/8;
- if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
- m_aLayout.ScanLineStride *= -1;
}
}
}
@@ -515,8 +510,12 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
bitmapLayout.ScanLineBytes =
bitmapLayout.ScanLineStride= aRequestedBytes.getWidth();
+ sal_Int32 nScanlineStride=bitmapLayout.ScanLineStride;
if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
- bitmapLayout.ScanLineStride *= -1;
+ {
+ pOutBuf += bitmapLayout.ScanLineStride*(aRequestedBytes.getHeight()-1);
+ nScanlineStride *= -1;
+ }
if( !m_aBmpEx.IsTransparent() )
{
@@ -527,7 +526,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
{
Scanline pScan = m_pBmpAcc->GetScanline(y);
rtl_copyMemory(pOutBuf, pScan+aRequestedBytes.Left(), aRequestedBytes.getWidth());
- pOutBuf += bitmapLayout.ScanLineStride;
+ pOutBuf += nScanlineStride;
}
}
else
@@ -568,7 +567,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
}
}
- pOutBuf += bitmapLayout.ScanLineStride;
+ pOutBuf += nScanlineStride;
}
}
@@ -870,6 +869,59 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( con
return aRes;
}
+uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ const sal_Size nLen( deviceColor.getLength() );
+ const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
+ ENSURE_ARG_OR_THROW2(nLen%nComponentsPerPixel==0,
+ "number of channels no multiple of pixel element count",
+ static_cast<rendering::XBitmapPalette*>(this), 01);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/nComponentsPerPixel);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+
+ if( m_bPalette )
+ {
+ OSL_ENSURE(m_nIndexIndex != -1,
+ "Invalid color channel indices");
+ ENSURE_OR_THROW(m_pBmpAcc,
+ "Unable to get BitmapAccess");
+
+ for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel )
+ {
+ const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(
+ sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex]));
+
+ // TODO(F3): Convert result to sRGB color space
+ const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 );
+ *pOut++ = rendering::ARGBColor(nAlpha,
+ nAlpha*toDoubleColor(aCol.GetRed()),
+ nAlpha*toDoubleColor(aCol.GetGreen()),
+ nAlpha*toDoubleColor(aCol.GetBlue()));
+ }
+ }
+ else
+ {
+ OSL_ENSURE(m_nRedIndex != -1 && m_nGreenIndex != -1 && m_nBlueIndex != -1,
+ "Invalid color channel indices");
+
+ for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel )
+ {
+ // TODO(F3): Convert result to sRGB color space
+ const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 );
+ *pOut++ = rendering::ARGBColor(
+ nAlpha,
+ nAlpha*deviceColor[i+m_nRedIndex],
+ nAlpha*deviceColor[i+m_nGreenIndex],
+ nAlpha*deviceColor[i+m_nBlueIndex]);
+ }
+ }
+
+ return aRes;
+}
+
uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -950,6 +1002,48 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Se
return aRes;
}
+uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ const sal_Size nLen( rgbColor.getLength() );
+ const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
+
+ uno::Sequence< double > aRes(nLen*nComponentsPerPixel);
+ double* pColors=aRes.getArray();
+
+ if( m_bPalette )
+ {
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ const double nAlpha( rgbColor[i].Alpha );
+ pColors[m_nIndexIndex] = m_pBmpAcc->GetBestPaletteIndex(
+ BitmapColor(toByteColor(rgbColor[i].Red / nAlpha),
+ toByteColor(rgbColor[i].Green / nAlpha),
+ toByteColor(rgbColor[i].Blue / nAlpha)));
+ if( m_nAlphaIndex != -1 )
+ pColors[m_nAlphaIndex] = nAlpha;
+
+ pColors += nComponentsPerPixel;
+ }
+ }
+ else
+ {
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ const double nAlpha( rgbColor[i].Alpha );
+ pColors[m_nRedIndex] = rgbColor[i].Red / nAlpha;
+ pColors[m_nGreenIndex] = rgbColor[i].Green / nAlpha;
+ pColors[m_nBlueIndex] = rgbColor[i].Blue / nAlpha;
+ if( m_nAlphaIndex != -1 )
+ pColors[m_nAlphaIndex] = nAlpha;
+
+ pColors += nComponentsPerPixel;
+ }
+ }
+ return aRes;
+}
+
sal_Int32 SAL_CALL VclCanvasBitmap::getBitsPerPixel( ) throw (uno::RuntimeException)
{
vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -1163,6 +1257,65 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR
return aRes;
}
+uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) );
+ const sal_Size nLen( deviceColor.getLength() );
+ const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nNumColors);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+
+ ENSURE_OR_THROW(m_pBmpAcc,
+ "Unable to get BitmapAccess");
+
+ if( m_aBmpEx.IsTransparent() )
+ {
+ const long nNonAlphaBytes( (m_nBitsPerInputPixel+7)/8 );
+ const sal_Int32 nBytesPerPixel((m_nBitsPerOutputPixel+7)/8);
+ const sal_uInt8 nAlphaFactor( m_aBmpEx.IsAlpha() ? 1 : 255 );
+ for( sal_Size i=0; i<nLen; i+=nBytesPerPixel )
+ {
+ // if palette, index is guaranteed to be 8 bit
+ const BitmapColor aCol =
+ m_bPalette ?
+ m_pBmpAcc->GetPaletteColor(*pIn) :
+ m_pBmpAcc->GetPixelFromData(pIn,0);
+
+ // TODO(F3): Convert result to sRGB color space
+ const double nAlpha( 1.0 - toDoubleColor(nAlphaFactor*pIn[nNonAlphaBytes]) );
+ *pOut++ = rendering::ARGBColor(nAlpha,
+ nAlpha*toDoubleColor(aCol.GetRed()),
+ nAlpha*toDoubleColor(aCol.GetGreen()),
+ nAlpha*toDoubleColor(aCol.GetBlue()));
+ pIn += nBytesPerPixel;
+ }
+ }
+ else
+ {
+ for( sal_Int32 i=0; i<nNumColors; ++i )
+ {
+ const BitmapColor aCol =
+ m_bPalette ?
+ m_pBmpAcc->GetPaletteColor(
+ sal::static_int_cast<USHORT>(
+ m_pBmpAcc->GetPixelFromData(
+ pIn, i ))) :
+ m_pBmpAcc->GetPixelFromData(pIn, i);
+
+ // TODO(F3): Convert result to sRGB color space
+ *pOut++ = rendering::ARGBColor(1.0,
+ toDoubleColor(aCol.GetRed()),
+ toDoubleColor(aCol.GetGreen()),
+ toDoubleColor(aCol.GetBlue()));
+ }
+ }
+
+ return aRes;
+}
+
uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -1261,6 +1414,56 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co
return aRes;
}
+uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ const sal_Size nLen( rgbColor.getLength() );
+ const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8);
+
+ uno::Sequence< sal_Int8 > aRes(nNumBytes);
+ BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray());
+
+ if( m_aBmpEx.IsTransparent() )
+ {
+ const long nNonAlphaBytes( (m_nBitsPerInputPixel+7)/8 );
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ const double nAlpha( rgbColor[i].Alpha );
+ const BitmapColor aCol(toByteColor(rgbColor[i].Red / nAlpha),
+ toByteColor(rgbColor[i].Green / nAlpha),
+ toByteColor(rgbColor[i].Blue / nAlpha));
+ const BitmapColor aCol2 =
+ m_bPalette ?
+ BitmapColor(
+ sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) :
+ aCol;
+
+ m_pBmpAcc->SetPixelOnData(pColors,0,aCol2);
+ pColors += nNonAlphaBytes;
+ *pColors++ = 255 - toByteColor(nAlpha);
+ }
+ }
+ else
+ {
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ const BitmapColor aCol(toByteColor(rgbColor[i].Red),
+ toByteColor(rgbColor[i].Green),
+ toByteColor(rgbColor[i].Blue));
+ const BitmapColor aCol2 =
+ m_bPalette ?
+ BitmapColor(
+ sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) :
+ aCol;
+
+ m_pBmpAcc->SetPixelOnData(pColors,i,aCol2);
+ }
+ }
+
+ return aRes;
+}
+
BitmapEx VclCanvasBitmap::getBitmapEx() const
{
return m_aBmpEx;
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index 3a239d7c3b3c..ca2803fd6009 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -250,28 +250,61 @@ namespace vcl
{
// read ARGB color
aARGBColors = rLayout.ColorSpace->convertIntegerToARGB(aPixelData);
- for( sal_Int32 x=0; x<nWidth; ++x )
+
+ if( rWriteAcc->HasPalette() )
{
- const rendering::ARGBColor& rColor=aARGBColors[x];
- rWriteAcc->SetPixel( aRect.Y1, x,
- BitmapColor( toByteColor(rColor.Red),
- toByteColor(rColor.Green),
- toByteColor(rColor.Blue) ));
- rAlphaAcc->SetPixel( aRect.Y1, x,
- BitmapColor( 255 - toByteColor(rColor.Alpha) ));
+ for( sal_Int32 x=0; x<nWidth; ++x )
+ {
+ const rendering::ARGBColor& rColor=aARGBColors[x];
+ rWriteAcc->SetPixel( aRect.Y1, x,
+ rWriteAcc->GetBestPaletteIndex(
+ BitmapColor( toByteColor(rColor.Red),
+ toByteColor(rColor.Green),
+ toByteColor(rColor.Blue))) );
+ rAlphaAcc->SetPixel( aRect.Y1, x,
+ BitmapColor( 255 - toByteColor(rColor.Alpha) ));
+ }
+ }
+ else
+ {
+ for( sal_Int32 x=0; x<nWidth; ++x )
+ {
+ const rendering::ARGBColor& rColor=aARGBColors[x];
+ rWriteAcc->SetPixel( aRect.Y1, x,
+ BitmapColor( toByteColor(rColor.Red),
+ toByteColor(rColor.Green),
+ toByteColor(rColor.Blue) ));
+ rAlphaAcc->SetPixel( aRect.Y1, x,
+ BitmapColor( 255 - toByteColor(rColor.Alpha) ));
+ }
}
}
else
{
// read RGB color
aRGBColors = rLayout.ColorSpace->convertIntegerToRGB(aPixelData);
- for( sal_Int32 x=0; x<nWidth; ++x )
+ if( rWriteAcc->HasPalette() )
+ {
+ for( sal_Int32 x=0; x<nWidth; ++x )
+ {
+ const rendering::RGBColor& rColor=aRGBColors[x];
+ rWriteAcc->SetPixel( aRect.Y1, x,
+ rWriteAcc->GetBestPaletteIndex(
+ BitmapColor( toByteColor(rColor.Red),
+ toByteColor(rColor.Green),
+ toByteColor(rColor.Blue))) );
+ }
+ }
+ else
{
- const rendering::RGBColor& rColor=aRGBColors[x];
- rWriteAcc->SetPixel( aRect.Y1, x,
- BitmapColor( toByteColor(rColor.Red),
- toByteColor(rColor.Green),
- toByteColor(rColor.Blue) ));
+ for( sal_Int32 x=0; x<nWidth; ++x )
+ {
+ const rendering::RGBColor& rColor=aRGBColors[x];
+ rWriteAcc->SetPixel( aRect.Y1, x,
+ BitmapColor( toByteColor(rColor.Red),
+ toByteColor(rColor.Green),
+ toByteColor(rColor.Blue) ));
+ }
}
}
}
@@ -404,7 +437,7 @@ namespace vcl
{ // limit scoped access
ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(),
aBitmap );
- ScopedBitmapWriteAccess pAlphaWriteAccess( aAlpha.AcquireWriteAccess(),
+ ScopedBitmapWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL,
aAlpha );
ENSURE_OR_THROW(pWriteAccess.get() != NULL,
@@ -652,6 +685,23 @@ namespace vcl
}
return aRes;
}
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const double* pIn( deviceColor.getConstArray() );
+ const sal_Size nLen( deviceColor.getLength() );
+ ENSURE_ARG_OR_THROW2(nLen%4==0,
+ "number of channels no multiple of 4",
+ static_cast<rendering::XColorSpace*>(this), 0);
+
+ uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
+ rendering::ARGBColor* pOut( aRes.getArray() );
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ *pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]);
+ pIn += 4;
+ }
+ return aRes;
+ }
virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
{
const rendering::RGBColor* pIn( rgbColor.getConstArray() );
@@ -686,6 +736,23 @@ namespace vcl
}
return aRes;
}
+ virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
+ const sal_Size nLen( rgbColor.getLength() );
+
+ uno::Sequence< double > aRes(nLen*4);
+ double* pColors=aRes.getArray();
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pColors++ = pIn->Red/pIn->Alpha;
+ *pColors++ = pIn->Green/pIn->Alpha;
+ *pColors++ = pIn->Blue/pIn->Alpha;
+ *pColors++ = pIn->Alpha;
+ ++pIn;
+ }
+ return aRes;
+ }
public:
StandardColorSpace() : m_aComponentTags(4)
diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx
index 18b677659774..ae0e79f0959f 100644
--- a/vcl/test/canvasbitmaptest.cxx
+++ b/vcl/test/canvasbitmaptest.cxx
@@ -32,6 +32,7 @@
#include "precompiled_vcl.hxx"
// bootstrap stuff
+#include <sal/main.h>
#include <rtl/bootstrap.hxx>
#include <rtl/ref.hxx>
#include <comphelper/processfactory.hxx>
@@ -54,20 +55,45 @@
#include <cppuhelper/compbase3.hxx>
#include <tools/diagnose_ex.h>
+#include <tools/extendapplicationenvironment.hxx>
#include "vcl/svapp.hxx"
#include "vcl/canvastools.hxx"
+#include "vcl/canvasbitmap.hxx"
#include "vcl/dialog.hxx"
#include "vcl/outdev.hxx"
#include "vcl/bmpacc.hxx"
#include "vcl/virdev.hxx"
#include "vcl/bitmapex.hxx"
-#include "canvasbitmap.hxx"
using namespace ::com::sun::star;
using namespace ::vcl::unotools;
+// -----------------------------------------------------------------------
+
+void Main();
+
+// -----------------------------------------------------------------------
+
+SAL_IMPLEMENT_MAIN()
+{
+ tools::extendApplicationEnvironment();
+
+ uno::Reference< lang::XMultiServiceFactory > xMS;
+ xMS = cppu::createRegistryServiceFactory(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ),
+ sal_True );
+
+ InitVCL( xMS );
+ ::Main();
+ DeInitVCL();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
namespace com { namespace sun { namespace star { namespace rendering
{
@@ -258,28 +284,28 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
if( nOriginalDepth > 8 )
{
const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() );
- uno::Sequence<rendering::ARGBColor> aARGBColors(1);
- uno::Sequence<rendering::RGBColor> aRGBColors(1);
+ uno::Sequence<rendering::ARGBColor> aARGBColor(1);
+ uno::Sequence<rendering::RGBColor> aRGBColor(1);
uno::Sequence<sal_Int8> aPixel3, aPixel4;
const Color aCol(COL_GREEN);
- aARGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
- aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
- aARGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
- aARGBColors[0].Alpha = 1.0;
+ aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
+ aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+ aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ aARGBColor[0].Alpha = 1.0;
- aRGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
- aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
- aRGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
+ aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+ aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
- aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors );
+ aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
test( aPixel3 == aPixel4,
"Green pixel from bitmap matches with manually converted green pixel" );
if( !aContainedBmpEx.IsTransparent() )
{
- aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors );
+ aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
test( aPixel3 == aPixel4,
"Green pixel from bitmap matches with manually RGB-converted green pixel" );
}
@@ -409,28 +435,28 @@ void checkBitmapImport( const rtl::Reference<VclCanvasBitmap>& xBmp,
if( nOriginalDepth > 8 )
{
const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() );
- uno::Sequence<rendering::ARGBColor> aARGBColors(1);
- uno::Sequence<rendering::RGBColor> aRGBColors(1);
+ uno::Sequence<rendering::ARGBColor> aARGBColor(1);
+ uno::Sequence<rendering::RGBColor> aRGBColor(1);
uno::Sequence<sal_Int8> aPixel3, aPixel4;
const Color aCol(COL_GREEN);
- aARGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
- aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
- aARGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
- aARGBColors[0].Alpha = 1.0;
+ aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
+ aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+ aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ aARGBColor[0].Alpha = 1.0;
- aRGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
- aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
- aRGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
+ aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+ aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
- aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors );
+ aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
test( aPixel3 == aPixel4,
"Green pixel from bitmap matches with manually converted green pixel" );
if( !aContainedBmpEx.IsTransparent() )
{
- aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors );
+ aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
test( aPixel3 == aPixel4,
"Green pixel from bitmap matches with manually RGB-converted green pixel" );
}
@@ -631,6 +657,13 @@ private:
return uno::Sequence< rendering::ARGBColor >();
}
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ test(false, "Method not implemented");
+ return uno::Sequence< rendering::ARGBColor >();
+ }
+
virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
@@ -645,6 +678,13 @@ private:
return uno::Sequence< double >();
}
+ virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ test(false, "This method is not expected to be called!");
+ return uno::Sequence< double >();
+ }
+
virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException)
{
return mnBitsPerPixel;
@@ -660,9 +700,17 @@ private:
return util::Endianness::LITTLE;
}
- virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerColorSpace( const uno::Sequence< ::sal_Int8 >&,
- const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException,
- uno::RuntimeException)
+ virtual uno::Sequence< double > SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& ,
+ const uno::Reference< rendering::XColorSpace >& ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ test(false, "Method not implemented");
+ return uno::Sequence< double >();
+ }
+
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& ,
+ const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
{
test(false, "Method not implemented");
return uno::Sequence< sal_Int8 >();
@@ -722,6 +770,44 @@ private:
return aRes;
}
+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ const sal_Size nLen( deviceColor.getLength() );
+ const sal_Int32 nBytesPerPixel(mnBitsPerPixel == 8 ? 1 : 4);
+ test(nLen%nBytesPerPixel==0,
+ "number of channels no multiple of pixel element count");
+
+ uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel );
+ rendering::ARGBColor* pOut( aRes.getArray() );
+
+ if( getPalette().is() )
+ {
+ for( sal_Size i=0; i<nLen; ++i )
+ {
+ *pOut++ = rendering::ARGBColor(
+ 1.0,
+ vcl::unotools::toDoubleColor(deviceColor[i]),
+ vcl::unotools::toDoubleColor(deviceColor[i]),
+ vcl::unotools::toDoubleColor(deviceColor[i]));
+ }
+ }
+ else
+ {
+ for( sal_Size i=0; i<nLen; i+=4 )
+ {
+ const double fAlpha=vcl::unotools::toDoubleColor(deviceColor[i+3]);
+ *pOut++ = rendering::ARGBColor(
+ fAlpha,
+ fAlpha*vcl::unotools::toDoubleColor(deviceColor[i+0]),
+ fAlpha*vcl::unotools::toDoubleColor(deviceColor[i+1]),
+ fAlpha*vcl::unotools::toDoubleColor(deviceColor[i+2]));
+ }
+ }
+
+ return aRes;
+ }
+
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
@@ -736,6 +822,13 @@ private:
return uno::Sequence< sal_Int8 >();
}
+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+ {
+ test(false, "Method not implemented");
+ return uno::Sequence< sal_Int8 >();
+ }
+
public:
TestBitmap( const geometry::IntegerSize2D& rSize, bool bPalette ) :
maSize(rSize),
@@ -784,14 +877,14 @@ public:
void TestWindow::Paint( const Rectangle& )
{
- static sal_Int8 lcl_depths[]={1,4,8,16,24,32};
+ static sal_Int8 lcl_depths[]={1,4,8,16,24};
try
{
// Testing VclCanvasBitmap wrapper
// ===============================
- for( int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i )
+ for( unsigned int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i )
{
const sal_Int8 nDepth( lcl_depths[i] );
Bitmap aBitmap(Size(200,200),nDepth);
@@ -801,8 +894,8 @@ void TestWindow::Paint( const Rectangle& )
aBitmap);
if( pAcc.get() )
{
- BitmapColor aBlack;
- BitmapColor aWhite;
+ BitmapColor aBlack(0);
+ BitmapColor aWhite(0);
if( pAcc->HasPalette() )
{
aBlack.SetIndex( sal::static_int_cast<BYTE>(pAcc->GetBestPaletteIndex(BitmapColor(0,0,0))) );
@@ -943,73 +1036,14 @@ void TestWindow::Paint( const Rectangle& )
exit(2);
}
-USHORT TestApp::Exception( USHORT nError )
-{
- switch( nError & EXC_MAJORTYPE )
- {
- case EXC_RSCNOTLOADED:
- Abort( String::CreateFromAscii(
- "Error: could not load language resources.\nPlease check your installation.\n" ) );
- break;
- }
- return 0;
-}
+} // namespace
-void TestApp::Main()
+void Main()
{
- bool bHelp = false;
-
- for( USHORT i = 0; i < GetCommandLineParamCount(); i++ )
- {
- ::rtl::OUString aParam = GetCommandLineParam( i );
-
- if( aParam.equalsAscii( "--help" ) ||
- aParam.equalsAscii( "-h" ) )
- bHelp = true;
- }
-
- if( bHelp )
- {
- printf( "outdevgrind - Profile OutputDevice\n" );
- return;
- }
-
- //-------------------------------------------------
- // create the global service-manager
- //-------------------------------------------------
- uno::Reference< lang::XMultiServiceFactory > xFactory;
- try
- {
- uno::Reference< uno::XComponentContext > xCtx = ::cppu::defaultBootstrap_InitialComponentContext();
- xFactory = uno::Reference< lang::XMultiServiceFactory >( xCtx->getServiceManager(),
- uno::UNO_QUERY );
- if( xFactory.is() )
- ::comphelper::setProcessServiceFactory( xFactory );
- }
- catch( uno::Exception& )
- {
- }
+ TestWindow aWindow;
+ aWindow.Execute();
+ aWindow.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - canvasbitmaptest" ) ) );
- if( !xFactory.is() )
- {
- fprintf( stderr,
- "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
- exit( 1 );
- }
-
- // Create UCB.
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
- aArgs[ 1 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
- ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
-
- TestWindow pWindow;
- pWindow.Execute();
-
- // clean up UCB
- ::ucbhelper::ContentBroker::deinitialize();
+ Application::Execute();
}
-} // namespace
-
-TestApp aTestApp;
diff --git a/vcl/test/dndtest.cxx b/vcl/test/dndtest.cxx
index bd912fcdf444..2d426acf84b5 100755
--- a/vcl/test/dndtest.cxx
+++ b/vcl/test/dndtest.cxx
@@ -138,7 +138,7 @@ class StringTransferable : public ::cppu::WeakImplHelper1< XTransferable >
Sequence< DataFlavor > m_aFlavorList;
public:
- StringTransferable( const OUString& rString ) : m_aFlavorList( 1 ), m_aData( rString )
+ StringTransferable( const OUString& rString ) : m_aData( rString ), m_aFlavorList( 1 )
{
DataFlavor df;
@@ -297,7 +297,7 @@ void MyWin::Resize()
void SAL_CALL MyDragAndDropListener::dragGestureRecognized( const DragGestureEvent& dge ) throw(RuntimeException)
{
- printf( "XDragGestureListener::dragGestureRecognized called ( Window: %X, %d, %d ).\n", m_pWindow, dge.DragOriginX, dge.DragOriginY );
+ printf( "XDragGestureListener::dragGestureRecognized called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dge.DragOriginX, dge.DragOriginY );
Reference< XDragSource > xDragSource( dge.DragSource, UNO_QUERY );
xDragSource->startDrag( dge, -1, 0, 0, new StringTransferable( OUString::createFromAscii( "TestString" ) ), this );
@@ -308,7 +308,7 @@ void SAL_CALL MyDragAndDropListener::dragGestureRecognized( const DragGestureEve
void SAL_CALL MyDragAndDropListener::drop( const DropTargetDropEvent& dtde ) throw(RuntimeException)
{
- printf( "XDropTargetListener::drop called ( Window: %X, %d, %d ).\n", m_pWindow, dtde.LocationX, dtde.LocationY );
+ printf( "XDropTargetListener::drop called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtde.LocationX, dtde.LocationY );
dtde.Context->dropComplete( sal_True );
}
@@ -317,7 +317,7 @@ void SAL_CALL MyDragAndDropListener::drop( const DropTargetDropEvent& dtde ) thr
void SAL_CALL MyDragAndDropListener::dragEnter( const DropTargetDragEnterEvent& dtdee ) throw(RuntimeException)
{
- printf( "XDropTargetListener::dragEnter called ( Window: %X, %d, %d ).\n", m_pWindow, dtdee.LocationX, dtdee.LocationY );
+ printf( "XDropTargetListener::dragEnter called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtdee.LocationX, dtdee.LocationY );
dtdee.Context->acceptDrag( dtdee.DropAction );
}
@@ -325,14 +325,14 @@ void SAL_CALL MyDragAndDropListener::dragEnter( const DropTargetDragEnterEvent&
void SAL_CALL MyDragAndDropListener::dragExit( const DropTargetEvent& ) throw(RuntimeException)
{
- printf( "XDropTargetListener::dragExit called ( Window: %X ).\n", m_pWindow );
+ printf( "XDropTargetListener::dragExit called ( Window: %p ).\n", m_pWindow );
}
// -----------------------------------------------------------------------
void SAL_CALL MyDragAndDropListener::dragOver( const DropTargetDragEvent& dtde ) throw(RuntimeException)
{
- printf( "XDropTargetListener::dragOver called ( Window: %X, %d, %d ).\n", m_pWindow, dtde.LocationX, dtde.LocationY );
+ printf( "XDropTargetListener::dragOver called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtde.LocationX, dtde.LocationY );
dtde.Context->acceptDrag( dtde.DropAction );
}
@@ -340,7 +340,7 @@ void SAL_CALL MyDragAndDropListener::dragOver( const DropTargetDragEvent& dtde )
void SAL_CALL MyDragAndDropListener::dropActionChanged( const DropTargetDragEvent& dtde ) throw(RuntimeException)
{
- printf( "XDropTargetListener::dropActionChanged called ( Window: %X, %d, %d ).\n", m_pWindow, dtde.LocationX, dtde.LocationY );
+ printf( "XDropTargetListener::dropActionChanged called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtde.LocationX, dtde.LocationY );
dtde.Context->acceptDrag( dtde.DropAction );
}
@@ -348,42 +348,42 @@ void SAL_CALL MyDragAndDropListener::dropActionChanged( const DropTargetDragEven
void SAL_CALL MyDragAndDropListener::dragDropEnd( const DragSourceDropEvent& dsde ) throw(RuntimeException)
{
- printf( "XDragSourceListener::dropDropEnd called ( Window: %X, %s ).\n", m_pWindow, dsde.DropSuccess ? "sucess" : "failed" );
+ printf( "XDragSourceListener::dropDropEnd called ( Window: %p, %s ).\n", m_pWindow, dsde.DropSuccess ? "sucess" : "failed" );
}
// -----------------------------------------------------------------------
void SAL_CALL MyDragAndDropListener::dragEnter( const DragSourceDragEvent& ) throw(RuntimeException)
{
- printf( "XDragSourceListener::dragEnter called ( Window: %X ).\n", m_pWindow );
+ printf( "XDragSourceListener::dragEnter called ( Window: %p ).\n", m_pWindow );
}
// -----------------------------------------------------------------------
void SAL_CALL MyDragAndDropListener::dragExit( const DragSourceEvent& ) throw(RuntimeException)
{
- printf( "XDragSourceListener::dragExit called ( Window: %X ).\n", m_pWindow );
+ printf( "XDragSourceListener::dragExit called ( Window: %p ).\n", m_pWindow );
}
// -----------------------------------------------------------------------
void SAL_CALL MyDragAndDropListener::dragOver( const DragSourceDragEvent& ) throw(RuntimeException)
{
- printf( "XDragSourceListener::dragOver called ( Window: %X ).\n", m_pWindow );
+ printf( "XDragSourceListener::dragOver called ( Window: %p ).\n", m_pWindow );
}
// -----------------------------------------------------------------------
void SAL_CALL MyDragAndDropListener::dropActionChanged( const DragSourceDragEvent& ) throw(RuntimeException)
{
- printf( "XDragSourceListener::dropActionChanged called ( Window: %X ).\n", m_pWindow );
+ printf( "XDragSourceListener::dropActionChanged called ( Window: %p ).\n", m_pWindow );
}
// -----------------------------------------------------------------------
void SAL_CALL MyDragAndDropListener::disposing( const EventObject& ) throw(RuntimeException)
{
- printf( "XEventListener::disposing called ( Window: %X ).\n", m_pWindow );
+ printf( "XEventListener::disposing called ( Window: %p ).\n", m_pWindow );
}
// -----------------------------------------------------------------------
diff --git a/vcl/test/makefile.mk b/vcl/test/makefile.mk
index 45f36555c302..4f10be112d2c 100644
--- a/vcl/test/makefile.mk
+++ b/vcl/test/makefile.mk
@@ -46,13 +46,12 @@ TARGETTYPE=GUI
# --- Files --------------------------------------------------------
-OBJFILES= \
+APP1OBJS= \
$(OBJ)$/dndtest.obj
APP1NOSAL= TRUE
APP1TARGET= $(TARGET)
-APP1OBJS= $(OBJFILES) $(OBJ)$/salmain.obj
APP1STDLIBS= $(CPPULIB) \
$(CPPUHELPERLIB) \
$(TOOLSLIB) \
@@ -68,12 +67,6 @@ APP2TARGET= canvasbitmaptest
APP2OBJS= \
$(OBJ)$/canvasbitmaptest.obj
-.IF "$(GUI)"!="UNX"
- APP2OBJS += $(OBJ)$/salmain.obj
-.ELSE
- APP2OBJS += $(SLO)$/salmain.obj
-.ENDIF
-
APP2NOSAL= TRUE
APP2STDLIBS=$(TOOLSLIB) \
$(COMPHELPERLIB) \
diff --git a/vcl/unx/source/gdi/salbmp.cxx b/vcl/unx/source/gdi/salbmp.cxx
index 07fffb6b2218..f70f445ed28c 100644
--- a/vcl/unx/source/gdi/salbmp.cxx
+++ b/vcl/unx/source/gdi/salbmp.cxx
@@ -141,9 +141,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount,
case( 4 ): pDIB->mnFormat |= BMP_FORMAT_4BIT_MSN_PAL; break;
case( 8 ): pDIB->mnFormat |= BMP_FORMAT_8BIT_PAL; break;
#ifdef OSL_BIGENDIAN
- case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK; break;
+ case(16 ):
+ pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK;
+ pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f );
+ break;
#else
- case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK; break;
+ case(16 ):
+ pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK;
+ pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f );
+ break;
#endif
default:
nBitCount = 24;
@@ -251,7 +257,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
case( 16 ):
{
nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
- aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
+ aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
if( LSBFirst == pImage->byte_order )
{