synchronized with downstream git
authorMatthias Kramm <kramm@quiss.org>
Tue, 13 Oct 2009 02:31:24 +0000 (19:31 -0700)
committerMatthias Kramm <kramm@quiss.org>
Tue, 13 Oct 2009 02:31:24 +0000 (19:31 -0700)
14 files changed:
lib/Makefile.in
lib/bitio.c
lib/devices/swf.c
lib/gfxdevice.h
lib/gfxpoly.c
lib/gfxpoly/Makefile
lib/gfxpoly/test_stroke.c
lib/modules/swfbits.c
lib/pdf/GFXOutputDev.cc
lib/pdf/InfoOutputDev.h
lib/rfxswf.c
spec/edit_spec.py
src/pdf2swf.c
src/swfcombine.c

index 630a70f..ef5a16c 100644 (file)
@@ -141,15 +141,19 @@ readers/image.$(O): readers/image.c readers/image.h
 
 libocr$(A): $(ocr_objects) devices/ocr.$(O)
        $(AR) r libocr$(A) $(ocr_objects) devices/ocr.$(O)
 
 libocr$(A): $(ocr_objects) devices/ocr.$(O)
        $(AR) r libocr$(A) $(ocr_objects) devices/ocr.$(O)
+       $(RANLIB) libocr$(A)
 
 libbase$(A): $(base_objects) Makefile
        $(AR) r libbase$(A) $(base_objects)
 
 libbase$(A): $(base_objects) Makefile
        $(AR) r libbase$(A) $(base_objects)
+       $(RANLIB) libbase$(A)
 
 libgfxswf$(A): devices/swf.$(O) readers/swf2.$(O) readers/image.$(O)
        $(AR) r libgfxswf$(A) devices/swf.$(O) readers/swf2.$(O) readers/image.$(O)
 
 libgfxswf$(A): devices/swf.$(O) readers/swf2.$(O) readers/image.$(O)
        $(AR) r libgfxswf$(A) devices/swf.$(O) readers/swf2.$(O) readers/image.$(O)
+       $(RANLIB) libgfxswf$(A)
 
 libgfx$(A): $(gfx_objects) $(gfxpoly_objects) Makefile
        $(AR) r libgfx$(A) $(gfx_objects) $(gfxpoly_objects)
 
 libgfx$(A): $(gfx_objects) $(gfxpoly_objects) Makefile
        $(AR) r libgfx$(A) $(gfx_objects) $(gfxpoly_objects)
+       $(RANLIB) libgfx$(A)
 
 librfxswf$(A): Makefile $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects) Makefile
        $(AR) r librfxswf$(A) $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects)
 
 librfxswf$(A): Makefile $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects) Makefile
        $(AR) r librfxswf$(A) $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects)
index bd54935..c8f1d7d 100644 (file)
@@ -68,9 +68,14 @@ static int reader_fileread(reader_t*reader, void* data, int len)
        reader->pos += ret;
     return ret;
 }
        reader->pos += ret;
     return ret;
 }
+static void reader_fileread_dealloc(reader_t*r)
+{
+    memset(r, 0, sizeof(reader_t));
+}
 void reader_init_filereader(reader_t*r, int handle)
 {
     r->read = reader_fileread;
 void reader_init_filereader(reader_t*r, int handle)
 {
     r->read = reader_fileread;
+    r->dealloc = reader_fileread_dealloc;
     r->internal = (void*)handle;
     r->type = READER_TYPE_FILE;
     r->mybyte = 0;
     r->internal = (void*)handle;
     r->type = READER_TYPE_FILE;
     r->mybyte = 0;
index dbb851e..48b054a 100644 (file)
@@ -218,6 +218,10 @@ static void swf_addfont(gfxdevice_t*dev, gfxfont_t*font);
 static void swf_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action);
 static void swf_startframe(gfxdevice_t*dev, int width, int height);
 static void swf_endframe(gfxdevice_t*dev);
 static void swf_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action);
 static void swf_startframe(gfxdevice_t*dev, int width, int height);
 static void swf_endframe(gfxdevice_t*dev);
