namespace Tizen { namespace Media
{
-#define ISSUPPORTED(x) \
- ((x == MEDIA_PIXEL_FORMAT_YUV420P) || (x == MEDIA_PIXEL_FORMAT_BGRA8888) || \
- (x == MEDIA_PIXEL_FORMAT_RGB565LE) || (x == MEDIA_PIXEL_FORMAT_GRAY))
-
typedef struct {
ImageRotationType rotateType;
ImageFlipType flipType;
{
MEDIA_PIXEL_FORMAT_RGB565LE,
MEDIA_PIXEL_FORMAT_BGRA8888,
- MEDIA_PIXEL_FORMAT_YUV420P
+ MEDIA_PIXEL_FORMAT_YUV420P,
+ MEDIA_PIXEL_FORMAT_NV12,
+ MEDIA_PIXEL_FORMAT_NV21,
+ MEDIA_PIXEL_FORMAT_GRAY
};
_ImageBufferImpl::_ImageBufferImpl(void)
SysTryReturn(NID_MEDIA, (width > 0) && (height > 0), E_INVALID_ARG, E_INVALID_ARG,
"[E_INVALID_ARG] Dimensions should be greater than zero : (%d x %d).", width, height);
- SysTryReturn(NID_MEDIA, ISSUPPORTED(pixelFormat) == true, E_INVALID_ARG, E_INVALID_ARG,
- "[E_INVALID_ARG] Pixelformat is not supported : %d.", pixelFormat);
-
reqBufferSize = _ImageUtil::GetBufferSize(pixelFormat, width, height);
SysTryReturn(NID_MEDIA, reqBufferSize > 0, GetLastResult(), GetLastResult(),
"[%s] Could not get output buffer size.", GetErrorMessage(GetLastResult()));
SysTryReturn(NID_MEDIA, pMaskingColor != null, pOutBitmap.release(), E_SUCCESS,
"[%s] Could not apply masking color.", GetErrorMessage(r));
r = pOutBitmap->SetMaskingColor(pMaskingColor);
+ delete pMaskingColor;
SysTryReturn(NID_MEDIA, r == E_SUCCESS, pOutBitmap.release(), E_SUCCESS,
"[%s] Could not set masking color.", GetErrorMessage(r));
- delete pMaskingColor;
}
SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagated.",
SysTryReturn(NID_MEDIA, pMaskingColor != null, pOutBitmap.release(), E_SUCCESS,
"[%s] Could not apply masking color.", GetErrorMessage(r));
r = pOutBitmap->SetMaskingColor(pMaskingColor);
+ delete pMaskingColor;
SysTryReturn(NID_MEDIA, r == E_SUCCESS, pOutBitmap.release(), E_SUCCESS,
"[%s] Could not set masking color.", GetErrorMessage(r));
- delete pMaskingColor;
}
SysTryReturn(NID_MEDIA, pOutBitmap.get() != null, null, GetLastResult(), "[%s] Propagated.", GetErrorMessage(GetLastResult()));
SysTryReturn(NID_MEDIA, !__isLocked, null, E_INVALID_STATE,
"[E_INVALID_STATE] Instance is locked. Unlock to use.");
- SysTryReturn(NID_MEDIA, (inPixelFormat > MEDIA_PIXEL_FORMAT_NONE) && (inPixelFormat <= MEDIA_PIXEL_FORMAT_YUYV422),
- null, E_INVALID_ARG, "[E_INVALID_ARG] Pixel format is invalid.", inPixelFormat);
-
SysTryReturn(NID_MEDIA, IsSupportedPixelFormat(inPixelFormat) == true , null, E_UNSUPPORTED_FORMAT,
"[E_UNSUPPORTED_FORMAT] The specified pixelFormat is not supported.")
MediaPixelFormat pixFmt = MEDIA_PIXEL_FORMAT_NONE;
_ImageBufferImpl* pConvertedImpl = null;
- SysTryReturn(NID_MEDIA, ISSUPPORTED(pixelFormat) == true, pImgBuffer.get(), E_INVALID_ARG,
- "[E_INVALID_ARG] Pixel format %d is not supported.", pixelFormat);
+ SysTryReturn(NID_MEDIA, IsSupportedPixelFormat(pixelFormat) == true , null, E_UNSUPPORTED_FORMAT,
+ "[E_UNSUPPORTED_FORMAT] The specified pixelFormat is not supported.")
+
+ SysTryReturn(NID_MEDIA, _ImageUtil::IsValidDimension(pixelFormat, __width, __height) == true, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] Dimensions should be even for this pixel format: (%d x %d)", __width, __height);
if (pixelFormat != __pixelFormat)
{
"[%s] Failed to GetInstance.", GetErrorMessage(r));
pConvertedImpl->__maskColor = __maskColor;
pConvertedImpl->__transparent = __transparent;
+
}
else
{
MediaPixelFormat pixFmt = MEDIA_PIXEL_FORMAT_NONE;
_ImageBufferImpl* pResizedImpl = null;
- SysTryReturn(NID_MEDIA, (width > 0) && (height > 0), pImgBuffer.get(), E_INVALID_ARG,
+ SysTryReturn(NID_MEDIA, (width > 0) && (height > 0), null, E_INVALID_ARG,
"[E_INVALID_ARG] Dimensions should be greater than zero: (%d x %d)", width, height);
+ SysTryReturn(NID_MEDIA, _ImageUtil::IsValidDimension(__pixelFormat, width, height) == true, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] Dimensions should be even for this pixel format: (%d x %d)", width, height);
+
if ((width != __width) && (height != __height))
{
dstLength = _ImageUtil::GetBufferSize(__pixelFormat, width, height);
SysTryCatch(NID_MEDIA, pImgBuffer.get() != null, , E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] Could not create new instance.")
- r = pImgBuffer->Construct(width, height, __pixelFormat, pDataResized.get(), dstLength);
+ r = pImgBuffer->Construct(width, height, __pixelFormat, pDataResized.release(), dstLength);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r,
"[%s] Failed to construct the resized ImageBuffer.", GetErrorMessage(r));