bool CTextureMap::Release(int iPicture) { if (iPicture < 0 || iPicture >= (int)m_vecTexures.size()) return true; CTexture* pTexture = m_vecTexures[iPicture]; return pTexture->Release(); }
CGUIStaticPicture::CGUIStaticPicture(float _x, float _y, const char *texName, float _sx, float _sy, UINT color) : CGUIWidget(_x,_y), CGUIEventSupport(availableEvents, numEvents) { UINT ssx, ssy; CTexture *texture = new CTexture; rect = 0; bool released = false; if ( !( texture->CreateFromFile(texName) ) ) { texture->Release(); throw CExc(eGUI, E_FILE_NOT_FOUND,"CGUIStaticPicture::CGUIStaticPicture> Cannot find texture: %s",texName); } try{ texture->GetImageSize(&ssx,&ssy); if(_sx>0) ssx=(UINT)_sx; if(_sy>0) ssy=(UINT)_sy; rect = new CBltRect(_x, _y, (float)ssx, (float)ssy, color); rect->SetTexture(texture); texture->Release(); released=true; SetSize((float)ssx,(float)ssy); SetPos(_x,_y); throw_going=true; focusable=false; MsgAcceptConsume(MsgMouseL); // MsgSetConsume(MsgNone); // MsgSetProduce(MsgNone); // preposila elementum pod sebou AddToTrash(); }catch(CExc) { if(!released) texture->Release(); SAFE_DELETE(rect); throw; } }