summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/Palm2QImage.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/Palm2QImage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Palm2QImage.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp
index 361755f..09cad1c 100644
--- a/noncore/apps/opie-reader/Palm2QImage.cpp
+++ b/noncore/apps/opie-reader/Palm2QImage.cpp
@@ -120,17 +120,17 @@ static ColorMapEntry Palm4BitColormap[] = {
120 { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }}; 120 { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }};
121 121
122QImage* Palm2QImage 122QImage* Palm2QImage
123 (unsigned char *image_bytes_in, int byte_count_in) 123 (unsigned char *image_bytes_in, int byte_count_in)
124{ 124{
125 unsigned int width, height, bytes_per_row, flags, next_depth_offset; 125 unsigned int width, height, bytes_per_row, flags, next_depth_offset;
126 unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount; 126 unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount;
127 unsigned int palm_red_bits, palm_green_bits, palm_blue_bits; 127 unsigned int palm_red_bits, palm_green_bits, palm_blue_bits;
128 unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow, 128 unsigned char *palm_ptr, *x_ptr, *inbyte, *rowbuf, *lastrow,
129 *imagedatastart, *palmimage; 129 *imagedatastart, *palmimage;
130 ColorMapEntry *colormap; 130 ColorMapEntry *colormap;
131 131
132 palmimage = image_bytes_in; 132 palmimage = image_bytes_in;
133 width = READ_BIGENDIAN_SHORT(palmimage + 0); 133 width = READ_BIGENDIAN_SHORT(palmimage + 0);
134 height = READ_BIGENDIAN_SHORT(palmimage + 2); 134 height = READ_BIGENDIAN_SHORT(palmimage + 2);
135 bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4); 135 bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4);
136 flags = READ_BIGENDIAN_SHORT(palmimage + 6); 136 flags = READ_BIGENDIAN_SHORT(palmimage + 6);
@@ -208,17 +208,17 @@ QImage* Palm2QImage
208#else 208#else
209 QImage* qimage = new QImage(width, height, 16); 209 QImage* qimage = new QImage(width, height, 16);
210#endif 210#endif
211 211
212 /* row by row, uncompress the Palm image and copy it to the JPEG buffer */ 212 /* row by row, uncompress the Palm image and copy it to the JPEG buffer */
213 rowbuf = new unsigned char[bytes_per_row * width]; 213 rowbuf = new unsigned char[bytes_per_row * width];
214 lastrow = new unsigned char[bytes_per_row * width]; 214 lastrow = new unsigned char[bytes_per_row * width];
215 215
216 for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { 216 for (i=0, palm_ptr = imagedatastart , x_ptr = 0; i < height; ++i) {
217// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); 217// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row);
218 218
219 /* first, uncompress the Palm image */ 219 /* first, uncompress the Palm image */
220 if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { 220 if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) {
221 for (j = 0; j < bytes_per_row; ) { 221 for (j = 0; j < bytes_per_row; ) {
222 incount = *palm_ptr++; 222 incount = *palm_ptr++;
223 inval = *palm_ptr++; 223 inval = *palm_ptr++;
224 memset(rowbuf + j, inval, incount); 224 memset(rowbuf + j, inval, incount);