1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

Tidy up gradient stuff.

This commit is contained in:
Brenden Matthews 2021-03-06 06:58:08 -06:00
parent 211244d888
commit 16f2ed659e
No known key found for this signature in database
GPG Key ID: B49ABB7270D9D4FD
2 changed files with 4 additions and 8 deletions

View File

@ -40,7 +40,6 @@ short colour_depth = 0;
long redmask, greenmask, bluemask;
void set_up_gradient() {
int i;
#ifdef BUILD_X11
if (out_to_x.get(*state)) {
colour_depth = DisplayPlanes(display, screen);
@ -58,7 +57,7 @@ void set_up_gradient() {
redmask = 0;
greenmask = 0;
bluemask = 0;
for (i = (colour_depth / 3) - 1; i >= 0; i--) {
for (int i = (colour_depth / 3) - 1; i >= 0; i--) {
redmask |= 1 << i;
greenmask |= 1 << i;
bluemask |= 1 << i;
@ -94,7 +93,6 @@ std::unique_ptr<unsigned long[]> do_gradient(int width,
short redshift = (2 * colour_depth / 3 + colour_depth % 3);
short greenshift = (colour_depth / 3);
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
int i;
if (colour_depth == 0) { set_up_gradient(); }
red1 = (first_colour & redmask) >> redshift;
@ -109,7 +107,7 @@ std::unique_ptr<unsigned long[]> do_gradient(int width,
#ifdef HAVE_OPENMP
#pragma omp parallel for schedule(dynamic, 10) shared(colours)
#endif /* HAVE_OPENMP */
for (i = 0; i < width; i++) {
for (int i = 0; i < width; i++) {
int red3 = 0, green3 = 0, blue3 = 0; // colour components
float factor = (static_cast<float>(i) / (width - 1));

View File

@ -152,10 +152,8 @@ std::unique_ptr<unsigned long[]> do_hsv_gradient(int width,
int redshift = (2 * colour_depth / 3 + colour_depth % 3);
int greenshift = (colour_depth / 3);
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
// unsigned long *colours =
// static_cast<unsigned long *>(malloc(width * sizeof(unsigned long)));
int i;
if (colour_depth == 0) { set_up_gradient(); }
@ -186,7 +184,7 @@ std::unique_ptr<unsigned long[]> do_hsv_gradient(int width,
colours[0] = first_colour;
colours[width - 1] = last_colour;
for (i = 1; i < (width - 1); i++) {
for (int i = 1; i < (width - 1); i++) {
long k;
long divisor = width - i;