Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/SubtitleOctopus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class SubtitleOctopus {
int max_x = img->dst_x + img->w - 1, max_y = img->dst_y + img->h - 1;
ASS_Image *cur;
for (cur = img->next; cur != NULL; cur = cur->next) {
if (cur->w == 0 || cur->h == 0) continue; // skip empty images
if (cur->dst_x < min_x) min_x = cur->dst_x;
if (cur->dst_y < min_y) min_y = cur->dst_y;
int right = cur->dst_x + cur->w - 1;
Expand All @@ -255,8 +256,14 @@ class SubtitleOctopus {
if (bottom > max_y) max_y = bottom;
}

// make float buffer for blending
int width = max_x - min_x + 1, height = max_y - min_y + 1;

if (width == 0 || height == 0) {
// all images are empty
return &m_blendResult;
}

// make float buffer for blending
float* buf = (float*)buffer_resize(&m_blend, sizeof(float) * width * height * 4, 0);
if (buf == NULL) {
printf("libass: error: cannot allocate buffer for blending");
Expand Down