Cosmetics
This commit is contained in:
+8
-6
@@ -491,13 +491,15 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
|
|||||||
template<class T>
|
template<class T>
|
||||||
void drawScaledBitmap(const T * bitmap, coord_t x, coord_t y, coord_t w, coord_t h)
|
void drawScaledBitmap(const T * bitmap, coord_t x, coord_t y, coord_t w, coord_t h)
|
||||||
{
|
{
|
||||||
float vscale = float(h) / bitmap->height();
|
if (bitmap) {
|
||||||
float hscale = float(w) / bitmap->width();
|
float vscale = float(h) / bitmap->height();
|
||||||
float scale = vscale < hscale ? vscale : hscale;
|
float hscale = float(w) / bitmap->width();
|
||||||
|
float scale = vscale < hscale ? vscale : hscale;
|
||||||
|
|
||||||
int xshift = (w - (bitmap->width() * scale)) / 2;
|
int xshift = (w - (bitmap->width() * scale)) / 2;
|
||||||
int yshift = (h - (bitmap->height() * scale)) / 2;
|
int yshift = (h - (bitmap->height() * scale)) / 2;
|
||||||
drawBitmap(x + xshift, y + yshift, bitmap, 0, 0, 0, 0, scale);
|
drawBitmap(x + xshift, y + yshift, bitmap, 0, 0, 0, 0, scale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapBuffer * horizontalFlip() const;
|
BitmapBuffer * horizontalFlip() const;
|
||||||
|
|||||||
+3
-4
@@ -33,6 +33,8 @@ class CarouselItem {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~CarouselItem() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window * front;
|
Window * front;
|
||||||
Window * back;
|
Window * back;
|
||||||
@@ -49,10 +51,7 @@ class CarouselWindow: public Window {
|
|||||||
|
|
||||||
~CarouselWindow() override
|
~CarouselWindow() override
|
||||||
{
|
{
|
||||||
for (auto & item: items) {
|
clear();
|
||||||
item->front->deleteLater();
|
|
||||||
item->back->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addItem(CarouselItem * item)
|
void addItem(CarouselItem * item)
|
||||||
|
|||||||
Reference in New Issue
Block a user