aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/TextureRender.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/TextureRender.cc')
-rw-r--r--src/FbTk/TextureRender.cc33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index 5429003..0571b16 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -181,29 +181,6 @@ void prepareLinearTable(size_t size, FbTk::RGBA* rgba,
181 } 181 }
182} 182}
183 183
184void prepareSquareTable(size_t size, FbTk::RGBA* rgba,
185 const FbTk::Color* from, const FbTk::Color* to, double scale) {
186
187
188 const double r = from->red();
189 const double g = from->green();
190 const double b = from->blue();
191
192 const double delta_r = (to->red() - r);
193 const double delta_g = (to->green() - g);
194 const double delta_b = (to->blue() - b);
195
196 double s;
197 size_t i;
198 for (i = 0; i < size; ++i) {
199 s = 1.0 - ((double)(i + 1) / (double)size);
200 s *= s;
201 rgba[i].r = static_cast<unsigned char>(scale * (r + (s * delta_r)));
202 rgba[i].g = static_cast<unsigned char>(scale * (g + (s * delta_g)));
203 rgba[i].b = static_cast<unsigned char>(scale * (b + (s * delta_b)));
204 }
205}
206
207// 184//
208// 185//
209// To + . From + . 186// To + . From + .
@@ -591,17 +568,17 @@ void renderEllipticGradient(bool interlaced,
591 double _y; 568 double _y;
592 double d; 569 double d;
593 570
594 for (i = 0, y = 0; y < height; ++y) { 571 for (i = 0, y = 0; y < static_cast<int>(height); ++y) {
595 for (x = 0; x < width; ++x, ++i) { 572 for (x = 0; x < static_cast<int>(width); ++x, ++i) {
596 573
597 _x = x - w2; 574 _x = x - w2;
598 _y = y - h2; 575 _y = y - h2;
599 576
600 d = ((_x * _x * sw) + (_y * _y * sh)) / 2.0; 577 d = ((_x * _x * sw) + (_y * _y * sh)) / 2.0;
601 578
602 rgba[i].r = (unsigned char)(r - (d * dr)); 579 rgba[i].r = static_cast<unsigned char>(r - (d * dr));
603 rgba[i].g = (unsigned char)(g - (d * dg)); 580 rgba[i].g = static_cast<unsigned char>(g - (d * dg));
604 rgba[i].b = (unsigned char)(b - (d * db)); 581 rgba[i].b = static_cast<unsigned char>(b - (d * db));
605 582
606 pseudoInterlace(rgba[i], interlaced, y); 583 pseudoInterlace(rgba[i], interlaced, y);
607 } 584 }