aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/TextureRender.cc37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index df7a550..68b98df 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -570,31 +570,34 @@ void renderEllipticGradient(bool interlaced,
570 const FbTk::Color* from, const FbTk::Color* to, 570 const FbTk::Color* from, const FbTk::Color* to,
571 FbTk::ImageControl& imgctrl) { 571 FbTk::ImageControl& imgctrl) {
572 572
573 size_t i; 573 const double r = to->red();
574 int x; 574 const double g = to->green();
575 int y; 575 const double b = to->blue();
576 576
577 const double dr = r - from->red();
578 const double dg = g - from->green();
579 const double db = b - from->blue();
577 580
578 double r = to->red(); 581 const double w2 = width / 2.0;
579 double g = to->green(); 582 const double h2 = height / 2.0;
580 double b = to->blue();
581 583
582 double dr = r - from->red(); 584 const double sw = 1.0 / (w2 * w2);
583 double dg = g - from->green(); 585 const double sh = 1.0 / (h2 * h2);
584 double db = b - from->blue();
585
586 int w2 = width/2;
587 int h2 = height/2;
588 586
587 size_t i;
588 int x;
589 int y;
590 double _x;
591 double _y;
589 double d; 592 double d;
590 593
591 for (i = 0, y = -h2; y < h2; ++y) { 594 for (i = 0, y = 0; y < height; ++y) {
592 for (x = -w2; x < w2; ++x, ++i) { 595 for (x = 0; x < width; ++x, ++i) {
593 596
594 d = ((double)(x*x) / (double)(w2*w2)) 597 _x = x - w2;
595 + ((double)(y*y) / (double)(h2*h2)); 598 _y = y - h2;
596 599
597 d *= 0.5; 600 d = ((_x * _x * sw) + (_y * _y * sh)) / 2.0;
598 601
599 rgba[i].r = (unsigned char)(r - (d * dr)); 602 rgba[i].r = (unsigned char)(r - (d * dr));
600 rgba[i].g = (unsigned char)(g - (d * dg)); 603 rgba[i].g = (unsigned char)(g - (d * dg));