Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: src/views/animated/SkBorderView.cpp

Issue 1745813002: remove unused view files (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/views/SkStackViewLayout.cpp ('k') | src/views/animated/SkImageView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2011 Google Inc.
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 #include "SkBorderView.h"
9 #include "SkAnimator.h"
10 #include "SkWidgetViews.h"
11 #include "SkSystemEventTypes.h"
12 #include "SkTime.h"
13 #include "SkStackViewLayout.h"
14
15 SkBorderView::SkBorderView() : fLeft(SkIntToScalar(0)),
16 fRight(SkIntToScalar(0)),
17 fTop(SkIntToScalar(0)),
18 fBottom(SkIntToScalar(0))
19 {
20 fAnim.setHostEventSink(this);
21 init_skin_anim(kBorder_SkinEnum, &fAnim);
22 }
23
24 SkBorderView::~SkBorderView()
25 {
26
27 }
28
29 void SkBorderView::setSkin(const char skin[])
30 {
31 init_skin_anim(skin, &fAnim);
32 }
33
34 /* virtual */ void SkBorderView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
35 {
36 this->INHERITED::onInflate(dom, node);
37 }
38
39 /*virtual*/ void SkBorderView::onSizeChange()
40 {
41 this->INHERITED::onSizeChange();
42 SkEvent evt("user");
43 evt.setString("id", "setDim");
44 evt.setScalar("dimX", this->width());
45 evt.setScalar("dimY", this->height());
46 fAnim.doUserEvent(evt);
47 }
48
49 /*virtual*/ void SkBorderView::onDraw(SkCanvas* canvas)
50 {
51 SkPaint paint;
52 SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetM Secs());
53
54 if (diff == SkAnimator::kDifferent)
55 this->inval(nullptr);
56 else if (diff == SkAnimator::kPartiallyDifferent)
57 {
58 SkRect bounds;
59 fAnim.getInvalBounds(&bounds);
60 this->inval(&bounds);
61 }
62 }
63
64 /*virtual*/ bool SkBorderView::onEvent(const SkEvent& evt)
65 {
66 if (evt.isType(SK_EventType_Inval))
67 {
68 this->inval(nullptr);
69 return true;
70 }
71 if (evt.isType("recommendDim"))
72 {
73 evt.findScalar("leftMargin", &fLeft);
74 evt.findScalar("rightMargin", &fRight);
75 evt.findScalar("topMargin", &fTop);
76 evt.findScalar("bottomMargin", &fBottom);
77
78 //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout
79 //but that gives me an error
80 SkStackViewLayout* layout;
81 fMargin.set(fLeft, fTop, fRight, fBottom);
82 if (this->getLayout())
83 {
84 layout = (SkStackViewLayout*)this->getLayout();
85 layout->setMargin(fMargin);
86 }
87 else
88 {
89 layout = new SkStackViewLayout;
90 layout->setMargin(fMargin);
91 this->setLayout(layout)->unref();
92 }
93 this->invokeLayout();
94 }
95 return this->INHERITED::onEvent(evt);
96 }
OLDNEW
« no previous file with comments | « src/views/SkStackViewLayout.cpp ('k') | src/views/animated/SkImageView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698