Fix for canvas issue
authorHyun Lee <hyunn.lee@samsung.com>
Tue, 23 Apr 2013 08:08:29 +0000 (17:08 +0900)
committerHyun Lee <hyunn.lee@samsung.com>
Tue, 23 Apr 2013 08:08:29 +0000 (17:08 +0900)
Change-Id: I7f0f39a6592e3d561864a626d87910ff017ac6d1
Signed-off-by: Hyun Lee <hyunn.lee@samsung.com>
src/controls/FWebCtrl_Web.cpp

index c5f7f8c..8c34951 100755 (executable)
@@ -629,17 +629,24 @@ _Web::OnCanvasRequestedFN(const FloatRectangle& bounds)
        EINA_RECTANGLE_SET(&rect, absPoint.x, absPoint.y, absSize.width, absSize.height);
 
        Evas_Object* pScreenShot = ewk_view_screenshot_contents_get(pWebFrame, rect, 1.0f, evas_object_evas_get(pWebFrame));
-       SysTryReturn(NID_WEB_CTRL, pScreenShot, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get snapshot of Web control", GetErrorMessage(E_SYSTEM));
-
-       r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
-       evas_object_del(pScreenShot);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
 
        std::unique_ptr<Canvas> pCanvas(new (std::nothrow) Canvas());
        SysTryReturn(NID_WEB_CTRL, pCanvas.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       r = pCanvas->Construct(bufferInfo);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+       if (pScreenShot)
+       {
+               r = _Utility::GetPixelBufferFromEvasObject(pScreenShot, bufferInfo);
+               evas_object_del(pScreenShot);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+
+               r = pCanvas->Construct(bufferInfo);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+       }
+       else
+       {
+               r = pCanvas->Construct(bounds);
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] propagating", GetErrorMessage(r));
+       }
 
        return pCanvas.release();
 }