diff options
Diffstat (limited to 'kms++util/src/drawing.cpp')
-rw-r--r-- | kms++util/src/drawing.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp index a187dc0..4e5c6c1 100644 --- a/kms++util/src/drawing.cpp +++ b/kms++util/src/drawing.cpp | |||
@@ -8,6 +8,9 @@ namespace kms | |||
8 | { | 8 | { |
9 | void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color) | 9 | void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color) |
10 | { | 10 | { |
11 | if (x >= buf.width() || y >= buf.height()) | ||
12 | throw runtime_error("attempt to draw outside the buffer"); | ||
13 | |||
11 | switch (buf.format()) { | 14 | switch (buf.format()) { |
12 | case PixelFormat::XRGB8888: | 15 | case PixelFormat::XRGB8888: |
13 | case PixelFormat::ARGB8888: | 16 | case PixelFormat::ARGB8888: |
@@ -58,6 +61,9 @@ void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color) | |||
58 | 61 | ||
59 | void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) | 62 | void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) |
60 | { | 63 | { |
64 | if ((x + 1) >= buf.width() || y >= buf.height()) | ||
65 | throw runtime_error("attempt to draw outside the buffer"); | ||
66 | |||
61 | ASSERT((x & 1) == 0); | 67 | ASSERT((x & 1) == 0); |
62 | 68 | ||
63 | uint8_t *p = (uint8_t*)(buf.map(0) + buf.stride(0) * y + x * 2); | 69 | uint8_t *p = (uint8_t*)(buf.map(0) + buf.stride(0) * y + x * 2); |
@@ -104,6 +110,9 @@ void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, | |||
104 | void draw_yuv420_macropixel(IFramebuffer& buf, unsigned x, unsigned y, | 110 | void draw_yuv420_macropixel(IFramebuffer& buf, unsigned x, unsigned y, |
105 | YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4) | 111 | YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4) |
106 | { | 112 | { |
113 | if ((x + 1) >= buf.width() || (y + 1) >= buf.height()) | ||
114 | throw runtime_error("attempt to draw outside the buffer"); | ||
115 | |||
107 | ASSERT((x & 1) == 0); | 116 | ASSERT((x & 1) == 0); |
108 | ASSERT((y & 1) == 0); | 117 | ASSERT((y & 1) == 0); |
109 | 118 | ||