Pulse: update Intel logo

They use a new logo since 2006.

While I'm at it, also add logos for Cyrix and Via which were missing
previously (there are a few other missing but they are even more
uncommon). Use vector logos which can be scaled as needed. However, the
CPU chip background is still a bitmap, so we can't scale things just
yet.

Fixes #15919.
This commit is contained in:
Adrien Destugues
2020-05-11 18:47:21 +02:00
parent a22fff485c
commit f12419a91d
9 changed files with 419 additions and 961 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+38 -14
View File
@@ -16,6 +16,7 @@
#include <Catalog.h> #include <Catalog.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Dragger.h> #include <Dragger.h>
#include <IconUtils.h>
#include <Window.h> #include <Window.h>
#include <stdlib.h> #include <stdlib.h>
@@ -48,7 +49,7 @@ max_font_size(BFont font, const char* text, float maxSize, float maxWidth)
NormalPulseView::NormalPulseView(BRect rect) NormalPulseView::NormalPulseView(BRect rect)
: PulseView(rect, "NormalPulseView"), : PulseView(rect, "NormalPulseView"),
fHasBrandLogo(false) fBrandLogo(NULL)
{ {
SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor()); SetLowUIColor(ViewUIColor());
@@ -95,6 +96,7 @@ NormalPulseView::NormalPulseView(BRect rect)
NormalPulseView::~NormalPulseView() NormalPulseView::~NormalPulseView()
{ {
delete fCpuLogo; delete fCpuLogo;
delete fBrandLogo;
delete[] fCpuButtons; delete[] fCpuButtons;
delete[] fProgressBars; delete[] fProgressBars;
} }
@@ -108,7 +110,7 @@ NormalPulseView::CalculateFontSizes()
fProcessorFontSize = max_font_size(font, fProcessor, 11.0f, 46.0f); fProcessorFontSize = max_font_size(font, fProcessor, 11.0f, 46.0f);
if (!fHasBrandLogo) if (fBrandLogo == NULL)
fVendorFontSize = max_font_size(font, fVendor, 13.0f, 46.0f); fVendorFontSize = max_font_size(font, fVendor, 13.0f, 46.0f);
} }
@@ -122,10 +124,13 @@ NormalPulseView::DetermineVendorAndProcessor()
// Initialize logo // Initialize logo
fCpuLogo = new BBitmap(BRect(0, 0, 63, 62), B_CMAP8); fCpuLogo = new BBitmap(BRect(0, 0, 63, 62), B_CMAP8);
unsigned char *logo = BlankLogo; fCpuLogo->SetBits(BlankLogo, fCpuLogo->BitsLength(), 0, B_CMAP8);
const unsigned char* logo = NULL;
size_t logoSize = 0;
#if __POWERPC__ #if __POWERPC__
logo = PowerPCLogo; logo = PowerPCLogo;
logoSize = sizeof(PowerPCLogo);
#elif __i386__ #elif __i386__
uint32 topologyNodeCount = 0; uint32 topologyNodeCount = 0;
cpu_topology_node_info* topology = NULL; cpu_topology_node_info* topology = NULL;
@@ -138,12 +143,24 @@ NormalPulseView::DetermineVendorAndProcessor()
for (uint32 i = 0; i < topologyNodeCount; i++) { for (uint32 i = 0; i < topologyNodeCount; i++) {
if (topology[i].type == B_TOPOLOGY_PACKAGE) { if (topology[i].type == B_TOPOLOGY_PACKAGE) {
switch (topology[i].data.package.vendor) { switch (topology[i].data.package.vendor) {
case B_CPU_VENDOR_INTEL: case B_CPU_VENDOR_AMD:
logo = IntelLogo; logo = kAmdLogo;
logoSize = sizeof(kAmdLogo);
break; break;
case B_CPU_VENDOR_AMD: case B_CPU_VENDOR_CYRIX:
logo = AmdLogo; logo = kCyrixLogo;
logoSize = sizeof(kCyrixLogo);
break;
case B_CPU_VENDOR_INTEL:
logo = kIntelLogo;
logoSize = sizeof(kIntelLogo);
break;
case B_CPU_VENDOR_VIA:
logo = kViaLogo;
logoSize = sizeof(kViaLogo);
break; break;
default: default:
@@ -157,8 +174,14 @@ NormalPulseView::DetermineVendorAndProcessor()
delete[] topology; delete[] topology;
#endif #endif
fCpuLogo->SetBits(logo, fCpuLogo->BitsLength(), 0, B_CMAP8); if (logo != NULL) {
fHasBrandLogo = (logo != BlankLogo); fBrandLogo = new BBitmap(BRect(0, 0, 47, 47), B_RGBA32);
if (BIconUtils::GetVectorIcon(logo, logoSize, fBrandLogo) != B_OK) {
delete fBrandLogo;
fBrandLogo = NULL;
}
} else
fBrandLogo = NULL;
get_cpu_type(fVendor, sizeof(fVendor), fProcessor, sizeof(fProcessor)); get_cpu_type(fVendor, sizeof(fVendor), fProcessor, sizeof(fProcessor));
} }
@@ -169,11 +192,13 @@ NormalPulseView::Draw(BRect rect)
{ {
PushState(); PushState();
SetDrawingMode(B_OP_OVER);
// Processor picture // Processor picture
DrawBitmap(fCpuLogo, BPoint(10, 10)); DrawBitmap(fCpuLogo, BPoint(10, 10));
if (!fHasBrandLogo) { if (fBrandLogo != NULL) {
SetDrawingMode(B_OP_OVER); DrawBitmap(fBrandLogo, BPoint(18, 17));
} else {
SetHighColor(240, 240, 240); SetHighColor(240, 240, 240);
SetFontSize(fVendorFontSize); SetFontSize(fVendorFontSize);
@@ -183,12 +208,11 @@ NormalPulseView::Draw(BRect rect)
} }
// Draw processor type and speed // Draw processor type and speed
SetDrawingMode(B_OP_OVER);
SetHighColor(240, 240, 240); SetHighColor(240, 240, 240);
SetFontSize(fProcessorFontSize); SetFontSize(fProcessorFontSize);
float width = StringWidth(fProcessor); float width = StringWidth(fProcessor);
MovePenTo(10 + (32 - width / 2), 48); MovePenTo(10 + (32 - width / 2), 55);
DrawString(fProcessor); DrawString(fProcessor);
char buffer[64]; char buffer[64];
@@ -204,7 +228,7 @@ NormalPulseView::Draw(BRect rect)
GetFont(&font); GetFont(&font);
SetFontSize(max_font_size(font, buffer, fProcessorFontSize, 46.0f)); SetFontSize(max_font_size(font, buffer, fProcessorFontSize, 46.0f));
width = StringWidth(buffer); width = StringWidth(buffer);
MovePenTo(10 + (32 - width / 2), 60); MovePenTo(10 + (32 - width / 2), 64);
DrawString(buffer); DrawString(buffer);
PopState(); PopState();
+1 -1
View File
@@ -37,7 +37,7 @@ class NormalPulseView : public PulseView {
CPUButton **fCpuButtons; CPUButton **fCpuButtons;
BBitmap *fCpuLogo; BBitmap *fCpuLogo;
int32 fCpuCount; int32 fCpuCount;
bool fHasBrandLogo; BBitmap* fBrandLogo;
float fVendorFontSize, fProcessorFontSize; float fVendorFontSize, fProcessorFontSize;
}; };
+380 -946
View File
File diff suppressed because it is too large Load Diff