add patch
[framework/osp/uifw.git] / src / graphics / FGrp_Bitmap.cpp
index 7d5e49a..da4b502 100755 (executable)
@@ -605,15 +605,20 @@ _Bitmap::Construct(const byte* pBuffer, int bufSize, const Dimension& dim, Bitma
 }
 
 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;
@@ -621,7 +626,7 @@ _Bitmap::Construct(const void* pExtBuffer, int width, int height, int bitsPerPix
        {
                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;
@@ -1115,7 +1120,15 @@ _Bitmap::__Lock(BufferInfo& info, long timeout)
        {
                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;
@@ -1125,7 +1138,15 @@ _Bitmap::__Lock(BufferInfo& info, long timeout)
        {
                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;