Fixed scaling problem.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9156 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
518ba2b80c
commit
90c9b3ae9a
@ -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)
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user