Revert "Deskbar: Use hvif window icons & scale with font"

This reverts commit 2b65e2d808.
This commit is contained in:
John Scipione 2023-04-11 14:19:11 -04:00
parent a2755521d5
commit 27b3dee8b3
7 changed files with 131 additions and 75 deletions

View File

@ -338,7 +338,7 @@ TBarMenuBar::FetchTeamIcon()
if (fTeamIconData == NULL || fTeamIconSize == 0) {
// we haven't fetched vector icon data yet, fetch it
fTeamIconData = (const uint8*)AppResSet()->FindResource(
B_VECTOR_ICON_TYPE, R_TeamIcon, &fTeamIconSize);
B_VECTOR_ICON_TYPE, R_TeamIconVector, &fTeamIconSize);
}
if (fTeamIconData != NULL && fTeamIconSize > 0) {
@ -349,12 +349,11 @@ TBarMenuBar::FetchTeamIcon()
iconRect.InsetBy(-1, -1);
// grow icon by 1px so that it renders nicely at 12pt font size
BBitmap* icon = new(std::nothrow) BBitmap(iconRect, B_RGBA32);
if (icon != NULL && icon->InitCheck() == B_OK
&& BIconUtils::GetVectorIcon(fTeamIconData, fTeamIconSize, icon) == B_OK) {
if (icon != NULL && BIconUtils::GetVectorIcon(fTeamIconData,
fTeamIconSize, icon) == B_OK) {
// rasterize vector icon into a bitmap at the scaled size
teamIcon = icon;
} else
delete icon;
}
}
return teamIcon;

View File

@ -36,12 +36,9 @@ All rights reserved.
#include "WindowMenuItem.h"
#include <new>
#include <Bitmap.h>
#include <ControlLook.h>
#include <Debug.h>
#include <IconUtils.h>
#include <NaturalCompare.h>
#include "BarApp.h"
@ -272,15 +269,13 @@ TWindowMenuItem::_Init(const char* name)
}
if (fMini) {
if (fCurrentWorkSpace)
fBitmap = _FetchWindowVectorIcon(R_WindowHiddenIcon);
else
fBitmap = _FetchWindowVectorIcon(R_WindowHiddenSwitchIcon);
fBitmap = fCurrentWorkSpace
? AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowHiddenIcon)
: AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowHiddenSwitchIcon);
} else {
if (fCurrentWorkSpace)
fBitmap = _FetchWindowVectorIcon(R_WindowShownIcon);
else
fBitmap = _FetchWindowVectorIcon(R_WindowShownSwitchIcon);
fBitmap = fCurrentWorkSpace
? AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowShownIcon)
: AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowShownSwitchIcon);
}
BFont font(be_plain_font);
@ -292,26 +287,3 @@ TWindowMenuItem::_Init(const char* name)
SetLabel(name);
}
const BBitmap*
TWindowMenuItem::_FetchWindowVectorIcon(int32 id)
{
const BBitmap* windowIcon = NULL;
const uint8* data;
size_t size;
data = (const uint8*)AppResSet()->FindResource(B_VECTOR_ICON_TYPE, id, &size);
if (data != NULL && size > 0) {
// seems valid, scale bitmap according to font size
BBitmap* icon = new(std::nothrow) BBitmap(
BRect(B_ORIGIN, be_control_look->ComposeIconSize(B_MINI_ICON)), B_RGBA32);
if (icon != NULL && icon->InitCheck() == B_OK
&& BIconUtils::GetVectorIcon((const uint8*)data, size, icon) == B_OK) {
windowIcon = icon;
} else
delete icon;
}
return windowIcon;
}

View File

@ -76,7 +76,6 @@ protected:
private:
void _Init(const char* name);
const BBitmap* _FetchWindowVectorIcon(int32 id);
int32 fID;
bool fMini;

View File

@ -8,5 +8,6 @@ enum {
R_WindowHiddenIcon = 21,
R_ResizeIcon = 22,
R_WindowShownSwitchIcon = 23,
R_WindowHiddenSwitchIcon = 24
R_WindowHiddenSwitchIcon = 24,
R_TeamIconVector = 25
};

View File

