diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2024-06-03 22:08:42 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-06-06 10:03:14 +0200 |
commit | c30c1d12f283e75fdcc5bb508a79a9d33a431d28 (patch) | |
tree | 38fadb3098cd9516b3871c6340bf77ae2c6c10e3 /drawinglayer | |
parent | 734914261347d51dfd4f1140b037c52c86060277 (diff) |
tdf#153008 svx: impl crop for stretched bitmap fill
The ticket had a pptx with a:
<a:blipFill> <a:stretch> <a:fillRect ...>
Impress loaded the fillRect as a crop, but never used.
Implemented a crop in
SdrFillGraphicAttribute::createFillGraphicAttribute
because in the case of stretching, it blindly used the whole picture.
Cropping data was not available there so it is copied
into OffsetPosition, and Size
Change-Id: I195cc40a35dc24c708e7c0e3cdbe40d6e47b8ce5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168391
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/attribute/sdrfillgraphicattribute.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx index b78f3e322c38..0acf4ba44be2 100644 --- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx @@ -286,6 +286,19 @@ namespace drawinglayer::attribute aBitmapSize.setX(aBitmapSize.getX() / fRangeWidth); aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); } + else if (mpSdrFillGraphicAttribute->getStretch()) + { + //tdf#153008 We may want to calculate crop. (stretch-fillRect case) + aBitmapTopLeft.setX(getOffsetPosition().getX() * 0.01); + aBitmapTopLeft.setY(getOffsetPosition().getY() * 0.01); + if (getSize().getX() != 0.0 && getSize().getY() != 0.0) + { + const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0); + const double fRangeHeight(0.0 != rRange.getHeight() ? rRange.getHeight() : 1.0); + aBitmapSize.setX(getSize().getX() / fRangeWidth); + aBitmapSize.setY(getSize().getY() / fRangeHeight); + } + } // get offset in percent const double fOffsetX(std::clamp(getOffset().getX() * 0.01, 0.0, 1.0)); |