Kaydet (Commit) cbfe46bf authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

widget theme: take into account scaling factor for images

Change-Id: I65bd71dfd113fae33aee7c2b60b945e065314f80
Reviewed-on: https://gerrit.libreoffice.org/69016Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 100ea303
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <comphelper/seqstream.hxx> #include <comphelper/seqstream.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/lok.hxx>
#include <com/sun/star/graphic/SvgTools.hpp> #include <com/sun/star/graphic/SvgTools.hpp>
#include <basegfx/DrawCommands.hxx> #include <basegfx/DrawCommands.hxx>
...@@ -336,13 +337,18 @@ void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCom ...@@ -336,13 +337,18 @@ void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCom
break; break;
case DrawCommandType::IMAGE: case DrawCommandType::IMAGE:
{ {
double nScaleFactor = 1.0;
if (comphelper::LibreOfficeKit::isActive())
nScaleFactor = comphelper::LibreOfficeKit::getDPIScale();
auto const& rDrawCommand = static_cast<ImageDrawCommand const&>(*pDrawCommand); auto const& rDrawCommand = static_cast<ImageDrawCommand const&>(*pDrawCommand);
SvFileStream aFileStream(rDrawCommand.msSource, StreamMode::READ); SvFileStream aFileStream(rDrawCommand.msSource, StreamMode::READ);
BitmapEx aBitmap; BitmapEx aBitmap;
vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, 1.0); vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, nScaleFactor);
long nImageWidth = aBitmap.GetSizePixel().Width(); long nImageWidth = aBitmap.GetSizePixel().Width();
long nImageHeight = aBitmap.GetSizePixel().Height(); long nImageHeight = aBitmap.GetSizePixel().Height();
SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, nImageWidth, nImageHeight); SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, nImageWidth / nScaleFactor,
nImageHeight / nScaleFactor);
if (!!aBitmap) if (!!aBitmap)
{ {
const std::shared_ptr<SalBitmap> pSalBitmap const std::shared_ptr<SalBitmap> pSalBitmap
......
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