Commit b47bcd8f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

branchport link and color fixes

parent a09ba6da
......@@ -33,10 +33,10 @@ extern GBool xml;
GooString* HtmlFont::DefaultFont=new GooString("Times"); // Arial,Helvetica,sans-serif
HtmlFontColor::HtmlFontColor(GfxRGB rgb){
r=static_cast<int>(255*rgb.r);
g=static_cast<int>(255*rgb.g);
b=static_cast<int>(255*rgb.b);
if (!(Ok(r)&&Ok(b)&&Ok(g))) {printf("Error : Bad color \n");r=0;g=0;b=0;}
r=static_cast<int>(rgb.r/65535.0*255.0);
g=static_cast<int>(rgb.g/65535.0*255.0);
b=static_cast<int>(rgb.b/65535.0*255.0);
if (!(Ok(r)&&Ok(b)&&Ok(g))) {printf("Error : Bad color %d %d %d\n", r, g, b);r=0;g=0;b=0;}
}
GooString *HtmlFontColor::convtoX(unsigned int xcol) const{
......
......@@ -27,6 +27,7 @@
#include "goo/gmem.h"
#include "Error.h"
#include "GfxState.h"
#include "Page.h"
#ifdef ENABLE_LIBJPEG
#include "DCTStream.h"
#endif
......@@ -1036,6 +1037,12 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state) {
void HtmlOutputDev::endPage() {
Links *linksList = catalog->getPage(pageNum)->getLinks(catalog);
for (int i = 0; i < linksList->getNumLinks(); ++i)
{
processLink(linksList->getLink(i));
}
pages->conv();
pages->coalesce();
pages->dump(page, pageNum);
......@@ -1267,23 +1274,20 @@ void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
void HtmlOutputDev::drawLink(Link* link,Catalog *cat){
#warning THIS WONT WORK OUTPUTDEV DOES NOT HAS drawLink anymore
/*
double _x1,_y1,_x2,_y2,w;
void HtmlOutputDev::processLink(Link* link){
double _x1,_y1,_x2,_y2;
int x1,y1,x2,y2;
link->getRect(&_x1,&_y1,&_x2,&_y2);
w = link->getBorderStyle()->getWidth();
cvtUserToDev(_x1,_y1,&x1,&y1);
cvtUserToDev(_x2,_y2,&x2,&y2);
GooString* _dest=getLinkDest(link,cat);
GooString* _dest=getLinkDest(link,catalog);
HtmlLink t((double) x1,(double) y2,(double) x2,(double) y1,_dest);
pages->AddLink(t);
delete _dest;*/
delete _dest;
}
GooString* HtmlOutputDev::getLinkDest(Link *link,Catalog* catalog){
......
......@@ -232,6 +232,18 @@ public:
//----- initialization and control
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog * catalogA,
GBool (* abortCheckCbk)(void *data) = NULL,
void * abortCheckCbkData = NULL)
{
catalog = catalogA;
return gTrue;
}
// Start a page.
virtual void startPage(int pageNum, GfxState *state);
......@@ -259,7 +271,6 @@ public:
//new feature
virtual int DevType() {return 1234;}
virtual void drawLink(Link *link,Catalog *cat);
int getPageWidth() { return maxPageWidth; }
int getPageHeight() { return maxPageHeight; }
......@@ -272,6 +283,7 @@ private:
// convert encoding into a HTML standard, or encoding->getCString if not
// recognized
static char* mapEncodingToHtml(GooString* encoding);
void processLink(Link *link);
GooString* getLinkDest(Link *link,Catalog *catalog);
void dumpMetaVars(FILE *);
void doFrame(int firstPage);
......@@ -294,6 +306,7 @@ private:
GooString *Docname;
GooString *docTitle;
GooList *glMetaVars;
Catalog *catalog;
friend class HtmlPage;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment