* Fixed Twitcher's arrow drawing glitches as described in ticket #4704.

* Unfortunately, there are remaining issues, but this is something I need to
  discuss with Stippi: B_OP_COPY does not work as expected due to anti-aliasing
  anymore, but there is no replacement one could possibly use to get the desired
  effect without having to clear the background every time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33676 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-20 01:45:04 +00:00
parent 3637e0e057
commit 99113e07df
+77 -59
View File
@@ -1436,26 +1436,21 @@ TBox::Draw(BRect update)
void void
TBox::DrawIconScrollers(bool force) TBox::DrawIconScrollers(bool force)
{ {
bool updateLeft = false; rgb_color backgroundColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
bool updateRight = false;
rgb_color leftc = {0, 0, 0, 255};
rgb_color rightc = {0, 0, 0, 255};
rgb_color bkg = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_1_TINT); B_DARKEN_1_TINT);
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT); B_DARKEN_4_TINT);
bool updateLeft = false;
bool updateRight = false;
BRect rect = fIconView->Bounds(); BRect rect = fIconView->Bounds();
if (rect.left > (kSlotSize * kCenterSlot)) { if (rect.left > (kSlotSize * kCenterSlot)) {
updateLeft = true; updateLeft = true;
fLeftScroller = true; fLeftScroller = true;
leftc = dark;
} else { } else {
fLeftScroller = false; fLeftScroller = false;
if (force) { if (force)
updateLeft = true; updateLeft = true;
leftc = bkg;
}
} }
int32 maxIndex = fManager->GroupList()->CountItems() - 1; int32 maxIndex = fManager->GroupList()->CountItems() - 1;
@@ -1465,115 +1460,138 @@ TBox::DrawIconScrollers(bool force)
if (lastFrame.right > rect.right) { if (lastFrame.right > rect.right) {
updateRight = true; updateRight = true;
fRightScroller = true; fRightScroller = true;
rightc = dark;
} else { } else {
fRightScroller = false; fRightScroller = false;
if (force) { if (force)
updateRight = true; updateRight = true;
rightc = bkg;
}
} }
PushState();
SetDrawingMode(B_OP_COPY);
rect = fIconView->Frame(); rect = fIconView->Frame();
if (updateLeft) { if (updateLeft) {
SetHighColor(leftc); BPoint pt1, pt2, pt3;
BPoint pt1, pt2, pt3;
pt1.x = rect.left - 5; pt1.x = rect.left - 5;
pt1.y = floorf((rect.bottom + rect.top) / 2); pt1.y = floorf((rect.bottom + rect.top) / 2);
pt2.x = pt3.x = pt1.x + 3; pt2.x = pt3.x = pt1.x + 3;
pt2.y = pt1.y - 3; pt2.y = pt1.y - 3;
pt3.y = pt1.y + 3; pt3.y = pt1.y + 3;
FillTriangle(pt1, pt2, pt3);
if (fLeftScroller) {
SetHighColor(dark);
FillTriangle(pt1, pt2, pt3);
} else if (force) {
SetHighColor(backgroundColor);
FillRect(BRect(pt1.x, pt2.y, pt3.x, pt3.y));
}
} }
if (updateRight) { if (updateRight) {
SetHighColor(rightc); BPoint pt1, pt2, pt3;
BPoint pt1, pt2, pt3;
pt1.x = rect.right + 4; pt1.x = rect.right + 4;
pt1.y = rintf((rect.bottom + rect.top) / 2); pt1.y = rintf((rect.bottom + rect.top) / 2);
pt2.x = pt3.x = pt1.x - 4; pt2.x = pt3.x = pt1.x - 4;
pt2.y = pt1.y - 4; pt2.y = pt1.y - 4;
pt3.y = pt1.y + 4; pt3.y = pt1.y + 4;
FillTriangle(pt1, pt2, pt3);
if (fRightScroller) {
SetHighColor(dark);
FillTriangle(pt1, pt2, pt3);
} else if (force) {
SetHighColor(backgroundColor);
FillRect(BRect(pt3.x, pt2.y, pt1.x, pt3.y));
}
} }
PopState();
} }
void void
TBox::DrawWindowScrollers(bool force) TBox::DrawWindowScrollers(bool force)
{ {
rgb_color backgroundColor = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color dark = tint_color(backgroundColor, B_DARKEN_4_TINT);
bool updateUp = false; bool updateUp = false;
bool updateDown = false; bool updateDown = false;
rgb_color upColor = {0, 0, 0, 255};
rgb_color downColor = {0, 0, 0, 255};
rgb_color bkg = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_4_TINT);
BRect rect = fWindow->WindowView()->Bounds(); BRect rect = fWindow->WindowView()->Bounds();
if (rect.top != 0) { if (rect.top != 0) {
updateUp = true; updateUp = true;
fUpScroller = true; fUpScroller = true;
upColor = dark;
} else { } else {
fUpScroller = false; fUpScroller = false;
if (force) { if (force)
updateUp = true; updateUp = true;
upColor = bkg;
}
} }
int32 groupIndex = fManager->CurrentIndex(); int32 groupIndex = fManager->CurrentIndex();
int32 maxIndex = fManager->CountWindows(groupIndex) - 1; int32 maxIndex = fManager->CountWindows(groupIndex) - 1;
BRect lastFrame(0, 0, 0, 0); BRect lastFrame(0, 0, 0, 0);
if (maxIndex >= 0) { if (maxIndex >= 0)
lastFrame = fWindow->WindowView()->FrameOf(maxIndex); lastFrame = fWindow->WindowView()->FrameOf(maxIndex);
}
if (maxIndex >= 0 && lastFrame.bottom > rect.bottom) { if (maxIndex >= 0 && lastFrame.bottom > rect.bottom) {
updateDown = true; updateDown = true;
fDownScroller = true; fDownScroller = true;
downColor = dark;
} else { } else {
fDownScroller = false; fDownScroller = false;
if (force) { if (force)
updateDown = true; updateDown = true;
downColor = bkg;
}
} }
PushState();
SetDrawingMode(B_OP_COPY);
rect = fWindow->WindowView()->Frame(); rect = fWindow->WindowView()->Frame();
rect.InsetBy(-3, 0); rect.InsetBy(-3, 0);
if (updateUp) { if (updateUp) {
SetHighColor(upColor); if (fUpScroller) {
BPoint pt1, pt2, pt3; SetHighColor(dark);
pt1.x = rect.left - 6; BPoint pt1, pt2, pt3;
pt1.y = rect.top + 3; pt1.x = rect.left - 6;
pt2.y = pt3.y = pt1.y + 4; pt1.y = rect.top + 3;
pt2.x = pt1.x - 4; pt2.y = pt3.y = pt1.y + 4;
pt3.x = pt1.x + 4; pt2.x = pt1.x - 4;
FillTriangle(pt1, pt2, pt3); pt3.x = pt1.x + 4;
FillTriangle(pt1, pt2, pt3);
pt1.x += rect.Width() + 12; pt1.x += rect.Width() + 12;
pt2.x += rect.Width() + 12; pt2.x += rect.Width() + 12;
pt3.x += rect.Width() + 12; pt3.x += rect.Width() + 12;
FillTriangle(pt1, pt2, pt3); FillTriangle(pt1, pt2, pt3);
} else if (force) {
FillRect(BRect(rect.left - 10, rect.top + 3, rect.left - 2,
rect.top + 7), B_SOLID_LOW);
FillRect(BRect(rect.right + 2, rect.top + 3, rect.right + 10,
rect.top + 7), B_SOLID_LOW);
}
} }
if (updateDown) { if (updateDown) {
SetHighColor(downColor); if (fDownScroller) {
BPoint pt1, pt2, pt3; SetHighColor(dark);
pt1.x = rect.left - 6; BPoint pt1, pt2, pt3;
pt1.y = rect.bottom - 3; pt1.x = rect.left - 6;
pt2.y = pt3.y = pt1.y - 4; pt1.y = rect.bottom - 3;
pt2.x = pt1.x - 4; pt2.y = pt3.y = pt1.y - 4;
pt3.x = pt1.x + 4; pt2.x = pt1.x - 4;
FillTriangle(pt1, pt2, pt3); pt3.x = pt1.x + 4;
FillTriangle(pt1, pt2, pt3);
pt1.x += rect.Width() + 12;
pt2.x += rect.Width() + 12;
pt3.x += rect.Width() + 12;
FillTriangle(pt1, pt2, pt3);
pt1.x += rect.Width() + 12;
pt2.x += rect.Width() + 12;
pt3.x += rect.Width() + 12;
FillTriangle(pt1, pt2, pt3);
} else if (force) {
FillRect(BRect(rect.left - 10, rect.bottom - 7, rect.left - 2,
rect.bottom - 3), B_SOLID_LOW);
FillRect(BRect(rect.right + 2, rect.bottom - 7, rect.right + 10,
rect.bottom - 3), B_SOLID_LOW);
}
} }
PopState();
Sync(); Sync();
} }