Media: make ListViewItem scale correctly with big fonts.
Fixes #11918. Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
This commit is contained in:
parent
ffafcc16d7
commit
68ec13b405
@ -84,22 +84,24 @@ struct MediaListItem::Renderer {
|
||||
onto->FillRect(frame, B_SOLID_LOW);
|
||||
}
|
||||
|
||||
frame.left += 4;
|
||||
frame.top += kITEM_MARGIN;
|
||||
BRect iconFrame(MediaIcons::IconRectAt(frame.LeftTop() + BPoint(1, 0)));
|
||||
BPoint point(frame.left + 4.0f,
|
||||
frame.top + (frame.Height() - MediaIcons::sBounds.Height()) / 2.0f);
|
||||
|
||||
BRect iconFrame(MediaIcons::IconRectAt(point + BPoint(1, 0)));
|
||||
|
||||
onto->SetDrawingMode(B_OP_OVER);
|
||||
if (fPrimaryIcon && !fDoubleInsets) {
|
||||
onto->DrawBitmap(fPrimaryIcon, iconFrame);
|
||||
frame.left = iconFrame.right + 1;
|
||||
point.x = iconFrame.right + 1;
|
||||
} else if (fSecondaryIcon) {
|
||||
onto->DrawBitmap(fSecondaryIcon, iconFrame);
|
||||
}
|
||||
|
||||
iconFrame = MediaIcons::IconRectAt(iconFrame.RightTop() + BPoint(1, 0));
|
||||
|
||||
if (fDoubleInsets && fPrimaryIcon) {
|
||||
onto->DrawBitmap(fPrimaryIcon, iconFrame);
|
||||
frame.left = iconFrame.right + 1;
|
||||
point.x = iconFrame.right + 1;
|
||||
}
|
||||
|
||||
onto->SetDrawingMode(B_OP_COPY);
|
||||
@ -108,12 +110,11 @@ struct MediaListItem::Renderer {
|
||||
BFont font = be_plain_font;
|
||||
font_height fontInfo;
|
||||
font.GetHeight(&fontInfo);
|
||||
float lineHeight = fontInfo.ascent + fontInfo.descent
|
||||
+ fontInfo.leading;
|
||||
|
||||
onto->SetFont(&font);
|
||||
onto->MovePenTo(frame.left + 8, frame.top
|
||||
+ ((frame.Height() - (lineHeight)) / 2)
|
||||
+ (fontInfo.ascent + fontInfo.descent) - 1);
|
||||
onto->MovePenTo(point.x + 8, frame.top
|
||||
+ fontInfo.ascent + (frame.Height()
|
||||
- ceilf(fontInfo.ascent + fontInfo.descent)) / 2.0f);
|
||||
onto->DrawString(fTitle);
|
||||
|
||||
onto->SetHighColor(highColor);
|
||||
|
Loading…
x
Reference in New Issue
Block a user