1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTextOnPath.h"
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkAnimateMaker.h"
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkCanvas.h"
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawPath.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDrawText.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkPaint.h"
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#if SK_USE_CONDENSED_INFO == 0
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comconst SkMemberInfo SkTextOnPath::fInfo[] = {
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SK_MEMBER(offset, Float),
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SK_MEMBER(path, Path),
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SK_MEMBER(text, Text)
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comDEFINE_GET_MEMBER(SkTextOnPath);
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comSkTextOnPath::SkTextOnPath() : offset(0), path(NULL), text(NULL) {
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.combool SkTextOnPath::draw(SkAnimateMaker& maker) {
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkASSERT(text);
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkASSERT(path);
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBoundableAuto boundable(this, maker);
36d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com    maker.fCanvas->drawTextOnPathHV(text->getText(), text->getSize(),
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                                    path->getPath(), offset, 0, *maker.fPaint);
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    return false;
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}
40