summaryrefslogtreecommitdiff
path: root/svx/source/customshapes
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@novell.com>2010-10-26 23:04:44 +0200
committerThorsten Behrens <tbehrens@novell.com>2010-10-26 23:04:44 +0200
commit0e059638d80793931dc5c6fb9fdf9bb4466abadf (patch)
tree1c8fd2e038a97a74cd0b03a95dfaa5ac80c8f13c /svx/source/customshapes
parent045822069090d8a37aab656e2875f4d9437e133f (diff)
Better shading algo for customshapes, better gradients
Some custom shapes can have shaded parts, like for example 3d can, the bevelled buttons etc. Those shaded colors are calculated internally, and have been way off at times. Now using HSV color space & the originally documented luminance modifications in steps of 10 percent. Compared to MSO, still no 100 percent match, but that seems due to gamma correction there. Additionally, starting with MSO12, gradients on those shaded surfaces look much better; adapted code to display gradients equally nice. Note that most of this patch also applies to ooxml import; note as well that customshapes from *all* kind of input files (including ODF docs) now look different than before; no real way of changing this in a backward-compatible way, since behaviour of custom shapes is mandated (mostly) by internal tables, and not stored in a file. Applies patches/dev300/ppt-customshape-shading-fix (much of it was accepted at OOo already, via i#102797) Applies patches/dev300/ppt-customshape-shading-fix.diff: fixed prob with line arrows - the extra-added single point polygons lead to extra arrows randomly around the custom shape. i#105654
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx16
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx2
2 files changed, 17 insertions, 1 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 4e4322ba8f..f67449b858 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1735,6 +1735,22 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
if(aNewB2DPolyPolygon.count())
{
+ if( !bLineGeometryNeededOnly )
+ {
+ // hack aNewB2DPolyPolygon to fill logic rect - this is
+ // needed to produce gradient fills that look like mso
+ aNewB2DPolygon.clear();
+ aNewB2DPolygon.append(basegfx::B2DPoint(0,0));
+ aNewB2DPolygon.setClosed(true);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+
+ aNewB2DPolygon.clear();
+ aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(),
+ aLogicRect.GetHeight()));
+ aNewB2DPolygon.setClosed(true);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
+
// #i37011#
bool bForceCreateTwoObjects(false);
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index f0ffcef031..dabe89d2ff 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -633,7 +633,7 @@ void InsertMissingOutlinePoints( const Polygon& /*rOutlinePoly*/, const std::vec
void GetPoint( const Polygon& rPoly, const std::vector< double >& rDistances, const double& fX, double& fx1, double& fy1 )
{
fy1 = fx1 = 0.0;
- if ( rPoly.GetSize() )
+ if ( rPoly.GetSize() > 1 )
{
std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fX );
sal_uInt16 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );