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/svg/qsvggenerator.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 QtSvg 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**
     
    262262
    263263            if (!constantAlpha) {
    264                 const qreal spacing = 0.02;
     264                const qreal spacing = qreal(0.02);
    265265                QGradientStops newStops;
    266266                QRgb fromColor = PREMUL(stops.at(0).second.rgba());
     
    363363
    364364            // SVG uses absolute offset
    365             dashOffset = QString::fromLatin1("%1").arg(spen.dashOffset() * penWidth);
     365            dashOffset = QString::number(spen.dashOffset() * penWidth);
    366366
    367367            d_func()->attributes.stroke = color;
     
    404404        switch (spen.joinStyle()) {
    405405        case Qt::MiterJoin:
    406             stream() << "stroke-linejoin=\"miter\" ";
    407             stream() << "stroke-miterlimit=\""<<spen.miterLimit()<<"\" ";
     406            stream() << "stroke-linejoin=\"miter\" "
     407                        "stroke-miterlimit=\""<<spen.miterLimit()<<"\" ";
    408408            break;
    409409        case Qt::BevelJoin:
     
    414414            break;
    415415        case Qt::SvgMiterJoin:
    416             stream() << "stroke-linejoin=\"miter\" ";
    417             stream() << "stroke-miterlimit=\""<<spen.miterLimit()<<"\" ";
     416            stream() << "stroke-linejoin=\"miter\" "
     417                        "stroke-miterlimit=\""<<spen.miterLimit()<<"\" ";
    418418            break;
    419419        default:
     
    428428            QString color, colorOpacity;
    429429            translate_color(sbrush.color(), &color, &colorOpacity);
    430             stream() << "fill=\"" << color << "\" ";
    431             stream() << "fill-opacity=\""
     430            stream() << "fill=\"" << color << "\" "
     431                        "fill-opacity=\""
    432432                     << colorOpacity << "\" ";
    433433            d_func()->attributes.fill = color;
     
    494494
    495495        *d->stream << "font-family=\"" << d->attributes.font_family << "\" "
    496                    << "font-size=\"" << d->attributes.font_size << "\" "
    497                    << "font-weight=\"" << d->attributes.font_weight << "\" "
    498                    << "font-style=\"" << d->attributes.font_style << "\" "
     496                     "font-size=\"" << d->attributes.font_size << "\" "
     497                     "font-weight=\"" << d->attributes.font_weight << "\" "
     498                     "font-style=\"" << d->attributes.font_style << "\" "
    499499                   << endl;
    500500    }
     
    512512/*!
    513513    \class QSvgGenerator
    514     \ingroup multimedia
     514    \ingroup painting
    515515    \since 4.3
    516516    \brief The QSvgGenerator class provides a paint device that is used to create SVG drawings.
     
    568568        delete d->engine->outputDevice();
    569569    delete d->engine;
    570     delete d_ptr;
    571570}
    572571
     
    850849
    851850    if (d->viewBox.isValid()) {
    852         *d->stream << " viewBox=\"" << d->viewBox.left() << " " << d->viewBox.top();
    853         *d->stream << " " << d->viewBox.width() << " " << d->viewBox.height() << "\"" << endl;
     851        *d->stream << " viewBox=\"" << d->viewBox.left() << ' ' << d->viewBox.top();
     852        *d->stream << ' ' << d->viewBox.width() << ' ' << d->viewBox.height() << '\"' << endl;
    854853    }
    855854
    856855    *d->stream << " xmlns=\"http://www.w3.org/2000/svg\""
    857                << " xmlns:xlink=\"http://www.w3.org/1999/xlink\" "
    858                << " version=\"1.2\" baseProfile=\"tiny\">" << endl;
     856                 " xmlns:xlink=\"http://www.w3.org/1999/xlink\" "
     857                 " version=\"1.2\" baseProfile=\"tiny\">" << endl;
    859858
    860859    if (!d->attributes.document_title.isEmpty()) {
     
    919918    Q_UNUSED(flags);
    920919    stream() << "<image ";
    921     stream() << "x=\""<<r.x()<<"\" ";
    922     stream() << "y=\""<<r.y()<<"\" ";
    923     stream() << "width=\""<<r.width()<<"\" ";
    924     stream() << "height=\""<<r.height()<<"\" ";
     920    stream() << "x=\""<<r.x()<<"\" "
     921                "y=\""<<r.y()<<"\" "
     922                "width=\""<<r.width()<<"\" "
     923                "height=\""<<r.height()<<"\" "
     924                "preserveAspectRatio=\"none\" ";
    925925
    926926    QByteArray data;
     
    931931    stream() << "xlink:href=\"data:image/png;base64,"
    932932             << data.toBase64()
    933              <<"\" ";
    934     stream() << "/>\n";
     933             <<"\" />\n";
    935934}
    936935
     
    959958    if (flags & QPaintEngine::DirtyTransform) {
    960959        d->matrix = state.matrix();
    961         *d->stream << "transform=\"matrix(" << d->matrix.m11() << ","
    962                    << d->matrix.m12() << ","
    963                    << d->matrix.m21() << "," << d->matrix.m22() << ","
    964                    << d->matrix.dx() << "," << d->matrix.dy()
     960        *d->stream << "transform=\"matrix(" << d->matrix.m11() << ','
     961                   << d->matrix.m12() << ','
     962                   << d->matrix.m21() << ',' << d->matrix.m22() << ','
     963                   << d->matrix.dx() << ',' << d->matrix.dy()
    965964                   << ")\""
    966965                   << endl;
     
    972971
    973972    if (flags & QPaintEngine::DirtyOpacity) {
    974         if (!qFuzzyCompare(state.opacity(), 1))
     973        if (!qFuzzyIsNull(state.opacity() - 1))
    975974            stream() << "opacity=\""<<state.opacity()<<"\" ";
    976975    }
    977976
    978     *d->stream << ">" << endl;
     977    *d->stream << '>' << endl;
    979978
    980979    d->afterFirstUpdate = true;
     
    985984    Q_D(QSvgPaintEngine);
    986985
    987     *d->stream << "<path ";
    988 
    989 
    990     *d->stream << "fill-rule=";
     986    *d->stream << "<path "
     987                  "fill-rule=";
    991988    if (p.fillRule() == Qt::OddEvenFill)
    992989        *d->stream << "\"evenodd\" ";
     
    1000997        switch (e.type) {
    1001998        case QPainterPath::MoveToElement:
    1002             *d->stream << "M" << e.x << "," << e.y;
     999            *d->stream << 'M' << e.x << ',' << e.y;
    10031000            break;
    10041001        case QPainterPath::LineToElement:
    1005             *d->stream << "L" << e.x << "," << e.y;
     1002            *d->stream << 'L' << e.x << ',' << e.y;
    10061003            break;
    10071004        case QPainterPath::CurveToElement:
    1008             *d->stream << "C" << e.x << "," << e.y;
     1005            *d->stream << 'C' << e.x << ',' << e.y;
    10091006            ++i;
    10101007            while (i < p.elementCount()) {
     
    10141011                    break;
    10151012                } else
    1016                     *d->stream << " ";
    1017                 *d->stream << e.x << "," << e.y;
     1013                    *d->stream << ' ';
     1014                *d->stream << e.x << ',' << e.y;
    10181015                ++i;
    10191016            }
     
    10231020        }
    10241021        if (i != p.elementCount() - 1) {
    1025             *d->stream << " ";
     1022            *d->stream << ' ';
    10261023        }
    10271024    }
     
    10451042        for (int i = 0; i < pointCount; ++i) {
    10461043            const QPointF &pt = points[i];
    1047             stream() << pt.x() << "," << pt.y() << " ";
     1044            stream() << pt.x() << ',' << pt.y() << ' ';
    10481045        }
    10491046        stream() << "\" />" <<endl;
     
    10641061
    10651062    *d->stream << "<text "
    1066                << "fill=\"" << d->attributes.stroke << "\" "
    1067                << "fill-opacity=\"" << d->attributes.strokeOpacity << "\" "
    1068                << "stroke=\"none\" "
    1069                << "x=\"" << pt.x() << "\" y=\"" << pt.y() << "\" ";
     1063                  "fill=\"" << d->attributes.stroke << "\" "
     1064                  "fill-opacity=\"" << d->attributes.strokeOpacity << "\" "
     1065                  "stroke=\"none\" "
     1066                  "xml:space=\"preserve\" "
     1067                  "x=\"" << pt.x() << "\" y=\"" << pt.y() << "\" ";
    10701068    qfontToSvg(textItem.font());
    10711069    *d->stream << " >"
Note: See TracChangeset for help on using the changeset viewer.