diff --git a/source/ngc/gui/gui_imagedata.cpp b/source/ngc/gui/gui_imagedata.cpp index 1bf9c21..23f29e7 100644 --- a/source/ngc/gui/gui_imagedata.cpp +++ b/source/ngc/gui/gui_imagedata.cpp @@ -24,16 +24,35 @@ GuiImageData::GuiImageData(const u8 * img) else { PNGUPROP imgProp; - IMGCTX ctx; + IMGCTX ctx = PNGU_SelectImageFromBuffer(img); - ctx = PNGU_SelectImageFromBuffer(img); - PNGU_GetImageProperties (ctx, &imgProp); - width = imgProp.imgWidth; - height = imgProp.imgHeight; - data = (u8 *)memalign (32, imgProp.imgWidth * imgProp.imgHeight * 4); - PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255); - int len = imgProp.imgWidth * imgProp.imgHeight * 4; - DCFlushRange(data, len+len%32); + if(!ctx) + return; + + int res = PNGU_GetImageProperties(ctx, &imgProp); + + if(res == PNGU_OK) + { + data = (u8 *)memalign (32, imgProp.imgWidth * imgProp.imgHeight * 4); + + if(data) + { + res = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255); + + if(res == PNGU_OK) + { + width = imgProp.imgWidth; + height = imgProp.imgHeight; + int len = imgProp.imgWidth * imgProp.imgHeight * 4; + DCFlushRange(data, len+len%32); + } + else + { + free(data); + data = NULL; + } + } + } PNGU_ReleaseImageContext (ctx); } } diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 1154a09..2383326 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -3264,7 +3264,7 @@ MainMenu (int menu) GuiImage logoImgOver(&logoOver); btnLogo = new GuiButton(logoImg.GetWidth(), logoImg.GetHeight()); btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - btnLogo->SetPosition(-50, 30); + btnLogo->SetPosition(-30, 30); btnLogo->SetImage(&logoImg); btnLogo->SetImageOver(&logoImgOver); btnLogo->SetTrigger(&trigA);