tell gs exactly the size we want so we don't have off by one problems due to rounding

svn path=/trunk/KDE/kdegraphics/okular/; revision=676275
remotes/origin/KDE/4.0
Albert Astals Cid 19 years ago
parent 68822746af
commit fcc47e4106
  1. 1
      generators/ghostview/generator_ghostview.cpp
  2. 3
      generators/ghostview/gshandler.cpp
  3. 2
      generators/ghostview/gshandler.h
  4. 4
      generators/ghostview/interpreter_cmd.cpp

@ -359,7 +359,6 @@ void GSGenerator::generatePixmap( Okular::PixmapRequest * req )
// TODO check if needed
// asyncGenerator->setOrientation(rotation (internalDoc->orientation(pgNo)));
// asyncGenerator->setSize( reqwidth, reqheight );
asyncGenerator->setMedia( internalDoc -> getPaperSize ( internalDoc -> pageMedia( pgNo )) );
asyncGenerator->setMagnify( qMax( (double)reqwidth / width, (double)reqheight / height ) );
PsPosition u=internalDoc->pagePos(pgNo);

@ -113,7 +113,7 @@ GSHandler::GSHandler()
m_ghostScriptInstance = 0;
}
void GSHandler::init(const QString &media, double magnify, bool plaformFonts, int aaText, int aaGfx, GSInterpreterCMD *interpreter)
void GSHandler::init(const QString &media, double magnify, int width, int height, bool plaformFonts, int aaText, int aaGfx, GSInterpreterCMD *interpreter)
{
int errorCode;
@ -138,6 +138,7 @@ void GSHandler::init(const QString &media, double magnify, bool plaformFonts, in
<< QString("-dTextAlphaBits=%1").arg(aaText)
<< QString("-dGraphicsAlphaBits=%1").arg(aaGfx)
<< QString("-sPAPERSIZE=%1").arg(media.toLower())
<< QString().sprintf("-g%dx%d", width, height)
<< QString().sprintf("-r%fx%f", (magnify * Okular::Utils::dpiX()),
(magnify * Okular::Utils::dpiY()))
<< QString().sprintf("-dDisplayFormat=%d", DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST | DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_TOPFIRST)

@ -24,6 +24,8 @@ class GSHandler
void init(const QString &media,
double magnify,
int width,
int height,
bool plaformFonts,
int aaText,
int aaGfx,

@ -86,7 +86,7 @@ void GSInterpreterCMD::fordwardImage(QImage *image)
{
if (image->width() != m_request->width() || image->height() != m_request->height())
{
kDebug(4656) << "Generated image does not match wanted size " << image->width() << " " << m_request->width() << " " << image->height() << " " << m_request->height() << endl;
kWarning(4656) << "Generated image does not match wanted size " << image->width() << " " << m_request->width() << " " << image->height() << " " << m_request->height() << endl;
QImage aux = image->scaled(m_request->width(), m_request->height());
delete image;
image = new QImage(aux);
@ -108,7 +108,7 @@ void GSInterpreterCMD::run()
while(1)
{
m_semaphore.acquire();
m_handler->init(m_media, m_magnify, m_pfonts, m_aaText, m_aaGfx, this);
m_handler->init(m_media, m_magnify, m_request->width(), m_request->height(), m_pfonts, m_aaText, m_aaGfx, this);
// send structural information
if (m_sendStructure)

Loading…
Cancel
Save