diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-09-16 22:18:52 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-09-16 22:18:52 +0000 |
| commit | 4d1ce95be98866d08f4b8ab8db389a5d45215cbd (patch) | |
| tree | b4bb81d65b005f676fe7f97f53b25fd48e40fee1 | |
| parent | Fix overflow in autotrace channel reduction (diff) | |
| download | inkscape-4d1ce95be98866d08f4b8ab8db389a5d45215cbd.tar.gz inkscape-4d1ce95be98866d08f4b8ab8db389a5d45215cbd.zip | |
Actually fix overflow
| -rw-r--r-- | src/trace/autotrace/inkscape-autotrace.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/trace/autotrace/inkscape-autotrace.cpp b/src/trace/autotrace/inkscape-autotrace.cpp index 58abe8c61..156a7b3cd 100644 --- a/src/trace/autotrace/inkscape-autotrace.cpp +++ b/src/trace/autotrace/inkscape-autotrace.cpp @@ -60,12 +60,12 @@ static guchar* to_3channels(GdkPixbuf* input) { int rs = gdk_pixbuf_get_rowstride (input); for(int row=0;row<gdk_pixbuf_get_height(input);row++) { for (int col=0;col<gdk_pixbuf_get_width(input);col++) { - char alpha = *(pix + row * rs + col * 4 + 3); - char white = 255 - alpha; + guchar alpha = *(pix + row * rs + col * 4 + 3); + guchar white = 255 - alpha; for(int chan=0;chan<3;chan++) { guchar *pnew = (pix + row * rs + col * 3 + chan); guchar *pold = (pix + row * rs + col * 4 + chan); - out[x++] = (char)(((int)(*pold) * (int)alpha / 256) + white); + out[x++] = (guchar)(((int)(*pold) * (int)alpha / 256) + white); } } } |
