[vte] lib: sixel: Also reset data capacity when dropping the buffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] lib: sixel: Also reset data capacity when dropping the buffer
- Date: Sun, 18 Oct 2020 22:55:18 +0000 (UTC)
commit a9b3bda2bed8713cd8ae503fee5db1d8c9124313
Author: Christian Persch <chpe src gnome org>
Date: Mon Oct 19 00:54:13 2020 +0200
lib: sixel: Also reset data capacity when dropping the buffer
src/sixel-context.cc | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/sixel-context.cc b/src/sixel-context.cc
index 7a8826a3..580f7a6c 100644
--- a/src/sixel-context.cc
+++ b/src/sixel-context.cc
@@ -142,8 +142,12 @@ Context::make_color_hls(int h,
void
Context::reset() noexcept
{
- m_scanlines_data.reset();
- m_scanlines_data_capacity = 0;
+ /* Keep buffer of default size */
+ if (m_scanlines_data_capacity > minimum_capacity()) {
+ m_scanlines_data.reset();
+ m_scanlines_data_capacity = 0;
+ }
+
m_scanline_begin = m_scanline_pos = m_scanline_end = nullptr;
}
@@ -420,8 +424,10 @@ Context::image_data(size_t* size,
/* We drop the scanlines buffer here if it's bigger than the default buffer size,
* so that parsing a big image doesn't retain the large buffer forever.
*/
- if (m_scanlines_data_capacity > minimum_capacity())
+ if (m_scanlines_data_capacity > minimum_capacity()) {
m_scanlines_data.reset();
+ m_scanlines_data_capacity = 0;
+ }
return wdata.release();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]