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 2014/07/24 13:28:29 UTC
svn commit: r1613069 - in /openoffice/branches/AOO410/main/drawinglayer: ./
source/processor2d/vclmetafileprocessor2d.cxx
Author: alg
Date: Thu Jul 24 11:28:28 2014
New Revision: 1613069
URL: http://svn.apache.org/r1613069
Log:
i125300 enhanced handling of multiple ClipRegions in MetafileProcessor
Modified:
openoffice/branches/AOO410/main/drawinglayer/ (props changed)
openoffice/branches/AOO410/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
Propchange: openoffice/branches/AOO410/main/drawinglayer/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Jul 24 11:28:28 2014
@@ -0,0 +1,5 @@
+/openoffice/branches/AOO400/main/drawinglayer:1503684
+/openoffice/branches/ia2/main/drawinglayer:1417739-1541842
+/openoffice/branches/ooxml-osba/main/drawinglayer:1546391,1546395,1546574,1546934,1547030,1547392,1551920,1551954,1551958,1552283
+/openoffice/branches/rejuvenate01/main/drawinglayer:1480411,1534063,1534098,1536312,1549902,1560617
+/openoffice/trunk/main/drawinglayer:1571617,1571677,1572569,1572577,1574058,1574101,1575922,1576216,1576748,1578786,1579934,1580657,1580779,1581746,1581840,1582359,1582365,1582709,1583336,1583418,1583589,1583988,1585261,1586242,1586249,1586583,1587468,1589050,1592692,1592716,1594206,1595847,1595851,1595858,1596218,1596491,1596494,1597076,1597102,1597109,1599169,1599173-1599174,1600581,1600587,1600590,1600630,1600861,1600863,1600883,1602434,1602823,1602850,1603416,1603897,1612866
Modified: openoffice/branches/AOO410/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx?rev=1613069&r1=1613068&r2=1613069&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx (original)
+++ openoffice/branches/AOO410/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx Thu Jul 24 11:28:28 2014
@@ -1724,20 +1724,55 @@ namespace drawinglayer
// prepare new mask polygon and rescue current one
aMask.transform(maCurrentTransformation);
const basegfx::B2DPolyPolygon aLastClipPolyPolygon(maClipPolyPolygon);
-
+
if(maClipPolyPolygon.count())
{
- // there is already a clip polygon set; build clipped union of
- // current mask polygon and new one
- maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
- aMask,
- maClipPolyPolygon,
- true, // #i106516# we want the inside of aMask, not the outside
- false);
+ // due to the cost of PolyPolygon clipping and numerical reasons try first if the current
+ // and the new ClipRegion are ranges. If yes, processing can be simplified
+ if(basegfx::tools::isRectangle(aMask)
+ && basegfx::tools::isRectangle(maClipPolyPolygon))
+ {
+ // both ClipPolygons are rectangles
+ if(aMask.getB2DRange().equal(maClipPolyPolygon.getB2DRange()))
+ {
+ // equal -> no change in ClipRegion needed, leave
+ // maClipPolyPolygon unchanged
+ }
+ else
+ {
+ // not equal -> create new ClipRegion from the two ranges
+ basegfx::B2DRange aClipRange(aMask.getB2DRange());
+
+ aClipRange.intersect(maClipPolyPolygon.getB2DRange());
+
+ if(aClipRange.isEmpty())
+ {
+ // no common ClipRegion -> set empty ClipRegion, no content to show
+ maClipPolyPolygon.clear();
+ }
+ else
+ {
+ // use common ClipRegion as new ClipRegion
+ maClipPolyPolygon = basegfx::B2DPolyPolygon(
+ basegfx::tools::createPolygonFromRect(aClipRange));
+ }
+ }
+ }
+ else
+ {
+ // The current ClipRegion or the new one is not a rectangle;
+ // there is already a clip polygon set; build clipped union of
+ // current mask polygon and new one
+ maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
+ aMask,
+ maClipPolyPolygon,
+ true, // #i106516# we want the inside of aMask, not the outside
+ false);
+ }
}
else
{
- // use mask directly
+ // use new mask directly as ClipRegion
maClipPolyPolygon = aMask;
}
@@ -1746,8 +1781,13 @@ namespace drawinglayer
// set VCL clip region; subdivide before conversion to tools polygon. Subdivision necessary (!)
// Removed subdivision and fixed in Region::ImplPolyPolyRegionToBandRegionFunc() in VCL where
// the ClipRegion is built from the Polygon. A AdaptiveSubdivide on the source polygon was missing there
- mpOutputDevice->Push(PUSH_CLIPREGION);
- mpOutputDevice->SetClipRegion(Region(maClipPolyPolygon));
+ const bool bNewClipRegion(maClipPolyPolygon != aLastClipPolyPolygon);
+
+ if(bNewClipRegion)
+ {
+ mpOutputDevice->Push(PUSH_CLIPREGION);
+ mpOutputDevice->SetClipRegion(Region(maClipPolyPolygon));
+ }
// recursively paint content
// #121267# Only need to process sub-content when clip polygon is *not* empty.
@@ -1755,7 +1795,10 @@ namespace drawinglayer
process(rMaskCandidate.getChildren());
// restore VCL clip region
- mpOutputDevice->Pop();
+ if(bNewClipRegion)
+ {
+ mpOutputDevice->Pop();
+ }
}
// restore to rescued clip polygon