evince r3006 - in trunk: . backend/dvi/mdvi-lib



Author: carlosgc
Date: Mon Apr 14 19:58:00 2008
New Revision: 3006
URL: http://svn.gnome.org/viewvc/evince?rev=3006&view=rev

Log:
2008-04-14  Carlos Garcia Campos  <carlosgc gnome org>

	* backend/dvi/mdvi-lib/bitmap.[ch]: (bitmap_convert_lsb8),
	(bitmap_convert_msb8):
	* backend/dvi/mdvi-lib/t1.c: (t1_glyph_bitmap):
	* backend/dvi/mdvi-lib/tt.c: (tt_get_bitmap):

	Fix T1 font rendering in dvi backend. Patch by Mattias Nissler.


Modified:
   trunk/ChangeLog
   trunk/backend/dvi/mdvi-lib/bitmap.c
   trunk/backend/dvi/mdvi-lib/bitmap.h
   trunk/backend/dvi/mdvi-lib/t1.c
   trunk/backend/dvi/mdvi-lib/tt.c

Modified: trunk/backend/dvi/mdvi-lib/bitmap.c
==============================================================================
--- trunk/backend/dvi/mdvi-lib/bitmap.c	(original)
+++ trunk/backend/dvi/mdvi-lib/bitmap.c	Mon Apr 14 19:58:00 2008
@@ -125,7 +125,7 @@
  * 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 @@
 	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 @@
 	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 @@
 		
 		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;

Modified: trunk/backend/dvi/mdvi-lib/bitmap.h
==============================================================================
--- trunk/backend/dvi/mdvi-lib/bitmap.h	(original)
+++ trunk/backend/dvi/mdvi-lib/bitmap.h	Mon Apr 14 19:58:00 2008
@@ -136,8 +136,8 @@
 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 *));

Modified: trunk/backend/dvi/mdvi-lib/t1.c
==============================================================================
--- trunk/backend/dvi/mdvi-lib/t1.c	(original)
+++ trunk/backend/dvi/mdvi-lib/t1.c	Mon Apr 14 19:58:00 2008
@@ -437,25 +437,16 @@
 
 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)

Modified: trunk/backend/dvi/mdvi-lib/tt.c
==============================================================================
--- trunk/backend/dvi/mdvi-lib/tt.c	(original)
+++ trunk/backend/dvi/mdvi-lib/tt.c	Mon Apr 14 19:58:00 2008
@@ -382,7 +382,7 @@
 	
 	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);
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]