kit/Kit.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
New commits: commit 873110de88cd57955893e2e7779673cd51ee0daf Author: Michael Meeks <[email protected]> AuthorDate: Tue Jan 7 10:51:21 2020 +0000 Commit: Michael Meeks <[email protected]> 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 <[email protected]> Reviewed-by: Michael Meeks <[email protected]> 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) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
