Cosmetics

This commit is contained in:
Bertrand Songis
2020-04-10 20:56:28 +02:00
parent d48f8beb68
commit a12865277b
2 changed files with 11 additions and 10 deletions
+8 -6
View File
@@ -491,13 +491,15 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
template<class T>
void drawScaledBitmap(const T * bitmap, coord_t x, coord_t y, coord_t w, coord_t h)
{
float vscale = float(h) / bitmap->height();
float hscale = float(w) / bitmap->width();
float scale = vscale < hscale ? vscale : hscale;
if (bitmap) {
float vscale = float(h) / bitmap->height();
float hscale = float(w) / bitmap->width();
float scale = vscale < hscale ? vscale : hscale;
int xshift = (w - (bitmap->width() * scale)) / 2;
int yshift = (h - (bitmap->height() * scale)) / 2;
drawBitmap(x + xshift, y + yshift, bitmap, 0, 0, 0, 0, scale);
int xshift = (w - (bitmap->width() * scale)) / 2;
int yshift = (h - (bitmap->height() * scale)) / 2;
drawBitmap(x + xshift, y + yshift, bitmap, 0, 0, 0, 0, scale);
}
}
BitmapBuffer * horizontalFlip() const;
+3 -4
View File
@@ -33,6 +33,8 @@ class CarouselItem {
{
}
virtual ~CarouselItem() = default;
public:
Window * front;
Window * back;
@@ -49,10 +51,7 @@ class CarouselWindow: public Window {
~CarouselWindow() override
{
for (auto & item: items) {
item->front->deleteLater();
item->back->deleteLater();
}
clear();
}
void addItem(CarouselItem * item)