incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1335392 - in /incubator/ooo/trunk/main: svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdxcgv.cxx vcl/source/gdi/metaact.cxx vcl/source/gdi/outdev6.cxx vcl/source/gdi/outmap.cxx
Date Tue, 08 May 2012 09:27:10 GMT
Author: alg
Date: Tue May  8 09:27:10 2012
New Revision: 1335392

URL: http://svn.apache.org/viewvc?rev=1335392&view=rev
Log:
#119125# Added usage of the ClipRegion for the dismantle of Metafile to SdrObjects (ImpSdrGDIMetaFileImport)
as good as possible with Metafile usage

Modified:
    incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx
    incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx
    incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx
    incubator/ooo/trunk/main/vcl/source/gdi/outmap.cxx

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx?rev=1335392&r1=1335391&r2=1335392&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx Tue May  8 09:27:10 2012
@@ -68,6 +68,8 @@
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <svx/xlinjoit.hxx>
 #include <svx/xlndsit.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <svx/xbtmpit.hxx>
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -80,7 +82,11 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFi
 	maLineCap(com::sun::star::drawing::LineCap_BUTT),
 	maDash(XDASH_RECT, 0, 0, 0, 0, 0),
 	bFntDirty(sal_True),
-	bLastObjWasPolyWithoutLine(sal_False),bNoLine(sal_False),bNoFill(sal_False),bLastObjWasLine(sal_False)
+	bLastObjWasPolyWithoutLine(sal_False),
+    bNoLine(sal_False),
+    bNoFill(sal_False),
+    bLastObjWasLine(sal_False),
+    maClip()
 {
 	aVD.EnableOutput(sal_False);
 
@@ -93,6 +99,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFi
 	pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
 	pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END);
 	pModel=&rModel;
+    checkClip();
 }
 
 ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
@@ -378,9 +385,9 @@ void ImpSdrGDIMetaFileImport::SetAttribu
 	}
 }
 
-void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale )
+void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, sal_Bool bScale)
 {
-	if ( bScale && !aScaleRect.IsEmpty() )
+    if ( bScale && !aScaleRect.IsEmpty() )
     {
 		if ( bSize )
 			pObj->NbcResize( Point(), aScaleX, aScaleY );
@@ -388,61 +395,124 @@ void ImpSdrGDIMetaFileImport::InsertObj(
 			pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) );
 	}
 
-    // #i111954# check object for visibility
-    // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
-    bool bVisible(false);
-
-    if(pObj->HasLineStyle())
+    if(isClip())
     {
-        bVisible = true;
-    }
+        const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly());
+        const basegfx::B2DRange aOldRange(aPoly.getB2DRange());
+    	const SdrLayerID aOldLayer(pObj->GetLayer());
+    	const SfxItemSet aOldItemSet(pObj->GetMergedItemSet());
+        const SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
+        BitmapEx aBitmapEx;
 
-    if(!bVisible && pObj->HasFillStyle())
-    {
-        bVisible = true;
-    }
+        if(pSdrGrafObj)
+        {
+        	aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx();
+        }
 
