[escher] Remove BurgerMenuView

This commit is contained in:
Émilie Feral
2020-01-20 18:01:48 +01:00
committed by Léa Saviot
parent 56319ef275
commit ef5681ec0b
4 changed files with 0 additions and 79 deletions

View File

@@ -6,7 +6,6 @@ escher_src += $(addprefix escher/src/,\
bank_view_controller.cpp \
bordered.cpp \
buffer_text_view.cpp \
burger_menu_view.cpp \
button.cpp \
button_row_controller.cpp \
chevron_view.cpp \

View File

@@ -5,7 +5,6 @@
#include <escher/alternate_empty_view_delegate.h>
#include <escher/bank_view_controller.h>
#include <escher/buffer_text_view.h>
#include <escher/burger_menu_view.h>
#include <escher/button.h>
#include <escher/button_row_controller.h>
#include <escher/chevron_view.h>

View File

@@ -1,17 +0,0 @@
#ifndef ESCHER_BURGER_MENU_VIEW_H
#define ESCHER_BURGER_MENU_VIEW_H
#include <escher/view.h>
class BurgerMenuView : public View {
public:
BurgerMenuView() : m_backgroundColor(KDColorWhite) {}
void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override;
void setBackgroundColor(KDColor color);
constexpr static KDCoordinate k_burgerSize = 13;
private:
KDColor m_backgroundColor;
};
#endif

View File

@@ -1,60 +0,0 @@
#include <escher/burger_menu_view.h>
#include <kandinsky/color.h>
const uint8_t sBurgerMask[BurgerMenuView::k_burgerSize][BurgerMenuView::k_burgerSize] = {
{0xFF, 0xFF, 0xFF, 0xE0, 0xA5, 0x83, 0x76, 0x83, 0xA5, 0xE0, 0xFF, 0xFF, 0xFF},
{0xFF, 0xFD, 0xAF, 0x84, 0xC8, 0xF0, 0xFC, 0xF0, 0xC8, 0x84, 0xAF, 0xFC, 0xFF},
{0xFF, 0xAC, 0x9C, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x9C, 0xAC, 0xFF},
{0xE1, 0x86, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x86, 0xE1},
{0xA6, 0xC8, 0xFF, 0x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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0xFF},
{0xFF, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0xFF},
{0xFF, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xFF},
{0xFF, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0xFF},
{0xFF, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0xFF},
{0xFF, 0xDF, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDF, 0xFF},
{0xFF, 0xFF, 0xB9, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xDF, 0x67, 0x1D, 0x06, 0x1D, 0x67, 0xDF, 0x94, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
};
KDColor sBurgerWorkingBuffer[BurgerMenuView::k_burgerSize*BurgerMenuView::k_burgerSize];
void BurgerMenuView::drawRect(KDContext * ctx, KDRect rect) const {
/* Draw the burger vertically and horizontally centered in the view. */
KDCoordinate widthCenter = bounds().width()/2;
KDCoordinate heightCenter = bounds().height()/2;
KDCoordinate burgerHalfSize = k_burgerSize/2;
KDRect frame(widthCenter - burgerHalfSize, heightCenter - burgerHalfSize, k_burgerSize, k_burgerSize);
// Reinitialize the color of the rectangle to avoid corruptions after successive drawings of burger view
KDColor sample = ctx->getPixel(KDPointZero);
ctx->fillRect(bounds(), sample);
// Draw the circle
ctx->blendRectWithMask(frame, m_backgroundColor, (const uint8_t *)sCircleMask, sBurgerWorkingBuffer);
// Draw the burger
ctx->blendRectWithMask(frame, KDColorBlack, (const uint8_t *)sBurgerMask, sBurgerWorkingBuffer);
}
KDSize BurgerMenuView::minimalSizeForOptimalDisplay() const {
return KDSize(k_burgerSize, k_burgerSize);
}
void BurgerMenuView::setBackgroundColor(KDColor color) {
m_backgroundColor = color;
markRectAsDirty(bounds());
}