Kaydet (Commit) d857e278 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Qt5 fix alpha drawing of start center image

Drawing the bottom-left start center image had multiple errors.
New images didn't set the default clip rect and weren't correctly
resized. The damage handling was also missing for alpha bitmaps.

Change-Id: Idabacbb8b507c990a24006152f064ae4f144b89e
Reviewed-on: https://gerrit.libreoffice.org/47277Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst 30a3011a
......@@ -41,6 +41,7 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage )
, m_pTextStyle{ nullptr, }
, m_aTextColor( MAKE_SALCOLOR(0x00, 0x00, 0x00) )
{
ResetClipRegion();
}
Qt5Graphics::~Qt5Graphics()
......
......@@ -151,7 +151,10 @@ bool Qt5Graphics::setClipRegion(const vcl::Region& rRegion)
void Qt5Graphics::ResetClipRegion()
{
m_aClipRegion = QRegion(m_pQImage->rect());
if (m_pQImage)
m_aClipRegion = QRegion(m_pQImage->rect());
else
m_aClipRegion = QRegion();
if (!m_aClipPath.isEmpty())
{
QPainterPath aPath;
......@@ -490,7 +493,7 @@ static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlph
if (x && !(x % 8))
++alpha_line;
if (0 == (*alpha_line & (1 << (x % 8))))
image_line[0] = 0;
image_line[3] = 0;
}
}
}
......@@ -509,6 +512,7 @@ bool Qt5Graphics::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rS
aPainter.drawImage(
QPoint(rPosAry.mnDestX, rPosAry.mnDestY), aImage,
QRect(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
aPainter.update(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight);
return true;
}
......
......@@ -58,10 +58,10 @@ bool Qt5VirtualDevice::SetSizeUsingBuffer(long nNewDX, long nNewDY, sal_uInt8* p
if (nNewDY == 0)
nNewDY = 1;
if (m_pImage && m_aFrameSize.getX() != nNewDX && m_aFrameSize.getY() != nNewDY)
if (m_pImage && m_aFrameSize.width() == nNewDX && m_aFrameSize.height() == nNewDY)
return true;
m_aFrameSize = basegfx::B2IVector(nNewDX, nNewDY);
m_aFrameSize = QSize(nNewDX, nNewDY);
nNewDX *= m_fScale;
nNewDY *= m_fScale;
......@@ -87,8 +87,8 @@ bool Qt5VirtualDevice::SetSizeUsingBuffer(long nNewDX, long nNewDY, sal_uInt8* p
return true;
}
long Qt5VirtualDevice::GetWidth() const { return m_pImage ? m_aFrameSize.getX() : 0; }
long Qt5VirtualDevice::GetWidth() const { return m_pImage ? m_aFrameSize.width() : 0; }
long Qt5VirtualDevice::GetHeight() const { return m_pImage ? m_aFrameSize.getY() : 0; }
long Qt5VirtualDevice::GetHeight() const { return m_pImage ? m_aFrameSize.height() : 0; }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -20,11 +20,12 @@
#pragma once
#include <salvd.hxx>
#include <basegfx/vector/b2ivector.hxx>
#include <memory>
#include <list>
#include <QtCore/QSize>
class Qt5Graphics;
class QImage;
enum class DeviceFormat;
......@@ -34,7 +35,7 @@ class Qt5VirtualDevice : public SalVirtualDevice
std::list<Qt5Graphics*> m_aGraphics;
std::unique_ptr<QImage> m_pImage;
DeviceFormat m_eFormat;
basegfx::B2IVector m_aFrameSize;
QSize m_aFrameSize;
double m_fScale;
public:
......
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