xref: /haiku/docs/develop/servers/app_server/BitmapManager.rst (revision 3d4afef9cba2f328e238089d4609d00d4b1524f3)
1BitmapManager class
2###################
3
4The BitmapManager object handles all ServerBitmap allocation and
5deallocation. The rest of the server uses CreateBitmap and DeleteBitmap
6instead of new and delete.
7
8Member Functions
9================
10
11BitmapManager(void)
12-------------------
13
141. Create the bitmap list
152. Create the bitmap area
163. Allocate the access semaphore
174. Call set_buffer_area_management
185. Set up the buffer pool via bpool
19
20~BitmapManager(void)
21--------------------
22
231. Iterate over each item in the bitmap list, removing each item,
24   calling brel() on its buffer, and deleting it.
252. Delete the bitmap list
263. Delete the bitmap area
274. Free the access semaphore
28
29ServerBitmap \*CreateBitmap(BRect bounds, color_space space, int32 flags, int32 bytes_per_row=-1, screen_id screen=B_MAIN_SCREEN_ID)
30------------------------------------------------------------------------------------------------------------------------------------
31
32CreateBitmap is called by outside objects to allocate a ServerBitmap
33object. If a problem occurs, it returns NULL.
34
351. Acquire the access semaphore
362. Verify parameters and if any are invalid, spew an error to stderr and
37   return NULL
383. Allocate a new ServerBitmap
394. Allocate a buffer for the bitmap with the bitmap's
40   theoretical buffer length
415. If NULL, delete the bitmap and return NULL
426. Set the bitmap's area and buffer to the appropriate values (area_for
43   buffer and buffer)
447. Add the bitmap to the bitmap list
458. Release the access semaphore
469. Return the bitmap
47
48void DeleteBitmap(ServerBitmap \*bitmap)
49----------------------------------------
50
51Frees a ServerBitmap allocated by CreateBitmap()
52
531. Acquire the access semaphore
542. Find the bitmap in the list
553. Remove the bitmap from the list or release the semaphore and return
56   if not found
574. call brel() on the bitmap's buffer if it is non-NULL
585. delete the bitmap
596. Release the access semaphore
60
61