BitmapManager class¶
The BitmapManager object handles all ServerBitmap allocation and deallocation. The rest of the server uses CreateBitmap and DeleteBitmap instead of new and delete.
Member Functions¶
BitmapManager(void)¶
Create the bitmap list
Create the bitmap area
Allocate the access semaphore
Call set_buffer_area_management
Set up the buffer pool via bpool
~BitmapManager(void)¶
Iterate over each item in the bitmap list, removing each item, calling brel() on its buffer, and deleting it.
Delete the bitmap list
Delete the bitmap area
Free the access semaphore
ServerBitmap *CreateBitmap(BRect bounds, color_space space, int32 flags, int32 bytes_per_row=-1, screen_id screen=B_MAIN_SCREEN_ID)¶
CreateBitmap is called by outside objects to allocate a ServerBitmap object. If a problem occurs, it returns NULL.
Acquire the access semaphore
Verify parameters and if any are invalid, spew an error to stderr and return NULL
Allocate a new ServerBitmap
Allocate a buffer for the bitmap with the bitmap’s theoretical buffer length
If NULL, delete the bitmap and return NULL
Set the bitmap’s area and buffer to the appropriate values (area_for buffer and buffer)
Add the bitmap to the bitmap list
Release the access semaphore
Return the bitmap
void DeleteBitmap(ServerBitmap *bitmap)¶
Frees a ServerBitmap allocated by CreateBitmap()
Acquire the access semaphore
Find the bitmap in the list
Remove the bitmap from the list or release the semaphore and return if not found
call brel() on the bitmap’s buffer if it is non-NULL
delete the bitmap
Release the access semaphore