diff options
Diffstat (limited to 'kms++util')
| -rw-r--r-- | kms++util/src/colorbar.cpp | 7 | ||||
| -rw-r--r-- | kms++util/src/drawing.cpp | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/kms++util/src/colorbar.cpp b/kms++util/src/colorbar.cpp index cd0b978..c727306 100644 --- a/kms++util/src/colorbar.cpp +++ b/kms++util/src/colorbar.cpp @@ -99,6 +99,13 @@ static void drm_draw_color_bar_semiplanar_yuv(IFramebuffer& buf, int old_xpos, i void draw_color_bar(IFramebuffer& buf, int old_xpos, int xpos, int width) { + // Skip if the bar is not fully drawable + if (xpos + width > (int)buf.width()) + return; + + if (old_xpos >= 0 && old_xpos + width > (int)buf.width()) + old_xpos = -1; + switch (buf.format()) { case PixelFormat::NV12: case PixelFormat::NV21: diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp index 862638b..7e3ca97 100644 --- a/kms++util/src/drawing.cpp +++ b/kms++util/src/drawing.cpp @@ -533,6 +533,10 @@ static bool get_char_pixel(char c, uint32_t x, uint32_t y) static void draw_char(IFramebuffer& buf, uint32_t xpos, uint32_t ypos, char c, RGB color) { + // Skip characters that are not fully drawable + if (xpos + 8 > buf.width() || ypos + 8 > buf.height()) + return; + unsigned x, y; YUV yuvcolor = color.yuv(); |
