michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #include "SkSVGClipPath.h" michael@0: #include "SkSVGParser.h" michael@0: #include "SkSVGUse.h" michael@0: michael@0: DEFINE_SVG_NO_INFO(ClipPath) michael@0: michael@0: bool SkSVGClipPath::isDef() { michael@0: return true; michael@0: } michael@0: michael@0: bool SkSVGClipPath::isNotDef() { michael@0: return false; michael@0: } michael@0: michael@0: void SkSVGClipPath::translate(SkSVGParser& parser, bool defState) { michael@0: parser._startElement("clip"); michael@0: INHERITED::translate(parser, defState); michael@0: SkASSERT(fChildren.count() == 1); michael@0: SkSVGElement* child = *fChildren.begin(); michael@0: SkASSERT(child->getType() == SkSVGType_Use); michael@0: SkSVGUse* use = (SkSVGUse*) child; michael@0: SkSVGElement* ref = NULL; michael@0: const char* refStr = &use->f_xlink_href.c_str()[1]; michael@0: SkASSERT(parser.getIDs().find(refStr, &ref)); michael@0: SkASSERT(ref); michael@0: if (ref->getType() == SkSVGType_Rect) michael@0: parser._addAttribute("rectangle", refStr); michael@0: else michael@0: parser._addAttribute("path", refStr); michael@0: parser._endElement(); michael@0: }