Changeset 561 for trunk/src/svg/qsvggenerator.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/svg/qsvggenerator.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSvg module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 262 262 263 263 if (!constantAlpha) { 264 const qreal spacing = 0.02;264 const qreal spacing = qreal(0.02); 265 265 QGradientStops newStops; 266 266 QRgb fromColor = PREMUL(stops.at(0).second.rgba()); … … 363 363 364 364 // SVG uses absolute offset 365 dashOffset = QString:: fromLatin1("%1").arg(spen.dashOffset() * penWidth);365 dashOffset = QString::number(spen.dashOffset() * penWidth); 366 366 367 367 d_func()->attributes.stroke = color; … … 404 404 switch (spen.joinStyle()) { 405 405 case Qt::MiterJoin: 406 stream() << "stroke-linejoin=\"miter\" " ;407 stream() <<"stroke-miterlimit=\""<<spen.miterLimit()<<"\" ";406 stream() << "stroke-linejoin=\"miter\" " 407 "stroke-miterlimit=\""<<spen.miterLimit()<<"\" "; 408 408 break; 409 409 case Qt::BevelJoin: … … 414 414 break; 415 415 case Qt::SvgMiterJoin: 416 stream() << "stroke-linejoin=\"miter\" " ;417 stream() <<"stroke-miterlimit=\""<<spen.miterLimit()<<"\" ";416 stream() << "stroke-linejoin=\"miter\" " 417 "stroke-miterlimit=\""<<spen.miterLimit()<<"\" "; 418 418 break; 419 419 default: … … 428 428 QString color, colorOpacity; 429 429 translate_color(sbrush.color(), &color, &colorOpacity); 430 stream() << "fill=\"" << color << "\" " ;431 stream() <<"fill-opacity=\""430 stream() << "fill=\"" << color << "\" " 431 "fill-opacity=\"" 432 432 << colorOpacity << "\" "; 433 433 d_func()->attributes.fill = color; … … 494 494 495 495 *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 << "\" " 499 499 << endl; 500 500 } … … 512 512 /*! 513 513 \class QSvgGenerator 514 \ingroup multimedia514 \ingroup painting 515 515 \since 4.3 516 516 \brief The QSvgGenerator class provides a paint device that is used to create SVG drawings. … … 568 568 delete d->engine->outputDevice(); 569 569 delete d->engine; 570 delete d_ptr;571 570 } 572 571 … … 850 849 851 850 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; 854 853 } 855 854 856 855 *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; 859 858 860 859 if (!d->attributes.document_title.isEmpty()) { … … 919 918 Q_UNUSED(flags); 920 919 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\" "; 925 925 926 926 QByteArray data; … … 931 931 stream() << "xlink:href=\"data:image/png;base64," 932 932 << data.toBase64() 933 <<"\" "; 934 stream() << "/>\n"; 933 <<"\" />\n"; 935 934 } 936 935 … … 959 958 if (flags & QPaintEngine::DirtyTransform) { 960 959 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() 965 964 << ")\"" 966 965 << endl; … … 972 971 973 972 if (flags & QPaintEngine::DirtyOpacity) { 974 if (!qFuzzy Compare(state.opacity(),1))973 if (!qFuzzyIsNull(state.opacity() - 1)) 975 974 stream() << "opacity=\""<<state.opacity()<<"\" "; 976 975 } 977 976 978 *d->stream << ">"<< endl;977 *d->stream << '>' << endl; 979 978 980 979 d->afterFirstUpdate = true; … … 985 984 Q_D(QSvgPaintEngine); 986 985 987 *d->stream << "<path "; 988 989 990 *d->stream << "fill-rule="; 986 *d->stream << "<path " 987 "fill-rule="; 991 988 if (p.fillRule() == Qt::OddEvenFill) 992 989 *d->stream << "\"evenodd\" "; … … 1000 997 switch (e.type) { 1001 998 case QPainterPath::MoveToElement: 1002 *d->stream << "M" << e.x << ","<< e.y;999 *d->stream << 'M' << e.x << ',' << e.y; 1003 1000 break; 1004 1001 case QPainterPath::LineToElement: 1005 *d->stream << "L" << e.x << ","<< e.y;1002 *d->stream << 'L' << e.x << ',' << e.y; 1006 1003 break; 1007 1004 case QPainterPath::CurveToElement: 1008 *d->stream << "C" << e.x << ","<< e.y;1005 *d->stream << 'C' << e.x << ',' << e.y; 1009 1006 ++i; 1010 1007 while (i < p.elementCount()) { … … 1014 1011 break; 1015 1012 } else 1016 *d->stream << " ";1017 *d->stream << e.x << ","<< e.y;1013 *d->stream << ' '; 1014 *d->stream << e.x << ',' << e.y; 1018 1015 ++i; 1019 1016 } … … 1023 1020 } 1024 1021 if (i != p.elementCount() - 1) { 1025 *d->stream << " ";1022 *d->stream << ' '; 1026 1023 } 1027 1024 } … … 1045 1042 for (int i = 0; i < pointCount; ++i) { 1046 1043 const QPointF &pt = points[i]; 1047 stream() << pt.x() << "," << pt.y() << " ";1044 stream() << pt.x() << ',' << pt.y() << ' '; 1048 1045 } 1049 1046 stream() << "\" />" <<endl; … … 1064 1061 1065 1062 *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() << "\" "; 1070 1068 qfontToSvg(textItem.font()); 1071 1069 *d->stream << " >"
Note:
See TracChangeset
for help on using the changeset viewer.