diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 082f564556a4..3605d8fe0be0 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -244,9 +244,9 @@ namespace basegfx // add defined offsets after rotation if(!fTools::equal(0.5, rOffset.getX()) || !fTools::equal(0.5, rOffset.getY())) { - // use scaled target size - fTargetOffsetX += (rOffset.getX() - 0.5) * fTargetSizeX; - fTargetOffsetY += (rOffset.getY() - 0.5) * fTargetSizeY; + // use original target size + fTargetOffsetX += (rOffset.getX() - 0.5) * rTargetRange.getWidth(); + fTargetOffsetY += (rOffset.getY() - 0.5) * rTargetRange.getHeight(); } // add object translate diff --git a/sw/qa/extras/uiwriter/data3/tdf133477.fodt b/sw/qa/extras/uiwriter/data3/tdf133477.fodt new file mode 100644 index 000000000000..e18a0e458a2d --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf133477.fodt @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + Top left corner is blue. + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 8336544274b4..cd8c7ac359bc 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include @@ -1304,4 +1306,31 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf127652) CPPUNIT_ASSERT_EQUAL_MESSAGE("We are on the wrong page!", assertPage, currentPage); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133477) +{ + load(DATA_DIRECTORY, "tdf133477.fodt"); + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + // Save the shape to a BMP. + uno::Reference xGraphicExporter + = drawing::GraphicExportFilter::create(mxComponentContext); + uno::Reference xSourceDoc(getShape(1), uno::UNO_QUERY); + xGraphicExporter->setSourceDocument(xSourceDoc); + + SvMemoryStream aStream; + uno::Reference xOutputStream(new utl::OStreamWrapper(aStream)); + uno::Sequence aDescriptor( + comphelper::InitPropertySequence({ { "OutputStream", uno::makeAny(xOutputStream) }, + { "FilterName", uno::makeAny(OUString("BMP")) } })); + xGraphicExporter->filter(aDescriptor); + aStream.Seek(STREAM_SEEK_TO_BEGIN); + + // Read it back and check the color of the first pixel. + Graphic aGraphic; + ReadGraphic(aStream, aGraphic); + BitmapEx aBitmap = aGraphic.GetBitmapEx(); + CPPUNIT_ASSERT_EQUAL(Color(0, 102, 204), aBitmap.GetPixelColor(0, 0)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */