From e5c4ce4f6746cce6ec7c9bd6d69a550832cb5525 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Sat, 21 Jul 2018 23:05:24 -0400 Subject: [PATCH] HaikuDepot: Fix package list icon size for regular and featured views Fixes #13399 Change-Id: I9a372d467e2056c6985fdc43b4629aa8fecd7535 --- src/apps/haikudepot/ui/FeaturedPackagesView.cpp | 3 +++ src/apps/haikudepot/ui/PackageListView.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp index d1ca2e0ee4..afc761e1f5 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp @@ -51,7 +51,10 @@ public: SetHighUIColor(B_LIST_ITEM_TEXT_COLOR); SetEventMask(B_POINTER_EVENTS); + // Featured icon package should be scaled to 64x64 fIconView = new BitmapView("package icon view"); + fIconView->SetExplicitMinSize(BSize(64, 64)); + fInstalledIconView = new BitmapView("installed icon view"); fTitleView = new BStringView("package title view", ""); fPublisherView = new BStringView("package publisher view", ""); diff --git a/src/apps/haikudepot/ui/PackageListView.cpp b/src/apps/haikudepot/ui/PackageListView.cpp index bcdbf7e101..e924639d1b 100644 --- a/src/apps/haikudepot/ui/PackageListView.cpp +++ b/src/apps/haikudepot/ui/PackageListView.cpp @@ -331,10 +331,12 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent) if (bitmapField != NULL) { const BBitmap* bitmap = bitmapField->Bitmap(); + // Scale the bitmap to 16x16 + BRect r = BRect(0, 0, 15, 15); + // figure out the placement float x = 0.0; - BRect r = bitmap ? bitmap->Bounds() : BRect(0, 0, 15, 15); - float y = rect.top + ((rect.Height() - r.Height()) / 2); + float y = rect.top + ((rect.Height() - r.Height()) / 2) - 1; float width = 0.0; switch (Alignment()) { @@ -363,7 +365,8 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent) // draw the bitmap if (bitmap != NULL) { 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); }