mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 19:31:02 +01:00
Minor style changes
This commit is contained in:
parent
40248a8f48
commit
65f1dca716
@ -1023,8 +1023,8 @@ void PlaylistView::ReloadSettings() {
|
|||||||
// set_background_image when it is not needed, as this will cause the fading
|
// set_background_image when it is not needed, as this will cause the fading
|
||||||
// animation to start again. This also avoid to do useless
|
// animation to start again. This also avoid to do useless
|
||||||
// "force_background_redraw".
|
// "force_background_redraw".
|
||||||
if (background_image_filename != background_image_filename_
|
if (background_image_filename != background_image_filename_ ||
|
||||||
|| background_type != background_image_type_ ||
|
background_type != background_image_type_ ||
|
||||||
blur_radius_ != blur_radius) {
|
blur_radius_ != blur_radius) {
|
||||||
// Store background properties
|
// Store background properties
|
||||||
background_image_type_ = background_type;
|
background_image_type_ = background_type;
|
||||||
@ -1202,7 +1202,7 @@ void PlaylistView::set_background_image(const QImage& image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (blur_radius_ != 0)
|
if (blur_radius_ != 0)
|
||||||
background_image_ = blur_background_image(background_image_, blur_radius_, false);
|
background_image_ = BlurImage(background_image_, blur_radius_, false);
|
||||||
|
|
||||||
if (isVisible()) {
|
if (isVisible()) {
|
||||||
previous_background_image_opacity_ = 1.0;
|
previous_background_image_opacity_ = 1.0;
|
||||||
@ -1211,7 +1211,7 @@ void PlaylistView::set_background_image(const QImage& image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QImage PlaylistView::blur_background_image(const QImage& image, int radius, bool alphaOnly = false)
|
QImage PlaylistView::BlurImage(const QImage& image, int radius, bool alphaOnly = false)
|
||||||
{
|
{
|
||||||
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
|
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
|
||||||
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
|
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
|
||||||
@ -1241,7 +1241,7 @@ QImage PlaylistView::blur_background_image(const QImage& image, int radius, bool
|
|||||||
p += bpl;
|
p += bpl;
|
||||||
for (int j = r1; j < r2; j++, p += bpl)
|
for (int j = r1; j < r2; j++, p += bpl)
|
||||||
for (int i = i1; i <= i2; i++)
|
for (int i = i1; i <= i2; i++)
|
||||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int row = r1; row <= r2; row++) {
|
for (int row = r1; row <= r2; row++) {
|
||||||
@ -1252,7 +1252,7 @@ QImage PlaylistView::blur_background_image(const QImage& image, int radius, bool
|
|||||||
p += 4;
|
p += 4;
|
||||||
for (int j = c1; j < c2; j++, p += 4)
|
for (int j = c1; j < c2; j++, p += 4)
|
||||||
for (int i = i1; i <= i2; i++)
|
for (int i = i1; i <= i2; i++)
|
||||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int col = c1; col <= c2; col++) {
|
for (int col = c1; col <= c2; col++) {
|
||||||
@ -1263,7 +1263,7 @@ QImage PlaylistView::blur_background_image(const QImage& image, int radius, bool
|
|||||||
p -= bpl;
|
p -= bpl;
|
||||||
for (int j = r1; j < r2; j++, p -= bpl)
|
for (int j = r1; j < r2; j++, p -= bpl)
|
||||||
for (int i = i1; i <= i2; i++)
|
for (int i = i1; i <= i2; i++)
|
||||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int row = r1; row <= r2; row++) {
|
for (int row = r1; row <= r2; row++) {
|
||||||
@ -1274,7 +1274,7 @@ QImage PlaylistView::blur_background_image(const QImage& image, int radius, bool
|
|||||||
p -= 4;
|
p -= 4;
|
||||||
for (int j = c1; j < c2; j++, p -= 4)
|
for (int j = c1; j < c2; j++, p -= 4)
|
||||||
for (int i = i1; i <= i2; i++)
|
for (int i = i1; i <= i2; i++)
|
||||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -167,7 +167,7 @@ class PlaylistView : public QTreeView {
|
|||||||
// Save image as the background_image_ after applying some modifications (opacity, ...).
|
// Save image as the background_image_ after applying some modifications (opacity, ...).
|
||||||
// Should be used instead of modifying background_image_ directly
|
// Should be used instead of modifying background_image_ directly
|
||||||
void set_background_image(const QImage& image);
|
void set_background_image(const QImage& image);
|
||||||
QImage blur_background_image(const QImage& image, int radius, bool alphaOnly);
|
QImage BlurImage(const QImage& image, int radius, bool alphaOnly);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int kGlowIntensitySteps;
|
static const int kGlowIntensitySteps;
|
||||||
|
Loading…
Reference in New Issue
Block a user