This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 9910a9b5e922bd0493e5c76efb27474c4310ca34 (commit)
from e9d8edec450a97a0b8741273bb5d5e90fb94c821 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/gfxprim.git/commit/9910a9b5e922bd0493e5c76efb27474c4310ca…
commit 9910a9b5e922bd0493e5c76efb27474c4310ca34
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:28:16 2015 +0100
demos: c_simple: v4l2_show: Handle SYS_RESIZE
Adds SYS_RESIZE event handling and centers the image in the window.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c
index 97467b5..443d6d4 100644
--- a/demos/c_simple/v4l2_show.c
+++ b/demos/c_simple/v4l2_show.c
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
GP_Backend *backend;
GP_Grabber *grabber;
const char *v4l2_device = "/dev/video0";
- unsigned int w = 320, h = 240;
+ unsigned int w = 640, h = 480;
int mode = 0;
int opt;
@@ -113,7 +113,10 @@ int main(int argc, char *argv[])
break;
}
- GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, 0, 0);
+ unsigned int c_x = (backend->context->w - res->w) / 2;
+ unsigned int c_y = (backend->context->h - res->h) / 2;
+
+ GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, c_x, c_y);
GP_BackendFlip(backend);
if (mode)
@@ -150,6 +153,13 @@ int main(int argc, char *argv[])
mode = 0;
break;
}
+ break;
+ case GP_EV_SYS:
+ if (ev.code == GP_EV_SYS_RESIZE) {
+ GP_BackendResizeAck(backend);
+ GP_Fill(backend->context, 0);
+ }
+ break;
}
}
}
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/v4l2_show.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via e9d8edec450a97a0b8741273bb5d5e90fb94c821 (commit)
via ffbfb62987085873f5996218fdf3fbb7ae0390e4 (commit)
from 01cb569b20ec2962ccb1f4b845d2f396ad8b08df (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/gfxprim.git/commit/e9d8edec450a97a0b8741273bb5d5e90fb94c8…
commit e9d8edec450a97a0b8741273bb5d5e90fb94c821
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 9 14:47:15 2015 +0100
loaders: JPG: Fix read callback
Apparently when I/O read callback returns buffer of size 0 the libjpeg
segfaults. So we now return FALSE from the callback even when read
returns 0, which means end of the file when the underlying I/O is file
based.
Special thanks to the american fuzzy lop (afl).
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c
index 4921f24..9ac4630 100644
--- a/libs/loaders/GP_JPG.c
+++ b/libs/loaders/GP_JPG.c
@@ -156,8 +156,8 @@ static boolean fill_input_buffer(struct jpeg_decompress_struct *cinfo)
ret = GP_IORead(src->io, src->buffer, src->size);
- if (ret < 0) {
- GP_WARN("Failed to fill buffer");
+ if (ret <= 0) {
+ GP_WARN("Failed to fill buffer, IORead returned %i", ret);
return FALSE;
}
http://repo.or.cz/gfxprim.git/commit/ffbfb62987085873f5996218fdf3fbb7ae0390…
commit ffbfb62987085873f5996218fdf3fbb7ae0390e4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 9 14:11:17 2015 +0100
loaders: PCX: Make sure w < bytes_per_line * 8 / bpp
Fixes crash on inconsistent header where w > bytes_per_line * 8 / bpp.
Special thanks to the american fuzzy lop (afl).
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_PCX.c b/libs/loaders/GP_PCX.c
index 20c6b20..2304bbd 100644
--- a/libs/loaders/GP_PCX.c
+++ b/libs/loaders/GP_PCX.c
@@ -292,7 +292,7 @@ static int read_16_palette(GP_IO *io, struct pcx_header *header,
unsigned int i;
uint8_t b[header->bytes_per_line];
GP_Pixel palette[16];
- uint8_t idx=0, mask, mod;
+ uint8_t idx = 0, mask, mod;
for (i = 0; i < 16; i++) {
palette[i] = (GP_Pixel)header->palette[3*i] << 16;
@@ -543,6 +543,14 @@ int GP_ReadPCXEx(GP_IO *io, GP_Context **img, GP_DataStorage *storage,
w = header.xe - header.xs + 1;
h = header.ye - header.ys + 1;
+ uint32_t max_w = ((uint32_t)header.bytes_per_line * 8) / header.bpp;
+
+ if (w > max_w) {
+ GP_WARN("Truncating image width (%u) to "
+ "bytes_per_line * 8 / bpp (%"PRIu32")", w, max_w);
+ w = max_w;
+ }
+
res = GP_ContextAlloc(w, h, pixel_type);
if (!res) {
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_JPG.c | 4 ++--
libs/loaders/GP_PCX.c | 10 +++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")