update to match latest skia apis
git-svn-id: http://skia.googlecode.com/svn/trunk@566 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
647d3daeea
commit
5ee64ad6b5
@ -32,7 +32,7 @@ class SkSVGElement;
|
||||
|
||||
class SkSVGParser : public SkXMLParser {
|
||||
public:
|
||||
SkSVGParser();
|
||||
SkSVGParser(SkXMLParserError* err = NULL);
|
||||
virtual ~SkSVGParser();
|
||||
void _addAttribute(const char* attrName, const char* attrValue) {
|
||||
fXMLWriter.addAttribute(attrName, attrValue); }
|
||||
|
@ -40,6 +40,7 @@ enum SkSVGTypes {
|
||||
SkSVGType_Symbol,
|
||||
SkSVGType_Text,
|
||||
SkSVGType_Tspan,
|
||||
SkSVGType_Unknown,
|
||||
SkSVGType_Use
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,9 @@
|
||||
|
||||
static int gGeneratedMatrixID = 0;
|
||||
|
||||
SkSVGParser::SkSVGParser() : fHead(&fEmptyPaint), fIDs(256),
|
||||
SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
|
||||
SkXMLParser(errHandler),
|
||||
fHead(&fEmptyPaint), fIDs(256),
|
||||
fXMLWriter(&fStream), fCurrElement(NULL), fInSVG(false), fSuppressPaint(false) {
|
||||
fLastTransform.reset();
|
||||
fEmptyPaint.f_fill.set("black");
|
||||
@ -157,7 +159,7 @@ bool SkSVGParser::onAddAttributeLen(const char name[], const char value[], size_
|
||||
if (fCurrElement == NULL) // this signals we should ignore attributes for this element
|
||||
return true;
|
||||
if (fCurrElement->fIsDef == false && fCurrElement->fIsNotDef == false)
|
||||
return true; // also an ignored element
|
||||
return false; // also an ignored element
|
||||
size_t nameLen = strlen(name);
|
||||
int attrIndex = findAttribute(fCurrElement, name, nameLen, false);
|
||||
if (attrIndex == -1) {
|
||||
@ -201,9 +203,11 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
|
||||
if (nextColon && nextColon - name < len)
|
||||
return false;
|
||||
SkSVGTypes type = GetType(name, len);
|
||||
SkASSERT(type >= 0);
|
||||
if (type < 0)
|
||||
return true;
|
||||
// SkASSERT(type >= 0);
|
||||
if (type < 0) {
|
||||
type = SkSVGType_G;
|
||||
// return true;
|
||||
}
|
||||
SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : NULL;
|
||||
SkSVGElement* element = CreateElement(type, parent);
|
||||
bool result = false;
|
||||
|
@ -33,7 +33,7 @@ SkSVGRect::SkSVGRect() {
|
||||
}
|
||||
|
||||
void SkSVGRect::translate(SkSVGParser& parser, bool defState) {
|
||||
parser._startElement("rectangle");
|
||||
parser._startElement("rect");
|
||||
INHERITED::translate(parser, defState);
|
||||
SVG_ADD_ATTRIBUTE_ALIAS(left, x);
|
||||
SVG_ADD_ATTRIBUTE_ALIAS(top, y);
|
||||
|
@ -27,9 +27,11 @@ const SkSVGAttribute SkSVGSVG::gAttributes[] = {
|
||||
SVG_ATTRIBUTE(width),
|
||||
SVG_ATTRIBUTE(version),
|
||||
SVG_ATTRIBUTE(viewBox),
|
||||
SVG_ATTRIBUTE(x),
|
||||
SVG_LITERAL_ATTRIBUTE(xml:space, f_xml_space),
|
||||
SVG_ATTRIBUTE(xmlns),
|
||||
SVG_LITERAL_ATTRIBUTE(xmlns:xlink, f_xml_xlink)
|
||||
SVG_LITERAL_ATTRIBUTE(xmlns:xlink, f_xml_xlink),
|
||||
SVG_ATTRIBUTE(y),
|
||||
};
|
||||
|
||||
DEFINE_SVG_INFO(SVG)
|
||||
|
@ -30,9 +30,12 @@ private:
|
||||
SkString f_width;
|
||||
SkString f_version;
|
||||
SkString f_viewBox;
|
||||
SkString f_x;
|
||||
SkString f_xml_space;
|
||||
SkString f_xmlns;
|
||||
SkString f_xml_xlink;
|
||||
SkString f_y;
|
||||
|
||||
typedef SkSVGElement INHERITED;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user