Fixed triangle drawing. A bit.

svn-id: r33268
This commit is contained in:
Vicent Marti 2008-07-25 00:59:53 +00:00
parent 7c56278896
commit 49b4df308f
4 changed files with 20 additions and 13 deletions

View File

@ -498,9 +498,9 @@ void VectorRendererSpec<PixelType, PixelFormat>::
drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) {
// Awesome hack: the AA messes up the last pixel triangles if their width is even
// ...fix the width instead of fixing the AA :p
if (w % 2 == 0) {
w++; h++;
}
// if (w % 2 == 0) {
// w++; h++;
// }
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h)
return;
@ -517,16 +517,22 @@ drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) {
return;
color = _fgColor;
}
if (Base::_dynamicData != 0)
orient = (TriangleOrientation)Base::_dynamicData;
int newW = w * 3 / 4;
if (newW % 2) newW++;
switch(orient) {
case kTriangleUp:
case kTriangleDown:
#ifdef VECTOR_RENDERER_FAST_TRIANGLES
if (w == h)
drawTriangleFast(x, y, w, (orient == kTriangleDown), color, Base::_fillMode);
else
#endif
drawTriangleVertAlg(x, y, w, h, (orient == kTriangleDown), color, Base::_fillMode);
// #ifdef VECTOR_RENDERER_FAST_TRIANGLES
// if (w == h)
drawTriangleFast(x + (w / 2) - w * 3 / 8, y + w / 4, newW, (orient == kTriangleDown), color, Base::_fillMode);
// else
// #endif
// drawTriangleVertAlg(x, y, w, h, (orient == kTriangleDown), color, Base::_fillMode);
break;
case kTriangleLeft:

View File

@ -107,6 +107,7 @@ public:
};
enum TriangleOrientation {
kTriangleAuto = 0,
kTriangleUp,
kTriangleDown,
kTriangleLeft,

View File

@ -79,12 +79,12 @@ bool ThemeRenderer::loadDefaultXML() {
"<drawdata id = 'scrollbar_button_idle' cache = false>"
"<drawstep func = 'roundedsq' radius = '4' fill = 'none' fg_color = '120, 120, 120' stroke = 1 />"
"<drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = '9' height = '7' xpos = 'center' ypos = 'center' orientation = 'top' />"
"<drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = 'auto' height = 'auto' xpos = 'center' ypos = 'center' orientation = 'top' />"
"</drawdata>"
"<drawdata id = 'scrollbar_button_hover' cache = false>"
"<drawstep func = 'roundedsq' radius = '4' fill = 'background' fg_color = '120, 120, 120' bg_color = '206, 121, 99' stroke = 1 />"
"<drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = '9' height = '7' xpos = 'center' ypos = 'center' orientation = 'top' />"
"<drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = 'auto' height = 'auto' xpos = 'center' ypos = 'center' orientation = 'top' />"
"</drawdata>"
"<drawdata id = 'tab_active' cache = false>"

View File

@ -476,10 +476,10 @@ void ThemeRenderer::drawScrollbar(const Common::Rect &r, int sliderY, int slider
const int buttonExtra = (r.width() * 120) / 100;
r2.bottom = r2.top + buttonExtra;
queueDD(scrollState == kScrollbarStateUp ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2);
queueDD(scrollState == kScrollbarStateUp ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2, Graphics::VectorRenderer::kTriangleUp);
r2.translate(0, r.height() - r2.height());
queueDD(scrollState == kScrollbarStateDown ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2);
queueDD(scrollState == kScrollbarStateDown ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2, Graphics::VectorRenderer::kTriangleDown);
r2 = r;
r2.left += 1;