1// BitmapBuffer.h 2 3#include "ServerBitmap.h" 4 5#include "BitmapBuffer.h" 6 7// TODO: It should be more or less guaranteed that this object 8// is not used if InitCheck() returns an error, so the checks 9// in all thos functions should probably be removed... 10 11// constructor 12BitmapBuffer::BitmapBuffer(ServerBitmap* bitmap) 13 : fBitmap(bitmap) 14{ 15} 16 17// destructor 18BitmapBuffer::~BitmapBuffer() 19{ 20 // We don't own the ServerBitmap 21} 22 23// InitCheck 24status_t 25BitmapBuffer::InitCheck() const 26{ 27 status_t ret = B_NO_INIT; 28 if (fBitmap) 29 ret = fBitmap->IsValid() ? B_OK : B_ERROR; 30 return ret; 31} 32 33// ColorSpace 34color_space 35BitmapBuffer::ColorSpace() const 36{ 37 if (InitCheck() >= B_OK) 38 return fBitmap->ColorSpace(); 39 return B_NO_COLOR_SPACE; 40} 41 42// Bits 43void* 44BitmapBuffer::Bits() const 45{ 46 if (InitCheck() >= B_OK) 47 return fBitmap->Bits(); 48 return NULL; 49} 50 51// BytesPerRow 52uint32 53BitmapBuffer::BytesPerRow() const 54{ 55 if (InitCheck() >= B_OK) 56 return fBitmap->BytesPerRow(); 57 return 0; 58} 59 60// Width 61uint32 62BitmapBuffer::Width() const 63{ 64 if (InitCheck() >= B_OK) 65 return fBitmap->Width(); 66 return 0; 67} 68 69// Height 70uint32 71BitmapBuffer::Height() const 72{ 73 if (InitCheck() >= B_OK) 74 return fBitmap->Height(); 75 return 0; 76} 77 78