From 46daa6672edb1e1566d9fc1cae6bb772ed8c00b0 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Tue, 16 May 2006 19:00:25 +0000 Subject: [PATCH] Made copying into overlay save, by locking the bits. This could be further optimized, by always hloding the lock, and only unlocking when app-server requests it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17481 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../media/media-add-ons/videowindow/VideoNode.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/media-add-ons/videowindow/VideoNode.cpp b/src/add-ons/media/media-add-ons/videowindow/VideoNode.cpp index f380cccc54..e04876b507 100644 --- a/src/add-ons/media/media-add-ons/videowindow/VideoNode.cpp +++ b/src/add-ons/media/media-add-ons/videowindow/VideoNode.cpp @@ -299,7 +299,14 @@ VideoNode::HandleBuffer(BBuffer *buffer) LockBitmap(); if (fBitmap) { // bigtime_t start = system_time(); - memcpy(fBitmap->Bits(), buffer->Data(), fBitmap->BitsLength()); + if (fOverlayActive) { + if (B_OK == fBitmap->LockBits()) { + memcpy(fBitmap->Bits(), buffer->Data(), fBitmap->BitsLength()); + fBitmap->UnlockBits(); + } + } else { + memcpy(fBitmap->Bits(), buffer->Data(), fBitmap->BitsLength()); + } // printf("overlay copy: %Ld usec\n", system_time() - start); } UnlockBitmap();