Small cleanup. Use BitmapFlags() also in the other condition (don't
hardcode overlay color space). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28518 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -92,57 +92,60 @@ VideoView::SetBitmap(const BBitmap* bitmap)
|
|||||||
// we're going to deadlock when the window tells the node manager to
|
// we're going to deadlock when the window tells the node manager to
|
||||||
// stop the nodes (Window -> NodeManager -> VideoConsumer -> VideoView
|
// stop the nodes (Window -> NodeManager -> VideoConsumer -> VideoView
|
||||||
// -> Window).
|
// -> Window).
|
||||||
if (bitmap && LockLooperWithTimeout(10000) == B_OK) {
|
if (!bitmap || LockLooperWithTimeout(10000) != B_OK)
|
||||||
if (LockBitmap()) {
|
return;
|
||||||
if (fOverlayMode || (BitmapFlags(bitmap) & B_BITMAP_WILL_OVERLAY)) {
|
|
||||||
if (!fOverlayMode) {
|
|
||||||
// init overlay
|
|
||||||
rgb_color key;
|
|
||||||
status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(),
|
|
||||||
Bounds(), &key, B_FOLLOW_ALL,
|
|
||||||
B_OVERLAY_FILTER_HORIZONTAL
|
|
||||||
| B_OVERLAY_FILTER_VERTICAL);
|
|
||||||
if (ret == B_OK) {
|
|
||||||
fOverlayKeyColor = key;
|
|
||||||
SetViewColor(key);
|
|
||||||
SetLowColor(key);
|
|
||||||
snooze(20000);
|
|
||||||
FillRect(Bounds(), B_SOLID_LOW);
|
|
||||||
Sync();
|
|
||||||
// use overlay from here on
|
|
||||||
fOverlayMode = true;
|
|
||||||
|
|
||||||
// update restrictions
|
if (LockBitmap()) {
|
||||||
overlay_restrictions restrictions;
|
if (fOverlayMode
|
||||||
if (bitmap->GetOverlayRestrictions(&restrictions)
|
|| (BitmapFlags(bitmap) & B_BITMAP_WILL_OVERLAY) != 0) {
|
||||||
== B_OK)
|
if (!fOverlayMode) {
|
||||||
fOverlayRestrictions = restrictions;
|
// init overlay
|
||||||
} else {
|
rgb_color key;
|
||||||
// try again next time
|
status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(),
|
||||||
// synchronous draw
|
Bounds(), &key, B_FOLLOW_ALL,
|
||||||
FillRect(Bounds());
|
B_OVERLAY_FILTER_HORIZONTAL
|
||||||
Sync();
|
| B_OVERLAY_FILTER_VERTICAL);
|
||||||
}
|
if (ret == B_OK) {
|
||||||
|
fOverlayKeyColor = key;
|
||||||
|
SetViewColor(key);
|
||||||
|
SetLowColor(key);
|
||||||
|
snooze(20000);
|
||||||
|
FillRect(Bounds(), B_SOLID_LOW);
|
||||||
|
Sync();
|
||||||
|
// use overlay from here on
|
||||||
|
fOverlayMode = true;
|
||||||
|
|
||||||
|
// update restrictions
|
||||||
|
overlay_restrictions restrictions;
|
||||||
|
if (bitmap->GetOverlayRestrictions(&restrictions)
|
||||||
|
== B_OK)
|
||||||
|
fOverlayRestrictions = restrictions;
|
||||||
} else {
|
} else {
|
||||||
// transfer overlay channel
|
// try again next time
|
||||||
rgb_color key;
|
// synchronous draw
|
||||||
SetViewOverlay(bitmap, bitmap->Bounds(), Bounds(),
|
FillRect(Bounds());
|
||||||
&key, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL
|
Sync();
|
||||||
| B_OVERLAY_FILTER_VERTICAL
|
|
||||||
| B_OVERLAY_TRANSFER_CHANNEL);
|
|
||||||
}
|
}
|
||||||
} else if (fOverlayMode && bitmap->ColorSpace() != B_YCbCr422) {
|
} else {
|
||||||
fOverlayMode = false;
|
// transfer overlay channel
|
||||||
ClearViewOverlay();
|
rgb_color key;
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewOverlay(bitmap, bitmap->Bounds(), Bounds(),
|
||||||
|
&key, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL
|
||||||
|
| B_OVERLAY_FILTER_VERTICAL
|
||||||
|
| B_OVERLAY_TRANSFER_CHANNEL);
|
||||||
}
|
}
|
||||||
if (!fOverlayMode)
|
} else if (fOverlayMode
|
||||||
_DrawBitmap(bitmap);
|
&& (BitmapFlags(bitmap) & B_BITMAP_WILL_OVERLAY) == 0) {
|
||||||
|
fOverlayMode = false;
|
||||||
UnlockBitmap();
|
ClearViewOverlay();
|
||||||
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
}
|
}
|
||||||
UnlockLooper();
|
if (!fOverlayMode)
|
||||||
|
_DrawBitmap(bitmap);
|
||||||
|
|
||||||
|
UnlockBitmap();
|
||||||
}
|
}
|
||||||
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user