2005-06-24 07:31:41 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
*/
|
2003-07-25 19:44:59 +04:00
|
|
|
#ifndef BITMAP_MANAGER_H_
|
|
|
|
#define BITMAP_MANAGER_H_
|
|
|
|
|
|
|
|
#include <GraphicsDefs.h>
|
|
|
|
#include <List.h>
|
|
|
|
#include <OS.h>
|
2005-06-24 03:14:40 +04:00
|
|
|
#include <Rect.h>
|
2005-06-24 07:31:41 +04:00
|
|
|
#include <Locker.h>
|
2005-06-24 03:14:40 +04:00
|
|
|
|
|
|
|
#include "BGet++.h"
|
2003-07-25 19:44:59 +04:00
|
|
|
#include "TokenHandler.h"
|
|
|
|
|
|
|
|
class ServerBitmap;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BitmapManager BitmapManager.h
|
|
|
|
\brief Handler for BBitmap allocation
|
|
|
|
|
|
|
|
Whenever a ServerBitmap associated with a client-side BBitmap needs to be
|
|
|
|
created or destroyed, the BitmapManager needs to handle it. It takes care of
|
|
|
|
all memory management related to them.
|
2005-06-24 03:14:40 +04:00
|
|
|
|
|
|
|
NOTE: The allocator used is not thread-safe, it is currently protected
|
|
|
|
by the BitmapManager lock.
|
2003-07-25 19:44:59 +04:00
|
|
|
*/
|
2005-06-24 03:14:40 +04:00
|
|
|
class BitmapManager {
|
2005-07-11 01:16:43 +04:00
|
|
|
public:
|
|
|
|
BitmapManager();
|
|
|
|
virtual ~BitmapManager();
|
|
|
|
|
|
|
|
ServerBitmap *CreateBitmap( BRect bounds,
|
|
|
|
color_space space,
|
|
|
|
int32 flags,
|
|
|
|
int32 bytesPerRow = -1,
|
|
|
|
screen_id screen = B_MAIN_SCREEN_ID);
|
|
|
|
void DeleteBitmap(ServerBitmap* bitmap);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BList fBitmapList;
|
|
|
|
int8 *fBuffer;
|
|
|
|
TokenHandler fTokenizer;
|
|
|
|
BLocker fLock;
|
|
|
|
AreaPool fMemPool;
|
2003-07-25 19:44:59 +04:00
|
|
|
};
|
|
|
|
|
2005-06-24 07:31:41 +04:00
|
|
|
extern BitmapManager *gBitmapManager;
|
2003-07-25 19:44:59 +04:00
|
|
|
|
2005-06-24 07:31:41 +04:00
|
|
|
#endif /* BITMAP_MANAGER_H_ */
|