summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2024-09-15 19:27:13 -0700
committerVito Caputo <vcaputo@pengaru.com>2024-09-15 19:27:13 -0700
commite2bb7e45db6a9820292b6b01ce0dcdfae65cca9b (patch)
treee2033392e5ac1c477ef4006b83908eba4c5e85a1
parentfe5ff535d13622b35fdbc8528308068a503e3c08 (diff)
vcr: bump row clipping to not attempt partial row operations
It'd be nice to allow the last partial row to be rendered, but as-is it can result in segfault for some operations that aren't clipping at that granularity. Another option is to always round up the bits allocation to the ROW_HEIGHT boundaries, then not worry about this, and do the partial clip @ serialization to png time.
-rw-r--r--src/vcr.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/vcr.c b/src/vcr.c
index 99c5cfd..6c4fa8e 100644
--- a/src/vcr.c
+++ b/src/vcr.c
@@ -1124,7 +1124,7 @@ void vcr_mark_finish_line(vcr_t *vcr, vcr_layer_t layer, int row)
/* FIXME: the layers in backend/vcr etc should be in a layer-indexable array */
assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB);
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
switch (vcr->backend->type) {
@@ -1186,7 +1186,7 @@ void vcr_draw_bar(vcr_t *vcr, vcr_layer_t layer, int row, double t, int min_heig
assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB);
assert(min_height >= 0 && min_height < (VCR_ROW_HEIGHT - 1));
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
height = fabs(t) * (double)(VCR_ROW_HEIGHT - 1);
@@ -1265,7 +1265,7 @@ void vcr_clear_row(vcr_t *vcr, vcr_layer_t layer, int row, int x, int width)
assert(x + width <= vcr->width);
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
switch (vcr->backend->type) {
@@ -1333,7 +1333,7 @@ void vcr_shift_below_row_up_one(vcr_t *vcr, int row)
assert(vcr->backend);
assert(row > 0); /* TODO? assert row doesn't overflow? clamp to hierarchy_end? */
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
switch (vcr->backend->type) {
@@ -1437,7 +1437,7 @@ void vcr_shadow_row(vcr_t *vcr, vcr_layer_t layer, int row)
assert(layer == VCR_LAYER_TEXT);
assert(row >= 0);
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
switch (vcr->backend->type) {
@@ -1558,7 +1558,7 @@ void vcr_stash_row(vcr_t *vcr, vcr_layer_t layer, int row)
assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB);
/* for now we only support stashing graphs */
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
switch (vcr->backend->type) {
@@ -1616,7 +1616,7 @@ void vcr_unstash_row(vcr_t *vcr, vcr_layer_t layer, int row)
assert(vcr->backend);
assert(layer == VCR_LAYER_GRAPHA || layer == VCR_LAYER_GRAPHB);
- if (row * VCR_ROW_HEIGHT >= vcr->height)
+ if ((row + 1) * VCR_ROW_HEIGHT >= vcr->height)
return;
switch (vcr->backend->type) {
© All Rights Reserved