#include <FBaseSysLog.h>
#include <FGrpBitmap.h>
#include <FGrpDimension.h>
+#include <FUiCtrlFrame.h>
#include <FWebBookmarkItem.h>
#include "FWeb_BookmarkItemImpl.h"
#include "FWebCtrl_Utility.h"
using namespace Tizen::Base;
using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
using namespace Tizen::Web::Controls;
_BookmarkItemImpl::GetFaviconN(void) const
{
result r = E_SUCCESS;
-
- Evas* pEvas = _Utility::GetEvasFromUiApp();
- SysTryReturn(NID_WEB, pEvas, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
+ Frame* pFrame = null;
+ Evas* pEvas = null;
Evas_Object* pIcon = null;
- int ret = favorites_bookmark_get_favicon(__id, pEvas, &pIcon);
- SysTryReturn(NID_WEB, ret == FAVORITES_ERROR_NONE, null, E_SYSTEM, "[E_SYSTEM] Propagating.");
BufferInfo bufferInfo;
+ ByteBuffer byteBuffer;
+
+ std::unique_ptr<Bitmap> pImage;
+ Dimension dimension;
+ int ret = 0;
+
+ pEvas = _Utility::GetEvasFromUiApp(pFrame);
+ SysTryCatch(NID_WEB, pEvas, , E_SYSTEM, "[E_SYSTEM] Propagating.");
+
+ ret = favorites_bookmark_get_favicon(__id, pEvas, &pIcon);
+ SysTryCatch(NID_WEB, ret == FAVORITES_ERROR_NONE, , E_SYSTEM, "[E_SYSTEM] Propagating.");
+
+ if (!pIcon)
+ {
+ return null;
+ }
+
r = _Utility::GetPixelBufferFromEvasObject(pIcon, bufferInfo);
- SysTryReturn(NID_WEB, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- const Dimension dimension(bufferInfo.width, bufferInfo.height);
+ dimension.width = bufferInfo.width;
+ dimension.height = bufferInfo.height;
- ByteBuffer byteBuffer;
r = byteBuffer.Construct(reinterpret_cast < byte* >(bufferInfo.pPixels), 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
- SysTryReturn(NID_WEB, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
- SysTryReturn(NID_WEB, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pImage = std::unique_ptr<Bitmap>(new (std::nothrow) Bitmap());
+ SysTryCatch(NID_WEB, pImage.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
- SysTryReturn(NID_WEB, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryCatch(NID_WEB, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ delete pFrame;
return pImage.release();
+
+CATCH:
+ delete pFrame;
+
+ return null;
}