From: Matthias Kramm Date: Sat, 17 Jan 2009 05:36:47 +0000 (-0800) Subject: added text field and jpeg counting X-Git-Tag: release-0-9-0~255 X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=5f1e7e9ebbac00effaae0545c32fe9060215d125;p=swftools.git added text field and jpeg counting --- diff --git a/lib/pdf/InfoOutputDev.cc b/lib/pdf/InfoOutputDev.cc index 627ab0a..e6f3c03 100644 --- a/lib/pdf/InfoOutputDev.cc +++ b/lib/pdf/InfoOutputDev.cc @@ -20,7 +20,8 @@ InfoOutputDev::InfoOutputDev(XRef*xref) { num_links = 0; - num_images = 0; + num_jpeg_images = 0; + num_ppm_images = 0; num_fonts = 0; num_polygons= 0; fonts = 0; @@ -409,14 +410,16 @@ void InfoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { - num_images++; + if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; + OutputDev::drawImageMask(state,ref,str,width,height,invert,inlineImg); } void InfoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, int *maskColors, GBool inlineImg) { - num_images++; + if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; + OutputDev::drawImage(state,ref,str,width,height,colorMap,maskColors,inlineImg); } void InfoOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, @@ -426,6 +429,8 @@ void InfoOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int maskWidth, int maskHeight, GBool maskInvert) { + if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; + OutputDev::drawMaskedImage(state,ref,str,width,height,colorMap,maskStr,maskWidth,maskHeight,maskInvert); } @@ -436,5 +441,7 @@ void InfoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *st int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap) { + if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; + OutputDev::drawSoftMaskedImage(state,ref,str,width,height,colorMap,maskStr,maskWidth,maskHeight,maskColorMap); } diff --git a/lib/pdf/InfoOutputDev.h b/lib/pdf/InfoOutputDev.h index 2fd3ea5..532e2ed 100644 --- a/lib/pdf/InfoOutputDev.h +++ b/lib/pdf/InfoOutputDev.h @@ -94,9 +94,11 @@ class InfoOutputDev: public OutputDev public: int x1,y1,x2,y2; int num_links; - int num_images; + int num_ppm_images; + int num_jpeg_images; int num_fonts; int num_polygons; + int num_textfields; gfxfontlist_t*fonts; diff --git a/lib/pdf/pdf.cc b/lib/pdf/pdf.cc index 08fb178..189a05c 100644 --- a/lib/pdf/pdf.cc +++ b/lib/pdf/pdf.cc @@ -488,7 +488,7 @@ static gfxdocument_t*pdf_open(gfxsource_t*src, const char*filename) i->pages[t-1].yMax = i->info->y2; i->pages[t-1].width = i->info->x2 - i->info->x1; i->pages[t-1].height = i->info->y2 - i->info->y1; - i->pages[t-1].number_of_images = i->info->num_images; + i->pages[t-1].number_of_images = i->info->num_ppm_images + i->info->num_jpeg_images; i->pages[t-1].number_of_links = i->info->num_links; i->pages[t-1].number_of_fonts = i->info->num_fonts; i->pages[t-1].has_info = 1;