diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-27 19:03:30 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-05-27 13:55:08 -0700 |
commit | 330b300f220a78cb71e30b898f43c19f41961c8b (patch) | |
tree | d1a9ed44e04765a9049b615aa7649ca0b5a7108b | |
parent | 26903256232809a6566bfe0c42d637deb883b078 (diff) | |
download | subsurface-330b300f220a78cb71e30b898f43c19f41961c8b.tar.gz |
cleanup: unglobalize grayImage()
This function was globalized in be462ae1a6 to be used for the calender
widget, but that never came to be. Therefore, for now unglobalize it
until it is needed. That said, there probably is a helper function to
turn pictures into gray-scale.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | desktop-widgets/simplewidgets.h | 1 | ||||
-rw-r--r-- | desktop-widgets/starwidget.cpp | 37 |
2 files changed, 18 insertions, 20 deletions
diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h index ed364e75f..706b46818 100644 --- a/desktop-widgets/simplewidgets.h +++ b/desktop-widgets/simplewidgets.h @@ -161,6 +161,5 @@ private: }; bool isGnome3Session(); -QImage grayImage(const QImage &coloredImg); #endif // SIMPLEWIDGETS_H diff --git a/desktop-widgets/starwidget.cpp b/desktop-widgets/starwidget.cpp index d4a63b273..8748d929b 100644 --- a/desktop-widgets/starwidget.cpp +++ b/desktop-widgets/starwidget.cpp @@ -36,7 +36,6 @@ QImage focusedImage(const QImage& coloredImg) return img; } - int StarWidget::currentStars() const { return current; @@ -91,6 +90,24 @@ void StarWidget::setCurrentStars(int value) emit valueChanged(current); } +static QImage grayImage(const QImage &coloredImg) +{ + QImage img = coloredImg; + for (int i = 0; i < img.width(); ++i) { + for (int j = 0; j < img.height(); ++j) { + QRgb rgb = img.pixel(i, j); + if (!rgb) + continue; + + QColor c(rgb); + int gray = 204 + (c.red() + c.green() + c.blue()) / 15; + img.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + + return img; +} + StarWidget::StarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), current(0), readOnly(false) @@ -113,24 +130,6 @@ StarWidget::StarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), setFocusPolicy(Qt::StrongFocus); } -QImage grayImage(const QImage& coloredImg) -{ - QImage img = coloredImg; - for (int i = 0; i < img.width(); ++i) { - for (int j = 0; j < img.height(); ++j) { - QRgb rgb = img.pixel(i, j); - if (!rgb) - continue; - - QColor c(rgb); - int gray = 204 + (c.red() + c.green() + c.blue()) / 15; - img.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - - return img; -} - QSize StarWidget::sizeHint() const { const IconMetrics& metrics = defaultIconMetrics(); |