Kaydet (Commit) d76c498d authored tarafından Luboš Luňák's avatar Luboš Luňák

fix complex transformation in CanvasHelper::fillTexturedPolyPolygon()

There's pretty much the same code in CanvasHelper::fillTexturedPolyPolygon()
that has received various fixes over the time, but this code not, so
fix it as well.

Change-Id: I7293d4d67dff2d5276928bb3ab25adfb883ce3ca
Reviewed-on: https://gerrit.libreoffice.org/72700
Tested-by: Jenkins
Reviewed-by: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst f933d523
......@@ -636,7 +636,7 @@ namespace vclcanvas
}
else if( textures[0].Bitmap.is() )
{
const geometry::IntegerSize2D aBmpSize( textures[0].Bitmap->getSize() );
geometry::IntegerSize2D aBmpSize( textures[0].Bitmap->getSize() );
ENSURE_ARG_OR_THROW( aBmpSize.Width != 0 &&
aBmpSize.Height != 0,
......@@ -754,16 +754,35 @@ namespace vclcanvas
// GraphicObject only supports scaling, rotation
// and translation)
// setup GraphicAttr
aGrfAttr.SetMirrorFlags(
( aScale.getX() < 0.0 ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE ) |
( aScale.getY() < 0.0 ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE ) );
aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround( nRotate*10.0 )) );
// #i75339# don't apply mirror flags, having
// negative size values is enough to make
// GraphicObject flip the bitmap
// The angle has to be mapped from radian to tenths of
// degress with the orientation reversed: [0,2Pi) ->
// (3600,0]. Note that the original angle may have
// values outside the [0,2Pi) interval.
const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI));
aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround(nAngleInTenthOfDegrees)) );
pGrfObj.reset( new GraphicObject( aBmpEx ) );
}
else
{
// modify output position, to account for the fact
// that transformBitmap() always normalizes its output
// bitmap into the smallest enclosing box.
::basegfx::B2DRectangle aDestRect;
::canvas::tools::calcTransformedRectBounds( aDestRect,
::basegfx::B2DRectangle(0,
0,
aBmpSize.Width,
aBmpSize.Height),
aMatrix );
aOutputPos.setX( aDestRect.getMinX() );
aOutputPos.setY( aDestRect.getMinY() );
// complex transformation, use generic affine bitmap
// transformation
aBmpEx = tools::transformBitmap( aBmpEx,
......@@ -773,7 +792,10 @@ namespace vclcanvas
// clear scale values, generated bitmap already
// contains scaling
aScale.setX( 0.0 ); aScale.setY( 0.0 );
aScale.setX( 1.0 ); aScale.setY( 1.0 );
// update bitmap size, bitmap has changed above.
aBmpSize = vcl::unotools::integerSize2DFromSize(aBmpEx.GetSizePixel());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment