{
cOffset = c*3;
offset = cOffset + r*stride;
- *(bufptr) = ptr[offset+2];
+ *(bufptr+cOffset) = ptr[offset+2];
*(bufptr+cOffset+1) = ptr[offset+1];
*(bufptr+cOffset+2) = ptr[offset];
}
{
cOffset = c*4;
offset = cOffset + r*stride;
- *(bufptr) = ptr[offset+3];
+ *(bufptr+cOffset) = ptr[offset+3];
*(bufptr+cOffset+1) = ptr[offset+2];
*(bufptr+cOffset+2) = ptr[offset+1];
*(bufptr+cOffset+3) = ptr[offset];
}
default:
{
- DALI_LOG_WARNING( "Tbm surface has unsupported pixel format.\n" );
-
- pixbuf.resize( 0 );
- width = 0;
- height = 0;
+ DALI_ASSERT_ALWAYS( 0 && "Tbm surface has unsupported pixel format.\n" );
return false;
}
Vector<unsigned char> jpegBuffer;
try
{
- jpegBuffer.Reserve( jpegBufferSize );
+ jpegBuffer.Resize( jpegBufferSize );
}
catch(...)
{
iw = width;
ih = height;
Vector<unsigned char> data;
- data.Reserve(width * height * bpp);
+ data.Resize(width * height * bpp);
unsigned char *dataPtr = data.Begin();
memcpy(dataPtr, buffer, width * height * bpp);
w = ih;
iw = width;
ih = height;
Vector<unsigned char> data;
- data.Reserve(width * height * bpp);
+ data.Resize(width * height * bpp);
unsigned char *dataPtr = data.Begin();
memcpy(dataPtr, buffer, width * height * bpp);
w = ih;
bool EncodeToJpeg( const unsigned char* const pixelBuffer, Vector< unsigned char >& encodedPixels,
const std::size_t width, const std::size_t height, const Pixel::Format pixelFormat, unsigned quality )
{
+
if( !pixelBuffer )
{
DALI_LOG_ERROR("Null input buffer\n");
// save the pixels to a persistent buffer that we own and let our cleaner
// class clean up the buffer as it goes out of scope:
AutoJpgMem cleaner( dstBuffer );
- encodedPixels.Reserve( dstBufferSize );
+ encodedPixels.Resize( dstBufferSize );
memcpy( encodedPixels.Begin(), dstBuffer, dstBufferSize );
}
return true;
if(encoded_img)
{
const Vector<unsigned char>::SizeType bufferSize = encoded_img->Count();
- encoded_img->Reserve( bufferSize + length ); //< Can throw OOM.
+ encoded_img->Resize( bufferSize + length ); //< Can throw OOM.
unsigned char* const bufferBack = encoded_img->Begin() + bufferSize;
memcpy(bufferBack, data, length);
}