gfx/skia/trunk/src/svg/SkSVGElements.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 /*
     3  * Copyright 2006 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #include "SkSVGElements.h"
    11 #include "SkSVGParser.h"
    13 SkSVGBase::~SkSVGBase() {
    14 }
    16 void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex,
    17         const char* attrValue, size_t attrLength) {
    18     SkString* first = (SkString*) ((char*) this + sizeof(SkSVGElement));
    19     first += attrIndex;
    20     first->set(attrValue, attrLength);
    21 }
    24 SkSVGElement::SkSVGElement() : fParent(NULL), fIsDef(false), fIsNotDef(true) {
    25 }
    27 SkSVGElement::~SkSVGElement() {
    28 }
    30 SkSVGElement* SkSVGElement::getGradient() {
    31     return NULL;
    32 }
    34 bool SkSVGElement::isGroupParent() {
    35     SkSVGElement* parent = fParent;
    36     while (parent) {
    37         if (parent->getType() != SkSVGType_G)
    38             return false;
    39         parent = parent->fParent;
    40     }
    41     return true;
    42 }
    44 bool SkSVGElement::isDef() {
    45     return isGroupParent() == false ? fParent->isDef() : fIsDef;
    46 }
    48 bool SkSVGElement::isFlushable() {
    49     return true;
    50 }
    52 bool SkSVGElement::isGroup() {
    53     return false;
    54 }
    56 bool SkSVGElement::isNotDef() {
    57     return isGroupParent() == false ? fParent->isNotDef() : fIsNotDef;
    58 }
    60 bool SkSVGElement::onEndElement(SkSVGParser& parser) {
    61     if (f_id.size() > 0)
    62         parser.getIDs().set(f_id.c_str(), f_id.size(), this);
    63     return false;
    64 }
    66 bool SkSVGElement::onStartElement(SkSVGElement* child) {
    67     *fChildren.append() = child;
    68     return false;
    69 }
    71 void SkSVGElement::translate(SkSVGParser& parser, bool) {
    72     if (f_id.size() > 0)
    73         SVG_ADD_ATTRIBUTE(id);
    74 }
    76 void SkSVGElement::setIsDef() {
    77     fIsDef = isDef();
    78 }
    80 //void SkSVGElement::setIsNotDef() {
    81 //  fIsNotDef = isNotDef();
    82 //}
    84 void SkSVGElement::write(SkSVGParser& , SkString& ) {
    85     SkASSERT(0);
    86 }

mercurial