+
+pub struct PaceView {
+ is_valid: bool,
+}
+
+impl PaceView {
+ pub fn new() -> PaceView {
+ PaceView {
+ is_valid: false,
+ }
+ }
+
+ pub fn invalidate(&mut self) {
+ self.is_valid = false;
+ }
+
+ pub fn draw(&mut self, screen: &mut screen::Screen,
+ model: &mut model::Model) -> bool {
+ if self.is_valid &&
+ !model.check_and_reset_is_dirty(model::Field::Pace(0)) {
+ return false;
+ }
+
+ let mut min_and_s = [b':'; 6];
+
+ common::fmt::fmt_u32_pad(&mut min_and_s[0..3], model.pace_s / 60,
+ 3, b' ');
+
+ common::fmt::fmt_u32_pad(&mut min_and_s[4..6], model.pace_s % 60,
+ 2, b'0');
+
+ screen.clear();
+ screen.draw_text(&min_and_s);
+
+ self.is_valid = true;
+
+ true
+ }
+}