Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
2 /*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
10 #include "SkDrawText.h"
11 #include "SkAnimateMaker.h"
12 #include "SkCanvas.h"
13 #include "SkPaint.h"
15 enum SkText_Properties {
16 SK_PROPERTY(length)
17 };
19 #if SK_USE_CONDENSED_INFO == 0
21 const SkMemberInfo SkText::fInfo[] = {
22 SK_MEMBER_PROPERTY(length, Int),
23 SK_MEMBER(text, String),
24 SK_MEMBER(x, Float),
25 SK_MEMBER(y, Float)
26 };
28 #endif
30 DEFINE_GET_MEMBER(SkText);
32 SkText::SkText() : x(0), y(0) {
33 }
35 SkText::~SkText() {
36 }
38 bool SkText::draw(SkAnimateMaker& maker) {
39 SkBoundableAuto boundable(this, maker);
40 maker.fCanvas->drawText(text.c_str(), text.size(), x, y, *maker.fPaint);
41 return false;
42 }
44 #ifdef SK_DUMP_ENABLED
45 void SkText::dump(SkAnimateMaker* maker) {
46 INHERITED::dump(maker);
47 }
48 #endif
50 bool SkText::getProperty(int index, SkScriptValue* value) const {
51 SkASSERT(index == SK_PROPERTY(length));
52 value->fType = SkType_Int;
53 value->fOperand.fS32 = (int32_t) text.size();
54 return true;
55 }