fix some little bugs

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18051 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-07-06 20:03:44 +00:00
parent c8bb68e11b
commit fc6956ac0c
3 changed files with 25 additions and 11 deletions

View File

@ -246,7 +246,7 @@ RecorderWindow::InitWindow()
r = background->Bounds(); r = background->Bounds();
r.left = 2; r.left = 2;
r.right = r.left + 39; r.right = r.left + 37;
r.bottom = r.top + 104; r.bottom = r.top + 104;
fVUView = new VUView(r, B_FOLLOW_LEFT|B_FOLLOW_TOP); fVUView = new VUView(r, B_FOLLOW_LEFT|B_FOLLOW_TOP);
background->AddChild(fVUView); background->AddChild(fVUView);

View File

@ -14,9 +14,9 @@
//#define TRACE 1 //#define TRACE 1
#ifdef TRACE #ifdef TRACE
#define TRACE(x) printf(x) #define TRACE(x...) printf(x)
#else #else
#define TRACE(x) #define TRACE(x...)
#endif #endif
ScopeView::ScopeView(BRect rect, uint32 resizeFlags) ScopeView::ScopeView(BRect rect, uint32 resizeFlags)
@ -63,8 +63,13 @@ void
ScopeView::Draw(BRect updateRect) ScopeView::Draw(BRect updateRect)
{ {
BRect bounds = Bounds(); BRect bounds = Bounds();
if (!fIsRendering) SetHighColor(0,0,0);
if (!fIsRendering) {
FillRect(BRect(0,0,2,bounds.bottom));
DrawBitmapAsync(fBitmap, BPoint(2,0)); DrawBitmapAsync(fBitmap, BPoint(2,0));
} else
FillRect(bounds);
float x = 2; float x = 2;
if (fTotalTime !=0) if (fTotalTime !=0)
@ -152,17 +157,20 @@ ScopeView::RenderLoop()
} }
TRACE("finished computing\n"); TRACE("finished computing, rendering\n");
/* rendering */ /* rendering */
RenderBitmap(); RenderBitmap();
TRACE("rendering done\n");
/* ask drawing */ /* ask drawing */
fIsRendering = false; fIsRendering = false;
if (Window()->LockWithTimeout(5000) == B_OK) { if (Window()->LockWithTimeout(5000) == B_OK) {
Invalidate(); Invalidate();
TRACE("invalidate done\n");
Window()->Unlock(); Window()->Unlock();
} }
} }
@ -174,6 +182,7 @@ ScopeView::SetMainTime(bigtime_t timestamp)
{ {
fMainTime = timestamp; fMainTime = timestamp;
Invalidate(); Invalidate();
TRACE("invalidate done\n");
} }
@ -182,6 +191,7 @@ ScopeView::SetTotalTime(bigtime_t timestamp)
{ {
fTotalTime = timestamp; fTotalTime = timestamp;
Invalidate(); Invalidate();
TRACE("invalidate done\n");
} }
void void
@ -190,6 +200,7 @@ ScopeView::SetLeftTime(bigtime_t timestamp)
fLeftTime = timestamp; fLeftTime = timestamp;
RenderBitmap(); RenderBitmap();
Invalidate(); Invalidate();
TRACE("invalidate done\n");
} }
void void
@ -198,6 +209,7 @@ ScopeView::SetRightTime(bigtime_t timestamp)
fRightTime = timestamp; fRightTime = timestamp;
RenderBitmap(); RenderBitmap();
Invalidate(); Invalidate();
TRACE("invalidate done\n");
} }
@ -216,6 +228,7 @@ ScopeView::FrameResized(float width, float height)
InitBitmap(); InitBitmap();
RenderBitmap(); RenderBitmap();
Invalidate(); Invalidate();
TRACE("invalidate done\n");
} }

View File

@ -22,6 +22,7 @@ VUView::VUView(BRect rect, uint32 resizeFlags)
fBitmap(NULL), fBitmap(NULL),
fQuitting(false) fQuitting(false)
{ {
rect.OffsetTo(B_ORIGIN);
fLevelCount = int(rect.Height()) / 2; fLevelCount = int(rect.Height()) / 2;
fChannels = 2; fChannels = 2;
fCurrentLevels = new int32[fChannels]; fCurrentLevels = new int32[fChannels];
@ -142,10 +143,10 @@ VUView::RenderLoop()
fBitmap->Lock(); fBitmap->Lock();
fBitmapView->BeginLineArray(fLevelCount * 2); fBitmapView->BeginLineArray(fLevelCount * 2);
BPoint start1, end1, start2, end2; BPoint start1, end1, start2, end2;
start1.x = 1; start1.x = 3;
start2.x = 20; start2.x = 22;
end1.x = 14; end1.x = 16;
end2.x = 33; end2.x = 35;
start1.y = end1.y = start2.y = end2.y = 2; start1.y = end1.y = start2.y = end2.y = 2;
for (int32 i=fLevelCount-1; i>=0; i--) { for (int32 i=fLevelCount-1; i>=0; i--) {
fBitmapView->AddLine(start1, end1, levels[i][0]); fBitmapView->AddLine(start1, end1, levels[i][0]);