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.cc34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index f1addb4..8c7087f 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -49,9 +49,9 @@ using std::endl;
49using std::string; 49using std::string;
50using std::max; 50using std::max;
51using std::min; 51using std::min;
52using FbTk::ColorLUT::PRE_MULTIPLY_1_5;
53using FbTk::ColorLUT::PRE_MULTIPLY_1_125;
54using FbTk::ColorLUT::PRE_MULTIPLY_0_75; 52using FbTk::ColorLUT::PRE_MULTIPLY_0_75;
53using FbTk::ColorLUT::BRIGHTER_4;
54using FbTk::ColorLUT::BRIGHTER_8;
55 55
56namespace FbTk { 56namespace FbTk {
57 57
@@ -65,19 +65,17 @@ struct RGBA {
65 // simple function-pointers for interlace-code 65 // simple function-pointers for interlace-code
66 // (and avoid *this 'overhead') 66 // (and avoid *this 'overhead')
67 67
68 // 1.5 of current value, clamp to ~0 (0xff)
69 static void brighten_1_5(RGBA& color) {
70 color.r = PRE_MULTIPLY_1_5[color.r];
71 color.g = PRE_MULTIPLY_1_5[color.g];
72 color.b = PRE_MULTIPLY_1_5[color.b];
73 }
74 68
69 static void brighten_4(RGBA& color) {
70 color.r = BRIGHTER_4[color.r];
71 color.g = BRIGHTER_4[color.g];
72 color.b = BRIGHTER_4[color.b];
73 }
75 74
76 // 1.125 of current value 75 static void brighten_8(RGBA& color) {
77 static void brighten_1_125(RGBA& color) { 76 color.r = BRIGHTER_8[color.r];
78 color.r = PRE_MULTIPLY_1_125[color.r]; 77 color.g = BRIGHTER_8[color.g];
79 color.g = PRE_MULTIPLY_1_125[color.g]; 78 color.b = BRIGHTER_8[color.b];
80 color.b = PRE_MULTIPLY_1_125[color.b];
81 } 79 }
82 80
83 // 0.75 of old value 81 // 0.75 of old value
@@ -93,7 +91,7 @@ struct RGBA {
93}; 91};
94 92
95const RGBA::colorFunc RGBA::pseudoInterlaceFuncs[2] = { 93const RGBA::colorFunc RGBA::pseudoInterlaceFuncs[2] = {
96 RGBA::brighten_1_125, 94 RGBA::brighten_4,
97 RGBA::darken 95 RGBA::darken
98}; 96};
99 97
@@ -287,13 +285,13 @@ void renderBevel1(bool interlaced,
287 // brighten top line and first pixel of the 285 // brighten top line and first pixel of the
288 // 2nd line 286 // 2nd line
289 for (i = 0; i < width + 1; ++i) { 287 for (i = 0; i < width + 1; ++i) {
290 FbTk::RGBA::brighten_1_5(rgba[i]); 288 FbTk::RGBA::brighten_4(rgba[i]);
291 } 289 }
292 290
293 // bright and darken left and right border 291 // bright and darken left and right border
294 for (i = 2 * width - 1; i < s - width; i += width) { 292 for (i = 2 * width - 1; i < s - width; i += width) {
295 FbTk::RGBA::darken(rgba[i]); // right border 293 FbTk::RGBA::darken(rgba[i]); // right border
296 FbTk::RGBA::brighten_1_5(rgba[i + 1]); // left border on the next line 294 FbTk::RGBA::brighten_4(rgba[i + 1]); // left border on the next line
297 } 295 }
298 296
299 // darken bottom line, except the first pixel 297 // darken bottom line, except the first pixel
@@ -331,14 +329,14 @@ void renderBevel2(bool interlaced,
331 329
332 // top line, but stop 2 pixels before right border 330 // top line, but stop 2 pixels before right border
333 for (i = (width + 1); i < ((2 * width) - 2); i++) { 331 for (i = (width + 1); i < ((2 * width) - 2); i++) {
334 FbTk::RGBA::brighten_1_5(rgba[i]); 332 FbTk::RGBA::brighten_4(rgba[i]);
335 } 333 }
336 334
337 // first darken the right border, then brighten the 335 // first darken the right border, then brighten the
338 // left border 336 // left border
339 for ( ; i < (s - (2 * width) - 1); i += width) { 337 for ( ; i < (s - (2 * width) - 1); i += width) {
340 FbTk::RGBA::darken(rgba[i]); 338 FbTk::RGBA::darken(rgba[i]);
341 FbTk::RGBA::brighten_1_5(rgba[i + 3]); 339 FbTk::RGBA::brighten_4(rgba[i + 3]);
342 } 340 }
343 341
344 // bottom line 342 // bottom line