-    if(!bVisible)
-    {
-        SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
+        SdrObject::Free(pObj);
 
-        if(pTextObj && pTextObj->HasText())
+        if(!aOldRange.isEmpty())
         {
-            bVisible = true;
+            // clip against ClipRegion
+            const basegfx::B2DPolyPolygon aNewPoly(
+                basegfx::tools::clipPolyPolygonOnPolyPolygon(
+                    aPoly, 
+                    maClip, 
+                    true, 
+                    aPoly.isClosed() ? false : true));
+            const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange());
+            
+            if(!aNewRange.isEmpty())
+            {
+                pObj = new SdrPathObj(
+                    aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN, 
+                    aNewPoly);
+            
+		        pObj->SetLayer(aOldLayer);
+		        pObj->SetMergedItemSet(aOldItemSet);
+
+                if(!!aBitmapEx)
+                {
+                    // aNewRange is inside of aOldRange and defines which part of aBitmapEx
is used
+                    const double fScaleX(aBitmapEx.GetSizePixel().Width() / (aOldRange.getWidth()
? aOldRange.getWidth() : 1.0));
+                    const double fScaleY(aBitmapEx.GetSizePixel().Height() / (aOldRange.getHeight()
? aOldRange.getHeight() : 1.0));
+                    basegfx::B2DRange aPixel(aNewRange);
+                    basegfx::B2DHomMatrix aTrans;
+
+                    aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY());
+                    aTrans.scale(fScaleX, fScaleY);
+                    aPixel.transform(aTrans);
+
+                    const BitmapEx aClippedBitmap(
+                        aBitmapEx, 
+                        Point(floor(std::max(0.0, aPixel.getMinX())), floor(std::max(0.0,
aPixel.getMinY()))), 
+                        Size(ceil(aPixel.getWidth()), ceil(aPixel.getHeight())));
+
+                    pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
+                    pObj->SetMergedItem(XFillBitmapItem(String(), aClippedBitmap.GetBitmap()));
+                }
+            }
         }
     }
 
-    if(!bVisible)
+    if(pObj)
     {
-        SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
+        // #i111954# check object for visibility
+        // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
+        bool bVisible(false);
 
-        if(pGrafObj)
+        if(pObj->HasLineStyle())
         {
-            // this may be refined to check if the graphic really is visible. It
-            // is here to ensure that graphic objects without fill, line and text
-            // get created
             bVisible = true;
         }
-    }
 
-    if(!bVisible)
-    {
-        SdrObject::Free(pObj);
-    }
-    else
-    {
-	    aTmpList.InsertObject( pObj );
-	    if ( HAS_BASE( SdrPathObj, pObj ) )
-	    {
-		    FASTBOOL bClosed=pObj->IsClosedObj();
-		    bLastObjWasPolyWithoutLine=bNoLine && bClosed;
-		    bLastObjWasLine=!bClosed;
-	    }
-	    else
-	    {
-		    bLastObjWasPolyWithoutLine = sal_False;
-		    bLastObjWasLine = sal_False;
-	    }
+        if(!bVisible && pObj->HasFillStyle())
+        {
+            bVisible = true;
+        }
+
+        if(!bVisible)
+        {
+            SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
+
+            if(pTextObj && pTextObj->HasText())
+            {
+                bVisible = true;
+            }
+        }
+
+        if(!bVisible)
+        {
+            SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
+
+            if(pGrafObj)
+            {
+                // this may be refined to check if the graphic really is visible. It
+                // is here to ensure that graphic objects without fill, line and text
+                // get created
+                bVisible = true;
+            }
+        }
+
+        if(!bVisible)
+        {
+            SdrObject::Free(pObj);
+        }
+        else
+        {
+	        aTmpList.InsertObject( pObj );
+	        if ( HAS_BASE( SdrPathObj, pObj ) )
+	        {
+		        FASTBOOL bClosed=pObj->IsClosedObj();
+		        bLastObjWasPolyWithoutLine=bNoLine && bClosed;
+		        bLastObjWasLine=!bClosed;
+	        }
+	        else
+	        {
+		        bLastObjWasPolyWithoutLine = sal_False;
+		        bLastObjWasLine = sal_False;
+	        }
+        }
     }
 }
 
@@ -501,14 +571,14 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction& rAct)
 {
-	SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
+    SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
 	SetAttributes(pRect);
 	InsertObj(pRect);
 }
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct)
 {
-	SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
+    SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
 	SetAttributes(pRect);
 	long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2;
 	if (nRad!=0) {
@@ -523,14 +593,14 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaEllipseAction& rAct)
 {
-	SdrCircObj* pCirc=new SdrCircObj(OBJ_CIRC,rAct.GetRect());
+    SdrCircObj* pCirc=new SdrCircObj(OBJ_CIRC,rAct.GetRect());
 	SetAttributes(pCirc);
 	InsertObj(pCirc);
 }
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction& rAct)
 {
-	Point aCenter(rAct.GetRect().Center());
+    Point aCenter(rAct.GetRect().Center());
 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CARC,rAct.GetRect(),nStart,nEnd);