+static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points);
+static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points);
+static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points);
+
 static gfxresult_t* swf_finish(gfxdevice_t*driver);
 
 static swfoutput_internal* init_internal_struct()
 static gfxresult_t* swf_finish(gfxdevice_t*driver);
 
 static swfoutput_internal* init_internal_struct()
@@ -1531,7 +1535,7 @@ void swfoutput_finalize(gfxdevice_t*dev)
 
     /* Add AVM2 actionscript */
     if(i->config_flashversion>=9 && 
 
     /* Add AVM2 actionscript */
     if(i->config_flashversion>=9 && 
-            (i->config_insertstoptag || i->hasbuttons)) {
+            (i->config_insertstoptag || i->hasbuttons) && !i->config_linknameurl) {
         swf_AddButtonLinks(i->swf, i->config_insertstoptag, 
                 i->config_internallinkfunction||i->config_externallinkfunction);
     }
         swf_AddButtonLinks(i->swf, i->config_insertstoptag, 
                 i->config_internallinkfunction||i->config_externallinkfunction);
     }
@@ -1670,7 +1674,7 @@ static void swfoutput_setlinewidth(gfxdevice_t*dev, double _linewidth)
 }
 
 
 }
 
 
-static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover, const char*url);
+static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover, char*type, const char*url);
 static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points);
 static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points);
 static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points);
 static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points);
 static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points);
 static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points);
@@ -1736,8 +1740,8 @@ void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points)
     }
     actions = action_End(actions);
    
     }
     actions = action_End(actions);
    
-    drawlink(dev, actions, 0, points, 0, url);
-
+    drawlink(dev, actions, 0, points, 0, "url", url);
+    
     swf_ActionFree(actions);
 }
 void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points)
     swf_ActionFree(actions);
 }
 void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points)
@@ -1764,7 +1768,7 @@ void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points)
     char name[80];
     sprintf(name, "page%d", page);
 
     char name[80];
     sprintf(name, "page%d", page);
 
-    drawlink(dev, actions, 0, points, 0, name);
+    drawlink(dev, actions, 0, points, 0, "page", name);
     
     swf_ActionFree(actions);
 }
     
     swf_ActionFree(actions);
 }
@@ -1784,6 +1788,7 @@ void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points)
     if(i->textmode)
        endtext(dev);
 
     if(i->textmode)
        endtext(dev);
 
+    char*type = 0;
     if(!strncmp(tmp, "call:", 5))
     {
        char*x = strchr(&tmp[5], ':');
     if(!strncmp(tmp, "call:", 5))
     {
        char*x = strchr(&tmp[5], ':');
@@ -1802,6 +1807,7 @@ void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points)
        }
        actions2 = action_End(0);
        mouseover = 0;
        }
        actions2 = action_End(0);
        mouseover = 0;
+        type = "call";
     }
     else
     {
     }
     else
     {
@@ -1814,9 +1820,10 @@ void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points)
        actions2 = action_PushString(actions2, "");
        actions2 = action_SetVariable(actions2);
        actions2 = action_End(actions2);
        actions2 = action_PushString(actions2, "");
        actions2 = action_SetVariable(actions2);
        actions2 = action_End(actions2);
+        type = "subtitle";
     }
 
     }
 
-    drawlink(dev, actions1, actions2, points, mouseover, name);
+    drawlink(dev, actions1, actions2, points, mouseover, type, name);
 
     swf_ActionFree(actions1);
     swf_ActionFree(actions2);
 
     swf_ActionFree(actions1);
     swf_ActionFree(actions2);
@@ -1863,7 +1870,7 @@ static void drawgfxline(gfxdevice_t*dev, gfxline_t*line, int fill)
 }
 
 
 }
 
 
