incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1234749 - in /incubator/ooo/trunk/main/drawinglayer/source/primitive3d: sdrextrudelathetools3d.cxx sdrextrudeprimitive3d.cxx sdrlatheprimitive3d.cxx
Date Mon, 23 Jan 2012 11:22:50 GMT
Author: alg
Date: Mon Jan 23 11:22:50 2012
New Revision: 1234749

URL: http://svn.apache.org/viewvc?rev=1234749&view=rev
Log:
#118822# secured 3D geometry creation (slices) by subdividing the 2D source polyPolygon early

Modified:
    incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
    incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
    incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx

Modified: incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx?rev=1234749&r1=1234748&r2=1234749&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx (original)
+++ incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx Mon
Jan 23 11:22:50 2012
@@ -116,14 +116,14 @@ namespace
 		bool bCreateTextureCoordinates)
 	{
 		OSL_ENSURE(rPolA.count() == rPolB.count(), "impAddInBetweenFill: unequally sized polygons
(!)");
-		const sal_uInt32 nPolygonCount(rPolA.count());
+		const sal_uInt32 nPolygonCount(::std::min(rPolA.count(), rPolB.count()));
 
 		for(sal_uInt32 a(0L); a < nPolygonCount; a++)
 		{
 			const basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a));
 			const basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a));
 			OSL_ENSURE(aSubA.count() == aSubB.count(), "impAddInBetweenFill: unequally sized polygons
(!)");
-			const sal_uInt32 nPointCount(aSubA.count());
+			const sal_uInt32 nPointCount(::std::min(aSubA.count(), aSubB.count()));
 
 			if(nPointCount)
 			{
@@ -213,13 +213,14 @@ namespace
 		bool bSmoothHorizontalNormals)
 	{
 		OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons
(!)");
+		const sal_uInt32 nPolygonCount(::std::min(rPolA.count(), rPolB.count()));
 
-		for(sal_uInt32 a(0L); a < rPolA.count(); a++)
+		for(sal_uInt32 a(0L); a < nPolygonCount; a++)
 		{
 			basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a));
 			basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a));
 			OSL_ENSURE(aSubA.count() == aSubB.count(), "sdrExtrudePrimitive3D: unequally sized polygons
(!)");
-			const sal_uInt32 nPointCount(aSubA.count());
+			const sal_uInt32 nPointCount(::std::min(aSubA.count(), aSubB.count()));
 
 			if(nPointCount)
 			{
@@ -296,13 +297,14 @@ namespace
 	{
 		const double fWeightB(1.0 - fWeightA);
 		OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons
(!)");
+		const sal_uInt32 nPolygonCount(::std::min(rPolA.count(), rPolB.count()));
 
-		for(sal_uInt32 a(0L); a < rPolA.count(); a++)
+		for(sal_uInt32 a(0L); a < nPolygonCount; a++)
 		{
 			basegfx::B3DPolygon aSubA(rPolA.getB3DPolygon(a));
 			const basegfx::B3DPolygon aSubB(rPolB.getB3DPolygon(a));
 			OSL_ENSURE(aSubA.count() == aSubB.count(), "sdrExtrudePrimitive3D: unequally sized polygons
(!)");
-			const sal_uInt32 nPointCount(aSubA.count());
+			const sal_uInt32 nPointCount(::std::min(aSubA.count(), aSubB.count()));
 
 			for(sal_uInt32 b(0L); b < nPointCount; b++)
 			{
@@ -539,12 +541,19 @@ namespace drawinglayer
 						
 						for(sal_uInt32 d(0); d < nNumSlices; d++)
 						{
-                            OSL_ENSURE(nSlideSubPolygonCount == rSliceVector[d].getB3DPolyPolygon().count(),

-                                "Slice PolyPolygon with different Polygon count (!)");
-                            OSL_ENSURE(nSubPolygonPointCount == rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).count(),

-                                "Slice Polygon with different point count (!)");
-							aNew.append(rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).getB3DPoint(c));
-						}
+                            const bool bSamePolygonCount(nSlideSubPolygonCount == rSliceVector[d].getB3DPolyPolygon().count());
+                            const bool bSamePointCount(nSubPolygonPointCount == rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).count());
+
+                            if(bSamePolygonCount && bSamePointCount)
+                            {
+                                aNew.append(rSliceVector[d].getB3DPolyPolygon().getB3DPolygon(b).getB3DPoint(c));
+                            }
+                            else
+                            {
+                                OSL_ENSURE(bSamePolygonCount, "Slice PolyPolygon with different
Polygon count (!)");
+                                OSL_ENSURE(bSamePointCount, "Slice Polygon with different
point count (!)");
+                            }
+                        }
 
 						aNew.setClosed(bCloseHorLines);
 						aRetval.append(aNew);

Modified: incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx?rev=1234749&r1=1234748&r2=1234749&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx (original)
+++ incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx Mon
Jan 23 11:22:50 2012
@@ -369,7 +369,8 @@ namespace drawinglayer
 		{
 			// prepare the polygon. No double points, correct orientations and a correct
 			// outmost polygon are needed
-			maCorrectedPolyPolygon = getPolyPolygon();
+            // Also important: subdivide here to ensure equal point count for all slices
(!)
+			maCorrectedPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon());
 			maCorrectedPolyPolygon.removeDoublePoints();
 			maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);
 			maCorrectedPolyPolygon = basegfx::tools::correctOutmostPolygon(maCorrectedPolyPolygon);

Modified: incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx?rev=1234749&r1=1234748&r2=1234749&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx (original)
+++ incubator/ooo/trunk/main/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx Mon Jan
23 11:22:50 2012
@@ -213,6 +213,7 @@ namespace drawinglayer
 		{
 			// prepare the polygon. No double points, correct orientations and a correct
 			// outmost polygon are needed
+            // Also important: subdivide here to ensure equal point count for all slices
(!)
 			maCorrectedPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(getPolyPolygon());
 			maCorrectedPolyPolygon.removeDoublePoints();
 			maCorrectedPolyPolygon = basegfx::tools::correctOrientations(maCorrectedPolyPolygon);



Mime
View raw message