From e7e7ff9b344356c0a9ffed2998b597328eb1331f Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Sun, 13 Jul 2008 17:08:44 +0000 Subject: Bugfix of the bugfix. Rounded squares work now on all resolutions. svn-id: r33040 --- graphics/VectorRenderer.cpp | 34 ++++++++++++++++++++++++++-------- gui/ThemeDefaultXML.cpp | 2 +- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index 1827d71024..19a4f75058 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -129,6 +129,17 @@ inline uint32 fp_sqroot(uint32 x) { *(ptr4 + (y) + (px)) = color; \ } +#define __BE_DRAWCIRCLE_XCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \ + *(ptr1 + (y) - (px)) = color1; \ + *(ptr1 + (x) - (py)) = color2; \ + *(ptr2 - (x) - (py)) = color2; \ + *(ptr2 - (y) - (px)) = color1; \ + *(ptr3 - (y) + (px)) = color3; \ + *(ptr3 - (x) + (py)) = color4; \ + *(ptr4 + (x) + (py)) = color4; \ + *(ptr4 + (y) + (px)) = color3; \ +} + #define __BE_RESET() { \ f = 1 - r; \ ddF_x = 0; ddF_y = -2 * r; \ @@ -703,17 +714,24 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto } } else { __BE_RESET(); - + PixelType color1, color2, color3, color4; + if (fill_m == kFillGradient) { while (x++ < y) { __BE_ALGORITHM(); - colorFill(ptr_tl - x - py, ptr_tr + x - py, calcGradient(real_radius - y, long_h)); - colorFill(ptr_tl - y - px, ptr_tr + y - px, calcGradient(real_radius - x, long_h)); + + color1 = calcGradient(real_radius - x, long_h); + color2 = calcGradient(real_radius - y, long_h); + color3 = calcGradient(long_h - r + x, long_h); + color4 = calcGradient(long_h - r + y, long_h); + + colorFill(ptr_tl - x - py, ptr_tr + x - py, color2); + colorFill(ptr_tl - y - px, ptr_tr + y - px, color1); - colorFill(ptr_bl - x + py, ptr_br + x + py, calcGradient(long_h - r + y, long_h)); - colorFill(ptr_bl - y + px, ptr_br + y + px, calcGradient(long_h - r + x, long_h)); + colorFill(ptr_bl - x + py, ptr_br + x + py, color4); + colorFill(ptr_bl - y + px, ptr_br + y + px, color3); -// __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); + __BE_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); } } else { while (x++ < y) { @@ -725,8 +743,8 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill(ptr_bl - x + py, ptr_br + x + py, color); colorFill(ptr_bl - y + px, ptr_br + y + px, color); - // FIXME: maybe not needed at all? -// __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); + // do not remove - messes up the drawing at lower resolutions + __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); } } diff --git a/gui/ThemeDefaultXML.cpp b/gui/ThemeDefaultXML.cpp index 68c87c6f2c..be2a9df8b6 100644 --- a/gui/ThemeDefaultXML.cpp +++ b/gui/ThemeDefaultXML.cpp @@ -60,7 +60,7 @@ bool ThemeRenderer::loadDefaultXML() { "" "" - "" + "" "" "" -- cgit v1.2.3