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 "SkDrawText.h" michael@0: #include "SkAnimateMaker.h" michael@0: #include "SkCanvas.h" michael@0: #include "SkPaint.h" michael@0: michael@0: enum SkText_Properties { michael@0: SK_PROPERTY(length) michael@0: }; michael@0: michael@0: #if SK_USE_CONDENSED_INFO == 0 michael@0: michael@0: const SkMemberInfo SkText::fInfo[] = { michael@0: SK_MEMBER_PROPERTY(length, Int), michael@0: SK_MEMBER(text, String), michael@0: SK_MEMBER(x, Float), michael@0: SK_MEMBER(y, Float) michael@0: }; michael@0: michael@0: #endif michael@0: michael@0: DEFINE_GET_MEMBER(SkText); michael@0: michael@0: SkText::SkText() : x(0), y(0) { michael@0: } michael@0: michael@0: SkText::~SkText() { michael@0: } michael@0: michael@0: bool SkText::draw(SkAnimateMaker& maker) { michael@0: SkBoundableAuto boundable(this, maker); michael@0: maker.fCanvas->drawText(text.c_str(), text.size(), x, y, *maker.fPaint); michael@0: return false; michael@0: } michael@0: michael@0: #ifdef SK_DUMP_ENABLED michael@0: void SkText::dump(SkAnimateMaker* maker) { michael@0: INHERITED::dump(maker); michael@0: } michael@0: #endif michael@0: michael@0: bool SkText::getProperty(int index, SkScriptValue* value) const { michael@0: SkASSERT(index == SK_PROPERTY(length)); michael@0: value->fType = SkType_Int; michael@0: value->fOperand.fS32 = (int32_t) text.size(); michael@0: return true; michael@0: }