From 33ad49789b54e6872500d39fba28be42d09695fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 15 May 2018 17:02:49 +0200 Subject: [PATCH] [escher][apps] Make View using blendRectWithMask without background inherit from TransparentView --- apps/battery_view.cpp | 1 - apps/battery_view.h | 2 +- apps/hardware_test/arrow_view.h | 2 +- apps/lock_view.h | 2 +- apps/shared/ok_view.h | 3 +-- apps/shared/round_cursor_view.h | 2 +- escher/include/escher/chevron_view.h | 5 ++--- escher/include/escher/ellipsis_view.h | 5 ++--- escher/include/escher/gauge_view.h | 4 ++-- escher/include/escher/key_view.h | 4 ++-- escher/include/escher/switch_view.h | 4 ++-- escher/src/chevron_view.cpp | 5 ----- escher/src/ellipsis_view.cpp | 5 ----- escher/src/gauge_view.cpp | 1 - escher/src/key_view.cpp | 1 - escher/src/switch_view.cpp | 1 - 16 files changed, 15 insertions(+), 32 deletions(-) diff --git a/apps/battery_view.cpp b/apps/battery_view.cpp index 74c044f8c..092089a9f 100644 --- a/apps/battery_view.cpp +++ b/apps/battery_view.cpp @@ -23,7 +23,6 @@ const uint8_t tickMask[BatteryView::k_tickHeight][BatteryView::k_tickWidth] = { BatteryView::BatteryView() : - View(), m_chargeState(Ion::Battery::Charge::SOMEWHERE_INBETWEEN), m_isCharging(false), m_isPlugged(false) diff --git a/apps/battery_view.h b/apps/battery_view.h index 70d6ae251..4a29b8efe 100644 --- a/apps/battery_view.h +++ b/apps/battery_view.h @@ -3,7 +3,7 @@ #include -class BatteryView : public View { +class BatteryView : public TransparentView { public: BatteryView(); bool setChargeState(Ion::Battery::Charge chargeState); diff --git a/apps/hardware_test/arrow_view.h b/apps/hardware_test/arrow_view.h index c4a8f6437..fb5213e9f 100644 --- a/apps/hardware_test/arrow_view.h +++ b/apps/hardware_test/arrow_view.h @@ -5,7 +5,7 @@ namespace HardwareTest { -class ArrowView : public View { +class ArrowView : public TransparentView { public: ArrowView(); void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/apps/lock_view.h b/apps/lock_view.h index a80bf40ce..ae9b83eae 100644 --- a/apps/lock_view.h +++ b/apps/lock_view.h @@ -3,7 +3,7 @@ #include -class LockView : public View { +class LockView : public TransparentView { public: void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; diff --git a/apps/shared/ok_view.h b/apps/shared/ok_view.h index c5128f1a9..e059338ee 100644 --- a/apps/shared/ok_view.h +++ b/apps/shared/ok_view.h @@ -5,9 +5,8 @@ namespace Shared { -class OkView : public View { +class OkView : public TransparentView { public: - using View::View; void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; constexpr static KDCoordinate k_okSize = 20; diff --git a/apps/shared/round_cursor_view.h b/apps/shared/round_cursor_view.h index 93a3e78ce..f9df48562 100644 --- a/apps/shared/round_cursor_view.h +++ b/apps/shared/round_cursor_view.h @@ -5,7 +5,7 @@ namespace Shared { -class RoundCursorView : public View { +class RoundCursorView : public TransparentView { public: RoundCursorView(KDColor color = KDColorBlack); void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/escher/include/escher/chevron_view.h b/escher/include/escher/chevron_view.h index 12d48f6e6..95fb06f69 100644 --- a/escher/include/escher/chevron_view.h +++ b/escher/include/escher/chevron_view.h @@ -1,11 +1,10 @@ #ifndef ESCHER_CHEVRON_VIEW_H #define ESCHER_CHEVRON_VIEW_H -#include +#include -class ChevronView : public View { +class ChevronView : public TransparentView { public: - ChevronView(); void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; /* k_chevronHeight and k_chevronWidth are the dimensions of the chevron. */ diff --git a/escher/include/escher/ellipsis_view.h b/escher/include/escher/ellipsis_view.h index 4d89a00f3..66a3e405d 100644 --- a/escher/include/escher/ellipsis_view.h +++ b/escher/include/escher/ellipsis_view.h @@ -1,11 +1,10 @@ #ifndef ESCHER_ELLIPSIS_VIEW_H #define ESCHER_ELLIPSIS_VIEW_H -#include +#include -class EllipsisView : public View { +class EllipsisView : public TransparentView { public: - EllipsisView(); void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; /* k_ellipsisHeight and k_ellipsisWidth are the dimensions of the ellipsis. */ diff --git a/escher/include/escher/gauge_view.h b/escher/include/escher/gauge_view.h index 21ed0c057..274242d4e 100644 --- a/escher/include/escher/gauge_view.h +++ b/escher/include/escher/gauge_view.h @@ -1,9 +1,9 @@ #ifndef ESCHER_GAUGE_VIEW_H #define ESCHER_GAUGE_VIEW_H -#include +#include -class GaugeView : public View { +class GaugeView : public TransparentView { public: GaugeView(); float level(); diff --git a/escher/include/escher/key_view.h b/escher/include/escher/key_view.h index f0ac8fa62..bd38af907 100644 --- a/escher/include/escher/key_view.h +++ b/escher/include/escher/key_view.h @@ -1,9 +1,9 @@ #ifndef ESCHER_KEY_VIEW_H #define ESCHER_KEY_VIEW_H -#include +#include -class KeyView : public View { +class KeyView : public TransparentView { public: enum class Type { Up, diff --git a/escher/include/escher/switch_view.h b/escher/include/escher/switch_view.h index 3ecf2a6b6..482697cc5 100644 --- a/escher/include/escher/switch_view.h +++ b/escher/include/escher/switch_view.h @@ -1,9 +1,9 @@ #ifndef ESCHER_SWITCH_VIEW_H #define ESCHER_SWITCH_VIEW_H -#include +#include -class SwitchView : public View { +class SwitchView : public TransparentView { public: SwitchView(); bool state(); diff --git a/escher/src/chevron_view.cpp b/escher/src/chevron_view.cpp index 72ab87e69..b6c7b32d2 100644 --- a/escher/src/chevron_view.cpp +++ b/escher/src/chevron_view.cpp @@ -14,11 +14,6 @@ const uint8_t chevronMask[ChevronView::k_chevronHeight][ChevronView::k_chevronWi {0x0C, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, }; -ChevronView::ChevronView() : - View() -{ -} - KDColor s_workingBuffer[ChevronView::k_chevronWidth*ChevronView::k_chevronHeight]; void ChevronView::drawRect(KDContext * ctx, KDRect rect) const { diff --git a/escher/src/ellipsis_view.cpp b/escher/src/ellipsis_view.cpp index b54c1d8d6..f965ea447 100644 --- a/escher/src/ellipsis_view.cpp +++ b/escher/src/ellipsis_view.cpp @@ -7,11 +7,6 @@ const uint8_t ellipsisMask[EllipsisView::k_ellipsisHeight][EllipsisView::k_ellip {0xFF, 0xD1, 0xA1, 0xC1, 0xFF, 0xFF, 0xFF, 0xD1, 0xA1, 0xC1, 0xFF, 0xFF, 0xFF, 0xD1, 0xA1, 0xC1, 0xFF}, }; -EllipsisView::EllipsisView() : - View() -{ -} - KDColor s_ellipsisWorkingBuffer[EllipsisView::k_ellipsisWidth*EllipsisView::k_ellipsisHeight]; void EllipsisView::drawRect(KDContext * ctx, KDRect rect) const { diff --git a/escher/src/gauge_view.cpp b/escher/src/gauge_view.cpp index d00ec57e6..f22d7ecf6 100644 --- a/escher/src/gauge_view.cpp +++ b/escher/src/gauge_view.cpp @@ -15,7 +15,6 @@ const uint8_t gaugeIndicatorMask[GaugeView::k_indicatorDiameter][GaugeView::k_in }; GaugeView::GaugeView() : - View(), m_level(1), m_backgroundColor(KDColorWhite) { diff --git a/escher/src/key_view.cpp b/escher/src/key_view.cpp index 9d2ec44d3..1c1022f5b 100644 --- a/escher/src/key_view.cpp +++ b/escher/src/key_view.cpp @@ -67,7 +67,6 @@ const uint8_t minusMask[KeyView::k_keySize][KeyView::k_keySize] = { }; KeyView::KeyView(Type type) : - View(), m_type(type) { } diff --git a/escher/src/switch_view.cpp b/escher/src/switch_view.cpp index 34a88932d..23ebd23a6 100644 --- a/escher/src/switch_view.cpp +++ b/escher/src/switch_view.cpp @@ -33,7 +33,6 @@ const uint8_t onOffMask[SwitchView::k_onOffSize][SwitchView::k_onOffSize] = { }; SwitchView::SwitchView() : -View(), m_state(true) { }