-static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover, const char*url)
+static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover, char*type, const char*url)
 {
     swfoutput_internal*i = (swfoutput_internal*)dev->internal;
     RGBA rgb;
 {
     swfoutput_internal*i = (swfoutput_internal*)dev->internal;
     RGBA rgb;
@@ -1877,6 +1884,11 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf
     int buttonid = getNewID(dev);
     gfxbbox_t bbox = gfxline_getbbox(points);
     
     int buttonid = getNewID(dev);
     gfxbbox_t bbox = gfxline_getbbox(points);
     
+    if(i->config_linknameurl) {
+        actions1 = 0;
+        actions2 = 0;
+    }
+    
     i->hasbuttons = 1;
 
     /* shape */
     i->hasbuttons = 1;
 
     /* shape */
index caaa983..2e508bf 100644 (file)
@@ -114,7 +114,7 @@ typedef struct _gfxdevice
     void (*fillbitmap)(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*imgcoord2devcoord, gfxcxform_t*cxform); //cxform? tiling?
     void (*fillgradient)(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*gradcoord2devcoord); //?
 
     void (*fillbitmap)(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*imgcoord2devcoord, gfxcxform_t*cxform); //cxform? tiling?
     void (*fillgradient)(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*gradcoord2devcoord); //?
 
-    /* deprecated */ void (*addfont)(struct _gfxdevice*dev, gfxfont_t*font);
+    void (*addfont)(struct _gfxdevice*dev, gfxfont_t*font);
 
     void (*drawchar)(struct _gfxdevice*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix);
 
 
     void (*drawchar)(struct _gfxdevice*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix);
 
index dd97ff4..a687e63 100644 (file)
@@ -911,7 +911,7 @@ static ArtSVP* gfxfillToSVP(gfxline_t*line, int perturb)
 
 //#ifdef SHEAR
 //    double shear = find_shear_value(svp);
 
 //#ifdef SHEAR
 //    double shear = find_shear_value(svp);
-//    gfxline_t*line =  gfxpoly_to_gfxline((gfxpoly_t*)svp);
+//    gfxline_t*line =  gfxline_from_gfxpoly((gfxpoly_t*)svp);
 //    gfxline_t*l = line;
 //    while(l) {
 //        l->y += l->x*shear;
 //    gfxline_t*l = line;
 //    while(l) {
 //        l->y += l->x*shear;
@@ -963,7 +963,7 @@ ArtSVP* run_intersector(ArtSVP*svp, ArtWindRule rule)
     return result;
 }
 
     return result;
 }
 
-gfxline_t* gfxpoly_to_gfxline(gfxpoly_t*poly)
+gfxline_t* gfxline_from_gfxpoly(gfxpoly_t*poly)
 {
     ArtSVP*svp = (ArtSVP*)poly;
     int size = 0;
 {
     ArtSVP*svp = (ArtSVP*)poly;
     int size = 0;
@@ -998,7 +998,7 @@ gfxline_t* gfxpoly_to_gfxline(gfxpoly_t*poly)
     }
 }
 
     }
 }
 
