Skip to content

Commit 59287ab

Browse files
committed
window management
1 parent 275e230 commit 59287ab

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/controller/Display.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ namespace udd {
198198
}
199199

200200
void Display::showImage(Image& image, Rotation rotation) {
201-
showImage(image, Point(0, 0), Point(config.width, config.height), rotation);
201+
Point p1 = Point(0, 0);
202+
Point p2 = Point(config.width, config.height);
203+
204+
if (image.getWidth > config.width) {
205+
p2 = Point(config.height, config.width);
206+
}
207+
showImage(image, p1, p2, rotation);
202208
}
203209

204210
void Display::showImage(Image &image, Point p1, Point p2, Rotation rotation) {

src/controller/Image.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Image::Image(int width, int height, Color backgroundColor) {
2828
clear(backgroundColor);
2929
}
3030

31+
int udd::Image::getWidth() {
32+
return width;
33+
}
34+
35+
int udd::Image::getHeight() {
36+
return height;
37+
}
38+
3139
void Image::clear(Color backgroundColor) {
3240
for (int x = 0; x < width; ++x) {
3341
for (int y = 0; y < height; ++y) {

src/controller/Image.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ namespace udd {
2020

2121
Image(int width, int height, Color backgroundColor);
2222

23+
int getWidth();
24+
int getHeight();
25+
2326
void clear(Color backgroundColor);
2427

2528
void close();

0 commit comments

Comments
 (0)