HaikuDepot: Fix package list icon size for regular and featured views

Fixes #13399
Change-Id: I9a372d467e2056c6985fdc43b4629aa8fecd7535
This commit is contained in:
David Murphy 2018-07-21 23:05:24 -04:00 committed by waddlesplash
parent fb7812fab0
commit e5c4ce4f67
2 changed files with 9 additions and 3 deletions

View File

@ -51,7 +51,10 @@ public:
SetHighUIColor(B_LIST_ITEM_TEXT_COLOR); SetHighUIColor(B_LIST_ITEM_TEXT_COLOR);
SetEventMask(B_POINTER_EVENTS); SetEventMask(B_POINTER_EVENTS);
// Featured icon package should be scaled to 64x64
fIconView = new BitmapView("package icon view"); fIconView = new BitmapView("package icon view");
fIconView->SetExplicitMinSize(BSize(64, 64));
fInstalledIconView = new BitmapView("installed icon view"); fInstalledIconView = new BitmapView("installed icon view");
fTitleView = new BStringView("package title view", ""); fTitleView = new BStringView("package title view", "");
fPublisherView = new BStringView("package publisher view", ""); fPublisherView = new BStringView("package publisher view", "");

View File

@ -331,10 +331,12 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
if (bitmapField != NULL) { if (bitmapField != NULL) {
const BBitmap* bitmap = bitmapField->Bitmap(); const BBitmap* bitmap = bitmapField->Bitmap();
// Scale the bitmap to 16x16
BRect r = BRect(0, 0, 15, 15);
// figure out the placement // figure out the placement
float x = 0.0; float x = 0.0;
BRect r = bitmap ? bitmap->Bounds() : BRect(0, 0, 15, 15); float y = rect.top + ((rect.Height() - r.Height()) / 2) - 1;
float y = rect.top + ((rect.Height() - r.Height()) / 2);
float width = 0.0; float width = 0.0;
switch (Alignment()) { switch (Alignment()) {
@ -363,7 +365,8 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
// draw the bitmap // draw the bitmap
if (bitmap != NULL) { if (bitmap != NULL) {
parent->SetDrawingMode(B_OP_ALPHA); parent->SetDrawingMode(B_OP_ALPHA);
parent->DrawBitmap(bitmap, BPoint(x, y)); BRect viewRect(x, y, x + 16, y + 16);
parent->DrawBitmap(bitmap, bitmap->Bounds(), viewRect);
parent->SetDrawingMode(B_OP_OVER); parent->SetDrawingMode(B_OP_OVER);
} }