-gfxpoly_t* gfxpoly_fillToPoly(gfxline_t*line)
+gfxpoly_t* gfxpoly_from_fill(gfxline_t*line, double gridsize)
 {
     /* I'm not sure whether doing perturbation here is actually
        a good idea- if that line has been run through the machinery
 {
     /* I'm not sure whether doing perturbation here is actually
        a good idea- if that line has been run through the machinery
@@ -1098,7 +1098,7 @@ gfxpoly_t* gfxpoly_union(gfxpoly_t*poly1, gfxpoly_t*poly2)
     return (gfxpoly_t*)svp;
 }
 
     return (gfxpoly_t*)svp;
 }
 
-gfxpoly_t* gfxpoly_strokeToPoly(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit)
+gfxpoly_t* gfxpoly_from_stroke(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit, double gridsize)
 {
     ArtVpath* vec = gfxline_to_ArtVpath(line, 0);
     msg("<verbose> Casting gfxline of %d segments to a stroke-polygon", gfxline_len(line));
 {
     ArtVpath* vec = gfxline_to_ArtVpath(line, 0);
     msg("<verbose> Casting gfxline of %d segments to a stroke-polygon", gfxline_len(line));
@@ -1122,7 +1122,7 @@ gfxpoly_t* gfxpoly_strokeToPoly(gfxline_t*line, gfxcoord_t width, gfx_capType ca
     return (gfxpoly_t*)svp;
 }
 
     return (gfxpoly_t*)svp;
 }
 
-gfxline_t* gfxline_circularToEvenOdd(gfxline_t*line)
+gfxline_t* gfxpoly_circular_to_evenodd(gfxline_t*line, double gridsize)
 {
     msg("<verbose> Converting circular-filled gfxline of %d segments to even-odd filled gfxline", gfxline_len(line));
     ArtSVP* svp = gfxfillToSVP(line, 1);
 {
     msg("<verbose> Converting circular-filled gfxline of %d segments to even-odd filled gfxline", gfxline_len(line));
     ArtSVP* svp = gfxfillToSVP(line, 1);
@@ -1135,13 +1135,13 @@ gfxline_t* gfxline_circularToEvenOdd(gfxline_t*line)
        return 0;
     }
 
        return 0;
     }
 
-    gfxline_t* result = gfxpoly_to_gfxline((gfxpoly_t*)svp_rewinded);
+    gfxline_t* result = gfxline_from_gfxpoly((gfxpoly_t*)svp_rewinded);
     art_svp_free(svp);
     art_svp_free(svp_rewinded);
     return result;
 }
 
     art_svp_free(svp);
     art_svp_free(svp_rewinded);
     return result;
 }
 
-gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2)
+gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2, double gridsize)
 {
     ArtVpath *vec = art_new (ArtVpath, 5+1);
     vec[0].code = ART_MOVETO;
 {
     ArtVpath *vec = art_new (ArtVpath, 5+1);
     vec[0].code = ART_MOVETO;
@@ -1167,7 +1167,7 @@ gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2)
     return (gfxpoly_t*)svp;
 }
 
     return (gfxpoly_t*)svp;
 }
 
-void gfxpoly_free(gfxpoly_t*poly)
+void gfxpoly_destroy(gfxpoly_t*poly)
 {
     ArtSVP*svp = (ArtSVP*)poly;
     art_svp_free(svp);
 {
     ArtSVP*svp = (ArtSVP*)poly;
     art_svp_free(svp);
index 2065984..7a8b9cc 100644 (file)
@@ -37,13 +37,12 @@ stroke.o: stroke.c poly.h convert.h wind.h
        $(CC) -c stroke.c -o stroke.o
 
 GFX=../gfxfont.o ../gfxtools.o  ../devices/ops.o ../devices/polyops.o ../devices/text.o ../devices/bbox.o ../devices/render.o ../devices/rescale.o ../devices/record.o
        $(CC) -c stroke.c -o stroke.o
 
 GFX=../gfxfont.o ../gfxtools.o  ../devices/ops.o ../devices/polyops.o ../devices/text.o ../devices/bbox.o ../devices/render.o ../devices/rescale.o ../devices/record.o
-
 stroke: test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a ../libbase.a 
 stroke: test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a ../libbase.a 
-       $(CC) test_stroke.c $(OBJS) ../librfxswf.a ../libgfxswf.a $(GFX) ../libbase.a -o stroke $(LIBS)
+       $(CC) test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a $(GFX) ../libbase.a -o stroke $(LIBS)
 
 SWF = ../librfxswf.a ../libpdf.a -lstdc++
 test: ../libbase.a test.c $(OBJS) poly.h convert.h $(GFX) 
 
 SWF = ../librfxswf.a ../libpdf.a -lstdc++
 test: ../libbase.a test.c $(OBJS) poly.h convert.h $(GFX) 
-       $(CC) test.c $(OBJS) $(SWF) ../libbase.a $(GFX) -o test $(LIBS)
+       $(CC) test.c $(OBJS) $(SWF) $(GFX) ../libbase.a -o test $(LIBS)
 
 clean: 
        rm -f *.o test stroke
 
 clean: 
        rm -f *.o test stroke
index d468cb8..0e292cd 100644 (file)
@@ -1,5 +1,6 @@
 #include <math.h>
 #include "../gfxtools.h"
 #include <math.h>
 #include "../gfxtools.h"
+#include "convert.h"
 #include "stroke.h"
 #include "convert.h"
 
 #include "stroke.h"
 #include "convert.h"
 
index 4fa38f5..4643551 100644 (file)
@@ -1182,9 +1182,15 @@ TAG* swf_AddImage(TAG*tag, int bitid, RGBA*mem, int width, int height, int quali
     int has_alpha = swf_ImageHasAlpha(mem,width,height);
 
     /* try lossless image */
     int has_alpha = swf_ImageHasAlpha(mem,width,height);
 
     /* try lossless image */
+
+#ifdef NO_LOSSLESS
+    tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0);
+    tag1->len = 0x7fffffff;
+#else
     tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0);
     swf_SetU16(tag1, bitid);
     swf_SetLosslessImage(tag1, mem, width, height);
     tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0);
     swf_SetU16(tag1, bitid);
     swf_SetLosslessImage(tag1, mem, width, height);
