aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2011-12-14 00:55:18 +0000
committerEugene Sandulenko2011-12-14 00:56:15 +0000
commit71d6771be5911f533e4747156ea15be72502a42c (patch)
tree72682caad2eb2357e55cb041349b25c9c3162636 /graphics
parentf1a099d4f8ba4cd2efc58c24f7075f77c7459016 (diff)
downloadscummvm-rg350-71d6771be5911f533e4747156ea15be72502a42c.tar.gz
scummvm-rg350-71d6771be5911f533e4747156ea15be72502a42c.tar.bz2
scummvm-rg350-71d6771be5911f533e4747156ea15be72502a42c.zip
GUI: Implement dithering for tabs and round squares
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRendererSpec.cpp50
1 files changed, 33 insertions, 17 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 588e17b6cb..b5dc129e3c 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -880,6 +880,8 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer:
} else {
BE_RESET();
+ precalcGradient(long_h);
+
PixelType color1, color2;
color1 = color2 = color;
@@ -889,22 +891,32 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer:
if (fill_m == kFillGradient) {
color1 = calcGradient(real_radius - x, long_h);
color2 = calcGradient(real_radius - y, long_h);
- }
- colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color2);
- colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color1);
+ gradientFill(ptr_tl - x - py, w - 2 * r + 2 * x, x1 + r - x - y, real_radius - y);
+ gradientFill(ptr_tl - y - px, w - 2 * r + 2 * y, x1 + r - y - x, real_radius - x);
+
+ *(ptr_tr + (y) - (px)) = color1;
+ *(ptr_tr + (x) - (py)) = color2;
+ *(ptr_tl - (x) - (py)) = color2;
+ *(ptr_tl - (y) - (px)) = color1;
+ } else {
+ colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color);
+ colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color);
- *(ptr_tr + (y) - (px)) = color1;
- *(ptr_tr + (x) - (py)) = color2;
- *(ptr_tl - (x) - (py)) = color2;
- *(ptr_tl - (y) - (px)) = color1;
+ *(ptr_tr + (y) - (px)) = color;
+ *(ptr_tr + (x) - (py)) = color;
+ *(ptr_tl - (x) - (py)) = color;
+ *(ptr_tl - (y) - (px)) = color;
+ }
}
ptr_fill += pitch * r;
while (short_h--) {
- if (fill_m == kFillGradient)
- color = calcGradient(real_radius++, long_h);
- colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ if (fill_m == kFillGradient) {
+ gradientFill(ptr_fill, w + 1, x1, real_radius++);
+ } else {
+ colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ }
ptr_fill += pitch;
}
}
@@ -1390,6 +1402,8 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
PixelType color1, color2, color3, color4;
if (fill_m == kFillGradient) {
+ precalcGradient(long_h);
+
while (x++ < y) {
BE_ALGORITHM();
@@ -1398,11 +1412,11 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
color3 = calcGradient(long_h - r + x, long_h);
color4 = calcGradient(long_h - r + y, long_h);
- colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color2);
- colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color1);
+ gradientFill(ptr_tl - x - py, w - 2 * r + 2 * x, x1 + r - x - y, real_radius - y);
+ gradientFill(ptr_tl - y - px, w - 2 * r + 2 * y, x1 + r - y - x, real_radius - x);
- colorFill<PixelType>(ptr_bl - x + py, ptr_br + x + py, color4);
- colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color3);
+ gradientFill(ptr_bl - x + py, w - 2 * r + 2 * x, x1 + r - x - y, long_h - r + y);
+ gradientFill(ptr_bl - y + px, w - 2 * r + 2 * y, x1 + r - y - x, long_h - r + x);
BE_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py);
}
@@ -1423,9 +1437,11 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
ptr_fill += pitch * r;
while (short_h--) {
- if (fill_m == kFillGradient)
- color = calcGradient(real_radius++, long_h);
- colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ if (fill_m == kFillGradient) {
+ gradientFill(ptr_fill, w + 1, x1, real_radius++);
+ } else {
+ colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ }
ptr_fill += pitch;
}
}