| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkScrollBarView.h" | 8 #include "SkScrollBarView.h" |
| 9 #include "SkAnimator.h" | 9 #include "SkAnimator.h" |
| 10 #include "SkWidgetViews.h" | 10 #include "SkWidgetViews.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 evt.setScalar("dimY", this->height()); | 82 evt.setScalar("dimY", this->height()); |
| 83 fAnim.doUserEvent(evt); | 83 fAnim.doUserEvent(evt); |
| 84 } | 84 } |
| 85 | 85 |
| 86 /*virtual*/ void SkScrollBarView::onDraw(SkCanvas* canvas) | 86 /*virtual*/ void SkScrollBarView::onDraw(SkCanvas* canvas) |
| 87 { | 87 { |
| 88 SkPaint paint; | 88 SkPaint paint; |
| 89 SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetM
Secs()); | 89 SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetM
Secs()); |
| 90 | 90 |
| 91 if (diff == SkAnimator::kDifferent) | 91 if (diff == SkAnimator::kDifferent) |
| 92 this->inval(NULL); | 92 this->inval(nullptr); |
| 93 else if (diff == SkAnimator::kPartiallyDifferent) | 93 else if (diff == SkAnimator::kPartiallyDifferent) |
| 94 { | 94 { |
| 95 SkRect bounds; | 95 SkRect bounds; |
| 96 fAnim.getInvalBounds(&bounds); | 96 fAnim.getInvalBounds(&bounds); |
| 97 this->inval(&bounds); | 97 this->inval(&bounds); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 /*virtual*/ bool SkScrollBarView::onEvent(const SkEvent& evt) | 101 /*virtual*/ bool SkScrollBarView::onEvent(const SkEvent& evt) |
| 102 { | 102 { |
| 103 if (evt.isType(SK_EventType_Inval)) | 103 if (evt.isType(SK_EventType_Inval)) |
| 104 { | 104 { |
| 105 this->inval(NULL); | 105 this->inval(nullptr); |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 if (evt.isType("recommendDim")) | 108 if (evt.isType("recommendDim")) |
| 109 { | 109 { |
| 110 SkScalar width; | 110 SkScalar width; |
| 111 | 111 |
| 112 if (evt.findScalar("x", &width)) | 112 if (evt.findScalar("x", &width)) |
| 113 this->setWidth(width); | 113 this->setWidth(width); |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 SkEvent e("user"); | 138 SkEvent e("user"); |
| 139 e.setString("id", "adjustScrollBar"); | 139 e.setString("id", "adjustScrollBar"); |
| 140 e.setScalar("_totalLength", SkIntToScalar(total)); | 140 e.setScalar("_totalLength", SkIntToScalar(total)); |
| 141 e.setScalar("_startPoint", SkIntToScalar(start)); | 141 e.setScalar("_startPoint", SkIntToScalar(start)); |
| 142 e.setScalar("_shownLength", SkIntToScalar(shown)); | 142 e.setScalar("_shownLength", SkIntToScalar(shown)); |
| 143 // e.setS32("hideBar", hideBar); | 143 // e.setS32("hideBar", hideBar); |
| 144 fAnim.doUserEvent(e); | 144 fAnim.doUserEvent(e); |
| 145 } | 145 } |
| OLD | NEW |