mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Force TIFF to always use more than one strip
This commit is contained in:
parent
78d85bd72e
commit
fa3c150610
@ -55,7 +55,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
int i;
|
int i;
|
||||||
int rows_per_strip, strip_count;
|
int rows_per_strip, strip_count;
|
||||||
int free_memory;
|
int free_memory;
|
||||||
int row, column;
|
int row, column, strip, bytes_put;
|
||||||
FILE *tif_file;
|
FILE *tif_file;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
uint32_t* strip_offset;
|
uint32_t* strip_offset;
|
||||||
@ -84,6 +84,15 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
strip_count++;
|
strip_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rows_per_strip > symbol->bitmap_height) {
|
||||||
|
rows_per_strip = symbol->bitmap_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strip_count == 1) {
|
||||||
|
rows_per_strip = (rows_per_strip / 2) + 1;
|
||||||
|
strip_count++;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
uint32_t strip_offset[strip_count];
|
uint32_t strip_offset[strip_count];
|
||||||
uint32_t strip_bytes[strip_count];
|
uint32_t strip_bytes[strip_count];
|
||||||
@ -144,6 +153,8 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
free_memory += sizeof(tiff_ifd_t);
|
free_memory += sizeof(tiff_ifd_t);
|
||||||
|
|
||||||
/* Pixel data */
|
/* Pixel data */
|
||||||
|
strip = 0;
|
||||||
|
bytes_put = 0;
|
||||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||||
@ -155,13 +166,16 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
putc(bggrn, tif_file);
|
putc(bggrn, tif_file);
|
||||||
putc(bgblu, tif_file);
|
putc(bgblu, tif_file);
|
||||||
}
|
}
|
||||||
|
bytes_put += 3;
|
||||||
}
|
}
|
||||||
if (((row + 1) % rows_per_strip) == 0) {
|
|
||||||
/* End of a strip */
|
if ((bytes_put + 3) >= strip_bytes[strip]) {
|
||||||
if ((strip_bytes[0] % 2) == 1) {
|
// End of strip, pad if strip length is odd
|
||||||
/* Add end-of strip pad */
|
if (strip_bytes[strip] % 2 == 1) {
|
||||||
putc(0, tif_file);
|
putc(0, tif_file);
|
||||||
}
|
}
|
||||||
|
strip++;
|
||||||
|
bytes_put = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user