diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-12-29 15:47:42 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-01-05 04:35:45 +0100 |
commit | 86fdd581a832c7476d7556f3f4fb7d83f5de4d8b (patch) | |
tree | d6244e506a96a5483d52ab3ccbae1b3fac508a75 /vcl/headless/svpgdi.cxx | |
parent | 5a7cdbfbd3cbf3ea92c38e78a3b159fdffed7740 (diff) |
vcl: move tryToUse{Source,Mask}Buffer to BitmapHelper
Change-Id: I9352aec388db56596fef3f5f323244b1df26cdcb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127979
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/headless/svpgdi.cxx')
-rw-r--r-- | vcl/headless/svpgdi.cxx | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 3a321af10293..04849793efd9 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -57,84 +57,6 @@ # endif #endif -namespace -{ - // MM02 decide to use buffers or not - const char* pDisableMM02Goodies(getenv("SAL_DISABLE_MM02_GOODIES")); - bool bUseBuffer(nullptr == pDisableMM02Goodies); - const tools::Long nMinimalSquareSizeToBuffer(64*64); - - void tryToUseSourceBuffer(const SalBitmap& rSourceBitmap, std::shared_ptr<BitmapHelper>& rSurface) - { - // MM02 try to access buffered BitmapHelper - std::shared_ptr<SystemDependentData_BitmapHelper> pSystemDependentData_BitmapHelper; - const bool bBufferSource(bUseBuffer - && rSourceBitmap.GetSize().Width() * rSourceBitmap.GetSize().Height() > nMinimalSquareSizeToBuffer); - - if(bBufferSource) - { - const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rSourceBitmap)); - pSystemDependentData_BitmapHelper = rSrcBmp.getSystemDependentData<SystemDependentData_BitmapHelper>(); - - if(pSystemDependentData_BitmapHelper) - { - // reuse buffered data - rSurface = pSystemDependentData_BitmapHelper->getBitmapHelper(); - } - } - - if(rSurface) - return; - - // create data on-demand - rSurface = std::make_shared<BitmapHelper>(rSourceBitmap); - - if(bBufferSource) - { - // add to buffering mechanism to potentially reuse next time - const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rSourceBitmap)); - rSrcBmp.addOrReplaceSystemDependentData<SystemDependentData_BitmapHelper>( - ImplGetSystemDependentDataManager(), - rSurface); - } - } - - void tryToUseMaskBuffer(const SalBitmap& rMaskBitmap, std::shared_ptr<MaskHelper>& rMask) - { - // MM02 try to access buffered MaskHelper - std::shared_ptr<SystemDependentData_MaskHelper> pSystemDependentData_MaskHelper; - const bool bBufferMask(bUseBuffer - && rMaskBitmap.GetSize().Width() * rMaskBitmap.GetSize().Height() > nMinimalSquareSizeToBuffer); - - if(bBufferMask) - { - const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rMaskBitmap)); - pSystemDependentData_MaskHelper = rSrcBmp.getSystemDependentData<SystemDependentData_MaskHelper>(); - - if(pSystemDependentData_MaskHelper) - { - // reuse buffered data - rMask = pSystemDependentData_MaskHelper->getMaskHelper(); - } - } - - if(rMask) - return; - - // create data on-demand - rMask = std::make_shared<MaskHelper>(rMaskBitmap); - - if(bBufferMask) - { - // add to buffering mechanism to potentially reuse next time - const SvpSalBitmap& rSrcBmp(static_cast<const SvpSalBitmap&>(rMaskBitmap)); - rSrcBmp.addOrReplaceSystemDependentData<SystemDependentData_MaskHelper>( - ImplGetSystemDependentDataManager(), - rMask); - } - } -} - bool SvpSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap ) { if (rAlphaBitmap.GetBitCount() != 8 && rAlphaBitmap.GetBitCount() != 1) |