Make sure never to draw the favicon too big, in case we only got a big one from

the page, and use the proper drawing mode and filtering.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@479 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2012-07-03 15:43:56 +02:00
committed by Alexandre Deckner
parent 9f30678a67
commit 27dab3e5fe
+8 -8
View File
@@ -532,7 +532,8 @@ public:
BView("page icon view", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), BView("page icon view", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
fIcon(NULL) fIcon(NULL)
{ {
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
} }
~PageIconView() ~PageIconView()
@@ -546,21 +547,20 @@ public:
return; return;
BRect bounds(Bounds()); BRect bounds(Bounds());
BRect iconBounds(fIcon->Bounds()); BRect iconBounds(0, 0, 15, 15);
BPoint iconPos( iconBounds.OffsetTo(
floorf((bounds.left + bounds.right floorf((bounds.left + bounds.right
- (iconBounds.left + iconBounds.right)) / 2 + 0.5f), - (iconBounds.left + iconBounds.right)) / 2 + 0.5f),
floorf((bounds.top + bounds.bottom floorf((bounds.top + bounds.bottom
- (iconBounds.top + iconBounds.bottom)) / 2 + 0.5f)); - (iconBounds.top + iconBounds.bottom)) / 2 + 0.5f));
DrawBitmap(fIcon, iconPos); DrawBitmap(fIcon, fIcon->Bounds(), iconBounds,
B_FILTER_BITMAP_BILINEAR);
} }
virtual BSize MinSize() virtual BSize MinSize()
{ {
if (fIcon != NULL) { if (fIcon != NULL)
return BSize(fIcon->Bounds().Width() + 3, return BSize(18, 18);
fIcon->Bounds().Height() + 3);
}
return BSize(0, 0); return BSize(0, 0);
} }