From 8b41c21369ab2de688d6369fafc532a52de0d9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 3 Mar 2006 20:24:13 +0000 Subject: [PATCH] * B_BITMAP_WILL_OVERLAY bitmaps are currently not supported. (makes VLC run without changes) * B_BITMAP_CLEAR_TO_WHITE causes the server to clear the bitmap to white... :-) * removed weird comment git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16578 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/BitmapManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/servers/app/BitmapManager.cpp b/src/servers/app/BitmapManager.cpp index b853dcc032..ae1f8e3aa5 100644 --- a/src/servers/app/BitmapManager.cpp +++ b/src/servers/app/BitmapManager.cpp @@ -20,6 +20,7 @@ #include #include +#include #include "BitmapManager.h" #include "ServerBitmap.h" @@ -77,12 +78,14 @@ BitmapManager::CreateBitmap(BRect bounds, color_space space, int32 flags, if (!locker.IsLocked()) return NULL; +// TODO: create an overlay bitmap if graphics card supports it +if (flags & B_BITMAP_WILL_OVERLAY) + return NULL; + ServerBitmap* bitmap = new(nothrow) ServerBitmap(bounds, space, flags, bytesPerRow); if (bitmap == NULL) return NULL; - // Server version of this code will also need to handle such things as - // bitmaps which accept child views by checking the flags. uint8* buffer = (uint8*)fMemPool.GetBuffer(bitmap->BitsLength()); if (buffer && fBitmapList.AddItem(bitmap)) { @@ -95,6 +98,11 @@ BitmapManager::CreateBitmap(BRect bounds, color_space space, int32 flags, area_info info; get_area_info(bitmap->fArea, &info); bitmap->fOffset = buffer - (uint8*)info.address; + + if (flags & B_BITMAP_CLEAR_TO_WHITE) { + // should work for most colorspaces + memset(bitmap->Bits(), 255, bitmap->BitsLength()); + } } else { // Allocation failed for buffer or bitmap list fMemPool.ReleaseBuffer(buffer);