Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qpdf.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949#include <qnumeric.h>
    5050
     51#ifdef Q_OS_UNIX
     52#include "private/qcore_unix_p.h" // overrides QT_OPEN
     53#endif
     54
    5155QT_BEGIN_NAMESPACE
    5256
     
    7579    qreal frac = val - (qreal)ival;
    7680
    77     int ifrac = (int)(frac * 1000000);
    78     if (ifrac == 1000000) {
     81    int ifrac = (int)(frac * 1000000000);
     82    if (ifrac == 1000000000) {
    7983        ++ival;
    8084        ifrac = 0;
     
    8791        ival /= 10;
    8892    }
    89     int fact = 100000;
     93    int fact = 100000000;
    9094    if (i == 0) {
    9195        *(buf++) = '0';
     
    142146            handleDirty(false)
    143147    {
    144         dev->open(QIODevice::ReadWrite);
     148        dev->open(QIODevice::ReadWrite | QIODevice::Append);
    145149    }
    146150
     
    310314    Qt::FillRule fillRule = path.fillRule();
    311315
    312     const char *op = 0;
     316    const char *op = "";
    313317    switch (flags) {
    314318    case ClipPath:
     
    347351    QByteArray result;
    348352    ByteStream s(&result);
    349     s << "[";
     353    s << '[';
    350354
    351355    QVector<qreal> dasharray = pen.dashPattern();
     
    358362        s << dw;
    359363    }
    360     s << "]";
     364    s << ']';
    361365    //qDebug() << "dasharray: pen has" << dasharray;
    362366    //qDebug() << "  => " << result;
     
    916920{
    917921    QByteArray s = string;
    918     s.replace(" ", "");
    919     s.replace("(", "");
    920     s.replace(")", "");
    921     s.replace("<", "");
    922     s.replace(">", "");
    923     s.replace("[", "");
    924     s.replace("]", "");
    925     s.replace("{", "");
    926     s.replace("}", "");
    927     s.replace("/", "");
    928     s.replace("%", "");
     922    s.replace(' ', "");
     923    s.replace('(', "");
     924    s.replace(')', "");
     925    s.replace('<', "");
     926    s.replace('>', "");
     927    s.replace('[', "");
     928    s.replace(']', "");
     929    s.replace('{', "");
     930    s.replace('}', "");
     931    s.replace('/', "");
     932    s.replace('%', "");
    929933    return s;
    930934}
     
    965969void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount)
    966970{
    967     Q_D(QPdfBaseEngine);
    968     if (!points || !d->hasPen)
     971    if (!points)
    969972        return;
    970973
     
    996999
    9971000    Q_D(QPdfBaseEngine);
     1001    if (d->useAlphaEngine) {
     1002        QAlphaPaintEngine::drawRects(rects, rectCount);
     1003        if (!continueCall())
     1004            return;
     1005    }
     1006
    9981007    if (d->clipEnabled && d->allClipped)
    9991008        return;
     
    14631472        QList<QVariant> margins(value.toList());
    14641473        Q_ASSERT(margins.size() == 4);
    1465         d->leftMargin = margins.at(0).toDouble();
    1466         d->topMargin = margins.at(1).toDouble();
    1467         d->rightMargin = margins.at(2).toDouble();
    1468         d->bottomMargin = margins.at(3).toDouble();
     1474        d->leftMargin = margins.at(0).toReal();
     1475        d->topMargin = margins.at(1).toReal();
     1476        d->rightMargin = margins.at(2).toReal();
     1477        d->bottomMargin = margins.at(3).toReal();
    14691478        d->hasCustomPageMargins = true;
    14701479        break;
     
    15681577                    << d->rightMargin << d->bottomMargin;
    15691578        } else {
    1570             const int defaultMargin = 10; // ~3.5 mm
     1579            const qreal defaultMargin = 10; // ~3.5 mm
    15711580            margins << defaultMargin << defaultMargin
    15721581                    << defaultMargin << defaultMargin;
     
    16481657    // leave stdin/out/err untouched
    16491658    while(--i > 2)
    1650         ::close(i);
     1659        QT_CLOSE(i);
    16511660}
    16521661#endif
     
    16821691            pr = printerName;
    16831692        int fds[2];
    1684         if (pipe(fds) != 0) {
     1693        if (qt_safe_pipe(fds) != 0) {
    16851694            qWarning("QPdfPrinter: Could not open pipe to print");
    16861695            return false;
     
    17011710                (void)execl("/bin/true", "true", (char *)0);
    17021711                (void)execl("/usr/bin/true", "true", (char *)0);
    1703                 ::exit(0);
     1712                ::_exit(0);
    17041713            }
    1705             dup2(fds[0], 0);
     1714            qt_safe_dup2(fds[0], 0, 0);
    17061715
    17071716            closeAllOpenFds();
     
    17651774                (void)execv("/usr/bin/lp", lpargs);
    17661775                (void)execv("/usr/bin/lpr", lprargs);
     1776
     1777                delete []lpargs;
     1778                delete []lprargs;
    17671779            }
    17681780            // if we couldn't exec anything, close the fd,
     
    17701782            // child of the GUI process) has exited.  then
    17711783            // exit.
    1772             ::close(0);
     1784            QT_CLOSE(0);
    17731785            (void)::sleep(1);
    1774             ::exit(0);
     1786            ::_exit(0);
    17751787        }
    17761788        // parent process
    1777         ::close(fds[0]);
     1789        QT_CLOSE(fds[0]);
    17781790        fd = fds[1];
    1779         (void)::waitpid(pid, 0, 0);
     1791        (void)qt_safe_waitpid(pid, 0, 0);
    17801792
    17811793        if (fd < 0)
     
    19241936    if (ti.fontEngine->type() == QFontEngine::Win) {
    19251937        QFontEngineWin *fe = static_cast<QFontEngineWin *>(ti.fontEngine);
    1926         size = fe->tm.w.tmHeight;
     1938        size = fe->tm.tmHeight;
    19271939    }
    19281940#endif
     
    19301942    QVarLengthArray<glyph_t> glyphs;
    19311943    QVarLengthArray<QFixedPoint> positions;
    1932     QTransform m;
    1933     m.translate(p.x(), p.y());
     1944    QTransform m = QTransform::fromTranslate(p.x(), p.y());
    19341945    ti.fontEngine->getGlyphPositions(ti.glyphs, m, ti.flags,
    19351946                                     glyphs, positions);
Note: See TracChangeset for help on using the changeset viewer.