tdf#89926 Fix OOXML gradient angle import

The rotation of the shape needs to be added to get the correct
angle. Due to this nDmlAngle can be twice as big. The conversion
to LO angles needs to be updated to prevent negative results.

Change-Id: I3a13cb268af41a55cd8b9df3084d028008aed4f2
Reviewed-on: https://gerrit.libreoffice.org/39648
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Paul Trojahn
2017-07-04 19:38:31 +02:00
committed by Miklos Vajna
parent 1c1783864a
commit 41f098c0a2
2 changed files with 4 additions and 4 deletions

View File

@@ -533,9 +533,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
// Now we have a potential border and a largest segment. Use those. // Now we have a potential border and a largest segment. Use those.
aGradient.Style = bSymmetric ? awt::GradientStyle_AXIAL : awt::GradientStyle_LINEAR; aGradient.Style = bSymmetric ? awt::GradientStyle_AXIAL : awt::GradientStyle_LINEAR;
sal_Int32 nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation; sal_Int32 nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) + nShapeRotation;
// convert DrawingML angle (in 1/60000 degrees) to API angle (in 1/10 degrees) // convert DrawingML angle (in 1/60000 degrees) to API angle (in 1/10 degrees)
aGradient.Angle = static_cast< sal_Int16 >( (4500 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 ); aGradient.Angle = static_cast< sal_Int16 >( (8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 );
Color aStartColor, aEndColor; Color aStartColor, aEndColor;
if( bSymmetric ) if( bSymmetric )
{ {

View File

@@ -88,7 +88,7 @@
</XShape> </XShape>
<XShape positionX="5291" positionY="7175" sizeX="1419" sizeY="1450" type="com.sun.star.drawing.CustomShape" name="Left Arrow 9" fontHeight="24.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="GRADIENT" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName=""> <XShape positionX="5291" positionY="7175" sizeX="1419" sizeY="1450" type="com.sun.star.drawing.CustomShape" name="Left Arrow 9" fontHeight="24.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="GRADIENT" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="b29dde" endColor="ffffff" angle="450" border="0" xOffset="0" yOffset="0" startIntensity="100" endIntensity="100" stepCount="0"/> <FillGradient style="LINEAR" startColor="b29dde" endColor="ffffff" angle="1350" border="0" xOffset="0" yOffset="0" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/> <FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
<FillBitmap width="32" height="32"/> <FillBitmap width="32" height="32"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/> <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
@@ -165,7 +165,7 @@
</XShape> </XShape>
<XShape positionX="18620" positionY="6171" sizeX="1418" sizeY="1450" type="com.sun.star.drawing.CustomShape" name="Left Arrow 13" fontHeight="24.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="GRADIENT" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName=""> <XShape positionX="18620" positionY="6171" sizeX="1418" sizeY="1450" type="com.sun.star.drawing.CustomShape" name="Left Arrow 13" fontHeight="24.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="GRADIENT" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="b29dde" endColor="ffffff" angle="2250" border="0" xOffset="0" yOffset="0" startIntensity="100" endIntensity="100" stepCount="0"/> <FillGradient style="LINEAR" startColor="b29dde" endColor="ffffff" angle="3150" border="0" xOffset="0" yOffset="0" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/> <FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
<FillBitmap width="32" height="32"/> <FillBitmap width="32" height="32"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/> <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>