summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/impgraph.cxx131
-rw-r--r--vcl/source/gdi/outdev.cxx6
-rw-r--r--vcl/source/gdi/outdev3.cxx5
-rw-r--r--vcl/source/gdi/outdev6.cxx12
-rw-r--r--vcl/source/gdi/salgdilayout.cxx3
5 files changed, 87 insertions, 70 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 6291c011fee1..a67d6fa7feac 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1504,92 +1504,99 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic )
// read Id
rIStm >> nTmp;
- if( !rIStm.GetError() && NATIVE_FORMAT_50 == nTmp )
+ // if there is no more data, avoid further expensive
+ // reading which will create VDevs and other stuff, just to
+ // read nothing. CAUTION: Eof is only true AFTER reading another
+ // byte, a speciality of SvMemoryStream (!)
+ if(!rIStm.GetError() && !rIStm.IsEof())
{
- Graphic aGraphic;
- GfxLink aLink;
- VersionCompat* pCompat;
+ if( NATIVE_FORMAT_50 == nTmp )
+ {
+ Graphic aGraphic;
+ GfxLink aLink;
+ VersionCompat* pCompat;
- // read compat info
- pCompat = new VersionCompat( rIStm, STREAM_READ );
- delete pCompat;
+ // read compat info
+ pCompat = new VersionCompat( rIStm, STREAM_READ );
+ delete pCompat;
- rIStm >> aLink;
+ rIStm >> aLink;
- // set dummy link to avoid creation of additional link after filtering;
- // we set a default link to avoid unnecessary swapping of native data
- aGraphic.SetLink( GfxLink() );
+ // set dummy link to avoid creation of additional link after filtering;
+ // we set a default link to avoid unnecessary swapping of native data
+ aGraphic.SetLink( GfxLink() );
- if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) )
- {
- // set link only, if no other link was set
- const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL );
+ if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) )
+ {
+ // set link only, if no other link was set
+ const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL );
- // assign graphic
- rImpGraphic = *aGraphic.ImplGetImpGraphic();
+ // assign graphic
+ rImpGraphic = *aGraphic.ImplGetImpGraphic();
- if( aLink.IsPrefMapModeValid() )
- rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() );
+ if( aLink.IsPrefMapModeValid() )
+ rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() );
- if( aLink.IsPrefSizeValid() )
- rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() );
+ if( aLink.IsPrefSizeValid() )
+ rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() );
- if( bSetLink )
- rImpGraphic.ImplSetLink( aLink );
+ if( bSetLink )
+ rImpGraphic.ImplSetLink( aLink );
+ }
+ else
+ {
+ rIStm.Seek( nStmPos1 );
+ rIStm.SetError( ERRCODE_IO_WRONGFORMAT );
+ }
}
else
{
- rIStm.Seek( nStmPos1 );
- rIStm.SetError( ERRCODE_IO_WRONGFORMAT );
- }
- }
- else
- {
- BitmapEx aBmpEx;
- const USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ BitmapEx aBmpEx;
+ const USHORT nOldFormat = rIStm.GetNumberFormatInt();
- rIStm.SeekRel( -4 );
- rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
- rIStm >> aBmpEx;
+ rIStm.SeekRel( -4 );
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rIStm >> aBmpEx;
- if( !rIStm.GetError() )
- {
- UINT32 nMagic1(0), nMagic2(0);
- ULONG nActPos = rIStm.Tell();
+ if( !rIStm.GetError() )
+ {
+ UINT32 nMagic1(0), nMagic2(0);
+ ULONG nActPos = rIStm.Tell();
- rIStm >> nMagic1 >> nMagic2;
- rIStm.Seek( nActPos );
+ rIStm >> nMagic1 >> nMagic2;
+ rIStm.Seek( nActPos );
- rImpGraphic = ImpGraphic( aBmpEx );
+ rImpGraphic = ImpGraphic( aBmpEx );
- if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) )
- {
- delete rImpGraphic.mpAnimation;
- rImpGraphic.mpAnimation = new Animation;
- rIStm >> *rImpGraphic.mpAnimation;
+ if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) )
+ {
+ delete rImpGraphic.mpAnimation;
+ rImpGraphic.mpAnimation = new Animation;
+ rIStm >> *rImpGraphic.mpAnimation;
- // #108077# manually set loaded BmpEx to Animation
- // (which skips loading its BmpEx if already done)
- rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx);
+ // #108077# manually set loaded BmpEx to Animation
+ // (which skips loading its BmpEx if already done)
+ rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx);
+ }
+ else
+ rIStm.ResetError();
}
else
+ {
+ GDIMetaFile aMtf;
+
+ rIStm.Seek( nStmPos1 );
rIStm.ResetError();
- }
- else
- {
- GDIMetaFile aMtf;
+ rIStm >> aMtf;
- rIStm.Seek( nStmPos1 );
- rIStm.ResetError();
- rIStm >> aMtf;
+ if( !rIStm.GetError() )
+ rImpGraphic = aMtf;
+ else
+ rIStm.Seek( nStmPos1 );
+ }
- if( !rIStm.GetError() )
- rImpGraphic = aMtf;
- else
- rIStm.Seek( nStmPos1 );
+ rIStm.SetNumberFormatInt( nOldFormat );
}
-
- rIStm.SetNumberFormatInt( nOldFormat );
}
}
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 9c94811e0122..2c33d069b007 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -791,6 +791,7 @@ int OutputDevice::ImplGetGraphics() const
if ( mpGraphics )
{
mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp );
+ mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
return TRUE;
}
@@ -2735,15 +2736,14 @@ void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly
if( mbInitFillColor )
ImplInitFillColor();
- if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
{
-#ifdef UNX // b2dpolygon support not implemented yet on non-UNX platforms
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
::basegfx::B2DPolyPolygon aB2DPP = rB2DPolyPoly;
aB2DPP.transform( aTransform );
if( mpGraphics->DrawPolyPolygon( aB2DPP, 0.0, this ) )
return;
-#endif
}
// fallback to old polygon drawing if needed
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 4a682c4cecc9..19a9778ebb04 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5351,6 +5351,11 @@ void OutputDevice::SetAntialiasing( USHORT nMode )
{
mnAntialiasing = nMode;
mbInitFont = TRUE;
+
+ if(mpGraphics)
+ {
+ mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
+ }
}
if( mpAlphaVDev )
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 4e3bba322bc8..d4c24ff44e20 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -186,9 +186,9 @@ fprintf(stderr,"OD::DT( fT=%f, bAA=%d)\n",fTransparency,mnAntialiasing);//######
if( mbInitFillColor )
ImplInitFillColor();
- if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
{
-#ifdef UNX
// b2dpolygon support not implemented yet on non-UNX platforms
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
::basegfx::B2DPolyPolygon aB2DPP = rB2DPolyPoly;
@@ -209,7 +209,6 @@ fprintf(stderr,"OD::DT( fT=%f, bAA=%d)\n",fTransparency,mnAntialiasing);//######
#endif
return;
}
-#endif
}
// fallback to old polygon drawing if needed
@@ -265,7 +264,12 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
// try hard to draw it directly, because the emulation layers are slower
if( !pDisableNative
- && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw )
+#ifdef WIN32
+ // workaround bad dithering on remote displaying when using GDI+ with toolbar buttoin hilighting
+ && !rPolyPoly.IsRect()
+#endif
+ )
{
// prepare the graphics device
if( mbInitClipRegion )
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 339cc875256f..509ad4f725ce 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -81,7 +81,8 @@ SalFrameGeometry SalFrame::GetGeometry()
// ----------------------------------------------------------------------------
SalGraphics::SalGraphics()
- : m_nLayout( 0 )
+: m_nLayout( 0 ),
+ m_bAntiAliasB2DDraw(false)
{
// read global RTL settings
if( Application::GetSettings().GetLayoutRTL() )