1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/animator/SkDrawText.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#include "SkDrawText.h" 1.14 +#include "SkAnimateMaker.h" 1.15 +#include "SkCanvas.h" 1.16 +#include "SkPaint.h" 1.17 + 1.18 +enum SkText_Properties { 1.19 + SK_PROPERTY(length) 1.20 +}; 1.21 + 1.22 +#if SK_USE_CONDENSED_INFO == 0 1.23 + 1.24 +const SkMemberInfo SkText::fInfo[] = { 1.25 + SK_MEMBER_PROPERTY(length, Int), 1.26 + SK_MEMBER(text, String), 1.27 + SK_MEMBER(x, Float), 1.28 + SK_MEMBER(y, Float) 1.29 +}; 1.30 + 1.31 +#endif 1.32 + 1.33 +DEFINE_GET_MEMBER(SkText); 1.34 + 1.35 +SkText::SkText() : x(0), y(0) { 1.36 +} 1.37 + 1.38 +SkText::~SkText() { 1.39 +} 1.40 + 1.41 +bool SkText::draw(SkAnimateMaker& maker) { 1.42 + SkBoundableAuto boundable(this, maker); 1.43 + maker.fCanvas->drawText(text.c_str(), text.size(), x, y, *maker.fPaint); 1.44 + return false; 1.45 +} 1.46 + 1.47 +#ifdef SK_DUMP_ENABLED 1.48 +void SkText::dump(SkAnimateMaker* maker) { 1.49 + INHERITED::dump(maker); 1.50 +} 1.51 +#endif 1.52 + 1.53 +bool SkText::getProperty(int index, SkScriptValue* value) const { 1.54 + SkASSERT(index == SK_PROPERTY(length)); 1.55 + value->fType = SkType_Int; 1.56 + value->fOperand.fS32 = (int32_t) text.size(); 1.57 + return true; 1.58 +}