fixed PS bounding box computation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2000-12-24 14:01:29 +00:00
parent 3a70a28254
commit a30f8da836

View File

@ -1668,10 +1668,26 @@ void wxPostScriptDC::EndDoc ()
// Compute the bounding box. Note that it is in the default user
// coordinate system, thus we have to convert the values.
wxCoord llx = (wxCoord) ((XLOG2DEV(m_minX)+wx_printer_translate_x)*wx_printer_scale_x);
wxCoord lly = (wxCoord) ((YLOG2DEV(m_minY)+wx_printer_translate_y)*wx_printer_scale_y);
wxCoord urx = (wxCoord) ((XLOG2DEV(m_maxX)+wx_printer_translate_x)*wx_printer_scale_x);
wxCoord ury = (wxCoord) ((YLOG2DEV(m_maxY)+wx_printer_translate_y)*wx_printer_scale_y);
wxCoord minX = (wxCoord) XLOG2DEV(m_minX);
wxCoord minY = (wxCoord) YLOG2DEV(m_minY);
wxCoord maxX = (wxCoord) XLOG2DEV(m_maxX);
wxCoord maxY = (wxCoord) YLOG2DEV(m_maxY);
// LOG2DEV may have changed the minimum to maximum vice versa
if ( minX > maxX ) { wxCoord tmp = minX; minX = maxX; maxX = tmp; }
if ( minY > maxY ) { wxCoord tmp = minY; minY = maxY; maxY = tmp; }
// account for used scaling (boundingbox is before scaling in ps-file)
double scale_x = m_printData.GetPrinterScaleX() / ms_PSScaleFactor;
double scale_y = m_printData.GetPrinterScaleY() / ms_PSScaleFactor;
wxCoord llx, lly, urx, ury;
llx = (wxCoord) ((minX+wx_printer_translate_x)*scale_x);
lly = (wxCoord) ((minY+wx_printer_translate_y)*scale_y);
urx = (wxCoord) ((maxX+wx_printer_translate_x)*scale_x);
ury = (wxCoord) ((maxY+wx_printer_translate_y)*scale_y);
// (end of bounding box computation)
// If we're landscape, our sense of "x" and "y" is reversed.
if (m_printData.GetOrientation() == wxLANDSCAPE)