[hb-view] Add one to row of padding

This commit is contained in:
Behdad Esfahbod 2022-07-14 16:02:10 -06:00
parent 2da36cf99a
commit ab21c4c283
1 changed files with 7 additions and 1 deletions

View File

@ -164,6 +164,7 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
uint32_t bg_color = data ? * (uint32_t *) data : 0; uint32_t bg_color = data ? * (uint32_t *) data : 0;
/* Drop first row while empty */ /* Drop first row while empty */
auto orig_data = data;
while (height) while (height)
{ {
unsigned int i; unsigned int i;
@ -175,9 +176,14 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
data += stride / 4; data += stride / 4;
height--; height--;
} }
if (orig_data < data)
{
data -= stride / 4;
height++; /* Add one first blank row for padding. */
}
/* Drop last row while empty */ /* Drop last row while empty */
unsigned int orig_height = height; auto orig_height = height;
while (height) while (height)
{ {
const uint32_t *row = data + (height - 1) * stride / 4; const uint32_t *row = data + (height - 1) * stride / 4;