Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Migliorata resistenza ad immagini mancanti o illeggibili


git-svn-id: svn://10.65.10.50/branches/R_10_00@20894 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-09-22 09:49:07 +00:00
parent 7040da8224
commit f05bcb09fd
3 changed files with 21 additions and 12 deletions

View File

@ -2511,17 +2511,21 @@ XVT_FNTID xvt_res_get_font(int rid)
XVT_IMAGE xvt_res_get_icon(int rid) XVT_IMAGE xvt_res_get_icon(int rid)
{ {
XVT_IMAGE img = NULL;
const wxIcon icon = xvtart_GetIconResource(rid); const wxIcon icon = xvtart_GetIconResource(rid);
int w = icon.GetWidth(); if (w <= 0) w = 32; if (icon.IsOk())
int h = icon.GetHeight(); if (h <= 0) h = 32;
wxBitmap bmp(w, h, icon.GetDepth());
{ {
wxMemoryDC dc(bmp); int w = icon.GetWidth(); if (w <= 0) w = 32;
dc.DrawIcon(icon, 0, 0); int h = icon.GetHeight(); if (h <= 0) h = 32;
wxBitmap bmp(w, h, icon.GetDepth());
{
wxMemoryDC dc(bmp);
dc.DrawIcon(icon, 0, 0);
}
XVT_IMAGE_FORMAT xif = bmp.GetDepth()>8 ? XVT_IMAGE_RGB : XVT_IMAGE_CL8;
img = xvt_image_create(xif, w, h, 0);
((TXVT_IMAGE*)img)->Image() = bmp.ConvertToImage();
} }
XVT_IMAGE_FORMAT xif = bmp.GetDepth()>8 ? XVT_IMAGE_RGB : XVT_IMAGE_CL8;
XVT_IMAGE img = xvt_image_create(xif, w, h, 0);
((TXVT_IMAGE*)img)->Image() = bmp.ConvertToImage();
return img; return img;
} }

View File

@ -292,7 +292,7 @@ wxIcon TArtProvider::GetIcon(const wxArtID& id, const wxArtClient& client, const
wxIconBundle bundle = GetIconBundle(id, client); wxIconBundle bundle = GetIconBundle(id, client);
const wxSize sz = size == wxDefaultSize ? GetNativeSizeHint(client) : size; const wxSize sz = size == wxDefaultSize ? GetNativeSizeHint(client) : size;
wxIcon ico = bundle.GetIcon(sz); wxIcon ico = bundle.GetIcon(sz);
if (sz.x != ico.GetWidth()) // Should never happen :-) if (ico.IsOk() && sz.x != ico.GetWidth()) // Should never happen :-)
{ {
wxBitmap bmpbig(bundle.GetIcon()); wxBitmap bmpbig(bundle.GetIcon());
wxImage img = bmpbig.ConvertToImage(); wxImage img = bmpbig.ConvertToImage();

View File

@ -1552,9 +1552,14 @@ void TwxOutlookBar::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{ {
const int sz = nSide > 16 ? (nSide < 48 ? (nSide/16*16) : 48) : 16; const int sz = nSide > 16 ? (nSide < 48 ? (nSide/16*16) : 48) : 16;
const wxIcon ico = xvtart_GetIconResource(oi.m_nIconId, wxART_TOOLBAR, sz); const wxIcon ico = xvtart_GetIconResource(oi.m_nIconId, wxART_TOOLBAR, sz);
const wxSize szIco(ico.GetWidth(), ico.GetHeight()); if (ico.IsOk())
dc.DrawIcon(ico, rect.x+nTextOffset, rect.y+(nSide-szIco.y)/2); {
nTextOffset += nTextOffset+szIco.x; const wxSize szIco(ico.GetWidth(), ico.GetHeight());
dc.DrawIcon(ico, rect.x+nTextOffset, rect.y+(nSide-szIco.y)/2);
nTextOffset += nTextOffset+szIco.x;
}
else
nTextOffset += nTextOffset+sz;
} }
dc.SetFont(GetFont()); // Imposta il font predefinito per questo controllo dc.SetFont(GetFont()); // Imposta il font predefinito per questo controllo