]> www.fi.muni.cz Git - evince.git/blobdiff - backend/dvi/mdvi-lib/bitmap.c
Split API documentation into libdocument, libview and shell. Required
[evince.git] / backend / dvi / mdvi-lib / bitmap.c
index 9014dba6000d821cf7e3f4ca42061fa76c19cdcf..3b16042d5c193fe5ac0c1fe1fbe76568f3a2bc5e 100644 (file)
@@ -18,6 +18,7 @@
 
 /* Bitmap manipulation routines */
 
+#include <config.h>
 #include <stdlib.h>
 
 #include "mdvi.h"
@@ -124,7 +125,7 @@ static Uchar bit_swap[] = {
  * hopelessly slow.
  */
 
-BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h)
+BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride)
 {
        BITMAP  *bm;
        int     i;
@@ -146,12 +147,13 @@ BITMAP    *bitmap_convert_lsb8(Uchar *bits, int w, int h)
        for(i = 0; i < h; i++) {
 #ifdef WORD_LITTLE_ENDIAN
                memcpy(unit, curr, bytes);
-               curr += bytes;
+               curr += stride;
 #else
                int     j;
                
                for(j = 0; j < bytes; curr++, j++)
                        unit[j] = bit_swap[*curr];
+               cur += stride - bytes;
 #endif
                memzero(unit + bytes, bm->stride - bytes);
                unit  += bm->stride;
@@ -161,7 +163,7 @@ BITMAP      *bitmap_convert_lsb8(Uchar *bits, int w, int h)
        return bm;
 }
 
-BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h)
+BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride)
 {
        BITMAP  *bm;
        Uchar   *unit;
@@ -179,9 +181,10 @@ BITMAP     *bitmap_convert_msb8(Uchar *data, int w, int h)
                
                for(j = 0; j < bytes; curr++, j++)
                        unit[j] = bit_swap[*curr];
+               curr += stride - bytes;
 #else
                memcpy(unit, curr, bytes);
-               curr += bytes;
+               curr += stride;
 #endif
                memzero(unit + bytes, bm->stride - bytes);
                unit += bm->stride;