if( asset )
{
length = AAsset_getLength( asset );
- memblock.Resize( length + 1 ); // 1 for extra zero at the end
+ memblock.ResizeUninitialized( length + 1 );
+ memblock[length] = 0;// 1 for extra zero at the end
char* buffer = reinterpret_cast<char*>(memblock.Begin());
errorCode = ( AAsset_read( asset, buffer, length ) != length ) ? 0 : 1;
{
fseek( file, 0, SEEK_END );
length = ftell( file );
- //Dali::Vector.Resize would lead to calling PushBack for each byte, waste of CPU resource
memblock.ResizeUninitialized( length + 1 );
//put last byte as 0, in case this is a text file without null-terminator
memblock[length] = 0;
{
fileSize = file->tellg();
- memblock.Resize( fileSize );
+ memblock.ResizeUninitialized( fileSize );
file->seekg (0, std::ios::beg);
file->read( reinterpret_cast<char*>(memblock.Begin()), fileSize );
{
dataSize += chunks[i].data.capacity();
}
- dataBuffer.Resize(dataSize);
+ dataBuffer.ResizeUninitialized(dataSize);
size_t offset = 0;
for( size_t i=0; i<chunks.size() ; ++i )
NULL, // Pclist_y. Optional pointers to contributor lists from another instance of a Resampler.
FILTER_SCALE, // src_x_ofs,
FILTER_SCALE ); // src_y_ofs. Offset input image by specified amount (fractional values okay).
- samples[0].Resize( srcWidth );
+ samples[0].ResizeUninitialized( srcWidth );
for( int i = 1; i < numChannels; ++i )
{
resamplers[i] = new Resampler( srcWidth,
resamplers[0]->get_clist_y(),
FILTER_SCALE,
FILTER_SCALE );
- samples[i].Resize( srcWidth );
+ samples[i].ResizeUninitialized( srcWidth );
}
const int srcPitch = srcWidth * numChannels;
{
return false;
}
- map.Resize(fsize);
+ map.ResizeUninitialized(fsize);
if(fread(&map[0], 1, fsize, fp) != fsize)
{
Dali::Vector<unsigned int> surface;
Dali::Vector<unsigned char> maskbuf;
Dali::Vector<unsigned char> pixbuf;
- pal.Resize(256 * 4);
+ pal.ResizeUninitialized(256 * 4);
unsigned int dword;
unsigned short word;
}
// Set up the surface as soon as we have the width and height, so we have a black image if there are any further errors.
- surface.Resize( w * h * 4 );
+ surface.ResizeUninitialized( w * h * 4 );
memset( &surface[0], 0, w * h * 4 );
if (!read_ushort(&map[0], fsize, &position, &word))
unsigned int bitStride = ( ( w + 31 ) / 32 ) * 4;
// Pixbuf only ever contains one scanline worth of data.
- pixbuf.Resize( stride );
- maskbuf.Resize( bitStride * h );
+ pixbuf.ResizeUninitialized( stride );
+ maskbuf.ResizeUninitialized( bitStride * h );
// Handle different bits-per-pixel.
if(!HandleBitsPerPixel(bitcount, map, pix, surface, w, h, fsize, position, pixbuf, stride, pal))
{
using PixelT = PixelType<N>;
Vector<PixelT> data;
- data.Resize( width * height );
+ data.ResizeUninitialized( width * height );
auto dataPtr = data.Begin();
auto original = reinterpret_cast<PixelT*>(buffer);
{
using PixelT = PixelType<N>;
Vector<PixelT> data;
- data.Resize(width * height);
+ data.ResizeUninitialized(width * height);
auto dataPtr = data.Begin();
auto original = reinterpret_cast<PixelT*>(buffer);
{
using PixelT = PixelType<N>;
Vector<PixelT> data;
- data.Resize(width * height);
+ data.ResizeUninitialized(width * height);
auto dataPtr = data.Begin();
auto original = reinterpret_cast<PixelT*>(buffer);
{
using PixelT = PixelType<N>;
Vector<PixelT> data;
- data.Resize(width * height);
+ data.ResizeUninitialized(width * height);
auto dataPtr = data.Begin();
auto original = reinterpret_cast<PixelT*>(buffer);
Vector<unsigned char> jpegBuffer;
try
{
- jpegBuffer.Resize( jpegBufferSize );
+ jpegBuffer.ResizeUninitialized( jpegBufferSize );
}
catch(...)
{
return false;
}
- encodedPixels.Resize( dstBufferSize );
+ encodedPixels.ResizeUninitialized( dstBufferSize );
memcpy( encodedPixels.Begin(), dstBuffer.get(), dstBufferSize );
}
return true;
if(encoded_img)
{
const Vector<unsigned char>::SizeType bufferSize = encoded_img->Count();
- encoded_img->Resize( bufferSize + length ); //< Can throw OOM.
+ encoded_img->ResizeUninitialized( bufferSize + length ); //< Can throw OOM.
unsigned char* const bufferBack = encoded_img->Begin() + bufferSize;
memcpy(bufferBack, data, length);
}
DALI_LOG_ERROR("Error: WBMP size is too large!\n");
return false;
}
- map.Resize(fsize);
+ map.ResizeUninitialized(fsize);
if(fread(&map[0], 1, fsize, fp) != fsize)
{
return false;
}
- surface.Resize(w* h );//(w * h * 4);
+ surface.ResizeUninitialized(w* h );//(w * h * 4);
memset(&surface[0], 0, w * h ); // w * h * 4
line_length = (w + 7) >> 3;
unsigned int headerSize = 1 + 1 + 4 + 4;// 8 + 8 + 32 + 32;
headerSize = std::min(headerSize, fsize);
- map.Resize(headerSize);
+ map.ResizeUninitialized(headerSize);
if(fread(&map[0], 1, headerSize, fp) != headerSize)
{
DALI_LOG_WARNING("image file read opeation error!\n");