pListT->Add(CONTENT_TYPE_IMAGE);
pListT->Add(CONTENT_TYPE_VIDEO);
- directory.Construct(*pListT);
+ result r = directory.Construct(*pListT);
delete pListT;
+ if (r != E_SUCCESS)
+ {
+ AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
+ delete pContentIdList;
+ return null;
+ }
+
IList* pContentDirectoryPathList = directory.GetContentDirectoryPathListN(SORT_ORDER_ASCENDING);
String* pDirPath = null;
if ((pContentDirectoryPathList != null) && (pContentDirectoryPathList->GetCount() > 0))
FileListPresentationModel::RotateImage(int index, RotateMode rotateMode)
{
result r = E_SUCCESS;
+ ImageBuffer rotateBuffer;
ImageBuffer* pRotatedBuffer = null;
- ImageBuffer* pRotatedBuffer1 = null;
ImageFormat imageFormat;
- int width = 0;
- int height = 0;
- pRotatedBuffer = new (std::nothrow) ImageBuffer();
-
+ Image img;
String filePath = GetContentFilePath(index);
- r = pRotatedBuffer->Construct(filePath);
- ImageBuffer::GetImageInfo(filePath, imageFormat, width, height);
+ r = img.Construct();
+
if (r == E_SUCCESS)
{
+ imageFormat = img.GetImageFormat(filePath);
+ }
+
+ r = rotateBuffer.Construct(filePath);
+ if (r == E_SUCCESS)
+ {
if (rotateMode == ROTATE_MODE_RIGHT)
{
- pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_90);
+ pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
}
else
{
- pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_270);
+ pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
}
}
- TryCatch(pRotatedBuffer1 != null, r = GetLastResult(), "RotateN failed:%s", GetErrorMessage(GetLastResult()));
- pRotatedBuffer1->EncodeToFile(filePath, imageFormat, true, 100);
- ContentManager::ScanFile(filePath);
- delete pRotatedBuffer1;
- delete pRotatedBuffer;
- return r;
- CATCH:
- if (pRotatedBuffer != null) //this buffer is no longer used
+ if (pRotatedBuffer != null)
{
+ r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
delete pRotatedBuffer;
}
- if (pRotatedBuffer1 != null) //this buffer is no longer used
- {
- delete pRotatedBuffer1;
- }
+
+ ContentManager::ScanFile(filePath);
return r;
}
}
}
pBitmap->Scale(DIMENSION_DEFAULT_THUMBNAIL);
- }
- else
- {
- delete pContentInfo;
- AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
- return null;
- }
+ ContentType contentType = pContentInfo->GetContentType();
- ContentType contentType = pContentInfo->GetContentType();
- if (contentType == CONTENT_TYPE_VIDEO)
- {
- VideoContentInfo* pVideoContentInfo = static_cast<VideoContentInfo*>(pContentInfo);
- duration = pVideoContentInfo->GetDuration();
+ if (contentType == CONTENT_TYPE_VIDEO)
+ {
+ VideoContentInfo* pVideoContentInfo = static_cast<VideoContentInfo*>(pContentInfo);
+ duration = pVideoContentInfo->GetDuration();
+ }
+
+ pNewThumbnailInfo = new (std::nothrow) ThumbnailInfo();
+ pNewThumbnailInfo->Construct(contentId, pContentInfo->GetContentPath(), *pBitmap, contentType, duration);
+ delete pBitmap;
}
- pNewThumbnailInfo = new (std::nothrow) ThumbnailInfo();
- pNewThumbnailInfo->Construct(contentId, pContentInfo->GetContentPath(), *pBitmap, contentType, duration);
- delete pBitmap;
}
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));