comparison src/glyphs-eimage.c @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 3ecd8885ac67
children 8de8e3f6228a
comparison
equal deleted inserted replaced
437:e2a4e8b94b82 438:84b14dcb0985
661 static int InterlacedOffset[] = { 0, 4, 2, 1 }; 661 static int InterlacedOffset[] = { 0, 4, 2, 1 };
662 static int InterlacedJumps[] = { 8, 8, 4, 2 }; 662 static int InterlacedJumps[] = { 8, 8, 4, 2 };
663 663
664 height = unwind.giffile->SHeight; 664 height = unwind.giffile->SHeight;
665 width = unwind.giffile->SWidth; 665 width = unwind.giffile->SWidth;
666 unwind.eimage = (unsigned char*) 666 unwind.eimage = (unsigned char*)
667 xmalloc (width * height * 3 * unwind.giffile->ImageCount); 667 xmalloc (width * height * 3 * unwind.giffile->ImageCount);
668 if (!unwind.eimage) 668 if (!unwind.eimage)
669 signal_image_error("Unable to allocate enough memory for image", instantiator); 669 signal_image_error("Unable to allocate enough memory for image", instantiator);
670 670
671 /* write the data in EImage format (8bit RGB triples) */ 671 /* write the data in EImage format (8bit RGB triples) */
693 row = InterlacedOffset[++pass]; 693 row = InterlacedOffset[++pass];
694 } 694 }
695 eip = unwind.eimage + (width * height * 3 * slice) + (row * width * 3); 695 eip = unwind.eimage + (width * height * 3 * slice) + (row * width * 3);
696 for (j = 0; j < width; j++) 696 for (j = 0; j < width; j++)
697 { 697 {
698 unsigned char pixel = 698 unsigned char pixel =
699 unwind.giffile->SavedImages[slice].RasterBits[(i * width) + j]; 699 unwind.giffile->SavedImages[slice].RasterBits[(i * width) + j];
700 *eip++ = cmo->Colors[pixel].Red; 700 *eip++ = cmo->Colors[pixel].Red;
701 *eip++ = cmo->Colors[pixel].Green; 701 *eip++ = cmo->Colors[pixel].Green;
702 *eip++ = cmo->Colors[pixel].Blue; 702 *eip++ = cmo->Colors[pixel].Blue;
703 } 703 }
725 if (unwind.giffile->SavedImages[0].Function == GRAPHICS_EXT_FUNC_CODE 725 if (unwind.giffile->SavedImages[0].Function == GRAPHICS_EXT_FUNC_CODE
726 && 726 &&
727 unwind.giffile->SavedImages[0].ExtensionBlockCount) 727 unwind.giffile->SavedImages[0].ExtensionBlockCount)
728 { 728 {
729 timeout = (unsigned short) 729 timeout = (unsigned short)
730 ((unwind.giffile->SavedImages[0].ExtensionBlocks[0].Bytes[2] << 8) + 730 ((unwind.giffile->SavedImages[0].ExtensionBlocks[0].Bytes[2] << 8) +
731 unwind.giffile-> SavedImages[0].ExtensionBlocks[0].Bytes[1]) * 10; 731 unwind.giffile-> SavedImages[0].ExtensionBlocks[0].Bytes[1]) * 10;
732 } 732 }
733 733
734 /* Too short a timeout will crucify us performance-wise. */ 734 /* Too short a timeout will crucify us performance-wise. */
735 tid = add_glyph_animated_timeout (timeout > 10 ? timeout : 10, image_instance); 735 tid = add_glyph_animated_timeout (timeout > 10 ? timeout : 10, image_instance);
736 736
737 if (!NILP (tid)) 737 if (!NILP (tid))
738 IMAGE_INSTANCE_PIXMAP_TIMEOUT (ii) = XINT (tid); 738 IMAGE_INSTANCE_PIXMAP_TIMEOUT (ii) = XINT (tid);
739 } 739 }
740 740
741 unbind_to (speccount, Qnil); 741 unbind_to (speccount, Qnil);
742 } 742 }
743 743
744 #endif /* HAVE_GIF */ 744 #endif /* HAVE_GIF */
745 745
1153 return mem->len; 1153 return mem->len;
1154 } 1154 }
1155 1155
1156 struct tiff_error_struct 1156 struct tiff_error_struct
1157 { 1157 {
1158 #if HAVE_VSNPRINTF 1158 #ifdef HAVE_VSNPRINTF
1159 char err_str[256]; 1159 char err_str[256];
1160 #else 1160 #else
1161 char err_str[1024]; /* return the error string */ 1161 char err_str[1024]; /* return the error string */
1162 #endif 1162 #endif
1163 jmp_buf setjmp_buffer; /* for return to caller */ 1163 jmp_buf setjmp_buffer; /* for return to caller */
1173 tiff_error_func(CONST char *module, CONST char *fmt, ...) 1173 tiff_error_func(CONST char *module, CONST char *fmt, ...)
1174 { 1174 {
1175 va_list vargs; 1175 va_list vargs;
1176 1176
1177 va_start (vargs, fmt); 1177 va_start (vargs, fmt);
1178 #if HAVE_VSNPRINTF 1178 #ifdef HAVE_VSNPRINTF
1179 vsnprintf (tiff_err_data.err_str, 255, fmt, vargs); 1179 vsnprintf (tiff_err_data.err_str, 255, fmt, vargs);
1180 #else 1180 #else
1181 /* pray this doesn't overflow... */ 1181 /* pray this doesn't overflow... */
1182 vsprintf (tiff_err_data.err_str, fmt, vargs); 1182 vsprintf (tiff_err_data.err_str, fmt, vargs);
1183 #endif 1183 #endif
1188 1188
1189 static void 1189 static void
1190 tiff_warning_func(CONST char *module, CONST char *fmt, ...) 1190 tiff_warning_func(CONST char *module, CONST char *fmt, ...)
1191 { 1191 {
1192 va_list vargs; 1192 va_list vargs;
1193 #if HAVE_VSNPRINTF 1193 #ifdef HAVE_VSNPRINTF
1194 char warn_str[256]; 1194 char warn_str[256];
1195 #else 1195 #else
1196 char warn_str[1024]; 1196 char warn_str[1024];
1197 #endif 1197 #endif
1198 1198
1199 va_start (vargs, fmt); 1199 va_start (vargs, fmt);
1200 #if HAVE_VSNPRINTF 1200 #ifdef HAVE_VSNPRINTF
1201 vsnprintf (warn_str, 255, fmt, vargs); 1201 vsnprintf (warn_str, 255, fmt, vargs);
1202 #else 1202 #else
1203 vsprintf (warn_str, fmt, vargs); 1203 vsprintf (warn_str, fmt, vargs);
1204 #endif 1204 #endif
1205 va_end (vargs); 1205 va_end (vargs);