[Libreoffice-commits] core.git: include/vcl svx/source vcl/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 8 12:31:15 UTC 2019
include/vcl/bitmapex.hxx | 1 +
include/vcl/outdev.hxx | 4 +++-
svx/source/svdraw/svdoashp.cxx | 32 +++++---------------------------
vcl/source/outdev/bitmap.cxx | 24 ++++++++++++++++++++++++
4 files changed, 33 insertions(+), 28 deletions(-)
New commits:
commit 207c368f4bfdbef8fde8efbf75f4fdcf7e0917ba
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 8 11:45:11 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 8 14:30:22 2019 +0200
use BitmapEx in ImpCreateShadowObjectClone
Change-Id: I7737c8b19dca787eab70b733d07a34a5e5f01c9c
Reviewed-on: https://gerrit.libreoffice.org/75208
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 478b9fdefea9..1067c0c45b52 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -468,6 +468,7 @@ public:
private:
friend class ImpGraphic;
+ friend class OutputDevice;
friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm);
friend void ReadRawDIB();
friend bool VCL_DLLPUBLIC ReadRawDIB(BitmapEx& rTarget, const unsigned char* pBuf,
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b3159396f9a4..0b92e735914f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1468,7 +1468,9 @@ public:
const basegfx::B2DHomMatrix& rTransformation,
const BitmapEx& rBitmapEx);
-
+ void DrawShadowBitmapEx(
+ const BitmapEx& rBitmapEx,
+ ::Color aShadowColor);
protected:
virtual void DrawDeviceBitmap(
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 45d8db33a2b3..603bedcf9924 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -354,35 +354,13 @@ static SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const S
{
GraphicObject aGraphicObject(rOriginalSet.Get(XATTR_FILLBITMAP).GetGraphicObject());
const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx());
- Bitmap aBitmap(aBitmapEx.GetBitmap());
- if(!aBitmap.IsEmpty())
+ if(!aBitmapEx.IsEmpty())
{
- Bitmap::ScopedReadAccess pReadAccess(aBitmap);
-
- if(pReadAccess)
- {
- ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create());
- pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel());
-
- for(long y(0); y < pReadAccess->Height(); y++)
- {
- for(long x(0); x < pReadAccess->Width(); x++)
- {
- const BitmapColor aColor = pReadAccess->GetColor(y, x);
- sal_uInt16 nLuminance(static_cast<sal_uInt16>(aColor.GetLuminance()) + 1);
- const Color aDestColor(
- static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8),
- static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8),
- static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8));
- pVirDev->DrawPixel(Point(x,y), aDestColor);
- }
- }
-
- pReadAccess.reset();
-
- aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmapEx(Point(0,0), aBitmap.GetSizePixel())));
- }
+ ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create());
+ pVirDev->SetOutputSizePixel(aBitmapEx.GetSizePixel());
+ pVirDev->DrawShadowBitmapEx(aBitmapEx, aShadowColor);
+ aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmapEx(Point(0,0), aBitmapEx.GetSizePixel())));
}
aTempSet.Put(XFillBitmapItem(aGraphicObject));
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 5322a0a29cea..b33a5dfcefa6 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1299,6 +1299,30 @@ void OutputDevice::DrawTransformedBitmapEx(
}
}
+void OutputDevice::DrawShadowBitmapEx(
+ const BitmapEx& rBitmapEx,
+ ::Color aShadowColor)
+{
+ Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.maBitmap));
+
+ if(!pReadAccess)
+ return;
+
+ for(long y(0); y < pReadAccess->Height(); y++)
+ {
+ for(long x(0); x < pReadAccess->Width(); x++)
+ {
+ const BitmapColor aColor = pReadAccess->GetColor(y, x);
+ sal_uInt16 nLuminance(static_cast<sal_uInt16>(aColor.GetLuminance()) + 1);
+ const Color aDestColor(
+ static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8),
+ static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8),
+ static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8));
+ DrawPixel(Point(x,y), aDestColor);
+ }
+ }
+}
+
void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle )
{
assert(!is_double_buffered_window());
More information about the Libreoffice-commits
mailing list