diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-16 15:30:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-19 07:36:22 +0100 |
commit | 62275a93e3b13a20aa1de7945a32a0d25582c1ca (patch) | |
tree | ba0f5a3ef6533b4a279eac66b5135aeffe96f486 /canvas/source/vcl/canvasbitmaphelper.cxx | |
parent | e9c74a075c3c0809b993c017c11d1505bd244dc8 (diff) |
move pixel color extracting from canvas to BitmapEx
part of making GetAlpha/GetMask an internal detail of vcl
Change-Id: I874a68f340cd3074cfbeb6303f52adeeb13e56a5
Reviewed-on: https://gerrit.libreoffice.org/51435
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas/source/vcl/canvasbitmaphelper.cxx')
-rw-r--r-- | canvas/source/vcl/canvasbitmaphelper.cxx | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index c2003f6a67cf..eef6258dded3 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -194,28 +194,14 @@ namespace vclcanvas ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aBmpSize.Height(), "Y coordinate out of bounds" ); - Bitmap aBitmap( mpBackBuffer->getBitmapReference().GetBitmap() ); - Bitmap aAlpha( mpBackBuffer->getBitmapReference().GetAlpha().GetBitmap() ); - - Bitmap::ScopedReadAccess pReadAccess( aBitmap ); - Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha.IsEmpty() ? - nullptr : aAlpha.AcquireReadAccess(), - aAlpha ); - ENSURE_OR_THROW( pReadAccess.get() != nullptr, - "Could not acquire read access to bitmap" ); + ::Color aColor = mpBackBuffer->getBitmapReference().GetPixelColor(pos.X, pos.Y); uno::Sequence< sal_Int8 > aRes( 4 ); sal_Int8* pRes = aRes.getArray(); - - const BitmapColor aColor( pReadAccess->GetColor( pos.Y, pos.X ) ); pRes[ 0 ] = aColor.GetRed(); pRes[ 1 ] = aColor.GetGreen(); pRes[ 2 ] = aColor.GetBlue(); - - if( pAlphaReadAccess.get() != nullptr ) - pRes[ 3 ] = pAlphaReadAccess->GetPixel( pos.Y, pos.X ).GetIndex(); - else - pRes[ 3 ] = sal_uInt8(255); + pRes[ 3 ] = aColor.GetTransparency(); return aRes; } |