@@ -540,7 +610,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction& rAct)
 {
-	Point aCenter(rAct.GetRect().Center());
+    Point aCenter(rAct.GetRect().Center());
 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
 	SdrCircObj* pCirc=new SdrCircObj(OBJ_SECT,rAct.GetRect(),nStart,nEnd);
@@ -550,7 +620,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 
 void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction& rAct)
 {
-	Point aCenter(rAct.GetRect().Center());
+    Point aCenter(rAct.GetRect().Center());
 	long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
 	long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
 	SdrCircObj* pCirc=new SdrCircObj(OBJ_CCUT,rAct.GetRect(),nStart,nEnd);
@@ -659,6 +729,32 @@ bool ImpSdrGDIMetaFileImport::CheckLastP
 	return false;
 }
 
+void ImpSdrGDIMetaFileImport::checkClip()
+{
+    if(aVD.IsClipRegion())
+    {
+        Region aRegion(aVD.GetClipRegion());
+
+        maClip = aRegion.ConvertToB2DPolyPolygon();
+
+        if(isClip())
+        {
+    		const basegfx::B2DHomMatrix aTransform(
+                basegfx::tools::createScaleTranslateB2DHomMatrix(
+                    fScaleX, 
+                    fScaleY, 
+                    aOfs.X(), 
+                    aOfs.Y()));
+	    	
+            maClip.transform(aTransform);
+        }
+    }
+}
+
+bool ImpSdrGDIMetaFileImport::isClip() const
+{
+    return !maClip.getB2DRange().isEmpty();
+}
 
 void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct )
 {
@@ -686,7 +782,7 @@ void ImpSdrGDIMetaFileImport::DoAction( 
 
 	if(bCreateLineObject)
 	{
-		SdrPathObj* pPath = new SdrPathObj(
+        SdrPathObj* pPath = new SdrPathObj(
 			aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
 			basegfx::B2DPolyPolygon(aSource));
 		nLineWidth = nNewLineWidth;
@@ -718,8 +814,7 @@ void ImpSdrGDIMetaFileImport::DoAction( 
 		{
 			// #i73407# make sure polygon is closed, it's a filled primitive
 			aSource.setClosed(true);
-
-			SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource));
+            SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource));
 			SetAttributes(pPath);
 			InsertObj(pPath, false);
 		}
@@ -740,8 +835,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 		{
 			// #i73407# make sure polygon is closed, it's a filled primitive
 			aSource.setClosed(true);
-
-			SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
+            SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
 			SetAttributes(pPath);
 			InsertObj(pPath, false);
 		}
@@ -841,7 +935,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 {
 	Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
 	aRect.Right()++; aRect.Bottom()++;
-	SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
+    SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
 	InsertObj(pGraf);
 }
 
@@ -849,7 +943,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 {
 	Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
 	aRect.Right()++; aRect.Bottom()++;
-	SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
+    SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
 	InsertObj(pGraf);
 }
 
@@ -857,7 +951,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 {
 	Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
 	aRect.Right()++; aRect.Bottom()++;
-	SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
+    SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
 	InsertObj(pGraf);
 }
 
@@ -865,7 +959,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M
 {
 	Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
 	aRect.Right()++; aRect.Bottom()++;
-	SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
+    SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
 	InsertObj(pGraf);
 }
 
@@ -884,7 +978,7 @@ void ImpSdrGDIMetaFileImport::DoAction( 
 		if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
 		{
 			const Hatch& rHatch = rAct.GetHatch();
-			SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
+            SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
 			SfxItemSet aHatchAttr(pModel->GetItemPool(),
 				XATTR_FILLSTYLE, XATTR_FILLSTYLE,
 				XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0 );
@@ -974,7 +1068,7 @@ void ImpSdrGDIMetaFileImport::DoAction( 
 				if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
 				{
 					const Gradient&	rGrad = pAct->GetGradient();
-					SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
+                    SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
 					SfxItemSet aGradAttr(pModel->GetItemPool(),
 					   XATTR_FILLSTYLE, XATTR_FILLSTYLE,
 					   XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0 );

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx?rev=1335392&r1=1335391&r2=1335392&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx Tue May  8 09:27:10 2012
@@ -101,7 +101,15 @@ protected:
 	// fuer Optimierung mehrerer Linien zu einer Polyline
 	sal_Bool                    bLastObjWasLine;
 
+    // clipregion
+    basegfx::B2DPolyPolygon     maClip;
+
 protected:
+    // ckeck for clip and evtl. fill maClip
+    void checkClip();
+    bool isClip() const;
+
+    // actions
 	void DoAction(MetaPixelAction			& rAct);
 	void DoAction(MetaPointAction			& rAct);
 	void DoAction(MetaLineAction			& rAct);
@@ -129,13 +137,13 @@ protected:
 	void DoAction(MetaTextFillColorAction	& rAct) { rAct.Execute(&aVD); }
 	void DoAction(MetaFontAction			& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True;
}
 	void DoAction(MetaTextAlignAction		& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True;
}
-	void DoAction(MetaClipRegionAction		& rAct) { rAct.Execute(&aVD); }
+	void DoAction(MetaClipRegionAction		& rAct) { rAct.Execute(&aVD); checkClip(); }
 	void DoAction(MetaRasterOpAction		& rAct) { rAct.Execute(&aVD); }
-	void DoAction(MetaPushAction			& rAct) { rAct.Execute(&aVD); }
-	void DoAction(MetaPopAction				& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True;
}
-	void DoAction(MetaMoveClipRegionAction	& rAct) { rAct.Execute(&aVD); }
-	void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
-	void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
+	void DoAction(MetaPushAction			& rAct) { rAct.Execute(&aVD); checkClip(); }
+	void DoAction(MetaPopAction				& rAct) { rAct.Execute(&aVD); bFntDirty=sal_True;
checkClip(); }
+	void DoAction(MetaMoveClipRegionAction	& rAct) { rAct.Execute(&aVD); checkClip();
}
+	void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); checkClip();
}
+	void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); checkClip();
}
 	void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
 
 	void ImportText( const Point& rPos, const XubString& rStr, const MetaAction&
rAct );

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=1335392&r1=1335391&r2=1335392&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdxcgv.cxx Tue May  8 09:27:10 2012
@@ -614,28 +614,28 @@ GDIMetaFile SdrExchangeView::GetMarkedOb
 
 		if( !aMtf.GetActionCount() )
 		{
-			VirtualDevice   aOut;
-            Size            aDummySize( 2, 2 );
-
-            aOut.SetOutputSizePixel( aDummySize );
-			aOut.EnableOutput( sal_False );
-			aOut.SetMapMode( aMap );
+			VirtualDevice aOut;
+            const Size aDummySize(2, 2);
 
+            aOut.SetOutputSizePixel(aDummySize);
+			aOut.EnableOutput(false);
+			aOut.SetMapMode(aMap);
             aMtf.Clear();
-			aMtf.Record( &aOut );
-
-			// Replace offset given formally to DrawMarkedObj and used at XOutDev with relative
-			// MapMode (which was also used in XOutDev in that case). Goal is to paint the object
-			// as if TopLeft point is (0,0)
-			const Fraction aNeutralFraction(1, 1);
-			const MapMode aRelativeMapMode(MAP_RELATIVE, Point(-aBound.Left(), -aBound.Top()), aNeutralFraction,
aNeutralFraction);
-			aOut.SetMapMode(aRelativeMapMode);
+			aMtf.Record(&aOut);
 
             DrawMarkedObj(aOut);
 
             aMtf.Stop();
 			aMtf.WindStart();
-		    aMtf.SetPrefMapMode( aMap );
+			
+            // moving the result is more reliable then setting a relative MapMode at the
VDev (used
+            // before), also see #i99268# in GetObjGraphic() below. Some draw actions at
+            // the OutDev are simply not handled correctly when a MapMode is set at the
+            // target devive, e.g. MetaFloatTransparentAction. Even the Move for this action
+            // was missing the manipulation of the embedded Metafile
+			aMtf.Move(-aBound.Left(), -aBound.Top());
+
+            aMtf.SetPrefMapMode( aMap );
 
 			// removed PrefSize extension. It is principially wrong to set a reduced size at
 			// the created MetaFile. The mentioned errors occurr at output time since the integer
@@ -718,8 +718,8 @@ Graphic SdrExchangeView::GetObjGraphic( 
 
 			// #i99268# replace the original offset from using XOutDev's SetOffset
 			// NOT (as tried with #i92760#) with another MapMode which gets recorded
-			// by the Metafile itself (what always leads to problems), but by hardly
-			// moving the result
+			// by the Metafile itself (what always leads to problems), but by
+			// moving the result directly
 			aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top());
 
     		aMtf.SetPrefMapMode( aMap );

Modified: incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx?rev=1335392&r1=1335391&r2=1335392&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx Tue May  8 09:27:10 2012
@@ -3816,6 +3816,9 @@ MetaAction* MetaFloatTransparentAction::
 void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
 {
 	maPoint.Move( nHorzMove, nVertMove );
+
+    // also neeed to move the content metafile
+    maMtf.Move( nHorzMove, nVertMove );
 }
 
 // ------------------------------------------------------------------------

Modified: incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx?rev=1335392&r1=1335391&r2=1335392&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx Tue May  8 09:27:10 2012
@@ -634,7 +634,10 @@ void OutputDevice::DrawTransparent( cons
 	const Color aBlack( COL_BLACK );
 
 	if( mpMetaFile )
+    {
+         // missing here is to map the data using the DeviceTransformation
 		mpMetaFile->AddAction( new MetaFloatTransparentAction( rMtf, rPos, rSize, rTransparenceGradient
) );
+    }
 
 	if( ( rTransparenceGradient.GetStartColor() == aBlack && rTransparenceGradient.GetEndColor()
== aBlack ) ||
 		( mnDrawMode & ( DRAWMODE_NOTRANSPARENCY ) ) )

Modified: incubator/ooo/trunk/main/vcl/source/gdi/outmap.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/outmap.cxx?rev=1335392&r1=1335391&r2=1335392&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/outmap.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/outmap.cxx Tue May  8 09:27:10 2012
@@ -1658,10 +1658,17 @@ Region OutputDevice::PixelToLogic( const
 		return rDeviceRegion;
 
 	Region			aRegion;
-	PolyPolygon*	pPolyPoly = rDeviceRegion.ImplGetImplRegion()->mpPolyPoly;
+	basegfx::B2DPolyPolygon* pB2DPolyPoly = rDeviceRegion.ImplGetImplRegion()->mpB2DPolyPoly;
+	PolyPolygon* pPolyPoly = pB2DPolyPoly ? 0 : rDeviceRegion.ImplGetImplRegion()->mpPolyPoly;
 
-	if ( pPolyPoly )
+    if ( pB2DPolyPoly ) // conversion with B2DPolyPolygon lost polygon-based ClipRegion
+    {
+		aRegion = Region( PixelToLogic( *pB2DPolyPoly ) );
+    }
+	else if ( pPolyPoly )
+    {
 		aRegion = Region( PixelToLogic( *pPolyPoly ) );
+    }
 	else
 	{
 		long				nX;



Mime
View raw message