Tracker & desklink: Pass -1 to GetTrackerIcon for sizing.
It can just deduce the size from the passed BBitmap if we do this. Simplifies the code somewhat.
This commit is contained in:
@@ -44,7 +44,7 @@ DeskButton::DeskButton(BRect frame, entry_ref* ref, const char* name,
|
|||||||
fTitleList(titles)
|
fTitleList(titles)
|
||||||
{
|
{
|
||||||
fSegments = new BBitmap(frame, B_RGBA32);
|
fSegments = new BBitmap(frame, B_RGBA32);
|
||||||
BNodeInfo::GetTrackerIcon(&fRef, fSegments, (icon_size)(frame.IntegerWidth() + 1));
|
BNodeInfo::GetTrackerIcon(&fRef, fSegments, (icon_size)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -281,11 +281,9 @@ IconMenuItem::IconMenuItem(const char* label, BMessage* message,
|
|||||||
fWhich(which)
|
fWhich(which)
|
||||||
{
|
{
|
||||||
if (nodeInfo != NULL) {
|
if (nodeInfo != NULL) {
|
||||||
fDeviceIcon = new BBitmap(BRect(BPoint(0, 0), be_control_look->ComposeIconSize(which)),
|
fDeviceIcon = new BBitmap(BRect(BPoint(0, 0),
|
||||||
kDefaultIconDepth);
|
be_control_look->ComposeIconSize(which)), kDefaultIconDepth);
|
||||||
|
if (nodeInfo->GetTrackerIcon(fDeviceIcon, (icon_size)-1) != B_OK) {
|
||||||
const icon_size size = (icon_size)(fDeviceIcon->Bounds().IntegerWidth() + 1);
|
|
||||||
if (nodeInfo->GetTrackerIcon(fDeviceIcon, size) != B_OK) {
|
|
||||||
delete fDeviceIcon;
|
delete fDeviceIcon;
|
||||||
fDeviceIcon = NULL;
|
fDeviceIcon = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user