Fixed scaling problem.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9156 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2004-10-02 05:26:45 +00:00
parent 518ba2b80c
commit 90c9b3ae9a
2 changed files with 12 additions and 10 deletions

View File

@ -48,6 +48,8 @@ bool PSDriver::startPage(int page)
{
page ++;
writeSpoolString("%%%%Page: %d %d\n", page, page);
writeSpoolString("gsave\n");
setupCTM();
return true;
}
@ -55,6 +57,7 @@ bool PSDriver::endPage(int)
{
try {
fPrintedPages ++;
writeSpoolString("grestore\n");
writeSpoolString("showpage\n");
return true;
}
@ -63,6 +66,14 @@ bool PSDriver::endPage(int)
}
}
void PSDriver::setupCTM() {
// move origin from bottom left to top left
writeSpoolString("0 %f translate\n", getJobData()->getPaperRect().Height());
// y values increase from top to bottom
// units of measure is dpi
writeSpoolString("72 %d div 72 -%d div scale\n", 2*getJobData()->getXres(), 2*getJobData()->getYres());
}
bool PSDriver::endDoc(bool)
{
try {
@ -235,15 +246,6 @@ void PSDriver::jobStart()
writeSpoolString("%%%%BeginDefaults\n");
writeSpoolString("%%%%PageMedia: Plain\n");
writeSpoolString("%%%%EndDefaults\n");
// setup CTM
writeSpoolString("%%%%BeginSetup\n");
// move origin from bottom left to top left
writeSpoolString("0 %f translate\n", getJobData()->getPaperRect().Height());
// y values increase from top to bottom
// units of measure is dpi
writeSpoolString("72 %d div 72 -%d div scale\n", getJobData()->getXres(), getJobData()->getYres());
writeSpoolString("%%%%EndSetup\n");
}
void PSDriver::startRasterGraphics(int x, int y, int width, int height, int widthByte)

View File

@ -22,8 +22,8 @@ protected:
virtual bool endDoc(bool success);
private:
void setupCTM();
void jobStart();
float scale(int d);
void startRasterGraphics(int x, int y, int width, int height, int widthByte);
void endRasterGraphics();
void rasterGraphics(