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 "SkTextToPath.h" michael@0: #include "SkAnimateMaker.h" michael@0: #include "SkDrawPaint.h" michael@0: #include "SkDrawPath.h" michael@0: #include "SkDrawText.h" michael@0: #include "SkPaint.h" michael@0: michael@0: #if SK_USE_CONDENSED_INFO == 0 michael@0: michael@0: const SkMemberInfo SkTextToPath::fInfo[] = { michael@0: SK_MEMBER(paint, Paint), michael@0: SK_MEMBER(path, Path), michael@0: SK_MEMBER(text, Text) michael@0: }; michael@0: michael@0: #endif michael@0: michael@0: DEFINE_GET_MEMBER(SkTextToPath); michael@0: michael@0: SkTextToPath::SkTextToPath() : paint(NULL), path(NULL), text(NULL) { michael@0: } michael@0: michael@0: bool SkTextToPath::draw(SkAnimateMaker& maker) { michael@0: path->draw(maker); michael@0: return false; michael@0: } michael@0: michael@0: void SkTextToPath::onEndElement(SkAnimateMaker& maker) { michael@0: if (paint == NULL || path == NULL || text == NULL) { michael@0: // !!! add error message here michael@0: maker.setErrorCode(SkDisplayXMLParserError::kErrorInAttributeValue); michael@0: return; michael@0: } michael@0: SkPaint realPaint; michael@0: paint->setupPaint(&realPaint); michael@0: realPaint.getTextPath(text->getText(), text->getSize(), text->x, michael@0: text->y, &path->getPath()); michael@0: }