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/qsvgstructure.cpp

    r2 r561  
    22**
    33** 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])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646#include "qsvgnode_p.h"
    4747#include "qsvgstyle_p.h"
     48
    4849
    4950#include "qpainter.h"
     
    6970    applyStyle(p, states);
    7071
    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;
    7877    }
    7978    revertStyle(p, states);
     
    9392QSvgNode * QSvgStructureNode::scopeNode(const QString &id) const
    9493{
    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
     98void QSvgStructureNode::addChild(QSvgNode *child, const QString &id)
     99{
     100    m_renderers.append(child);
    114101
    115102    if (id.isEmpty())
    116103        return; //we can't add it to scope without id
    117104
    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);
    124108}
    125109
     
    138122    return DEFS;
    139123}
    140 
    141 QSvgStyleProperty * QSvgStructureNode::scopeStyle(const QString &id) const
    142 {
    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 
    160124
    161125/*
     
    322286    applyStyle(p, states);
    323287
    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;
    342304                    }
    343305                }
    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                       
    352314                    }
    353315                }
    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                       
    363325                    }
    364326                }
    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            }
    380341        }
     342
    381343    }
    382344    revertStyle(p, states);
Note: See TracChangeset for help on using the changeset viewer.