vclmetafileprocessor2d.cxx (6633521b) vclmetafileprocessor2d.cxx (54d1d3e3)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 1727 unchanged lines hidden (view full) ---

1736 {
1737 basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
1738
1739 if(aMask.count())
1740 {
1741 // prepare new mask polygon and rescue current one
1742 aMask.transform(maCurrentTransformation);
1743 const basegfx::B2DPolyPolygon aLastClipPolyPolygon(maClipPolyPolygon);
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 1727 unchanged lines hidden (view full) ---

1736 {
1737 basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
1738
1739 if(aMask.count())
1740 {
1741 // prepare new mask polygon and rescue current one
1742 aMask.transform(maCurrentTransformation);
1743 const basegfx::B2DPolyPolygon aLastClipPolyPolygon(maClipPolyPolygon);
1744
1744
1745 if(maClipPolyPolygon.count())
1746 {
1745 if(maClipPolyPolygon.count())
1746 {
1747 // due to the cost of PolyPolygon clipping and numerical reasons try first if the current
1748 // and the new ClipRegion are ranges. If yes, processing can be simplified
1749 if(basegfx::tools::isRectangle(aMask)
1750 && basegfx::tools::isRectangle(maClipPolyPolygon))
1751 {
1752 // both ClipPolygons are rectangles
1753 if(aMask.getB2DRange().equal(maClipPolyPolygon.getB2DRange()))
1754 {
1755 // equal -> no change in ClipRegion needed, leave
1756 // maClipPolyPolygon unchanged
1757 }
1758 else
1759 {
1760 // not equal -> create new ClipRegion from the two ranges
1761 basegfx::B2DRange aClipRange(aMask.getB2DRange());
1762
1763 aClipRange.intersect(maClipPolyPolygon.getB2DRange());
1764
1765 if(aClipRange.isEmpty())
1766 {
1767 // no common ClipRegion -> set empty ClipRegion, no content to show
1768 maClipPolyPolygon.clear();
1769 }
1770 else
1771 {
1772 // use common ClipRegion as new ClipRegion
1773 maClipPolyPolygon = basegfx::B2DPolyPolygon(
1774 basegfx::tools::createPolygonFromRect(aClipRange));
1775 }
1776 }
1777 }
1778 else
1779 {
1780 // The current ClipRegion or the new one is not a rectangle;
1781 // there is already a clip polygon set; build clipped union of
1782 // current mask polygon and new one
1783 maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
1784 aMask,
1785 maClipPolyPolygon,
1786 true, // #i106516# we want the inside of aMask, not the outside
1787 false);
1788 }
1747 // there is already a clip polygon set; build clipped union of
1748 // current mask polygon and new one
1749 maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(
1750 aMask,
1751 maClipPolyPolygon,
1752 true, // #i106516# we want the inside of aMask, not the outside
1753 false);
1789 }
1790 else
1791 {
1754 }
1755 else
1756 {
1792 // use new mask directly as ClipRegion
1757 // use mask directly
1793 maClipPolyPolygon = aMask;
1794 }
1795
1796 if(maClipPolyPolygon.count())
1797 {
1798 // set VCL clip region; subdivide before conversion to tools polygon. Subdivision necessary (!)
1799 // Removed subdivision and fixed in Region::ImplPolyPolyRegionToBandRegionFunc() in VCL where
1800 // the ClipRegion is built from the Polygon. A AdaptiveSubdivide on the source polygon was missing there
1758 maClipPolyPolygon = aMask;
1759 }
1760
1761 if(maClipPolyPolygon.count())
1762 {
1763 // set VCL clip region; subdivide before conversion to tools polygon. Subdivision necessary (!)
1764 // Removed subdivision and fixed in Region::ImplPolyPolyRegionToBandRegionFunc() in VCL where
1765 // the ClipRegion is built from the Polygon. A AdaptiveSubdivide on the source polygon was missing there
1801 const bool bNewClipRegion(maClipPolyPolygon != aLastClipPolyPolygon);
1766 mpOutputDevice->Push(PUSH_CLIPREGION);
1767 mpOutputDevice->SetClipRegion(Region(maClipPolyPolygon));
1802
1768
1803 if(bNewClipRegion)
1804 {
1805 mpOutputDevice->Push(PUSH_CLIPREGION);
1806 mpOutputDevice->SetClipRegion(Region(maClipPolyPolygon));
1807 }
1808
1809 // recursively paint content
1810 // #121267# Only need to process sub-content when clip polygon is *not* empty.
1811 // If it is empty, the clip is empty and there can be nothing inside.
1812 process(rMaskCandidate.getChildren());
1813
1814 // restore VCL clip region
1769 // recursively paint content
1770 // #121267# Only need to process sub-content when clip polygon is *not* empty.
1771 // If it is empty, the clip is empty and there can be nothing inside.
1772 process(rMaskCandidate.getChildren());
1773
1774 // restore VCL clip region
1815 if(bNewClipRegion)
1816 {
1817 mpOutputDevice->Pop();
1818 }
1775 mpOutputDevice->Pop();
1819 }
1820
1821 // restore to rescued clip polygon
1822 maClipPolyPolygon = aLastClipPolyPolygon;
1823 }
1824 else
1825 {
1826 // no mask, no clipping. recursively paint content

--- 383 unchanged lines hidden ---
1776 }
1777
1778 // restore to rescued clip polygon
1779 maClipPolyPolygon = aLastClipPolyPolygon;
1780 }
1781 else
1782 {
1783 // no mask, no clipping. recursively paint content

--- 383 unchanged lines hidden ---