[Libreoffice-commits] online.git: kit/Kit.cpp
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 7 18:22:19 UTC 2020
kit/Kit.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
New commits:
commit 873110de88cd57955893e2e7779673cd51ee0daf
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jan 7 10:51:21 2020 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Jan 7 19:22:01 2020 +0100
android: don't use std::vector allocation for large pixel buffers.
Amazingly more time was spent allocating, wiping and freeing these
vectors on Android than the actual rendering of pixels in a profile.
Change-Id: I49ea093816eba0f4187613ab6c8dc24d8dcba75b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86335
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index fd5ebc9ba..b6446887b 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -899,6 +899,20 @@ public:
renderedTiles.back().setImgSize(imgSize);
}
+ struct RenderBuffer {
+ unsigned char *_data;
+ RenderBuffer(size_t x, size_t y)
+ {
+ _data = static_cast<unsigned char *>(calloc(x * y, 4));
+ }
+ ~RenderBuffer()
+ {
+ if (_data)
+ free (_data);
+ }
+ unsigned char *data() { return _data; }
+ };
+
void renderTiles(TileCombined &tileCombined, bool combined)
{
auto& tiles = tileCombined.getTiles();
@@ -934,7 +948,7 @@ public:
LOG_WRN("Unusual extremely large tile combine of size " << pixmapWidth << "x" << pixmapHeight);
const size_t pixmapSize = 4 * pixmapWidth * pixmapHeight;
- std::vector<unsigned char> pixmap(pixmapSize, 0);
+ RenderBuffer pixmap(pixmapWidth, pixmapHeight);
if (!_loKitDocument)
{
More information about the Libreoffice-commits
mailing list