Permalink
Browse files

egl: fix creation of XBMC icon texture.

CTexture iconTexture; will create a 0x0 texture and CTexture::LoadFromFile()
won't update that texture. Rather, it creates and returns a new object.
That's this object we want to use for SDL_WM_SetIcon() as initialization
data. i.e. that newly created object will have the right size.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
  • Loading branch information...
gbeauchesne committed Aug 13, 2012
1 parent abdf416 commit 196b26a29799234928ca3878db488e82b36c0a7e
Showing with 9 additions and 3 deletions.
  1. +9 −3 xbmc/windowing/X11/WinSystemX11GLES.cpp
@@ -155,12 +155,18 @@ bool CWinSystemX11GLES::CreateNewWindow(const CStdString& name, bool fullScreen,
if(!SetFullScreen(fullScreen, res, false))
return false;
- CTexture iconTexture;
- iconTexture.LoadFromFile("special://xbmc/media/icon.png");
+ CBaseTexture *pIconTexture;
+ pIconTexture = CBaseTexture::LoadFromFile("special://xbmc/media/icon.png");
+ if (!pIconTexture)
+ {
+ CLog::Log(LOGERROR, "Failed to load XBMC icon");
+ return false;
+ }
- SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture.GetPixels(), iconTexture.GetWidth(), iconTexture.GetHeight(), BPP, iconTexture.GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL);
+ SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(pIconTexture->GetPixels(), pIconTexture->GetWidth(), pIconTexture->GetHeight(), BPP, pIconTexture->GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL);
SDL_WM_SetCaption("XBMC Media Center", NULL);
+ delete pIconTexture;
m_bWindowCreated = true;
m_eglext = " ";

2 comments on commit 196b26a

@theuni

This comment has been minimized.

Show comment Hide comment
@theuni

theuni Aug 19, 2012

We shouldn't fail to create the window just because the icon didn't load.

We shouldn't fail to create the window just because the icon didn't load.

@gbeauchesne

This comment has been minimized.

Show comment Hide comment
@gbeauchesne

gbeauchesne Aug 19, 2012

Owner

OK, thanks, I will propagate the fix from WinSystemX11.cpp then. I just realized there was one there. Though, iconTexture probably needs to be checked for prior to delete'ing it. :)

Owner

gbeauchesne replied Aug 19, 2012

OK, thanks, I will propagate the fix from WinSystemX11.cpp then. I just realized there was one there. Though, iconTexture probably needs to be checked for prior to delete'ing it. :)

Please sign in to comment.