Changeset 561 for trunk/src/svg/qsvgstructure.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/qsvgstructure.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 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 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 46 46 #include "qsvgnode_p.h" 47 47 #include "qsvgstyle_p.h" 48 48 49 49 50 #include "qpainter.h" … … 69 70 applyStyle(p, states); 70 71 71 if (displayMode() != QSvgNode::NoneMode) { 72 while (itr != m_renderers.end()) { 73 QSvgNode *node = *itr; 74 if (node->isVisible()) 75 node->draw(p, states); 76 ++itr; 77 } 72 while (itr != m_renderers.end()) { 73 QSvgNode *node = *itr; 74 if ((node->isVisible()) && (node->displayMode() != QSvgNode::NoneMode)) 75 node->draw(p, states); 76 ++itr; 78 77 } 79 78 revertStyle(p, states); … … 93 92 QSvgNode * QSvgStructureNode::scopeNode(const QString &id) const 94 93 { 95 const QSvgStructureNode *group = this; 96 while (group && group->type() != QSvgNode::DOC) { 97 group = static_cast<QSvgStructureNode*>(group->parent()); 98 } 99 if (group) 100 return group->m_scope[id]; 101 return 0; 102 } 103 104 void QSvgStructureNode::addChild(QSvgNode *child, const QString &id, bool def) 105 { 106 if (!def) 107 m_renderers.append(child); 108 109 if (child->type() == QSvgNode::DEFS) { 110 QSvgDefs *defs = 111 static_cast<QSvgDefs*>(child); 112 m_linkedScopes.append(defs); 113 } 94 QSvgTinyDocument *doc = document(); 95 return doc ? doc->namedNode(id) : 0; 96 } 97 98 void QSvgStructureNode::addChild(QSvgNode *child, const QString &id) 99 { 100 m_renderers.append(child); 114 101 115 102 if (id.isEmpty()) 116 103 return; //we can't add it to scope without id 117 104 118 QSvgStructureNode *group = this; 119 while (group && group->type() != QSvgNode::DOC) { 120 group = static_cast<QSvgStructureNode*>(group->parent()); 121 } 122 if (group) 123 group->m_scope.insert(id, child); 105 QSvgTinyDocument *doc = document(); 106 if (doc) 107 doc->addNamedNode(id, child); 124 108 } 125 109 … … 138 122 return DEFS; 139 123 } 140 141 QSvgStyleProperty * QSvgStructureNode::scopeStyle(const QString &id) const142 {143 const QSvgStructureNode *group = this;144 while (group) {145 QSvgStyleProperty *prop = group->styleProperty(id);146 if (prop)147 return prop;148 QList<QSvgStructureNode*>::const_iterator itr = group->m_linkedScopes.constBegin();149 while (itr != group->m_linkedScopes.constEnd()) {150 prop = (*itr)->styleProperty(id);151 if (prop)152 return prop;153 ++itr;154 }155 group = static_cast<QSvgStructureNode*>(group->parent());156 }157 return 0;158 }159 160 124 161 125 /* … … 322 286 applyStyle(p, states); 323 287 324 if (displayMode() != QSvgNode::NoneMode) { 325 while (itr != m_renderers.end()) { 326 QSvgNode *node = *itr; 327 if (node->isVisible()) { 328 const QStringList &features = node->requiredFeatures(); 329 const QStringList &extensions = node->requiredExtensions(); 330 const QStringList &languages = node->requiredLanguages(); 331 const QStringList &formats = node->requiredFormats(); 332 const QStringList &fonts = node->requiredFonts(); 333 334 bool okToRender = true; 335 if (!features.isEmpty()) { 336 QStringList::const_iterator sitr = features.constBegin(); 337 for (; sitr != features.constEnd(); ++sitr) { 338 if (!isSupportedSvgFeature(*sitr)) { 339 okToRender = false; 340 break; 341 } 288 while (itr != m_renderers.end()) { 289 QSvgNode *node = *itr; 290 if (node->isVisible() && (node->displayMode() != QSvgNode::NoneMode)) { 291 const QStringList &features = node->requiredFeatures(); 292 const QStringList &extensions = node->requiredExtensions(); 293 const QStringList &languages = node->requiredLanguages(); 294 const QStringList &formats = node->requiredFormats(); 295 const QStringList &fonts = node->requiredFonts(); 296 297 bool okToRender = true; 298 if (!features.isEmpty()) { 299 QStringList::const_iterator sitr = features.constBegin(); 300 for (; sitr != features.constEnd(); ++sitr) { 301 if (!isSupportedSvgFeature(*sitr)) { 302 okToRender = false; 303 break; 342 304 } 343 305 } 344 345 if (okToRender && !extensions.isEmpty()) { 346 QStringList::const_iterator sitr = extensions.constBegin();347 for (; sitr != extensions.constEnd(); ++sitr) {348 if (!isSupportedSvgExtension(*sitr)) {349 okToRender = false;350 break;351 }306 } 307 308 309 310 ) { 311 312 ; 313 352 314 } 353 315 } 354 355 if (okToRender && !languages.isEmpty()) { 356 QStringList::const_iterator sitr = languages.constBegin();357 okToRender = false;358 for (; sitr != languages.constEnd(); ++sitr) {359 if ((*sitr).startsWith(m_systemLanguagePrefix)) {360 okToRender = true;361 break;362 }316 } 317 318 319 ; 320 321 ) { 322 323 ; 324 363 325 } 364 326 } 365 366 if (okToRender && !formats.isEmpty()) { 367 okToRender = false; 368 } 369 370 if (okToRender && !fonts.isEmpty()) { 371 okToRender = false; 372 } 373 374 if (okToRender) { 375 node->draw(p, states); 376 break; 377 } 378 } 379 ++itr; 327 } 328 329 if (okToRender && !formats.isEmpty()) { 330 okToRender = false; 331 } 332 333 if (okToRender && !fonts.isEmpty()) { 334 okToRender = false; 335 } 336 337 if (okToRender) { 338 node->draw(p, states); 339 break; 340 } 380 341 } 342 381 343 } 382 344 revertStyle(p, states);
Note:
See TracChangeset
for help on using the changeset viewer.