}
result
-_Bitmap::Construct(const void* pExtBuffer, int width, int height, int bitsPerPixel)
+_Bitmap::Construct(const void* pExtBuffer, int width, int height, int bitsPerPixel, int pixelsPerLine)
{
+ if (pixelsPerLine == 0)
+ {
+ pixelsPerLine = width;
+ }
+
switch (bitsPerPixel)
{
case 16:
{
typedef unsigned short Pixel;
- __pScratchPad16 = new (std::nothrow) _Util::ScratchPad<Pixel>((Pixel*) pExtBuffer, width, height, width);
+ __pScratchPad16 = new (std::nothrow) _Util::ScratchPad<Pixel>((Pixel*) pExtBuffer, width, height, pixelsPerLine);
__pBuffer = (unsigned char*) pExtBuffer;
}
break;
{
typedef unsigned long Pixel;
- __pScratchPad32 = new (std::nothrow) _Util::ScratchPad<Pixel>((Pixel*) pExtBuffer, width, height, width);
+ __pScratchPad32 = new (std::nothrow) _Util::ScratchPad<Pixel>((Pixel*) pExtBuffer, width, height, pixelsPerLine);
__pBuffer = (unsigned char*) pExtBuffer;
}
break;
{
info.width = __pScratchPad16->GetWidth();
info.height = __pScratchPad16->GetHeight();
- info.pitch = __pScratchPad16->GetWidth() * 2;
+
+ {
+ unsigned short* pBuffer;
+ int pitch;
+
+ __pScratchPad16->GetBuffer(pBuffer, pitch);
+ info.pitch = pitch * 2;
+ }
+
info.bitsPerPixel = 16;
info.pixelFormat = PIXEL_FORMAT_RGB565;
info.pPixels = (void*) this->__pBuffer;
{
info.width = __pScratchPad32->GetWidth();
info.height = __pScratchPad32->GetHeight();
- info.pitch = __pScratchPad32->GetWidth() * 4;
+
+ {
+ unsigned long* pBuffer;
+ int pitch;
+
+ __pScratchPad32->GetBuffer(pBuffer, pitch);
+ info.pitch = pitch * 4;
+ }
+
info.bitsPerPixel = 32;
info.pixelFormat = PIXEL_FORMAT_ARGB8888;
info.pPixels = (void*) this->__pBuffer;