Files
Upsilon/escher/src/ellipsis_view.cpp
Léa Saviot 57633829a9 [code] Split the Menu Controller in two columns.
The scripts names are on the right and open the script edition.
The left cells open the script options.

Change-Id: I3fbab8c3861f3395c3206775c92cda3470963b26
2017-11-17 14:05:23 +01:00

32 lines
1.4 KiB
C++

#include <escher/ellipsis_view.h>
#include <kandinsky/color.h>
const uint8_t ellipsisMask[EllipsisView::k_ellipsisHeight][EllipsisView::k_ellipsisWidth] = {
{0xFF, 0xDA, 0xBB, 0xD1, 0xFF, 0xFF, 0xFF, 0xDA, 0xBB, 0xD1, 0xFF, 0xFF, 0xFF, 0xDA, 0xBB, 0xD1, 0xFF},
{0xFF, 0xBA, 0x8C, 0xA1, 0xFF, 0xFF, 0xFF, 0xBA, 0x8C, 0xA1, 0xFF, 0xFF, 0xFF, 0xBA, 0x8C, 0xA1, 0xFF},
{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 {
/* Draw the ellipsis vertically and horizontally centered in the view.
* The heightCenter is the coordinate of the vertical middle of the view. That
* way, (heightCenter-switchHalfHeight) indicates the top the ellipsis. */
KDCoordinate widthCenter = bounds().width()/2;
KDCoordinate ellipsisHalfWidth = k_ellipsisWidth/2;
KDCoordinate heightCenter = bounds().height()/2;
KDCoordinate ellipsisHalfHeight = k_ellipsisHeight/2;
KDRect frame(widthCenter - ellipsisHalfWidth, heightCenter - ellipsisHalfHeight, k_ellipsisWidth, k_ellipsisHeight);
ctx->blendRectWithMask(frame, KDColorBlack, (const uint8_t *)ellipsisMask, s_ellipsisWorkingBuffer);
}
KDSize EllipsisView::minimalSizeForOptimalDisplay() const {
return KDSize(k_ellipsisWidth, k_ellipsisHeight);
}