diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-06-30 10:19:34 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-07-01 07:36:39 +0200 |
commit | d1fcc9053f98cc4afb52498b40a836884bb5ec6f (patch) | |
tree | 1bc3fed7ffc3972ad051f1a46f759825eeb82690 /vcl/source | |
parent | 8663d81828541072999b26451f7d6e6bfcb5f951 (diff) |
optimize Bitmap::Erase() for Skia by delaying the erase (tdf#134363)
Tdf#134363 causes OutputDevice::DrawTransformBitmapExDirect()
to create a huge 1bpp bitmap as mask, and Skia code then tries
to convert all the bits to a format Skia would understand. Which
is wasteful, as SkShader with the color given will do the same
task much more efficiently.
Change-Id: If0bba16f56fed9c3720be801b25a1e703054ed8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97488
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/bitmap/bitmappaint.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index 22ddf2ea5e6b..046b0e3ba3b5 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -36,6 +36,19 @@ bool Bitmap::Erase(const Color& rFillColor) if (IsEmpty()) return true; + if (mxSalBmp) + { + // implementation specific replace + std::shared_ptr<SalBitmap> xImpBmp(ImplGetSVData()->mpDefInst->CreateSalBitmap()); + if (xImpBmp->Create(*mxSalBmp) && xImpBmp->Erase(rFillColor)) + { + ImplSetSalBitmap(xImpBmp); + maPrefMapMode = MapMode(MapUnit::MapPixel); + maPrefSize = xImpBmp->GetSize(); + return true; + } + } + BitmapScopedWriteAccess pWriteAcc(*this); bool bRet = false; |