Draw the playback mark a bit nicer in the playlist window.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-04-22 08:17:24 +00:00
parent 486725aad1
commit f4aaf23e06
1 changed files with 36 additions and 7 deletions

View File

@ -11,9 +11,11 @@
#include <stdio.h> #include <stdio.h>
#include <Autolock.h> #include <Autolock.h>
#include <GradientLinear.h>
#include <Message.h> #include <Message.h>
#include <ScrollBar.h> #include <ScrollBar.h>
#include <ScrollView.h> #include <ScrollView.h>
#include <Shape.h>
#include <Window.h> #include <Window.h>
#include "CommandStack.h" #include "CommandStack.h"
@ -126,18 +128,44 @@ PlaylistItem::Draw(BView* owner, BRect frame, const font_height& fh,
BRect r(0, 0, playbackMarkSize, playbackMarkSize); BRect r(0, 0, playbackMarkSize, playbackMarkSize);
r.OffsetTo(frame.left + 4, r.OffsetTo(frame.left + 4,
ceilf((frame.top + frame.bottom) / 2) - 5); ceilf((frame.top + frame.bottom - playbackMarkSize) / 2));
#ifdef __HAIKU__
uint32 flags = owner->Flags();
owner->SetFlags(flags | B_SUBPIXEL_PRECISE);
BShape shape;
shape.MoveTo(r.LeftTop());
shape.LineTo(r.LeftBottom());
shape.LineTo(BPoint(r.right, (r.top + r.bottom) / 2));
shape.Close();
owner->MovePenTo(B_ORIGIN);
owner->FillShape(&shape);
shape.Clear();
r.InsetBy(1, 1);
shape.MoveTo(r.LeftTop());
shape.LineTo(r.LeftBottom());
shape.LineTo(BPoint(r.right, (r.top + r.bottom) / 2));
shape.Close();
BGradientLinear gradient;
gradient.SetStart(r.LeftTop());
gradient.SetEnd(r.LeftBottom());
gradient.AddColor(tint_color(green, B_LIGHTEN_1_TINT), 0);
gradient.AddColor(tint_color(green, B_DARKEN_1_TINT), 255.0);
owner->FillShape(&shape, gradient);
owner->SetFlags(flags);
#else
BPoint arrow[3]; BPoint arrow[3];
arrow[0] = r.LeftTop(); arrow[0] = r.LeftTop();
arrow[1] = r.LeftBottom(); arrow[1] = r.LeftBottom();
arrow[2].x = r.right; arrow[2].x = r.right;
arrow[2].y = (r.top + r.bottom) / 2; arrow[2].y = (r.top + r.bottom) / 2;
#ifdef __HAIKU__
owner->SetPenSize(2);
owner->StrokePolygon(arrow, 3);
owner->SetPenSize(1);
#else
rgb_color lightGreen = tint_color(green, B_LIGHTEN_2_TINT); rgb_color lightGreen = tint_color(green, B_LIGHTEN_2_TINT);
rgb_color darkGreen = tint_color(green, B_DARKEN_2_TINT); rgb_color darkGreen = tint_color(green, B_DARKEN_2_TINT);
owner->BeginLineArray(6); owner->BeginLineArray(6);
@ -163,10 +191,11 @@ PlaylistItem::Draw(BView* owner, BRect frame, const font_height& fh,
arrow[1].x += 1.0; arrow[1].x += 1.0;
arrow[1].y -= 1.0; arrow[1].y -= 1.0;
arrow[2].x -= 2.0; arrow[2].x -= 2.0;
#endif // __HAIKU__
owner->SetLowColor(owner->HighColor()); owner->SetLowColor(owner->HighColor());
owner->SetHighColor(green); owner->SetHighColor(green);
owner->FillPolygon(arrow, 3); owner->FillPolygon(arrow, 3);
#endif // __HAIKU__
} }
} }