From: Asbjørn Sloth Tønnesen Date: Tue, 8 Jun 2010 22:43:12 +0000 (+0000) Subject: Merge branch 'master' into startpage X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=refs%2Fheads%2Fstartpage;hp=-c Merge branch 'master' into startpage --- 3e69571a61c5ebbd53e6759b73008338a8ea4239 diff --combined lib/pdf/BitmapOutputDev.cc index 96e0d33,a858765..6b16993 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@@ -174,8 -174,8 +174,8 @@@ static int dbg_btm_counter=1 void BitmapOutputDev::flushBitmap() { - int width = rgbdev->getBitmapWidth(); - int height = rgbdev->getBitmapHeight(); + int bitmap_width = rgbdev->getBitmapWidth(); + int bitmap_height = rgbdev->getBitmapHeight(); if(sizeof(SplashColor)!=3) { msg(" sizeof(SplashColor)!=3"); @@@ -196,7 -196,7 +196,7 @@@ Guchar*alpha = rgbbitmap->getAlphaPtr(); Guchar*alpha2 = stalepolybitmap->getDataPtr(); - int width8 = (stalepolybitmap->getWidth()+7)/8; + int bitmap_width8 = (stalepolybitmap->getWidth()+7)/8; /*char filename[80]; sprintf(filename, "flush%d_mask.png", dbg_btm_counter); @@@ -206,14 -206,17 +206,17 @@@ sprintf(filename, "flush%d_bitmap.png", dbg_btm_counter); writeBitmap(rgbbitmap, filename);*/ - ibbox_t* boxes = get_bitmap_bboxes((unsigned char*)alpha, width, height); - ibbox_t*b; + ibbox_t pagebox = {-movex, -movey, -movex + this->width, -movey + this->height, 0}; + ibbox_t bitmapbox = {0, 0, bitmap_width, bitmap_height, 0}; + ibbox_t c = ibbox_clip(&bitmapbox, &pagebox); + ibbox_t* boxes = get_bitmap_bboxes((unsigned char*)(alpha+c.ymin*bitmap_width+c.xmin), c.xmax - c.xmin, c.ymax - c.ymin, bitmap_width); + ibbox_t*b; for(b=boxes;b;b=b->next) { - int xmin = b->xmin; - int ymin = b->ymin; - int xmax = b->xmax; - int ymax = b->ymax; + int xmin = b->xmin - this->movex; + int ymin = b->ymin - this->movey; + int xmax = b->xmax - this->movex; + int ymax = b->ymax - this->movey; /* clip against (-movex, -movey, -movex+width, -movey+height) */ @@@ -248,10 -251,10 +251,10 @@@ img->height = rangey; int x,y; for(y=0;ydata[y*rangex]; - Guchar*ain = &alpha[(y+ymin)*width+xmin]; - Guchar*ain2 = &alpha2[(y+ymin)*width8]; + Guchar*ain = &alpha[(y+ymin)*bitmap_width+xmin]; + Guchar*ain2 = &alpha2[(y+ymin)*bitmap_width8]; if(this->emptypage) { for(x=0;xsetPage(page); + gfxdev->setPage(page); + return gTrue; +} -void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2) +void BitmapOutputDev::startPage(int pageNum, GfxState *state) { + PDFRectangle *r = this->page->getCropBox(); double x1,y1,x2,y2; - state->transform(crop_x1,crop_y1,&x1,&y1); - state->transform(crop_x2,crop_y2,&x2,&y2); + state->transform(r->x1,r->y1,&x1,&y1); + state->transform(r->x2,r->y2,&x2,&y2); if(x2width = (int)(x2-x1); this->height = (int)(y2-y1); - rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); - boolpolydev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); - booltextdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); - clip0dev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); - clip1dev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); - gfxdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2); + rgbdev->startPage(pageNum, state); + boolpolydev->startPage(pageNum, state); + booltextdev->startPage(pageNum, state); + clip0dev->startPage(pageNum, state); + clip1dev->startPage(pageNum, state); + gfxdev->startPage(pageNum, state); boolpolybitmap = boolpolydev->getBitmap(); stalepolybitmap = new SplashBitmap(boolpolybitmap->getWidth(), boolpolybitmap->getHeight(), 1, boolpolybitmap->getMode(), 0); @@@ -999,6 -990,15 +1002,6 @@@ GBool BitmapOutputDev::needNonText( clip1dev->needNonText(); return rgbdev->needNonText(); } -/*GBool BitmapOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, - int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, Catalog *catalog, - GBool (*abortCheckCbk)(void *data), - void *abortCheckCbkData) -{ - return gTrue; -}*/ void BitmapOutputDev::setDefaultCTM(double *ctm) { boolpolydev->setDefaultCTM(ctm); diff --combined lib/pdf/xpdf-changes.patch index ddbd0cd,625b971..2cdaf30 --- a/lib/pdf/xpdf-changes.patch +++ b/lib/pdf/xpdf-changes.patch @@@ -85,6 -85,15 +85,6 @@@ for (i = oldLen; i < mapLen; ++i) { map[i] = 0; } ---- xpdf/CoreOutputDev.cc.orig 2010-05-18 11:22:18.000000000 -0700 -+++ xpdf/CoreOutputDev.cc 2010-05-18 11:22:18.000000000 -0700 -@@ -57,5 +57,5 @@ - - void CoreOutputDev::clear() { - startDoc(NULL); -- startPage(0, NULL); -+ startPage(0, NULL, 0,0,0,0); - } --- xpdf/Decrypt.cc.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/Decrypt.cc 2010-05-18 11:22:18.000000000 -0700 @@ -596,6 +596,7 @@ @@@ -97,6 -106,19 +97,6 @@@ } --- xpdf/Gfx.cc.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/Gfx.cc 2010-05-18 11:22:18.000000000 -0700 -@@ -454,7 +454,11 @@ - fontChanged = gFalse; - clip = clipNone; - ignoreUndef = 0; -- out->startPage(pageNum, state); -+ if(cropBox) { -+ out->startPage(pageNum, state, cropBox->x1,cropBox->y1,cropBox->x2,cropBox->y2); -+ } else { -+ out->startPage(pageNum, state, 0,0,0,0); -+ } - out->setDefaultCTM(state->getCTM()); - out->updateAll(state); - for (i = 0; i < 6; ++i) { @@ -465,6 +469,7 @@ abortCheckCbkData = abortCheckCbkDataA; @@@ -162,6 -184,15 +162,15 @@@ --- xpdf/GfxFont.cc.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/GfxFont.cc 2010-05-18 11:22:18.000000000 -0700 + @@ -194,7 +194,7 @@ + embFontID = obj2.getRef(); + if (type != fontType1) { + error(-1, "Mismatch between font type and embedded font file"); + - type = fontType1; + + type = isCIDFont() ? fontCIDType0 : fontType1; + } + } + obj2.free(); @@ -919,6 +919,10 @@ return 1; } @@@ -781,6 -812,15 +790,6 @@@ class GString; class GfxState; -@@ -94,7 +95,7 @@ - { return gTrue; } - - // Start a page. -- virtual void startPage(int pageNum, GfxState *state) {} -+ virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {} - - // End a page. - virtual void endPage() {} --- xpdf/SplashFTFont.cc.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/SplashFTFont.cc 2010-05-18 11:22:18.000000000 -0700 @@ -46,6 +46,7 @@ @@@ -933,6 -973,15 +942,6 @@@ #include #include "gfile.h" #include "GlobalParams.h" -@@ -702,7 +703,7 @@ - nT3Fonts = 0; - } - --void SplashOutputDev::startPage(int pageNum, GfxState *state) { -+void SplashOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) { - int w, h; - double *ctm; - SplashCoord mat[6]; @@ -2646,9 +2647,9 @@ softMask = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), @@@ -947,6 -996,15 +956,6 @@@ tBitmap->getPixel(x, y, color); --- xpdf/SplashOutputDev.h.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/SplashOutputDev.h 2010-05-18 11:22:18.000000000 -0700 -@@ -70,7 +70,7 @@ - //----- initialization and control - - // Start a page. -- virtual void startPage(int pageNum, GfxState *state); -+ virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2); - - // End a page. - virtual void endPage(); @@ -196,6 +196,9 @@ virtual void setVectorAntialias(GBool vaa); #endif @@@ -1078,6 -1136,17 +1087,6 @@@ }; //------------------------------------------------------------------------ ---- xpdf/TextOutputDev.cc.orig 2010-05-18 11:22:18.000000000 -0700 -+++ xpdf/TextOutputDev.cc 2010-05-18 11:22:18.000000000 -0700 -@@ -3877,7 +3877,7 @@ - } - } - --void TextOutputDev::startPage(int pageNum, GfxState *state) { -+void TextOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) { - text->startPage(state); - } - --- xpdf/TextOutputDev.h.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/TextOutputDev.h 2010-05-18 11:22:18.000000000 -0700 @@ -170,6 +170,7 @@ @@@ -1088,6 -1157,15 +1097,6 @@@ }; //------------------------------------------------------------------------ -@@ -578,7 +579,7 @@ - //----- initialization and control - - // Start a page. -- virtual void startPage(int pageNum, GfxState *state); -+ virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2); - - // End a page. - virtual void endPage(); --- xpdf/gfile.cc.orig 2010-05-18 11:22:18.000000000 -0700 +++ xpdf/gfile.cc 2010-05-18 11:22:18.000000000 -0700 @@ -439,6 +439,52 @@