Kandinsky: Get rid of KDCoordinateMax

Which is annoying to handle, because once you define it you have to
bother with additions overflowing...

Change-Id: I50b19858342c5a2909e3078f1a4167be50210db1
This commit is contained in:
Romain Goyet
2016-06-13 17:45:54 +02:00
parent 4c048a6832
commit e2a6cdff15
4 changed files with 12 additions and 9 deletions

View File

@@ -20,6 +20,7 @@ protected:
virtual void logAttributes(std::ostream &os) const override;
#endif
private:
void setContentViewOrigin();
KDPoint m_offset;
View * m_contentView;
ScrollViewIndicator m_verticalScrollIndicator;

View File

@@ -51,12 +51,7 @@ void ScrollView::layoutSubviews() {
m_verticalScrollIndicator.setFrame(verticalIndicatorFrame);
// Layout contentview
KDRect contentFrame;
contentFrame.origin = m_offset;
//contentFrame.size = m_contentView->bounds().size;
contentFrame.width = KDCoordinateMax;
contentFrame.height = KDCoordinateMax;
m_contentView->setFrame(contentFrame);
setContentViewOrigin();
}
void ScrollView::setContentOffset(KDPoint offset) {
@@ -72,6 +67,13 @@ void ScrollView::setContentOffset(KDPoint offset) {
markAsNeedingRedraw();
}
void ScrollView::setContentViewOrigin() {
KDRect contentFrame;
contentFrame.origin = m_offset;
contentFrame.size = m_contentView->bounds().size;
m_contentView->setFrame(contentFrame);
}
#if ESCHER_VIEW_LOGGING
const char * ScrollView::className() const {
return "ScrollView";

View File

@@ -4,7 +4,6 @@
#include <stdint.h>
typedef int16_t KDCoordinate;
#define KDCoordinateMax ((KDCoordinate)((1<<15)-1))
typedef struct {
KDCoordinate x;

View File

@@ -1,10 +1,11 @@
#include <kandinsky/drawing_area.h>
#include <ion.h>
KDRect KDDrawingArea = {
.x = 0,
.y = 0,
.width = KDCoordinateMax,
.height = KDCoordinateMax
.width = ION_SCREEN_WIDTH,
.height = ION_SCREEN_HEIGHT
};
void KDSetDrawingArea(KDRect rect) {