mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Make sure gradient width is >=2.
This should resolve #1070 for real this time.
This commit is contained in:
parent
16f2ed659e
commit
33aa5060c2
@ -92,6 +92,10 @@ std::unique_ptr<unsigned long[]> do_gradient(int width,
|
|||||||
int reddiff, greendiff, bluediff; // difference
|
int reddiff, greendiff, bluediff; // difference
|
||||||
short redshift = (2 * colour_depth / 3 + colour_depth % 3);
|
short redshift = (2 * colour_depth / 3 + colour_depth % 3);
|
||||||
short greenshift = (colour_depth / 3);
|
short greenshift = (colour_depth / 3);
|
||||||
|
|
||||||
|
// Make sure the width is always at least 2
|
||||||
|
width = std::max(2, width);
|
||||||
|
|
||||||
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
||||||
|
|
||||||
if (colour_depth == 0) { set_up_gradient(); }
|
if (colour_depth == 0) { set_up_gradient(); }
|
||||||
|
@ -153,6 +153,9 @@ std::unique_ptr<unsigned long[]> do_hsv_gradient(int width,
|
|||||||
int redshift = (2 * colour_depth / 3 + colour_depth % 3);
|
int redshift = (2 * colour_depth / 3 + colour_depth % 3);
|
||||||
int greenshift = (colour_depth / 3);
|
int greenshift = (colour_depth / 3);
|
||||||
|
|
||||||
|
// Make sure the width is always at least 2
|
||||||
|
width = std::max(2, width);
|
||||||
|
|
||||||
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
||||||
|
|
||||||
if (colour_depth == 0) { set_up_gradient(); }
|
if (colour_depth == 0) { set_up_gradient(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user