diff options
author | reed <reed@google.com> | 2016-02-27 13:32:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-27 13:32:44 -0800 |
commit | 60d0259486a25e7ecd804cb66f191c8709b60b3e (patch) | |
tree | 7ecb95b6e4713fe5d837080bca0874e42f8182cc /src/views/animated/SkStaticTextView.cpp | |
parent | 6b2af12a3954ef3dbbdbe927811eb0d9bca1c89a (diff) |
remove unused view files
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1745813002
TBR=
Review URL: https://codereview.chromium.org/1745813002
Diffstat (limited to 'src/views/animated/SkStaticTextView.cpp')
-rw-r--r-- | src/views/animated/SkStaticTextView.cpp | 191 |
1 files changed, 0 insertions, 191 deletions
diff --git a/src/views/animated/SkStaticTextView.cpp b/src/views/animated/SkStaticTextView.cpp deleted file mode 100644 index 4bec5106a4..0000000000 --- a/src/views/animated/SkStaticTextView.cpp +++ /dev/null @@ -1,191 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#include "SkWidgetViews.h" -#include "SkTextBox.h" - -#ifdef SK_DEBUG -static void assert_no_attr(const SkDOM& dom, const SkDOM::Node* node, const char attr[]) -{ - const char* value = dom.findAttr(node, attr); - if (value) - SkDebugf("unknown attribute %s=\"%s\"\n", attr, value); -} -#else - #define assert_no_attr(dom, node, attr) -#endif - -SkStaticTextView::SkStaticTextView() -{ - fMargin.set(0, 0); - fMode = kFixedSize_Mode; - fSpacingAlign = SkTextBox::kStart_SpacingAlign; - -// init_skin_paint(kStaticText_SkinEnum, &fPaint); -} - -SkStaticTextView::~SkStaticTextView() -{ -} - -void SkStaticTextView::computeSize() -{ - if (fMode == kAutoWidth_Mode) - { - SkScalar width = fPaint.measureText(fText.c_str(), fText.size()); - this->setWidth(width + fMargin.fX * 2); - } - else if (fMode == kAutoHeight_Mode) - { - SkScalar width = this->width() - fMargin.fX * 2; - int lines = width > 0 ? SkTextLineBreaker::CountLines(fText.c_str(), fText.size(), fPaint, width) : 0; - - this->setHeight(lines * fPaint.getFontSpacing() + fMargin.fY * 2); - } -} - -void SkStaticTextView::setMode(Mode mode) -{ - SkASSERT((unsigned)mode < kModeCount); - - if (fMode != mode) - { - fMode = SkToU8(mode); - this->computeSize(); - } -} - -void SkStaticTextView::setSpacingAlign(SkTextBox::SpacingAlign align) -{ - fSpacingAlign = SkToU8(align); - this->inval(nullptr); -} - -void SkStaticTextView::getMargin(SkPoint* margin) const -{ - if (margin) - *margin = fMargin; -} - -void SkStaticTextView::setMargin(SkScalar dx, SkScalar dy) -{ - if (fMargin.fX != dx || fMargin.fY != dy) - { - fMargin.set(dx, dy); - this->computeSize(); - this->inval(nullptr); - } -} - -size_t SkStaticTextView::getText(SkString* text) const -{ - if (text) - *text = fText; - return fText.size(); -} - -size_t SkStaticTextView::getText(char text[]) const -{ - if (text) - memcpy(text, fText.c_str(), fText.size()); - return fText.size(); -} - -void SkStaticTextView::setText(const SkString& text) -{ - this->setText(text.c_str(), text.size()); -} - -void SkStaticTextView::setText(const char text[]) -{ - if (text == nullptr) - text = ""; - this->setText(text, strlen(text)); -} - -void SkStaticTextView::setText(const char text[], size_t len) -{ - if (!fText.equals(text, len)) - { - fText.set(text, len); - this->computeSize(); - this->inval(nullptr); - } -} - -void SkStaticTextView::getPaint(SkPaint* paint) const -{ - if (paint) - *paint = fPaint; -} - -void SkStaticTextView::setPaint(const SkPaint& paint) -{ - if (fPaint != paint) - { - fPaint = paint; - this->computeSize(); - this->inval(nullptr); - } -} - -void SkStaticTextView::onDraw(SkCanvas* canvas) -{ - this->INHERITED::onDraw(canvas); - - if (fText.isEmpty()) - return; - - SkTextBox box; - - box.setMode(fMode == kAutoWidth_Mode ? SkTextBox::kOneLine_Mode : SkTextBox::kLineBreak_Mode); - box.setSpacingAlign(this->getSpacingAlign()); - box.setBox(fMargin.fX, fMargin.fY, this->width() - fMargin.fX, this->height() - fMargin.fY); - box.draw(canvas, fText.c_str(), fText.size(), fPaint); -} - -void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node) -{ -if (false) { // avoid bit rot, suppress warning - this->INHERITED::onInflate(dom, node); - - int index; - if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0) { - this->setMode((Mode)index); - } else { - assert_no_attr(dom, node, "mode"); - } - - if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0) { - this->setSpacingAlign((SkTextBox::SpacingAlign)index); - } else { - assert_no_attr(dom, node, "spacing-align"); - } - - SkScalar s[2]; - if (dom.findScalars(node, "margin", s, 2)) { - this->setMargin(s[0], s[1]); - } else { - assert_no_attr(dom, node, "margin"); - } - - const char* text = dom.findAttr(node, "text"); - if (text) { - this->setText(text); - } - - if ((node = dom.getFirstChild(node, "paint")) != nullptr && - (node = dom.getFirstChild(node, "screenplay")) != nullptr) - { -// FIXME: Including inflate_paint causes Windows build to fail -- it complains -// that SKListView::SkListView is undefined. -#if 0 - inflate_paint(dom, node, &fPaint); -#endif - } -} -} |