Changeset 561 for trunk/src/svg/qsvgstyle.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/qsvgstyle.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 ** … … 60 60 QSvgExtraStates::QSvgExtraStates() 61 61 : fillOpacity(1.0) 62 , strokeOpacity(1.0) 63 , svgFont(0) 64 , textAnchor(Qt::AlignLeft) 65 , fontWeight(400) 66 , fillRule(Qt::WindingFill) 67 , strokeDashOffset(0) 68 , vectorEffect(false) 62 69 { 63 70 } … … 66 73 { 67 74 } 75 76 void QSvgFillStyleProperty::apply(QPainter *, const QRectF &, QSvgNode *, QSvgExtraStates &) 77 { 78 Q_ASSERT(!"This should not be called!"); 79 } 80 81 void QSvgFillStyleProperty::revert(QPainter *, QSvgExtraStates &) 82 { 83 Q_ASSERT(!"This should not be called!"); 84 } 85 68 86 69 87 QSvgQualityStyle::QSvgQualityStyle(int color) … … 81 99 } 82 100 83 QSvgFillStyle::QSvgFillStyle(const QBrush &brush) 84 : m_fill(brush), m_style(0), m_fillRuleSet(false), m_fillOpacitySet(false) 85 { 86 } 87 88 QSvgFillStyle::QSvgFillStyle(QSvgStyleProperty *style) 89 : m_style(style), m_fillRuleSet(false), m_fillOpacitySet(false) 101 QSvgFillStyle::QSvgFillStyle() 102 : m_style(0) 103 , m_fillRule(Qt::WindingFill) 104 , m_oldFillRule(Qt::WindingFill) 105 , m_fillOpacity(1.0) 106 , m_oldFillOpacity(0) 107 , m_gradientResolved(1) 108 , m_fillRuleSet(0) 109 , m_fillOpacitySet(0) 110 , m_fillSet(0) 90 111 { 91 112 } … … 93 114 void QSvgFillStyle::setFillRule(Qt::FillRule f) 94 115 { 95 m_fillRuleSet = true;116 m_fillRuleSet = 1; 96 117 m_fillRule = f; 97 118 } … … 99 120 void QSvgFillStyle::setFillOpacity(qreal opacity) 100 121 { 101 m_fillOpacitySet = true;122 m_fillOpacitySet = 1; 102 123 m_fillOpacity = opacity; 103 124 } 104 125 105 static void recursivelySetFill(QSvgNode *node, Qt::FillRule f) 106 { 107 if (node->type() == QSvgNode::PATH) { 108 QSvgPath *path = static_cast<QSvgPath*>(node); 109 path->qpath()->setFillRule(f); 110 } else if (node->type() == QSvgNode::G) { 111 QList<QSvgNode*> renderers = static_cast<QSvgG*>(node)->renderers(); 112 foreach(QSvgNode *n, renderers) { 113 recursivelySetFill(n, f); 114 } 115 } 116 } 117 void QSvgFillStyle::apply(QPainter *p, const QRectF &rect, QSvgNode *node, QSvgExtraStates &states) 126 void QSvgFillStyle::setFillStyle(QSvgFillStyleProperty* style) 127 { 128 m_style = style; 129 m_fillSet = 1; 130 } 131 132 void QSvgFillStyle::setBrush(QBrush brush) 133 { 134 m_fill = brush; 135 m_style = 0; 136 m_fillSet = 1; 137 } 138 139 void QSvgFillStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &states) 118 140 { 119 141 m_oldFill = p->brush(); 120 m_oldOpacity = states.fillOpacity; 121 122 if (m_fillRuleSet) { 123 recursivelySetFill(node, m_fillRule); 124 m_fillRuleSet = false;//set it only on the first run 125 } 126 p->setBrush(m_fill); 142 m_oldFillRule = states.fillRule; 143 m_oldFillOpacity = states.fillOpacity; 144 145 if (m_fillRuleSet) 146 states.fillRule = m_fillRule; 147 if (m_fillSet) { 148 if (m_style) 149 p->setBrush(m_style->brush(p, states)); 150 else 151 p->setBrush(m_fill); 152 } 127 153 if (m_fillOpacitySet) 128 154 states.fillOpacity = m_fillOpacity; 129 if (m_style)130 m_style->apply(p, rect, node, states);131 155 } 132 156 133 157 void QSvgFillStyle::revert(QPainter *p, QSvgExtraStates &states) 134 158 { 135 if (m_style)136 m_style->revert(p, states);137 p->setBrush(m_oldFill);138 159 if (m_fillOpacitySet) 139 states.fillOpacity = m_oldOpacity; 160 states.fillOpacity = m_oldFillOpacity; 161 if (m_fillSet) 162 p->setBrush(m_oldFill); 163 if (m_fillRuleSet) 164 states.fillRule = m_oldFillRule; 140 165 } 141 166 … … 157 182 158 183 QSvgFontStyle::QSvgFontStyle(QSvgFont *font, QSvgTinyDocument *doc) 159 : m_font(font), m_pointSize(24), m_doc(doc) 160 { 161 } 162 163 QSvgFontStyle::QSvgFontStyle(const QFont &font, QSvgTinyDocument *doc) 164 : m_font(0), m_pointSize(24), m_doc(doc), m_qfont(font) 165 { 166 } 167 168 169 void QSvgFontStyle::setPointSize(qreal size) 170 { 171 m_pointSize = size; 172 } 173 174 qreal QSvgFontStyle::pointSize() const 175 { 176 return m_pointSize; 177 } 178 179 void QSvgFontStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &) 180 { 181 if (!m_font) { 182 m_oldFont = p->font(); 183 p->setFont(m_qfont); 184 } 185 } 186 187 void QSvgFontStyle::revert(QPainter *p, QSvgExtraStates &) 188 { 189 if (!m_font) { 190 p->setFont(m_oldFont); 191 } 192 } 193 194 QSvgStrokeStyle::QSvgStrokeStyle(const QPen &pen) 195 : m_stroke(pen) 196 { 197 } 198 199 void QSvgStrokeStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &) 184 : m_svgFont(font) 185 , m_doc(doc) 186 , m_familySet(0) 187 , m_sizeSet(0) 188 , m_styleSet(0) 189 , m_variantSet(0) 190 , m_weightSet(0) 191 , m_textAnchorSet(0) 192 { 193 } 194 195 QSvgFontStyle::QSvgFontStyle() 196 : m_svgFont(0) 197 , m_doc(0) 198 , m_familySet(0) 199 , m_sizeSet(0) 200 , m_styleSet(0) 201 , m_variantSet(0) 202 , m_weightSet(0) 203 , m_textAnchorSet(0) 204 { 205 } 206 207 int QSvgFontStyle::SVGToQtWeight(int weight) { 208 switch (weight) { 209 case 100: 210 case 200: 211 return QFont::Light; 212 case 300: 213 case 400: 214 return QFont::Normal; 215 case 500: 216 case 600: 217 return QFont::DemiBold; 218 case 700: 219 case 800: 220 return QFont::Bold; 221 case 900: 222 return QFont::Black; 223 } 224 return QFont::Normal; 225 } 226 227 void QSvgFontStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &states) 228 { 229 m_oldQFont = p->font(); 230 m_oldSvgFont = states.svgFont; 231 m_oldTextAnchor = states.textAnchor; 232 m_oldWeight = states.fontWeight; 233 234 if (m_textAnchorSet) 235 states.textAnchor = m_textAnchor; 236 237 QFont font = m_oldQFont; 238 if (m_familySet) { 239 states.svgFont = m_svgFont; 240 font.setFamily(m_qfont.family()); 241 } 242 243 if (m_sizeSet) 244 font.setPointSize(m_qfont.pointSizeF()); 245 246 if (m_styleSet) 247 font.setStyle(m_qfont.style()); 248 249 if (m_variantSet) 250 font.setCapitalization(m_qfont.capitalization()); 251 252 if (m_weightSet) { 253 if (m_weight == BOLDER) { 254 states.fontWeight = qMin(states.fontWeight + 100, 900); 255 } else if (m_weight == LIGHTER) { 256 states.fontWeight = qMax(states.fontWeight - 100, 100); 257 } else { 258 states.fontWeight = m_weight; 259 } 260 font.setWeight(SVGToQtWeight(states.fontWeight)); 261 } 262 263 p->setFont(font); 264 } 265 266 void QSvgFontStyle::revert(QPainter *p, QSvgExtraStates &states) 267 { 268 p->setFont(m_oldQFont); 269 states.svgFont = m_oldSvgFont; 270 states.textAnchor = m_oldTextAnchor; 271 states.fontWeight = m_oldWeight; 272 } 273 274 QSvgStrokeStyle::QSvgStrokeStyle() 275 : m_strokeOpacity(1.0) 276 , m_oldStrokeOpacity(0.0) 277 , m_strokeDashOffset(0) 278 , m_oldStrokeDashOffset(0) 279 , m_style(0) 280 , m_gradientResolved(1) 281 , m_vectorEffect(0) 282 , m_oldVectorEffect(0) 283 , m_strokeSet(0) 284 , m_strokeDashArraySet(0) 285 , m_strokeDashOffsetSet(0) 286 , m_strokeLineCapSet(0) 287 , m_strokeLineJoinSet(0) 288 , m_strokeMiterLimitSet(0) 289 , m_strokeOpacitySet(0) 290 , m_strokeWidthSet(0) 291 , m_vectorEffectSet(0) 292 { 293 } 294 295 void QSvgStrokeStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &states) 200 296 { 201 297 m_oldStroke = p->pen(); 202 p->setPen(m_stroke); 203 } 204 205 void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &) 298 m_oldStrokeOpacity = states.strokeOpacity; 299 m_oldStrokeDashOffset = states.strokeDashOffset; 300 m_oldVectorEffect = states.vectorEffect; 301 302 QPen pen = p->pen(); 303 304 qreal oldWidth = pen.widthF(); 305 qreal width = m_stroke.widthF(); 306 if (oldWidth == 0) 307 oldWidth = 1; 308 if (width == 0) 309 width = 1; 310 qreal scale = oldWidth / width; 311 312 if (m_strokeOpacitySet) 313 states.strokeOpacity = m_strokeOpacity; 314 315 if (m_vectorEffectSet) 316 states.vectorEffect = m_vectorEffect; 317 318 if (m_strokeSet) { 319 if (m_style) 320 pen.setBrush(m_style->brush(p, states)); 321 else 322 pen.setBrush(m_stroke.brush()); 323 } 324 325 if (m_strokeWidthSet) 326 pen.setWidthF(m_stroke.widthF()); 327 328 bool setDashOffsetNeeded = false; 329 330 if (m_strokeDashOffsetSet) { 331 states.strokeDashOffset = m_strokeDashOffset; 332 setDashOffsetNeeded = true; 333 } 334 335 if (m_strokeDashArraySet) { 336 if (m_stroke.style() == Qt::SolidLine) { 337 pen.setStyle(Qt::SolidLine); 338 } else if (m_strokeWidthSet || oldWidth == 1) { 339 // If both width and dash array was set, the dash array is already scaled correctly. 340 pen.setDashPattern(m_stroke.dashPattern()); 341 setDashOffsetNeeded = true; 342 } else { 343 // If dash array was set, but not the width, the dash array has to be scaled with respect to the old width. 344 QVector<qreal> dashes = m_stroke.dashPattern(); 345 for (int i = 0; i < dashes.size(); ++i) 346 dashes[i] /= oldWidth; 347 pen.setDashPattern(dashes); 348 setDashOffsetNeeded = true; 349 } 350 } else if (m_strokeWidthSet && pen.style() != Qt::SolidLine && scale != 1) { 351 // If the width was set, but not the dash array, the old dash array must be scaled with respect to the new width. 352 QVector<qreal> dashes = pen.dashPattern(); 353 for (int i = 0; i < dashes.size(); ++i) 354 dashes[i] *= scale; 355 pen.setDashPattern(dashes); 356 setDashOffsetNeeded = true; 357 } 358 359 if (m_strokeLineCapSet) 360 pen.setCapStyle(m_stroke.capStyle()); 361 if (m_strokeLineJoinSet) 362 pen.setJoinStyle(m_stroke.joinStyle()); 363 if (m_strokeMiterLimitSet) 364 pen.setMiterLimit(m_stroke.miterLimit()); 365 366 // You can have dash offset on solid strokes in SVG files, but not in Qt. 367 // QPen::setDashOffset() will set the pen style to Qt::CustomDashLine, 368 // so don't call the method if the pen is solid. 369 if (setDashOffsetNeeded && pen.style() != Qt::SolidLine) { 370 qreal currentWidth = pen.widthF(); 371 if (currentWidth == 0) 372 currentWidth = 1; 373 pen.setDashOffset(states.strokeDashOffset / currentWidth); 374 } 375 376 pen.setCosmetic(states.vectorEffect); 377 378 p->setPen(pen); 379 } 380 381 void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &states) 206 382 { 207 383 p->setPen(m_oldStroke); 384 states.strokeOpacity = m_oldStrokeOpacity; 385 states.strokeDashOffset = m_oldStrokeDashOffset; 386 states.vectorEffect = m_oldVectorEffect; 387 } 388 389 void QSvgStrokeStyle::setDashArray(const QVector<qreal> &dashes) 390 { 391 if (m_strokeWidthSet) { 392 QVector<qreal> d = dashes; 393 qreal w = m_stroke.widthF(); 394 if (w != 0 && w != 1) { 395 for (int i = 0; i < d.size(); ++i) 396 d[i] /= w; 397 } 398 m_stroke.setDashPattern(d); 399 } else { 400 m_stroke.setDashPattern(dashes); 401 } 402 m_strokeDashArraySet = 1; 208 403 } 209 404 … … 213 408 } 214 409 215 void QSvgSolidColorStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &)216 {217 m_oldFill = p->brush();218 m_oldStroke = p->pen();219 QBrush b = m_oldFill;220 b.setColor(m_solidColor);221 p->setBrush(b);222 QPen pen = m_oldStroke;223 pen.setColor(m_solidColor);224 p->setPen(pen);225 }226 227 void QSvgSolidColorStyle::revert(QPainter *p, QSvgExtraStates &)228 {229 p->setBrush(m_oldFill);230 p->setPen(m_oldStroke);231 }232 233 410 QSvgGradientStyle::QSvgGradientStyle(QGradient *grad) 234 411 : m_gradient(grad), m_gradientStopsSet(false) … … 236 413 } 237 414 238 void QSvgGradientStyle::apply(QPainter *p, const QRectF &/*rect*/, QSvgNode*, QSvgExtraStates &)415 QBrush QSvgGradientStyle::brush(QPainter *, QSvgExtraStates &) 239 416 { 240 417 if (!m_link.isEmpty()) { 241 418 resolveStops(); 242 }243 244 m_oldFill = p->brush();245 246 //resolving stop colors247 if (!m_resolvePoints.isEmpty()) {248 QColor color = p->brush().color();249 if (!color.isValid())250 color = p->pen().color();251 QList<qreal>::const_iterator itr = m_resolvePoints.constBegin();252 for (; itr != m_resolvePoints.constEnd(); ++itr) {253 //qDebug()<<"resolving "<<(*itr)<<" to "<<color;254 m_gradient->setColorAt(*itr, color);255 }256 419 } 257 420 … … 262 425 } 263 426 264 QBrush brush; 265 brush = QBrush(*m_gradient); 427 QBrush b(*m_gradient); 266 428 267 429 if (!m_matrix.isIdentity()) 268 brush.setMatrix(m_matrix); 269 270 p->setBrush(brush); 271 } 272 273 void QSvgGradientStyle::revert(QPainter *p, QSvgExtraStates &) 274 { 275 p->setBrush(m_oldFill); 430 b.setMatrix(m_matrix); 431 432 return b; 276 433 } 277 434 … … 280 437 { 281 438 m_matrix = mat; 282 }283 284 void QSvgGradientStyle::addResolve(qreal offset)285 {286 m_resolvePoints.append(offset);287 439 } 288 440 … … 390 542 if (stroke) { 391 543 stroke->apply(p, rect, node, states); 392 }393 394 if (solidColor) {395 solidColor->apply(p, rect, node, states);396 }397 398 if (gradient) {399 gradient->apply(p, rect, node, states);400 544 } 401 545 … … 411 555 //_after_ the original object transformations 412 556 if (!animateTransforms.isEmpty()) { 413 QList<QSvgRefCounter<QSvgAnimateTransform> >::const_iterator itr; 414 for (itr = animateTransforms.constBegin(); itr != animateTransforms.constEnd(); 415 ++itr) { 416 (*itr)->apply(p, rect, node, states); 557 qreal totalTimeElapsed = node->document()->currentElapsed(); 558 // Find the last animateTransform with additive="replace", since this will override all 559 // previous animateTransforms. 560 QList<QSvgRefCounter<QSvgAnimateTransform> >::const_iterator itr = animateTransforms.constEnd(); 561 do { 562 --itr; 563 if ((*itr)->animActive(totalTimeElapsed) 564 && (*itr)->additiveType() == QSvgAnimateTransform::Replace) { 565 // An animateTransform with additive="replace" will replace the transform attribute. 566 if (transform) 567 transform->revert(p, states); 568 break; 569 } 570 } while (itr != animateTransforms.constBegin()); 571 572 // Apply the animateTransforms after and including the last one with additive="replace". 573 for (; itr != animateTransforms.constEnd(); ++itr) { 574 if ((*itr)->animActive(totalTimeElapsed)) 575 (*itr)->apply(p, rect, node, states); 417 576 } 418 577 } … … 447 606 if (stroke) { 448 607 stroke->revert(p, states); 449 }450 451 if (solidColor) {452 solidColor->revert(p, states);453 }454 455 if (gradient) {456 gradient->revert(p, states);457 608 } 458 609 … … 460 611 //the native transforms 461 612 if (!animateTransforms.isEmpty()) { 462 QList<QSvgRefCounter<QSvgAnimateTransform> >::const_iterator itr ;463 itr = animateTransforms.constBegin();464 //only need to rever the first one because that465 //one has the original world matrix for the primitve466 if (itr != animateTransforms.constEnd()) {467 (*itr)->revert(p, states);613 QList<QSvgRefCounter<QSvgAnimateTransform> >::const_iterator itr = animateTransforms.constBegin(); 614 for (; itr != animateTransforms.constEnd(); ++itr) { 615 if ((*itr)->transformApplied()) { 616 (*itr)->revert(p, states); 617 break; 618 } 468 619 } 620 for (; itr != animateTransforms.constEnd(); ++itr) 621 (*itr)->clearTransformApplied(); 469 622 } 470 623 … … 489 642 : QSvgStyleProperty(), 490 643 m_from(startMs), m_to(endMs), m_by(byMs), 491 m_type(Empty), m_ count(0), m_finished(false)644 m_type(Empty), m_additive(Replace), m_count(0), m_finished(false), m_transformApplied(false) 492 645 { 493 646 m_totalRunningTime = m_to - m_from; 494 647 } 495 648 496 void QSvgAnimateTransform::setArgs(TransformType type, const QVector<qreal> &args)649 void QSvgAnimateTransform::setArgs(TransformType type, Additive additive, const QVector<qreal> &args) 497 650 { 498 651 m_type = type; 499 652 m_args = args; 653 m_additive = additive; 500 654 Q_ASSERT(!(args.count()%3)); 501 655 m_count = args.count() / 3; … … 506 660 m_oldWorldTransform = p->worldTransform(); 507 661 resolveMatrix(node); 508 if (!m_finished || m_freeze)509 p->setWorldTransform(m_transform, true);662 p->setWorldTransform(m_transform, true); 663 m_transformApplied = true; 510 664 } 511 665 512 666 void QSvgAnimateTransform::revert(QPainter *p, QSvgExtraStates &) 513 667 { 514 if (!m_finished || m_freeze) { 515 p->setWorldTransform(m_oldWorldTransform, false /* don't combine */); 516 } 668 p->setWorldTransform(m_oldWorldTransform, false /* don't combine */); 669 m_transformApplied = false; 517 670 } 518 671 … … 524 677 return; 525 678 526 qreal animationFrame = (totalTimeElapsed - m_from) / m_to; 527 528 if (m_repeatCount >= 0 && m_repeatCount < animationFrame) { 529 m_finished = true; 530 animationFrame = m_repeatCount; 679 qreal animationFrame = 0; 680 if (m_totalRunningTime != 0) { 681 animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime; 682 683 if (m_repeatCount >= 0 && m_repeatCount < animationFrame) { 684 m_finished = true; 685 animationFrame = m_repeatCount; 686 } 531 687 } 532 688 … … 545 701 startElem *= 3; 546 702 endElem *= 3; 547 qreal from1, from2 , from3;548 qreal to1, to2 , to3;703 qreal from1, from2; 704 qreal to1, to2; 549 705 from1 = m_args[startElem++]; 550 706 from2 = m_args[startElem++]; 551 from3 = m_args[startElem++];552 707 to1 = m_args[endElem++]; 553 708 to2 = m_args[endElem++]; 554 to3 = m_args[endElem++];555 709 556 710 qreal transXDiff = (to1-from1) * percentOfAnimation; … … 565 719 startElem *= 3; 566 720 endElem *= 3; 567 qreal from1, from2 , from3;568 qreal to1, to2 , to3;721 qreal from1, from2; 722 qreal to1, to2; 569 723 from1 = m_args[startElem++]; 570 724 from2 = m_args[startElem++]; 571 from3 = m_args[startElem++];572 725 to1 = m_args[endElem++]; 573 726 to2 = m_args[endElem++]; 574 to3 = m_args[endElem++];575 727 576 728 qreal transXDiff = (to1-from1) * percentOfAnimation; … … 612 764 startElem *= 3; 613 765 endElem *= 3; 614 qreal from1 , from2, from3;615 qreal to1 , to2, to3;766 qreal from1; 767 qreal to1; 616 768 from1 = m_args[startElem++]; 617 from2 = m_args[startElem++];618 from3 = m_args[startElem++];619 769 to1 = m_args[endElem++]; 620 to2 = m_args[endElem++];621 to3 = m_args[endElem++];622 770 623 771 qreal transXDiff = (to1-from1) * percentOfAnimation; 624 772 qreal transX = from1 + transXDiff; 625 773 m_transform = QTransform(); 626 m_transform.shear( tan(transX * deg2rad), 0);774 m_transform.shear(qTan(transX * deg2rad), 0); 627 775 break; 628 776 } … … 630 778 startElem *= 3; 631 779 endElem *= 3; 632 qreal from1 , from2, from3;633 qreal to1 , to2, to3;780 qreal from1; 781 qreal to1; 634 782 from1 = m_args[startElem++]; 635 from2 = m_args[startElem++];636 from3 = m_args[startElem++];637 783 to1 = m_args[endElem++]; 638 to2 = m_args[endElem++];639 to3 = m_args[endElem++];640 784 641 785 … … 643 787 qreal transY = from1 + transYDiff; 644 788 m_transform = QTransform(); 645 m_transform.shear(0, tan(transY * deg2rad));789 m_transform.shear(0, qTan(transY * deg2rad)); 646 790 break; 647 791 } … … 697 841 return; 698 842 699 qreal animationFrame = (totalTimeElapsed - m_from) / m_to; 843 qreal animationFrame = 0; 844 if (m_totalRunningTime != 0) 845 animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime; 700 846 701 847 if (m_repeatCount >= 0 && m_repeatCount < animationFrame) { … … 761 907 } 762 908 763 QString QSvgFontStyle::textAnchor() const764 {765 return m_textAnchor;766 }767 768 void QSvgFontStyle::setTextAnchor(const QString &anchor)769 {770 m_textAnchor = anchor;771 }772 773 909 QSvgOpacityStyle::QSvgOpacityStyle(qreal opacity) 774 : m_opacity(opacity) 910 : m_opacity(opacity), m_oldOpacity(0) 775 911 { 776 912 … … 802 938 { 803 939 if (!m_link.isEmpty() && m_doc) { 804 QSvgStyleProperty *prop = m_doc->s copeStyle(m_link);940 QSvgStyleProperty *prop = m_doc->styleProperty(m_link); 805 941 if (prop) { 806 942 if (prop->type() == QSvgStyleProperty::GRADIENT) { … … 809 945 st->resolveStops(); 810 946 m_gradient->setStops(st->qgradient()->stops()); 947 m_gradientStopsSet = st->gradientStopsSet(); 811 948 } 949 } else { 950 qWarning("Could not resolve property : %s", qPrintable(m_link)); 812 951 } 813 952 m_link = QString();
Note:
See TracChangeset
for help on using the changeset viewer.