diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/TextureRender.cc | 33 | ||||
-rw-r--r-- | src/FbTk/XmbFontImp.cc | 50 |
2 files changed, 5 insertions, 78 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 | ||
184 | void 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 | } |
diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc index e73670c..557708a 100644 --- a/src/FbTk/XmbFontImp.cc +++ b/src/FbTk/XmbFontImp.cc | |||
@@ -51,56 +51,6 @@ using std::string; | |||
51 | 51 | ||
52 | namespace { | 52 | namespace { |
53 | 53 | ||
54 | const char *getFontSize(const char *pattern, int *size) { | ||
55 | const char *p; | ||
56 | const char *p2=0; | ||
57 | int n=0; | ||
58 | |||
59 | for (p=pattern; 1; p++) { | ||
60 | if (!*p) { | ||
61 | if (p2!=0 && n>1 && n<72) { | ||
62 | *size = n; return p2+1; | ||
63 | } else { | ||
64 | *size = 16; return 0; | ||
65 | } | ||
66 | } else if (*p=='-') { | ||
67 | if (n>1 && n<72 && p2!=0) { | ||
68 | *size = n; | ||
69 | return p2+1; | ||
70 | } | ||
71 | p2=p; n=0; | ||
72 | } else if (*p>='0' && *p<='9' && p2!=0) { | ||
73 | n *= 10; | ||
74 | n += *p-'0'; | ||
75 | } else { | ||
76 | p2=0; n=0; | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | const char *getFontElement(const char *pattern, char *buf, int bufsiz, ...) { | ||
82 | const char *p, *v; | ||
83 | char *p2; | ||
84 | va_list va; | ||
85 | |||
86 | va_start(va, bufsiz); | ||
87 | buf[bufsiz-1] = 0; | ||
88 | buf[bufsiz-2] = '*'; | ||
89 | while((v = va_arg(va, char *)) != 0) { | ||
90 | p = FbTk::StringUtil::strcasestr(pattern, v); | ||
91 | if (p) { | ||
92 | strncpy(buf, p+1, bufsiz-2); | ||
93 | p2 = strchr(buf, '-'); | ||
94 | if (p2) *p2=0; | ||
95 | va_end(va); | ||
96 | return p; | ||
97 | } | ||
98 | } | ||
99 | va_end(va); | ||
100 | strncpy(buf, "*", bufsiz); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | XFontSet createFontSet(const char *fontname, bool& utf8mode) { | 54 | XFontSet createFontSet(const char *fontname, bool& utf8mode) { |
105 | Display *display = FbTk::App::instance()->display(); | 55 | Display *display = FbTk::App::instance()->display(); |
106 | XFontSet fs; | 56 | XFontSet fs; |