| OLD | NEW |
| (Empty) |
| 1 /* libs/graphics/svg/SkSVGElements.cpp | |
| 2 ** | |
| 3 ** Copyright 2006, The Android Open Source Project | |
| 4 ** | |
| 5 ** Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 ** you may not use this file except in compliance with the License. | |
| 7 ** You may obtain a copy of the License at | |
| 8 ** | |
| 9 ** http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 ** | |
| 11 ** Unless required by applicable law or agreed to in writing, software | |
| 12 ** distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 ** See the License for the specific language governing permissions and | |
| 15 ** limitations under the License. | |
| 16 */ | |
| 17 | |
| 18 #include "SkSVGElements.h" | |
| 19 #include "SkSVGParser.h" | |
| 20 | |
| 21 SkSVGBase::~SkSVGBase() { | |
| 22 } | |
| 23 | |
| 24 void SkSVGBase::addAttribute(SkSVGParser& parser, int attrIndex, | |
| 25 const char* attrValue, size_t attrLength) { | |
| 26 SkString* first = (SkString*) ((char*) this + sizeof(SkSVGElement)); | |
| 27 first += attrIndex; | |
| 28 first->set(attrValue, attrLength); | |
| 29 } | |
| 30 | |
| 31 | |
| 32 SkSVGElement::SkSVGElement() : fParent(NULL), fIsDef(false), fIsNotDef(true) { | |
| 33 } | |
| 34 | |
| 35 SkSVGElement::~SkSVGElement() { | |
| 36 } | |
| 37 | |
| 38 SkSVGElement* SkSVGElement::getGradient() { | |
| 39 return NULL; | |
| 40 } | |
| 41 | |
| 42 bool SkSVGElement::isGroupParent() { | |
| 43 SkSVGElement* parent = fParent; | |
| 44 while (parent) { | |
| 45 if (parent->getType() != SkSVGType_G) | |
| 46 return false; | |
| 47 parent = parent->fParent; | |
| 48 } | |
| 49 return true; | |
| 50 } | |
| 51 | |
| 52 bool SkSVGElement::isDef() { | |
| 53 return isGroupParent() == false ? fParent->isDef() : fIsDef; | |
| 54 } | |
| 55 | |
| 56 bool SkSVGElement::isFlushable() { | |
| 57 return true; | |
| 58 } | |
| 59 | |
| 60 bool SkSVGElement::isGroup() { | |
| 61 return false; | |
| 62 } | |
| 63 | |
| 64 bool SkSVGElement::isNotDef() { | |
| 65 return isGroupParent() == false ? fParent->isNotDef() : fIsNotDef; | |
| 66 } | |
| 67 | |
| 68 bool SkSVGElement::onEndElement(SkSVGParser& parser) { | |
| 69 if (f_id.size() > 0) | |
| 70 parser.getIDs().set(f_id.c_str(), f_id.size(), this); | |
| 71 return false; | |
| 72 } | |
| 73 | |
| 74 bool SkSVGElement::onStartElement(SkSVGElement* child) { | |
| 75 *fChildren.append() = child; | |
| 76 return false; | |
| 77 } | |
| 78 | |
| 79 void SkSVGElement::translate(SkSVGParser& parser, bool) { | |
| 80 if (f_id.size() > 0) | |
| 81 SVG_ADD_ATTRIBUTE(id); | |
| 82 } | |
| 83 | |
| 84 void SkSVGElement::setIsDef() { | |
| 85 fIsDef = isDef(); | |
| 86 } | |
| 87 | |
| 88 //void SkSVGElement::setIsNotDef() { | |
| 89 // fIsNotDef = isNotDef(); | |
| 90 //} | |
| 91 | |
| 92 void SkSVGElement::write(SkSVGParser& , SkString& ) { | |
| 93 SkASSERT(0); | |
| 94 } | |
| 95 | |
| 96 | |
| OLD | NEW |