summaryrefslogtreecommitdiff
blob: 39613743d46d8a649e816c30f6909fc5ba5056f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
diff --exclude-from=/home/dang/.scripts/diffrc -up -ruN evince-2.22.2.orig/backend/dvi/mdvi-lib/bitmap.c evince-2.22.2/backend/dvi/mdvi-lib/bitmap.c
--- evince-2.22.2.orig/backend/dvi/mdvi-lib/bitmap.c	2008-05-28 17:13:57.000000000 -0400
+++ evince-2.22.2/backend/dvi/mdvi-lib/bitmap.c	2008-07-07 10:54:03.000000000 -0400
@@ -125,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;
@@ -147,12 +147,13 @@ BITMAP	*bitmap_convert_lsb8(Uchar *bits,
 	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;
@@ -162,7 +163,7 @@ BITMAP	*bitmap_convert_lsb8(Uchar *bits,
 	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;
@@ -180,9 +181,10 @@ BITMAP	*bitmap_convert_msb8(Uchar *data,
 		
 		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;
diff --exclude-from=/home/dang/.scripts/diffrc -up -ruN evince-2.22.2.orig/backend/dvi/mdvi-lib/bitmap.h evince-2.22.2/backend/dvi/mdvi-lib/bitmap.h
--- evince-2.22.2.orig/backend/dvi/mdvi-lib/bitmap.h	2008-05-28 17:13:57.000000000 -0400
+++ evince-2.22.2/backend/dvi/mdvi-lib/bitmap.h	2008-07-07 10:54:03.000000000 -0400
@@ -136,8 +136,8 @@ extern void bitmap_rotate_clockwise __PR
 extern void bitmap_rotate_counter_clockwise __PROTO((BITMAP *));
 extern void bitmap_flip_rotate_clockwise __PROTO((BITMAP *));
 extern void bitmap_flip_rotate_counter_clockwise __PROTO((BITMAP *));
-extern BITMAP *bitmap_convert_lsb8 __PROTO((Uchar *, int, int));
-extern BITMAP *bitmap_convert_msb8 __PROTO((Uchar *, int, int));
+extern BITMAP *bitmap_convert_lsb8 __PROTO((Uchar *, int, int, int));
+extern BITMAP *bitmap_convert_msb8 __PROTO((Uchar *, int, int, int));
 
 #include <stdio.h>
 extern void	bitmap_print __PROTO((FILE *, BITMAP *));
diff --exclude-from=/home/dang/.scripts/diffrc -up -ruN evince-2.22.2.orig/backend/dvi/mdvi-lib/t1.c evince-2.22.2/backend/dvi/mdvi-lib/t1.c
--- evince-2.22.2.orig/backend/dvi/mdvi-lib/t1.c	2008-05-28 17:13:57.000000000 -0400
+++ evince-2.22.2/backend/dvi/mdvi-lib/t1.c	2008-07-07 10:54:03.000000000 -0400
@@ -437,25 +437,16 @@ static int t1_load_font(DviParams *param
 
 static inline BITMAP *t1_glyph_bitmap(GLYPH *glyph)
 {
-	BITMAP	*bm;
-	int	w, h;
+	int	w, h, pad;
 	
 	w = GLYPH_WIDTH(glyph);
 	h = GLYPH_HEIGHT(glyph);
 
 	if(!w || !h)
 		return MDVI_GLYPH_EMPTY;
-	switch(glyph->bpp << 3) {
-		case 8: 
-			bm = bitmap_convert_lsb8((unsigned char *)glyph->bits, w, h);
-			break;
-		default:
-			warning(_("(t1) unsupported bitmap pad size %d\n"),
-				glyph->bpp);
-			bm = MDVI_GLYPH_EMPTY;
-			break;
-	}
-	return bm;
+
+	pad = T1_GetBitmapPad();
+	return bitmap_convert_lsb8((unsigned char *)glyph->bits, w, h, ROUND(w, pad) * (pad >> 3));
 }
 
 static void t1_font_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch, DviGlyph *dest)
diff --exclude-from=/home/dang/.scripts/diffrc -up -ruN evince-2.22.2.orig/backend/dvi/mdvi-lib/tt.c evince-2.22.2/backend/dvi/mdvi-lib/tt.c
--- evince-2.22.2.orig/backend/dvi/mdvi-lib/tt.c	2008-05-28 17:13:57.000000000 -0400
+++ evince-2.22.2/backend/dvi/mdvi-lib/tt.c	2008-07-07 10:54:03.000000000 -0400
@@ -382,7 +382,7 @@ static int tt_get_bitmap(DviParams *para
 	
 	TT_Translate_Outline(&outline, -bbox.xMin, -bbox.yMin);
 	TT_Get_Outline_Bitmap(tt_handle, &outline, &raster);
-	glyph->data = bitmap_convert_msb8(raster.bitmap, w, h);
+	glyph->data = bitmap_convert_msb8(raster.bitmap, w, h, ROUND(w, 8));
 	TT_Done_Outline(&outline);
 	mdvi_free(raster.bitmap);