diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-08-07 13:31:50 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-08-15 08:09:55 +0200 |
commit | df19cc6cddc794eb6e289831707e690bd01eb227 (patch) | |
tree | 7560477330efacabfb0de4f37de9f332c70972de /desktop/source | |
parent | dda85e275d70d6365009042b8e207337f2e712c2 (diff) |
vcl: add "fillWithData" function to BitmapTools - used in lok
Change-Id: Ia143a39d2285bbdebf7fcfe709b0c6418d35585c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171589
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/lib/init.cxx | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 71f27c395d33..1857275268b1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -172,7 +172,7 @@ #include <vcl/ITiledRenderable.hxx> #include <vcl/dialoghelper.hxx> #ifdef _WIN32 -#include <vcl/BitmapReadAccess.hxx> +#include <vcl/BitmapTools.hxx> #endif #include <unicode/uchar.h> #include <unotools/securityoptions.hxx> @@ -4391,30 +4391,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, // pBuffer was not used there pDevice->EnableMapMode(false); BitmapEx aBmpEx = pDevice->GetBitmapEx({ 0, 0 }, { nCanvasWidth, nCanvasHeight }); - Bitmap aBmp = aBmpEx.GetBitmap(); - AlphaMask aAlpha = aBmpEx.GetAlphaMask(); - BitmapScopedReadAccess sraBmp(aBmp); - BitmapScopedReadAccess sraAlpha(aAlpha); - - assert(sraBmp->Height() == nCanvasHeight); - assert(sraBmp->Width() == nCanvasWidth); - assert(!sraAlpha || sraBmp->Height() == sraAlpha->Height()); - assert(!sraAlpha || sraBmp->Width() == sraAlpha->Width()); - auto p = pBuffer; - for (tools::Long y = 0; y < sraBmp->Height(); ++y) - { - Scanline dataBmp = sraBmp->GetScanline(y); - Scanline dataAlpha = sraAlpha ? sraAlpha->GetScanline(y) : nullptr; - for (tools::Long x = 0; x < sraBmp->Width(); ++x) - { - BitmapColor color = sraBmp->GetPixelFromData(dataBmp, x); - sal_uInt8 alpha = dataAlpha ? sraAlpha->GetPixelFromData(dataAlpha, x).GetBlue() : 255; - *p++ = color.GetBlue(); - *p++ = color.GetGreen(); - *p++ = color.GetRed(); - *p++ = alpha; - } - } + vcl::bitmap::fillWithData(pBuffer, aBmpEx); #endif #endif |