cache embedded images

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-04-06 15:26:16 +03:00
parent 3ba2ecd0fc
commit 7635c0ca3b
3 changed files with 8 additions and 8 deletions

View File

@ -312,7 +312,7 @@ void XTheme::Init()
static XImage NullIcon;
static XImage DummyIcon;
const XImage& XTheme::GetIcon(const XString& Name) const
const XImage& XTheme::GetIcon(const XString& Name)
{
for (size_t i = 0; i < Icons.size(); i++)
{
@ -324,7 +324,7 @@ const XImage& XTheme::GetIcon(const XString& Name) const
return NullIcon; //if name is not found
}
const XImage& XTheme::GetIcon(INTN Id) const
const XImage& XTheme::GetIcon(INTN Id)
{
for (size_t i = 0; i < Icons.size(); i++)
{
@ -341,12 +341,12 @@ const XImage& XTheme::GetIcon(INTN Id) const
Icon* NewIcon = new Icon(Id, true);
// NewIcon.GetEmbedded();
if (!Daylight && !NewIcon->ImageNight.isEmpty()) {
// Icons[i].ImageNight.Copy(NewIcon.ImageNight); //can't cash because it is const, fuck!!!
Icons[i].ImageNight = NewIcon->ImageNight; //
return NewIcon->ImageNight;
}
//if daylight or night icon absent
if (!NewIcon->Image.isEmpty()) {
// Icons[i].Image.Copy(NewIcon.Image);
Icons[i].Image = NewIcon->Image;
return NewIcon->Image;
}
}

View File

@ -116,8 +116,8 @@ public:
//fill the theme
// const XImage& GetIcon(const char* Name);
// const XImage& GetIcon(const CHAR16* Name);
const XImage& GetIcon(const XString& Name) const; //get by name
const XImage& GetIcon(INTN Id) const; //get by id
const XImage& GetIcon(const XString& Name); //get by name
const XImage& GetIcon(INTN Id); //get by id
const XImage& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider
const XImage& LoadOSIcon(const XString& Full);

View File

@ -179,10 +179,10 @@ EG_IMAGE * egLoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols)
(PixelPtr->g == FirstPixel.g) &&
(PixelPtr->r == FirstPixel.r)
) {
PixelPtr->a = 0;
PixelPtr->a = 0; //if a pixel has same color as first pixel then it will be transparent
#if USE_XTHEME
} else if (ThemeX.DarkEmbedded) {
*PixelPtr = SemiWhitePixel;
*PixelPtr = SemiWhitePixel; //specail case to change a text to semi white
#else
} else if (GlobalConfig.DarkEmbedded) {
*PixelPtr = SemiWhitePixel;