Home | History | Annotate | Download | only in animator
      1 
      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  */
      8 
      9 
     10 #include "SkDrawText.h"
     11 #include "SkAnimateMaker.h"
     12 #include "SkCanvas.h"
     13 #include "SkPaint.h"
     14 
     15 enum SkText_Properties {
     16     SK_PROPERTY(length)
     17 };
     18 
     19 #if SK_USE_CONDENSED_INFO == 0
     20 
     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 };
     27 
     28 #endif
     29 
     30 DEFINE_GET_MEMBER(SkText);
     31 
     32 SkText::SkText() : x(0), y(0) {
     33 }
     34 
     35 SkText::~SkText() {
     36 }
     37 
     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 }
     43 
     44 #ifdef SK_DUMP_ENABLED
     45 void SkText::dump(SkAnimateMaker* maker) {
     46     INHERITED::dump(maker);
     47 }
     48 #endif
     49 
     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 }
     56 
     57