OSDN Git Service

drop unused epsf feature of QPSPrintEngine
authorIvailo Monev <xakepa10@gmail.com>
Fri, 11 Nov 2022 00:41:39 +0000 (02:41 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Fri, 11 Nov 2022 00:41:39 +0000 (02:41 +0200)
note that it is hidden behind backdoor function

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/painting/qprintengine_ps.cpp
src/gui/painting/qprintengine_ps_p.h

index 1732dc7..4fcc495 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-static bool qt_gen_epsf = false;
-
-void qt_generate_epsf(bool b)
-{
-    qt_gen_epsf = b;
-}
-
 static const char *const ps_header =
 "/BD{bind def}bind def/d2{dup dup}BD/ED{exch def}BD/D0{0 ED}BD/F{setfont}BD\n"
 "/RL{rlineto}BD/CM{currentmatrix}BD/SM{setmatrix}BD/TR{translate}BD/SD\n"
@@ -436,42 +429,16 @@ void QPSPrintEnginePrivate::emitHeader(bool finished)
     int mright = paperRect.right() - pageRect.right();
     int width = pageRect.width();
     int height = pageRect.height();
-    if (finished && pageCount == 1 && copies == 1 && fullPage && qt_gen_epsf)
-    {
-        // According to the EPSF 3.0 spec it is required that the PS
-        // version is PS-Adobe-3.0
-        s << "%!PS-Adobe-3.0";
-        if (!boundingBox.isValid())
-            boundingBox.setRect(0, 0, width, height);
-        if (orientation == QPrinter::Landscape) {
-            if (!fullPage)
-                boundingBox.translate(-mleft, -mtop);
-            s << " EPSF-3.0\n%%BoundingBox: "
-              << int((printer->height() - boundingBox.bottom())*scale) // llx
-              << int((printer->width() - boundingBox.right())*scale - 1) // lly
-              << int((printer->height() - boundingBox.top())*scale + 1) // urx
-              << int((printer->width() - boundingBox.left())*scale); // ury
-        } else {
-            if (!fullPage)
-                boundingBox.translate(mleft, -mtop);
-            s << " EPSF-3.0\n%%BoundingBox: "
-              << int((boundingBox.left())*scale)
-              << int((printer->height() - boundingBox.bottom())*scale - 1)
-              << int((boundingBox.right())*scale + 1)
-              << int((printer->height() - boundingBox.top())*scale);
-        }
-    } else {
-        s << "%!PS-Adobe-1.0";
-        int w = width + (fullPage ? 0 : mleft + mright);
-        int h = height + (fullPage ? 0 : mtop + mbottom);
-        w = (int)(w*scale);
-        h = (int)(h*scale);
-        // set a bounding box according to the DSC
-        if (orientation == QPrinter::Landscape)
-            s << "\n%%BoundingBox: 0 0 " << h << w;
-        else
-            s << "\n%%BoundingBox: 0 0 " << w << h;
-    }
+    s << "%!PS-Adobe-1.0";
+    int w = width + (fullPage ? 0 : mleft + mright);
+    int h = height + (fullPage ? 0 : mtop + mbottom);
+    w = (int)(w*scale);
+    h = (int)(h*scale);
+    // set a bounding box according to the DSC
+    if (orientation == QPrinter::Landscape)
+        s << "\n%%BoundingBox: 0 0 " << h << w;
+    else
+        s << "\n%%BoundingBox: 0 0 " << w << h;
     s << '\n' << wrapDSC("%%Creator: " + creator.toUtf8());
     if (!title.isEmpty())
         s << wrapDSC("%%Title: " + title.toUtf8());
index 849c3be..900b664 100644 (file)
@@ -96,7 +96,6 @@ public:
                          bool gray, qreal scaleX, qreal scaleY);
 
     int         pageCount;
-    bool        epsf;
     QByteArray     fontsUsed;
 
     // stores the descriptions of the n first pages.