Skip to content

Instantly share code, notes, and snippets.

@saitoha
Created October 7, 2014 13:46
Show Gist options
  • Save saitoha/5dc5b66c2b2aba55e07f to your computer and use it in GitHub Desktop.
Save saitoha/5dc5b66c2b2aba55e07f to your computer and use it in GitHub Desktop.
ImageMagick v7: minor fixes
Index: coders/sixel.c
===================================================================
--- coders/sixel.c (revision 16656)
+++ coders/sixel.c (working copy)
@@ -15,7 +15,7 @@
% Software Design %
% Hayaki Saito %
% September 2014 %
-% Based on kmiya@culti's sixel decoder %
+% Based on kmiya's sixel(2014-3-28) %
% %
% %
% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
@@ -106,7 +106,6 @@
* 1: 8bit terminal */
unsigned char has_8bit_control;
- unsigned char conv_palette[256];
int save_pixel;
int save_count;
int active_palette;
@@ -654,7 +653,7 @@
/* designate palette index */
if (context->active_palette != np->color) {
nwrite = sprintf((char *)context->buffer + context->pos,
- "#%d", context->conv_palette[np->color]);
+ "#%d", np->color);
sixel_advance(context, nwrite);
context->active_palette = np->color;
}
@@ -703,9 +702,6 @@
return (MagickFalse);
}
(void) ResetMagickMemory(map, 0, len);
- for (n = 0; n < (ssize_t) ncolors; n++) {
- context->conv_palette[n] = n;
- }
if (context->has_8bit_control) {
nwrite = sprintf((char *)context->buffer, "\x90" "0;0;0" "q");
@@ -727,7 +723,7 @@
for (n = 0; n < ncolors; n++) {
/* DECGCI Graphics Color Introducer # Pc ; Pu; Px; Py; Pz */
nwrite = sprintf((char *)context->buffer + context->pos, "#%d;2;%d;%d;%d",
- context->conv_palette[n],
+ n,
(palette[n * 3 + 0] * 100 + 127) / 255,
(palette[n * 3 + 1] * 100 + 127) / 255,
(palette[n * 3 + 2] * 100 + 127) / 255);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment