clean surface when creating and fix bugs
authorSukwon Suh <sukwon.suh@samsung.com>
Fri, 22 Mar 2013 09:42:01 +0000 (18:42 +0900)
committerSukwon Suh <sukwon.suh@samsung.com>
Fri, 22 Mar 2013 09:42:01 +0000 (18:42 +0900)
Change-Id: I4a3c9bbb49725b6f8f5a236b26e02a68fd0b6892
Signed-off-by: Sukwon Suh <sukwon.suh@samsung.com>
src/graphics/opengl/FGrpEgl.cpp

index e2b3378..f449196 100644 (file)
@@ -1208,11 +1208,6 @@ _SglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType wi
                sglIndex = (_SglIndex)_SglCreatePixmapSurface(dpy, config, (EGLNativePixmapType)bitmap.get(), null);
                SysTryReturn(NID_GRP, sglIndex > INVALID_SGL_INDEX, EGL_NO_SURFACE, E_OPERATION_FAILED, "Propagating.");
 
                sglIndex = (_SglIndex)_SglCreatePixmapSurface(dpy, config, (EGLNativePixmapType)bitmap.get(), null);
                SysTryReturn(NID_GRP, sglIndex > INVALID_SGL_INDEX, EGL_NO_SURFACE, E_OPERATION_FAILED, "Propagating.");
 
-               BufferInfo bufferInfo;
-               bitmap.get()->Lock(bufferInfo);
-               memset(bufferInfo.pPixels, 0, bufferInfo.pitch * bufferInfo.height);
-               bitmap.get()->Unlock();
-
                _SglInfo* pSglInfo = pSglInfoTableManipulatorInstance->LockSglInfoTable(sglIndex);
                pSglInfo->sglIndex = sglIndex;
                pSglInfo->display = dpy;
                _SglInfo* pSglInfo = pSglInfoTableManipulatorInstance->LockSglInfoTable(sglIndex);
                pSglInfo->sglIndex = sglIndex;
                pSglInfo->display = dpy;
@@ -1249,10 +1244,6 @@ _SglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType wi
                        sglIndex = (_SglIndex)_SglCreatePixmapSurface(dpy, config, (EGLNativePixmapType)bitmapSecond.get(), null);
                        SysTryReturn(NID_GRP, sglIndex > INVALID_SGL_INDEX, EGL_NO_SURFACE, E_OPERATION_FAILED, "Propagating.");
 
                        sglIndex = (_SglIndex)_SglCreatePixmapSurface(dpy, config, (EGLNativePixmapType)bitmapSecond.get(), null);
                        SysTryReturn(NID_GRP, sglIndex > INVALID_SGL_INDEX, EGL_NO_SURFACE, E_OPERATION_FAILED, "Propagating.");
 
-                       bitmapSecond.get()->Lock(bufferInfo);
-                       memset(bufferInfo.pPixels, 0, bufferInfo.pitch * bufferInfo.height);
-                       bitmapSecond.get()->Unlock();
-
                        _SglInfo* pSglInfoSecond = pSglInfoTableManipulatorInstance->LockSglInfoTable(sglIndex);
                        pSglInfoSecond->sglIndex = sglIndex;
                        pSglInfoSecond->display = dpy;
                        _SglInfo* pSglInfoSecond = pSglInfoTableManipulatorInstance->LockSglInfoTable(sglIndex);
                        pSglInfoSecond->sglIndex = sglIndex;
                        pSglInfoSecond->display = dpy;
@@ -1498,6 +1489,10 @@ _CreateNativePixmap(_SglIndex sglIndex, Tizen::Graphics::Bitmap* pBitmap)
 #endif //#if defined(FGRAPHICS_INTERNAL_USE_EGLCOPYBUFFER)
 #endif //#if defined(FGRAPHICS_INTERNAL_USE_DRM)
 
 #endif //#if defined(FGRAPHICS_INTERNAL_USE_EGLCOPYBUFFER)
 #endif //#if defined(FGRAPHICS_INTERNAL_USE_DRM)
 
+       pBitmap->Lock(bufferInfo);
+       memset(bufferInfo.pPixels, 0, bufferInfo.pitch * bufferInfo.height);
+       pBitmap->Unlock();
+
        return (EGLNativePixmapType)pPixmapInfo->nativePixmap;
 
 CATCH_06:
        return (EGLNativePixmapType)pPixmapInfo->nativePixmap;
 
 CATCH_06:
@@ -1641,8 +1636,8 @@ _CreateNativePixmapEx(Tizen::Graphics::Bitmap* pBitmap, Tizen::Graphics::BufferI
 
        bufferInfo.bitsPerPixel = 32;
        bufferInfo.pixelFormat = PIXEL_FORMAT_ARGB8888;
 
        bufferInfo.bitsPerPixel = 32;
        bufferInfo.pixelFormat = PIXEL_FORMAT_ARGB8888;
-       bufferInfo.pitch = bufferInfo.width * bufferInfo.bitsPerPixel / 4;
-       memset(bufferInfo.pPixels, 0, bufferInfo.width * bufferInfo.height * 4);
+       bufferInfo.pitch = bufferInfo.width * bufferInfo.bitsPerPixel / 8;
+       memset(bufferInfo.pPixels, 0, bufferInfo.pitch * bufferInfo.height);
        r = pBitmapImpl->Construct(bufferInfo);
        if (r != E_SUCCESS)
        {
        r = pBitmapImpl->Construct(bufferInfo);
        if (r != E_SUCCESS)
        {