5 #include "MallocBuffer.h"
7 // TODO: maybe this class could be more flexible by taking
8 // a color_space argument in the constructor
9 // the hardcoded width * 4 (because that's how it's used now anyways)
10 // could be avoided, but I'm in a hurry... :-)
13 MallocBuffer::MallocBuffer(uint32 width
,
19 if (fWidth
> 0 && fHeight
> 0) {
20 fBuffer
= malloc((fWidth
* 4) * fHeight
);
25 MallocBuffer::~MallocBuffer()
33 MallocBuffer::InitCheck() const
35 return fBuffer
? B_OK
: B_NO_MEMORY
;
40 MallocBuffer::ColorSpace() const
47 MallocBuffer::Bits() const
49 if (InitCheck() >= B_OK
)
56 MallocBuffer::BytesPerRow() const
58 if (InitCheck() >= B_OK
)
65 MallocBuffer::Width() const
67 if (InitCheck() >= B_OK
)
74 MallocBuffer::Height() const
76 if (InitCheck() >= B_OK
)