diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-19 08:52:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-20 12:54:41 +0100 |
commit | b7da3f2d2518a8b92b0242e311bb31267acd1cd0 (patch) | |
tree | 0ba369fcf052112072184c13ddcf820a5ef97c81 /svx | |
parent | b10c7022f1be6e4825269bd5872575b5b53744ef (diff) |
use VirtualDevice in ImpCreateShadowObjectClone
part of making BitmapWriteAccess an internal detail of vcl/
Change-Id: Ia284ae33cd7aa982d27cf1188362226f492fa040
Reviewed-on: https://gerrit.libreoffice.org/49963
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 8b5fce92eea2..3b7ccaf33dae 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -76,6 +76,7 @@ #include <svx/xflhtit.hxx> #include <svx/xbtmpit.hxx> #include <vcl/bitmapaccess.hxx> +#include <vcl/virdev.hxx> #include <svx/svdview.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -354,45 +355,25 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS if(pReadAccess) { - Bitmap aDestBitmap(aBitmap.GetSizePixel(), 24L); - Bitmap::ScopedWriteAccess pWriteAccess(aDestBitmap); + ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create()); + pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel()); - if(pWriteAccess) + for(long y(0); y < pReadAccess->Height(); y++) { - for(long y(0); y < pReadAccess->Height(); y++) + for(long x(0); x < pReadAccess->Width(); x++) { - Scanline pScanline = pWriteAccess->GetScanline( y ); - for(long x(0); x < pReadAccess->Width(); x++) - { - sal_uInt16 nLuminance(static_cast<sal_uInt16>(pReadAccess->GetLuminance(y, x)) + 1); - const BitmapColor 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)); - pWriteAccess->SetPixelOnData(pScanline, x, aDestColor); - } + sal_uInt16 nLuminance(static_cast<sal_uInt16>(pReadAccess->GetLuminance(y, x)) + 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); } - - pWriteAccess.reset(); } pReadAccess.reset(); - if(aBitmapEx.IsTransparent()) - { - if(aBitmapEx.IsAlpha()) - { - aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha()))); - } - else - { - aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask()))); - } - } - else - { - aGraphicObject.SetGraphic(Graphic(aDestBitmap)); - } + aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmapEx(Point(0,0), aBitmap.GetSizePixel()))); } } |