we are using external bitmap image and it is running from last two days.But due to some memory issue it fails .
it fails for the below statement
/* Create an Embedded Wizard bitmap to store the image pixel data */
bitmap = EwCreateBitmap(EW_PIXEL_FORMAT_NATIVE, frameSize, 0, 1);
/* Enough memory to create the bitmap? */
if (bitmap == NULL)
{
EwFreeBitmap(bitmap); /* Added the statement to resolve the error 320 */
printf("bitmap failed\n\r");
return NULL;
}
/* Could create the image */
if (bitmap)
{
lockArea.Point1.X = 0;
lockArea.Point1.Y = 0;
lockArea.Point2.X = frameSize.X;
lockArea.Point2.Y = frameSize.Y;
lock = EwLockBitmap(bitmap, 0, lockArea, 0, 1);
png_bytep row_pointer;
row_pointer = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
for (unsigned int pass = 0; pass < (unsigned int)frameSize.Y; pass++)
{
png_read_rows(png_ptr, &row_pointer, NULL, 1);
unsigned int* dest = (unsigned int*)((char*)lock->Pixel1 + pass * lock->Pitch1Y);
for (unsigned int x = 0; x < (unsigned int)frameSize.X; x++)
{
png_byte* ptr = &(row_pointer[x * channels]);
// Get the RGBA values from the PNG decoder and arrange the 'red', 'green', 'blue' channels at the right bit offset position
unsigned int red = ptr[0] << EW_COLOR_CHANNEL_BIT_OFFSET_RED;
unsigned int green = ptr[1] << EW_COLOR_CHANNEL_BIT_OFFSET_GREEN;
unsigned int blue = ptr[2] << EW_COLOR_CHANNEL_BIT_OFFSET_BLUE;
unsigned int alpha;
if (channels == 4)
alpha = ptr[3] << EW_COLOR_CHANNEL_BIT_OFFSET_ALPHA;
else
alpha = 0xFF << EW_COLOR_CHANNEL_BIT_OFFSET_ALPHA;
// Store the pixel data in the bitmap memory
*dest++ = red | green | blue | alpha;
}
}
png_free(png_ptr, row_pointer);
row_pointer = NULL;
png_read_end(png_ptr, info_ptr);
/* Clean up after the read, and free any memory allocated. */
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
/* Unlock the bitmap */
EwUnlockBitmap(lock);
}
EMWI ERROR: code: 41
For details please visit
https://doc.embedded-wizard.de/errors
EMWI ERROR: code: 111, info1: 903, info2: 545
For details please visit
https://doc.embedded-wizard.de/errors
EMWI ERROR: code: 320
For details please visit
https://doc.embedded-wizard.de/errors
bitmap failed
What I tried . Analyses for 320 , put the statement EwFreeBitmap(bitmap); /* free the bitmap */ but still after some point it fails
code: 111, info1: 903, info2: 545 : I have put the printf statement :[SYSTEM EVENT] Opened:../../usr/share/splash.png 901x543 Channels:3 ColorType:2. so width and height has increased with "+2"
I am unable to find where exactly it fails ,.Because before migrating to EW11 it was working fine.
plase advice for the same ?