+#endif
 
 #if defined(HAVE_JPEGLIB)
     /* try jpeg image */
 
 #if defined(HAVE_JPEGLIB)
     /* try jpeg image */
index da9ec41..2596d25 100644 (file)
@@ -1442,10 +1442,13 @@ void GFXOutputDev::drawChar(GfxState *state, double x, double y,
     gfxmatrix_t m = this->current_font_matrix;
     this->transformXY(state, x-originX, y-originY, &m.tx, &m.ty);
     //m.tx += originX; m.ty += originY;
     gfxmatrix_t m = this->current_font_matrix;
     this->transformXY(state, x-originX, y-originY, &m.tx, &m.ty);
     //m.tx += originX; m.ty += originY;
-
-    msg("<debug> drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d render=%d glyphid=%d font=%08x",m.tx,m.ty,(charid&127)>=32?charid:'?', charid, u, uLen, font->isCIDFont(), render, glyphid, current_gfxfont);
     
     
-    if((render == RENDER_FILL && !config_drawonlyshapes) || render == RENDER_INVISIBLE) {
+    msg("<debug> drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d render=%d glyphid=%d font=%08x",m.tx,m.ty,(charid&127)>=32?charid:'?', charid, u, uLen, font->isCIDFont(), render, glyphid, current_gfxfont);
+
+    if((render == RENDER_FILL && !config_drawonlyshapes) ||
+       (render == RENDER_FILLSTROKE && state->getTransformedLineWidth()<1.0) ||
+       (render == RENDER_INVISIBLE)) {
+
        int space = this->current_fontinfo->space_char;
        if(config_extrafontdata && space>=0 && m.m00 && !m.m01) {
            /* space char detection */
        int space = this->current_fontinfo->space_char;
        if(config_extrafontdata && space>=0 && m.m00 && !m.m01) {
            /* space char detection */
@@ -1478,6 +1481,7 @@ void GFXOutputDev::drawChar(GfxState *state, double x, double y,
            msg("<notice> Some texts will be rendered as shape");
            gfxglobals->textmodeinfo = 1;
        }
            msg("<notice> Some texts will be rendered as shape");
            gfxglobals->textmodeinfo = 1;
        }
+
        gfxline_t*glyph = current_gfxfont->glyphs[glyphid].line;
        gfxline_t*tglyph = gfxline_clone(glyph);
        gfxline_transform(tglyph, &m);
        gfxline_t*glyph = current_gfxfont->glyphs[glyphid].line;
        gfxline_t*tglyph = gfxline_clone(glyph);
        gfxline_transform(tglyph, &m);
@@ -1561,10 +1565,11 @@ GBool GFXOutputDev::beginType3Char(GfxState *state, double x, double y, double d
 
        gfxmatrix_t m = this->current_font_matrix;
        this->transformXY(state, 0, 0, &m.tx, &m.ty);
 
        gfxmatrix_t m = this->current_font_matrix;
        this->transformXY(state, 0, 0, &m.tx, &m.ty);
-       m.m00*=INTERNAL_FONT_SIZE;
+
+       /*m.m00*=INTERNAL_FONT_SIZE;
        m.m01*=INTERNAL_FONT_SIZE;
        m.m10*=INTERNAL_FONT_SIZE;
        m.m01*=INTERNAL_FONT_SIZE;
        m.m10*=INTERNAL_FONT_SIZE;
-       m.m11*=INTERNAL_FONT_SIZE;
+       m.m11*=INTERNAL_FONT_SIZE;*/
 
        if(!current_fontinfo || (unsigned)charid >= current_fontinfo->num_glyphs || !current_fontinfo->glyphs[charid]) {
            msg("<error> Invalid charid %d for font", charid);
 
        if(!current_fontinfo || (unsigned)charid >= current_fontinfo->num_glyphs || !current_fontinfo->glyphs[charid]) {
            msg("<error> Invalid charid %d for font", charid);
@@ -2039,6 +2044,8 @@ void GFXOutputDev::updateFont(GfxState *state)
     current_gfxfont = this->current_fontinfo->getGfxFont();
     device->addfont(device, current_gfxfont);
     free(id);
     current_gfxfont = this->current_fontinfo->getGfxFont();
     device->addfont(device, current_gfxfont);
     free(id);
+    
+    device->addfont(device, current_gfxfont);
 
     updateFontMatrix(state);
 }
 
     updateFontMatrix(state);
 }
index 04e98f7..ead6a44 100644 (file)
@@ -105,7 +105,6 @@ class InfoOutputDev: public OutputDev
     int num_polygons;
     int num_textfields;
 
     int num_polygons;
     int num_textfields;
 
-    void finish();
     void dumpfonts(gfxdevice_t*dev);
 
     InfoOutputDev(XRef*xref);
     void dumpfonts(gfxdevice_t*dev);
 
     InfoOutputDev(XRef*xref);
index f6353a3..18b2c56 100644 (file)
@@ -177,7 +177,9 @@ int swf_SetU16(TAG * t,U16 v)
 void swf_SetS16(TAG * t,int v)
 {
     if(v>32767 || v<-32768) {
 void swf_SetS16(TAG * t,int v)
 {
     if(v>32767 || v<-32768) {
+      #ifdef DEBUG_RFXSWF
        fprintf(stderr, "Warning: S16 overflow: %d\n", v);
        fprintf(stderr, "Warning: S16 overflow: %d\n", v);
+      #endif
     }
     swf_SetU16(t, (S16)v);
 }
     }
     swf_SetU16(t, (S16)v);
 }
@@ -657,7 +659,9 @@ int swf_SetRect(TAG * t,SRECT * r)
   nbits = swf_CountBits(r->ymin,nbits);
   nbits = swf_CountBits(r->ymax,nbits);
   if(nbits>=32) {
   nbits = swf_CountBits(r->ymin,nbits);
   nbits = swf_CountBits(r->ymax,nbits);
   if(nbits>=32) {
+    #ifdef DEBUG_RFXSWF
     fprintf(stderr, "rfxswf: Warning: num_bits overflow in swf_SetRect\n");
     fprintf(stderr, "rfxswf: Warning: num_bits overflow in swf_SetRect\n");
+    #endif
     nbits=31;
   }
 
     nbits=31;
   }
 
@@ -823,7 +827,9 @@ int swf_SetMatrix(TAG * t,MATRIX * m)
     nbits = swf_CountBits(m->sy,nbits);
     if(nbits>=32) {
         /* TODO: happens on AMD64 systems for normal values? */
     nbits = swf_CountBits(m->sy,nbits);
     if(nbits>=32) {
         /* TODO: happens on AMD64 systems for normal values? */
+        #ifdef DEBUG_RFXSWF
        fprintf(stderr,"rfxswf: Error: matrix values too large\n");
        fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+        #endif
        nbits = 31;
     }
     swf_SetBits(t,nbits,5);
        nbits = 31;
     }
     swf_SetBits(t,nbits,5);
@@ -837,7 +843,9 @@ int swf_SetMatrix(TAG * t,MATRIX * m)
     nbits = swf_CountBits(m->r0,0);
     nbits = swf_CountBits(m->r1,nbits);
     if(nbits>=32) {
     nbits = swf_CountBits(m->r0,0);
     nbits = swf_CountBits(m->r1,nbits);
     if(nbits>=32) {
+        #ifdef DEBUG_RFXSWF
        fprintf(stderr,"rfxswf: Error: matrix values too large\n");
        fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+        #endif
        nbits = 31;
     }
     swf_SetBits(t,nbits,5);
        nbits = 31;
     }
     swf_SetBits(t,nbits,5);
@@ -848,7 +856,9 @@ int swf_SetMatrix(TAG * t,MATRIX * m)
   nbits = swf_CountBits(m->tx,0);
   nbits = swf_CountBits(m->ty,nbits);
   if(nbits>=32) {
   nbits = swf_CountBits(m->tx,0);
   nbits = swf_CountBits(m->ty,nbits);
   if(nbits>=32) {
+      #ifdef DEBUG_RFXSWF
       fprintf(stderr,"rfxswf: Error: matrix values too large\n");
       fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+      #endif
       nbits = 31;
   }
   swf_SetBits(t,nbits,5);
       nbits = 31;
   }
   swf_SetBits(t,nbits,5);
@@ -1132,7 +1142,9 @@ TAG * swf_ReadTag(reader_t*reader, TAG * prev)
   { t->data = (U8*)rfx_alloc(t->len);
     t->memsize = t->len;
     if (reader->read(reader, t->data, t->len) != t->len) {
   { t->data = (U8*)rfx_alloc(t->len);
     t->memsize = t->len;
     if (reader->read(reader, t->data, t->len) != t->len) {
+      #ifdef DEBUG_RFXSWF
       fprintf(stderr, "rfxswf: Warning: Short read (tagid %d). File truncated?\n", t->id);
       fprintf(stderr, "rfxswf: Warning: Short read (tagid %d). File truncated?\n", t->id);
+      #endif
       free(t->data);t->data=0;
       free(t);
       return NULL;
       free(t->data);t->data=0;
       free(t);
       return NULL;
@@ -1311,7 +1323,9 @@ void swf_FoldSprite(TAG * t)
   if(t->id!=ST_DEFINESPRITE)
       return;
   if(!t->len) {
   if(t->id!=ST_DEFINESPRITE)
       return;
   if(!t->len) {
+    #ifdef DEBUG_RFXSWF
       fprintf(stderr, "Error: Sprite has no ID!");
       fprintf(stderr, "Error: Sprite has no ID!");
+    #endif
       return;
   }
   if(t->len>4) {
       return;
   }
   if(t->len>4) {
index 670e1bf..9584b05 100755 (executable)
@@ -39,7 +39,12 @@ class TwoPixelCheck(Check):
         return "pixel at (%d,%d)" % (self.x2,self.y2)
 
 class PixelBrighterThan(TwoPixelCheck):
         return "pixel at (%d,%d)" % (self.x2,self.y2)
 
 class PixelBrighterThan(TwoPixelCheck):
-    pass
+    def verifies(self, model):
+        p1 = model.getPixel(self.x,self.y)
+        p2 = model.getPixel(self.x2,self.y2)
+        val1 = p1[0] + p1[1] + p1[2]
+        val2 = p2[0] + p2[1] + p2[2]
+        return val1 > val2
 
 class PixelDarkerThan(TwoPixelCheck):
     pass
 
 class PixelDarkerThan(TwoPixelCheck):
     pass
index 4344187..c50a3de 100644 (file)
@@ -748,6 +748,8 @@ int main(int argn, char *argv[])
     pagenum = 0;
 
     gfxdevice_t*out = create_output_device();;
     pagenum = 0;
 
     gfxdevice_t*out = create_output_device();;
+    pdf->prepare(pdf, out);
+
     for(pagenr = 1; pagenr <= pdf->num_pages; pagenr++) 
     {
        if(is_in_range(pagenr, pagerange)) {
     for(pagenr = 1; pagenr <= pdf->num_pages; pagenr++) 
     {
        if(is_in_range(pagenr, pagerange)) {
index 48847c2..378bf06 100644 (file)
@@ -1385,6 +1385,7 @@ int main(int argn, char *argv[])
        swf_WriteSWF(fi, &newswf);
     }
     close(fi);
        swf_WriteSWF(fi, &newswf);
     }
     close(fi);
-    return 0;
+
+    return 0; //ok
 }
 
 }