@ -1,7 +1,7 @@
#include "icons.h"
resource(R_LeafLogoBitmap) vector_icon {
resource(R_LeafLogoBitmap) #'VICN' array {
$"6E6369660102010602438798C0E5A13DF937406BAE4D330E4CA0420000AAFFFF"
$"00337F010216C676C7BCC676C7BCCDE4CEECDD2DCFB2D596D105DBF0CEC5DAD9"
$"CCB5DB59CDA2E352D196EA2CC98EE790CB83E947C8D3E65EC72EE82DC964E8B0"
@ -81,7 +81,32 @@ resource(R_SmallNewGroupIcon) archive(, 0x00000000) BBitmap {
}
};
resource(R_TeamIcon) vector_icon {
resource(R_TeamIcon) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 19.0, 15.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 20,
"_data" = array {
$"FFFF0000000000000000000000000000FFFFFFFF"
$"FFFF008F8F8F8F8F8F8F8F8F8F00000000FFFFFF"
$"FFFF008F8F8F8F8F0000000000D9D90000FFFFFF"
$"FFFF008F8F3F8F3F00D9001B00D9D9AA01FFFFFF"
$"FFFF008F3F3F3F3F8F8F00001500000A0016FFFF"
$"FFFF008F8F3F8F3F3F8F8F8F001B151C1C00FFFF"
$"FFFF008F8F3F8F3F8F8F8F8F0015150B1B00FFFF"
$"FFFF008F8F8F8F8F8F8F8F8F8F0100001C00FFFF"
$"FFFF008F8F8F8F8F8F8F8F8F8F0166001C00FFFF"
$"FFFF00000000000000000000000066660000FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFF0066660000FFFF"
$"FFFFFFFFFFFFFFFFFF000000000000000000FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFF0066668D00FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFF0066668D00FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFF0000AAAA0011FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFF000000000011FFFF"
}
};
resource(R_TeamIconVector) #'VICN' array {
$"6E6369661905FF03000001020006023F900F3DA311BDA3113F900F49E579C426"
$"607B77AD779F66986605F905F905F9020006023D81E73ACACFBCF5653FB7664A"
$"22313F685CA6A4D0FFB781C0FF036697CB020006023C194E3ADC9FBE40D23F4E"
@ -153,20 +178,54 @@ resource(R_GenericAppIcon) archive(, 0x00000000) BBitmap {
}
};
resource(R_WindowShownIcon) vector_icon {
$"6E63696605050005FF0578020006020000003A0000C000000000004BFFFF43FF"
$"FF9AFFFF65FFFFAF1205C8050A0620585458542C502C505420540A0A24542424"
$"4024402C542C542844284420202020540A042020202C402C40200A04202C2058"
$"5458542C0A044024402844284424060A030102202C240A040103202C240A0101"
$"03023EC4EC0000000000003EE8BA48800046D1740A020101202C240A00010020"
$"2C240A000104202C24"
resource(R_WindowShownIcon) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 15.0, 15.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 16,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FF0F0F0F0F0F0F0F0F0FFFFFFFFFFFFF"
$"FF0FFCFCFCFCFCFCFC00FFFFFFFFFFFF"
$"FF0FBDBDBDBDBDBDBD0F0F0F0F0FFFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF00000000000000000000000000FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
}
};
resource(R_WindowHiddenIcon) vector_icon {
$"6E6369660405000578059805C8050A0620585458542C502C505420540A0A2454"
$"24244024402C542C542844284420202020540A042020202C402C40200A04202C"
$"20585458542C0A044024402844284424050A020102202C240A030103202C240A"
$"010101202C240A000100202C240A000104202C24"
resource(R_WindowHiddenIcon) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 15.0, 15.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 16,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FF0F0F0F0F0F0F0F0F0FFFFFFFFFFFFF"
$"FF0F1313131313131300FFFFFFFFFFFF"
$"FF0F131313131313130F0F0F0F0FFFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF0F191919191919191919191900FFFF"
$"FF00000000000000000000000000FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
}
};
resource(R_ResizeIcon) archive(, 0x00000000) BBitmap {
@ -186,26 +245,52 @@ resource(R_ResizeIcon) archive(, 0x00000000) BBitmap {
}
};
resource(R_WindowShownSwitchIcon) vector_icon {
$"6E63696605050005FF0578020006020000003A0000C000000000004BFFFF43FF"
$"FF9AFFFF65FFFFAF1205C8060A0620585458542C502C505420540A0A24542424"
$"4024402C542C542844284420202020540A042020202C402C40200A04202C2058"
$"5458542C0A0440244028442844240A0450305050305030300C0A030102202C24"
$"0A040103202C240A010103023EC4EC0000000000003EE8BA48800046D1740A02"
$"0101202C240A000100202C240A000104202C240A020105023C00000000000000"
$"003800008D6DB64900000A020105023A00000000000000003800004500004A00"
$"000A02010502380000000000000000380000C000004900000A0201050237FFFF"
$"0000000000003800004300004A00000A0201050237FFFF000000000000380000"
$"4000004A80000A020105023B000000000000000038000042FFFF4A8000"
resource(R_WindowShownSwitchIcon) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 23.0, 15.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 24,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0C0C0C0C0C0C0C0C0CFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0CFAFAFAFAFAFAFA00FFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0CF9F9F9F9F9F9F90C0C0C0C0CFFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FFFF0CFF0C0C0CFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FFFFFFFFFFFFFFFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FFFFFFFFFFFFFFFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"0CFF0C0C0C0C0CFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FFFFFFFFFFFFFFFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FFFFFFFFFFFFFFFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FF0CFF0C0C0C0CFFFF0C193F3F3F3F3F3F3F3F3F1900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF00000000000000000000000000FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
}
};
resource(R_WindowHiddenSwitchIcon) vector_icon {
$"6E6369660405000578059805C8050A0620585458542C502C505420540A0A2454"
$"24244024402C542C542844284420202020540A042020202C402C40200A04202C"
$"20585458542C0A0440244028442844240B0A020102202C240A030103202C240A"
$"010101202C240A000100202C240A000104202C240A0101040242000000000000"
$"00003E0000CBC00048E0000A010104023E00000000000000003E0000C8000048"
$"E0000A010104023DFFFF0000000000003E0000C6FFFF49E0000A010104023DFF"
$"FF0000000000003E0000C77FFF4A70000A010104024000000000000000003E00"
$"00C8FFFF49E0000A010104024100000000000000003E0000CAA0004A7000"
resource(R_WindowHiddenSwitchIcon) archive(, 0x00000000) BBitmap {
"_frame" = rect { 0.0, 0.0, 23.0, 15.0 },
"_cspace" = 4,
"_bmflags" = 1,
"_rowbytes" = 24,
"_data" = array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0C0C0C0C0C0C0C0C0CFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0C1010101010101000FFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFF0C101010101010100C0C0C0C0CFFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFF0CFF0C0C0CFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"0CFF0C0C0C0C0CFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FF0CFF0C0C0C0CFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF0C191919191919191919191900FFFF"
$"FFFFFFFFFFFFFFFFFF00000000000000000000000000FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
}
};