- 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)
+