You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2012/02/24 17:11:12 UTC
svn commit: r1293316 - in /incubator/ooo/trunk/main:
chart2/source/controller/drawinglayer/ chart2/source/controller/main/
cui/source/tabpages/ sc/source/ui/app/ sd/source/ui/app/ sd/source/ui/view/
svx/inc/svx/ svx/source/svdraw/ svx/source/unodraw/ s...
Author: alg
Date: Fri Feb 24 16:11:11 2012
New Revision: 1293316
URL: http://svn.apache.org/viewvc?rev=1293316&view=rev
Log:
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles to bitmapEx, dynamically expanding needed bitmap size right and bottom dependent of having a hairline there. To check this, I adapted GDIMetaFile::GetBoundRect to be able to deliver the HairlineBoudRect inn parallell to the regular geometry one
Modified:
incubator/ooo/trunk/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
incubator/ooo/trunk/main/chart2/source/controller/main/ChartTransferable.cxx
incubator/ooo/trunk/main/cui/source/tabpages/tpline.cxx
incubator/ooo/trunk/main/sc/source/ui/app/drwtrans.cxx
incubator/ooo/trunk/main/sd/source/ui/app/sdxfer.cxx
incubator/ooo/trunk/main/sd/source/ui/view/drviews2.cxx
incubator/ooo/trunk/main/svx/inc/svx/svdxcgv.hxx
incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx
incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx
incubator/ooo/trunk/main/sw/source/core/frmedt/fecopy.cxx
incubator/ooo/trunk/main/sw/source/core/layout/paintfrm.cxx
incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx
incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx
incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
Modified: incubator/ooo/trunk/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx (original)
+++ incubator/ooo/trunk/main/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx Fri Feb 24 16:11:11 2012
@@ -190,7 +190,7 @@ Graphic ViewElementListProvider::GetSymb
if( pSymbolShapeProperties )
pObj->SetMergedItemSet(*pSymbolShapeProperties);
- GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
+ GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
Graphic aGraph(aMeta);
Size aSize = pObj->GetSnapRect().GetSize();
Modified: incubator/ooo/trunk/main/chart2/source/controller/main/ChartTransferable.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/chart2/source/controller/main/ChartTransferable.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/chart2/source/controller/main/ChartTransferable.cxx (original)
+++ incubator/ooo/trunk/main/chart2/source/controller/main/ChartTransferable.cxx Fri Feb 24 16:11:11 2012
@@ -60,7 +60,7 @@ ChartTransferable::ChartTransferable( Sd
pExchgView->MarkObj( pSelectedObj, pPv );
else
pExchgView->MarkAllObj( pPv );
- Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( sal_True ));
+ Graphic aGraphic( pExchgView->GetMarkedObjMetaFile(true));
m_xMetaFileGraphic.set( aGraphic.GetXGraphic());
if ( m_bDrawing )
{
Modified: incubator/ooo/trunk/main/cui/source/tabpages/tpline.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/cui/source/tabpages/tpline.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/cui/source/tabpages/tpline.cxx (original)
+++ incubator/ooo/trunk/main/cui/source/tabpages/tpline.cxx Fri Feb 24 16:11:11 2012
@@ -1042,7 +1042,7 @@ void SvxLineTabPage::Reset( const SfxIte
{
pObj->SetMergedItemSet(rOutAttrs);
}
- GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
+ GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
aSymbolGraphic=Graphic(aMeta);
aSymbolSize=pObj->GetSnapRect().GetSize();
@@ -1764,8 +1764,8 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl
pObj->SetMergedItemSet(rOutAttrs);
}
- Bitmap aBitmap(pView->GetAllMarkedBitmap());
- GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
+ BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx());
+ GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
pView->UnmarkAll();
pObj=pPage->RemoveObject(0);
SdrObject::Free(pObj);
@@ -1778,16 +1778,16 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl
pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
- Size aSize(aBitmap.GetSizePixel());
+ Size aSize(aBitmapEx.GetSizePixel());
if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
{
sal_Bool bWidth = aSize.Width() > aSize.Height();
double nScale = bWidth ?
(double)MAX_BMP_WIDTH / (double)aSize.Width():
(double)MAX_BMP_HEIGHT / (double)aSize.Height();
- aBitmap.Scale(nScale, nScale);
+ aBitmapEx.Scale(nScale, nScale);
}
- Image aImage(aBitmap);
+ Image aImage(aBitmapEx);
pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
}
aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
Modified: incubator/ooo/trunk/main/sc/source/ui/app/drwtrans.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/app/drwtrans.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/app/drwtrans.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/app/drwtrans.cxx Fri Feb 24 16:11:11 2012
@@ -435,9 +435,9 @@ sal_Bool ScDrawTransferObj::GetData( con
DBG_ASSERT( pPv, "pPv not there..." );
aView.MarkAllObj( pPv );
if ( nFormat == SOT_FORMAT_GDIMETAFILE )
- bOK = SetGDIMetaFile( aView.GetAllMarkedMetaFile( sal_True ), rFlavor );
+ bOK = SetGDIMetaFile( aView.GetMarkedObjMetaFile(true), rFlavor );
else
- bOK = SetBitmap( aView.GetAllMarkedBitmap( sal_True ), rFlavor );
+ bOK = SetBitmap( aView.GetMarkedObjBitmapEx(true).GetBitmap(), rFlavor );
}
else if ( nFormat == SOT_FORMATSTR_ID_SVXB )
{
Modified: incubator/ooo/trunk/main/sd/source/ui/app/sdxfer.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/ui/app/sdxfer.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/ui/app/sdxfer.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/ui/app/sdxfer.cxx Fri Feb 24 16:11:11 2012
@@ -546,12 +546,12 @@ sal_Bool SdTransferable::GetData( const
else if( nFormat == FORMAT_GDIMETAFILE )
{
if( mpSdViewIntern )
- bOK = SetGDIMetaFile( mpSdViewIntern->GetAllMarkedMetaFile( sal_True ), rFlavor );
+ bOK = SetGDIMetaFile( mpSdViewIntern->GetMarkedObjMetaFile(true), rFlavor );
}
else if( nFormat == FORMAT_BITMAP )
{
if( mpSdViewIntern )
- bOK = SetBitmap( mpSdViewIntern->GetAllMarkedBitmap( sal_True ), rFlavor );
+ bOK = SetBitmap( mpSdViewIntern->GetMarkedObjBitmapEx(true).GetBitmap(), rFlavor );
}
else if( ( nFormat == FORMAT_STRING ) && mpBookmark )
{
Modified: incubator/ooo/trunk/main/sd/source/ui/view/drviews2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/ui/view/drviews2.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/ui/view/drviews2.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/ui/view/drviews2.cxx Fri Feb 24 16:11:11 2012
@@ -705,7 +705,7 @@ void DrawViewShell::FuTemporary(SfxReque
{
case SID_CONVERT_TO_METAFILE:
{
- GDIMetaFile aMetaFile(mpDrawView->GetAllMarkedMetaFile ());
+ GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile());
aGraphic = Graphic(aMetaFile);
}
break;
@@ -713,9 +713,9 @@ void DrawViewShell::FuTemporary(SfxReque
{
bool bDone(false);
- // I have to get the image here directly since GetAllMarkedBitmap works
+ // I have to get the image here directly since GetMarkedObjBitmapEx works
// based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
- // channel. Argh! GetAllMarkedBitmap itself is too widely used to safely
+ // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
// change that, e.g. in the exchange formats. For now I can only add this
// exception to get good results for Svgs. This is how the code gets more
// and more crowded, at last I made a remark for myself to change this
@@ -733,8 +733,7 @@ void DrawViewShell::FuTemporary(SfxReque
if(!bDone)
{
- Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
- aGraphic = Graphic(aBitmap);
+ aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx());
}
}
break;
Modified: incubator/ooo/trunk/main/svx/inc/svx/svdxcgv.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/inc/svx/svdxcgv.hxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/inc/svx/svdxcgv.hxx (original)
+++ incubator/ooo/trunk/main/svx/inc/svx/svdxcgv.hxx Fri Feb 24 16:11:11 2012
@@ -71,11 +71,11 @@ public:
// Alle markierten Objekte in ein Metafile stecken. Z.Zt. noch etwas
// buggee (Offset..., Fremdgrafikobjekte (SdrGrafObj), Virtuelle
// Objektkopien (SdrVirtObj) mit Ankerpos<>(0,0)).
- virtual GDIMetaFile GetMarkedObjMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const;
+ GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked = false) const;
// Alle markierten Objekte auf eine Bitmap malen. Diese hat die Farbtiefe
// und Aufloesung des Bildschirms.
- BitmapEx GetMarkedObjBitmap(bool bNoVDevIfOneBmpMarked = false) const;
+ BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked = false) const;
// Alle markierten Objekte in ein neues Model kopieren. Dieses neue Model
// hat dann genau eine Page. Das Flag PageNotValid an diesem Model ist
@@ -89,8 +89,6 @@ public:
// der Default-Layer zugewiesen (Layer 0, (dokumentglobaler Standardlayer).
virtual SdrModel* GetMarkedObjModel() const;
- GDIMetaFile GetAllMarkedMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const { return GetMarkedObjMetaFile(bNoVDevIfOneMtfMarked); }
- Bitmap GetAllMarkedBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const { return GetMarkedObjBitmap(bNoVDevIfOneBmpMarked).GetBitmap(); }
Graphic GetAllMarkedGraphic() const;
SdrModel* GetAllMarkedModel() const { return GetMarkedObjModel(); }
Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx Fri Feb 24 16:11:11 2012
@@ -529,7 +529,7 @@ void SdrExchangeView::ImpPasteObject(Sdr
////////////////////////////////////////////////////////////////////////////////////////////////////
-BitmapEx SdrExchangeView::GetMarkedObjBitmap( bool bNoVDevIfOneBmpMarked ) const
+BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked) const
{
BitmapEx aBmp;
@@ -560,7 +560,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBi
if( !aBmp )
{
- const Graphic aGraphic( GetMarkedObjMetaFile( bNoVDevIfOneBmpMarked ) );
+ const Graphic aGraphic(GetMarkedObjMetaFile(bNoVDevIfOneBmpMarked));
// #i102089# support user's settings of AA and LineSnap when the MetaFile gets
// rasterconverted to a bitmap
@@ -580,7 +580,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBi
// -----------------------------------------------------------------------------
-GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile( sal_Bool bNoVDevIfOneMtfMarked ) const
+GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) const
{
GDIMetaFile aMtf;
@@ -659,7 +659,7 @@ Graphic SdrExchangeView::GetAllMarkedGra
if( ( 1 == GetMarkedObjectCount() ) && GetSdrMarkByIndex( 0 ) )
aRet = SdrExchangeView::GetObjGraphic( pMod, GetMarkedObjectByIndex( 0 ) );
else
- aRet = GetMarkedObjMetaFile( sal_False );
+ aRet = GetMarkedObjMetaFile(false);
}
return aRet;
Modified: incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/unoshape.cxx Fri Feb 24 16:11:11 2012
@@ -752,7 +752,7 @@ uno::Any SvxShape::GetBitmap( sal_Bool b
aRect.Justify();
Size aSize(aRect.GetSize());
- GDIMetaFile aMtf( pView->GetAllMarkedMetaFile() );
+ GDIMetaFile aMtf( pView->GetMarkedObjMetaFile() );
if( bMetaFile )
{
SvMemoryStream aDestStrm( 65535, 65535 );
Modified: incubator/ooo/trunk/main/sw/source/core/frmedt/fecopy.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/frmedt/fecopy.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/frmedt/fecopy.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/frmedt/fecopy.cxx Fri Feb 24 16:11:11 2012
@@ -1298,9 +1298,9 @@ sal_Bool SwFEShell::GetDrawObjGraphic( s
}
}
else if( SOT_FORMAT_GDIMETAFILE == nFmt )
- rGrf = Imp()->GetDrawView()->GetAllMarkedMetaFile();
+ rGrf = Imp()->GetDrawView()->GetMarkedObjMetaFile();
else if( SOT_FORMAT_BITMAP == nFmt )
- rGrf = Imp()->GetDrawView()->GetAllMarkedBitmap();
+ rGrf = Imp()->GetDrawView()->GetMarkedObjBitmapEx();
}
return bConvert;
}
Modified: incubator/ooo/trunk/main/sw/source/core/layout/paintfrm.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/layout/paintfrm.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/layout/paintfrm.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/layout/paintfrm.cxx Fri Feb 24 16:11:11 2012
@@ -6759,7 +6759,7 @@ Graphic SwDrawFrmFmt::MakeGraphic( Image
SdrView *pView = new SdrView( pMod );
SdrPageView *pPgView = pView->ShowSdrPage(pView->GetModel()->GetPage(0));
pView->MarkObj( pObj, pPgView );
- aRet = pView->GetMarkedObjBitmap();
+ aRet = pView->GetMarkedObjBitmapEx();
pView->HideSdrPage();
delete pView;
}
Modified: incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/vcl/gdimtf.hxx Fri Feb 24 16:11:11 2012
@@ -167,7 +167,7 @@ public:
* - coordinates of actions will be transformed to preferred mapmode
* - the returned rectangle is relative to the preferred mapmode of the metafile
*/
- Rectangle GetBoundRect( OutputDevice& i_rReference );
+ Rectangle GetBoundRect( OutputDevice& i_rReference, Rectangle* pHairline = 0 ) const;
void Adjust( short nLuminancePercent = 0, short nContrastPercent = 0,
short nChannelRPercent = 0, short nChannelGPercent = 0,
Modified: incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/gdimtf.cxx Fri Feb 24 16:11:11 2012
@@ -1476,7 +1476,8 @@ void GDIMetaFile::Rotate( long nAngle10
static void ImplActionBounds( Rectangle& o_rOutBounds,
const Rectangle& i_rInBounds,
- const std::vector<Rectangle>& i_rClipStack )
+ const std::vector<Rectangle>& i_rClipStack,
+ Rectangle* o_pHairline )
{
Rectangle aBounds( i_rInBounds );
if( ! i_rInBounds.IsEmpty() && ! i_rClipStack.empty() && ! i_rClipStack.back().IsEmpty() )
@@ -1487,10 +1488,18 @@ static void ImplActionBounds( Rectangle&
o_rOutBounds.Union( aBounds );
else
o_rOutBounds = aBounds;
+
+ if(o_pHairline)
+ {
+ if( ! o_pHairline->IsEmpty() )
+ o_pHairline->Union( aBounds );
+ else
+ *o_pHairline = aBounds;
+ }
}
}
-Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference )
+Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHairline ) const
{
GDIMetaFile aMtf;
VirtualDevice aMapVDev( i_rReference );
@@ -1503,9 +1512,18 @@ Rectangle GDIMetaFile::GetBoundRect( Out
Rectangle aBound;
- for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() )
+ if(pHairline)
{
+ *pHairline = Rectangle();
+ }
+
+ const sal_uLong nCount(GetActionCount());
+
+ for(sal_uLong a(0); a < nCount; a++)
+ {
+ MetaAction* pAction = GetAction(a);
const sal_uInt16 nActionType = pAction->GetType();
+ Rectangle* pUseHairline = (pHairline && aMapVDev.IsLineColor()) ? pHairline : 0;
switch( nActionType )
{
@@ -1515,7 +1533,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
ImplActionBounds( aBound,
Rectangle( aMapVDev.LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ),
aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
- aClipStack );
+ aClipStack, pUseHairline );
}
break;
@@ -1525,7 +1543,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
ImplActionBounds( aBound,
Rectangle( aMapVDev.LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ),
aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
- aClipStack );
+ aClipStack, pUseHairline );
}
break;
@@ -1535,28 +1553,39 @@ Rectangle GDIMetaFile::GetBoundRect( Out
Point aP1( pAct->GetStartPoint() ), aP2( pAct->GetEndPoint() );
Rectangle aRect( aP1, aP2 );
aRect.Justify();
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+
+ if(pUseHairline)
+ {
+ const LineInfo& rLineInfo = pAct->GetLineInfo();
+
+ if(0 != rLineInfo.GetWidth())
+ {
+ pUseHairline = 0;
+ }
+ }
+
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
case( META_RECT_ACTION ):
{
MetaRectAction* pAct = (MetaRectAction*) pAction;
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
case( META_ROUNDRECT_ACTION ):
{
MetaRoundRectAction* pAct = (MetaRoundRectAction*) pAction;
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
case( META_ELLIPSE_ACTION ):
{
MetaEllipseAction* pAct = (MetaEllipseAction*) pAction;
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1565,7 +1594,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
MetaArcAction* pAct = (MetaArcAction*) pAction;
// FIXME: this is imprecise
// e.g. for small arcs the whole rectangle is WAY too large
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1574,7 +1603,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
MetaPieAction* pAct = (MetaPieAction*) pAction;
// FIXME: this is imprecise
// e.g. for small arcs the whole rectangle is WAY too large
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1583,7 +1612,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
MetaChordAction* pAct = (MetaChordAction*) pAction;
// FIXME: this is imprecise
// e.g. for small arcs the whole rectangle is WAY too large
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1591,7 +1620,18 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction;
Rectangle aRect( pAct->GetPolygon().GetBoundRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+
+ if(pUseHairline)
+ {
+ const LineInfo& rLineInfo = pAct->GetLineInfo();
+
+ if(0 != rLineInfo.GetWidth())
+ {
+ pUseHairline = 0;
+ }
+ }
+
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1599,7 +1639,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaPolygonAction* pAct = (MetaPolygonAction*) pAction;
Rectangle aRect( pAct->GetPolygon().GetBoundRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1607,7 +1647,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction;
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1619,7 +1659,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() );
Point aPt( pAct->GetPoint() );
aRect.Move( aPt.X(), aPt.Y() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1632,7 +1672,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
0, pAct->GetDXArray() );
Point aPt( pAct->GetPoint() );
aRect.Move( aPt.X(), aPt.Y() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1645,7 +1685,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
pAct->GetWidth(), NULL );
Point aPt( pAct->GetPoint() );
aRect.Move( aPt.X(), aPt.Y() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1661,7 +1701,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
Point aPt( pAct->GetStartPoint() );
aRect.Move( aPt.X(), aPt.Y() );
aRect.Right() = aRect.Left() + pAct->GetWidth();
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1669,7 +1709,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1677,7 +1717,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1685,7 +1725,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction;
Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1693,7 +1733,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1701,7 +1741,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaGradientAction* pAct = (MetaGradientAction*) pAction;
Rectangle aRect( pAct->GetRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1709,7 +1749,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaGradientExAction* pAct = (MetaGradientExAction*) pAction;
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1723,7 +1763,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaHatchAction* pAct = (MetaHatchAction*) pAction;
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1731,7 +1771,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaTransparentAction* pAct = (MetaTransparentAction*) pAction;
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1756,7 +1796,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
// transform the rect to current VDev state
aRect = aMapVDev.LogicToLogic( aRect, aTransMtf.GetPrefMapMode(), aMapVDev.GetMapMode() );
- ImplActionBounds( aBound, aRect, aClipStack );
+ ImplActionBounds( aBound, aRect, aClipStack, 0 );
}
break;
@@ -1764,7 +1804,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaEPSAction* pAct = (MetaEPSAction*) pAction;
Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1804,7 +1844,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaBmpAction* pAct = (MetaBmpAction*) pAction;
Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1812,7 +1852,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaBmpExAction* pAct = (MetaBmpExAction*) pAction;
Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1820,7 +1860,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaMaskAction* pAct = (MetaMaskAction*) pAction;
Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1828,7 +1868,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction;
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1836,7 +1876,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction;
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1844,7 +1884,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction;
Rectangle aRect( pAct->GetRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1852,7 +1892,7 @@ Rectangle GDIMetaFile::GetBoundRect( Out
{
MetaTextRectAction* pAct = (MetaTextRectAction*) pAction;
Rectangle aRect( pAct->GetRect() );
- ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack );
+ ImplActionBounds( aBound, aMapVDev.LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
Modified: incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx?rev=1293316&r1=1293315&r2=1293316&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx Fri Feb 24 16:11:11 2012
@@ -559,41 +559,60 @@ Bitmap ImpGraphic::ImplGetBitmap(const G
}
else if( ( meType != GRAPHIC_DEFAULT ) && ImplIsSupportedGraphic() )
{
- // use corner points of graphic to determine the pixel
- // extent of the graphic (rounding errors are possible else)
- VirtualDevice aVDev;
- const Point aNullPt;
- const Point aTLPix( aVDev.LogicToPixel( aNullPt, maMetaFile.GetPrefMapMode() ) );
- const Point aBRPix( aVDev.LogicToPixel( Point( maMetaFile.GetPrefSize().Width() - 1, maMetaFile.GetPrefSize().Height() - 1 ), maMetaFile.GetPrefMapMode() ) );
- Size aDrawSize( aVDev.LogicToPixel( maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode() ) );
- Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 );
+ // calculate size
+ VirtualDevice aVDev;
+ Size aDrawSize(aVDev.LogicToPixel(maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode()));
if(rParameters.getSizePixel().Width() && rParameters.getSizePixel().Height())
{
- aDrawSize.Width() = FRound((double)rParameters.getSizePixel().Width() *
- (double)aDrawSize.Width() / (double)aSizePix.Width());
- aDrawSize.Height() = FRound((double)rParameters.getSizePixel().Height() *
- (double)aDrawSize.Height() / (double)aSizePix.Height());
+ // apply given size if exists
+ aDrawSize = rParameters.getSizePixel();
+ }
+
+ if(aDrawSize.Width() && aDrawSize.Height() && !rParameters.getUnlimitedSize()
+ && (aDrawSize.Width() > GRAPHIC_MTFTOBMP_MAXEXT || aDrawSize.Height() > GRAPHIC_MTFTOBMP_MAXEXT))
+ {
+ // limit bitmap size to a maximum of GRAPHIC_MTFTOBMP_MAXEXT x GRAPHIC_MTFTOBMP_MAXEXT
+ double fWH((double)aDrawSize.Width() / (double)aDrawSize.Height());
- aSizePix = rParameters.getSizePixel();
+ if(fWH <= 1.0)
+ {
+ aDrawSize.setWidth(basegfx::fround(GRAPHIC_MTFTOBMP_MAXEXT * fWH));
+ aDrawSize.setHeight(GRAPHIC_MTFTOBMP_MAXEXT);
+ }
+ else
+ {
+ aDrawSize.setWidth(GRAPHIC_MTFTOBMP_MAXEXT);
+ aDrawSize.setHeight(basegfx::fround(GRAPHIC_MTFTOBMP_MAXEXT / fWH));
+ }
}
- if( aSizePix.Width() && aSizePix.Height() && !rParameters.getUnlimitedSize()
- && (aSizePix.Width() > GRAPHIC_MTFTOBMP_MAXEXT || aSizePix.Height() > GRAPHIC_MTFTOBMP_MAXEXT))
- {
- const Size aOldSizePix( aSizePix );
- double fWH = (double) aSizePix.Width() / aSizePix.Height();
+ // calculate pixel size. Normally, it's the same as aDrawSize, but may
+ // need to be extended when hairlines are on the right or bottom edge
+ Size aPixelSize(aDrawSize);
- if( fWH <= 1.0 )
- aSizePix.Width() = FRound( GRAPHIC_MTFTOBMP_MAXEXT * fWH ), aSizePix.Height() = GRAPHIC_MTFTOBMP_MAXEXT;
- else
- aSizePix.Width() = GRAPHIC_MTFTOBMP_MAXEXT, aSizePix.Height() = FRound( GRAPHIC_MTFTOBMP_MAXEXT / fWH );
+ if(GRAPHIC_GDIMETAFILE == ImplGetType())
+ {
+ // get hairline and full bound rect
+ Rectangle aHairlineRect;
+ const Rectangle aRect(maMetaFile.GetBoundRect(aVDev, &aHairlineRect));
- aDrawSize.Width() = FRound( ( (double) aDrawSize.Width() * aSizePix.Width() ) / aOldSizePix.Width() );
- aDrawSize.Height() = FRound( ( (double) aDrawSize.Height() * aSizePix.Height() ) / aOldSizePix.Height() );
- }
+ if(!aRect.IsEmpty() && !aHairlineRect.IsEmpty())
+ {
+ // expand if needed to allow bottom and right hairlines to be added
+ if(aRect.Right() == aHairlineRect.Right())
+ {
+ aPixelSize.setWidth(aPixelSize.getWidth() + 1);
+ }
+
+ if(aRect.Bottom() == aHairlineRect.Bottom())
+ {
+ aPixelSize.setHeight(aPixelSize.getHeight() + 1);
+ }
+ }
+ }
- if( aVDev.SetOutputSizePixel( aSizePix ) )
+ if(aVDev.SetOutputSizePixel(aPixelSize))
{
if(rParameters.getAntiAliase())
{
@@ -605,8 +624,8 @@ Bitmap ImpGraphic::ImplGetBitmap(const G
aVDev.SetAntialiasing(aVDev.GetAntialiasing() | ANTIALIASING_PIXELSNAPHAIRLINE);
}
- ImplDraw( &aVDev, aNullPt, aDrawSize );
- aRetBmp = aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() );
+ ImplDraw( &aVDev, Point(), aDrawSize );
+ aRetBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
}
}