| 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 "SkProgressBarView.h" | 8 #include "SkProgressBarView.h" |
| 9 #include "SkAnimator.h" | 9 #include "SkAnimator.h" |
| 10 #include "SkWidgetViews.h" | 10 #include "SkWidgetViews.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 //otherwise i'll just leave it as it is | 28 //otherwise i'll just leave it as it is |
| 29 //this implies that if a new max and progress are set, max must be set first | 29 //this implies that if a new max and progress are set, max must be set first |
| 30 } | 30 } |
| 31 | 31 |
| 32 /*virtual*/ void SkProgressBarView::onDraw(SkCanvas* canvas) | 32 /*virtual*/ void SkProgressBarView::onDraw(SkCanvas* canvas) |
| 33 { | 33 { |
| 34 SkPaint paint; | 34 SkPaint paint; |
| 35 SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetM
Secs()); | 35 SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetM
Secs()); |
| 36 | 36 |
| 37 if (diff == SkAnimator::kDifferent) | 37 if (diff == SkAnimator::kDifferent) |
| 38 this->inval(NULL); | 38 this->inval(nullptr); |
| 39 else if (diff == SkAnimator::kPartiallyDifferent) | 39 else if (diff == SkAnimator::kPartiallyDifferent) |
| 40 { | 40 { |
| 41 SkRect bounds; | 41 SkRect bounds; |
| 42 fAnim.getInvalBounds(&bounds); | 42 fAnim.getInvalBounds(&bounds); |
| 43 this->inval(&bounds); | 43 this->inval(&bounds); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 /*virtual*/ bool SkProgressBarView::onEvent(const SkEvent& evt) | 47 /*virtual*/ bool SkProgressBarView::onEvent(const SkEvent& evt) |
| 48 { | 48 { |
| 49 if (evt.isType(SK_EventType_Inval)) | 49 if (evt.isType(SK_EventType_Inval)) |
| 50 { | 50 { |
| 51 this->inval(NULL); | 51 this->inval(nullptr); |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 if (evt.isType("recommendDim")) | 54 if (evt.isType("recommendDim")) |
| 55 { | 55 { |
| 56 SkScalar height; | 56 SkScalar height; |
| 57 | 57 |
| 58 if (evt.findScalar("y", &height)) | 58 if (evt.findScalar("y", &height)) |
| 59 this->setHeight(height); | 59 this->setHeight(height); |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 void SkProgressBarView::setProgress(int progress) | 102 void SkProgressBarView::setProgress(int progress) |
| 103 { | 103 { |
| 104 fProgress = progress; | 104 fProgress = progress; |
| 105 SkEvent e("user"); | 105 SkEvent e("user"); |
| 106 e.setString("id", "setProgress"); | 106 e.setString("id", "setProgress"); |
| 107 e.setS32("newProgress", progress); | 107 e.setS32("newProgress", progress); |
| 108 fAnim.doUserEvent(e); | 108 fAnim.doUserEvent(e); |
| 109 } | 109 } |
| OLD | NEW |