Ticket #11918: 0001-Fix-11918.-Media-ListViewItem-scales-well-with-big-f.patch

File 0001-Fix-11918.-Media-ListViewItem-scales-well-with-big-f.patch, 2.1 KB (added by Janus, 9 years ago)
  • src/preferences/media/MediaListItem.cpp

    From 79b0392885b904378cf22846a01e62152abe2f0c Mon Sep 17 00:00:00 2001
    From: Janus <janus2@ymail.com>
    Date: Sat, 21 Mar 2015 19:24:05 +0000
    Subject: [PATCH] Fix #11918. [Media] ListViewItem  scales well with big fonts
    
    ---
     src/preferences/media/MediaListItem.cpp | 21 +++++++++++----------
     1 file changed, 11 insertions(+), 10 deletions(-)
    
    diff --git a/src/preferences/media/MediaListItem.cpp b/src/preferences/media/MediaListItem.cpp
    index e642384..8681e0c 100644
    a b struct MediaListItem::Renderer {  
    8484            onto->FillRect(frame, B_SOLID_LOW);
    8585        }
    8686
    87         frame.left += 4;
    88         frame.top += kITEM_MARGIN;
    89         BRect iconFrame(MediaIcons::IconRectAt(frame.LeftTop() + BPoint(1, 0)));
     87        BPoint point(frame.left + 4.0f,
     88            frame.top + (frame.Height() - MediaIcons::sBounds.Height()) / 2.0f);
     89
     90        BRect iconFrame(MediaIcons::IconRectAt(point + BPoint(1, 0)));
    9091
    9192        onto->SetDrawingMode(B_OP_OVER);
    9293        if (fPrimaryIcon && !fDoubleInsets) {
    9394            onto->DrawBitmap(fPrimaryIcon, iconFrame);
    94             frame.left = iconFrame.right + 1;
     95            point.x = iconFrame.right + 1;
    9596        } else if (fSecondaryIcon) {
    9697            onto->DrawBitmap(fSecondaryIcon, iconFrame);
    9798        }
     99
    98100        iconFrame = MediaIcons::IconRectAt(iconFrame.RightTop() + BPoint(1, 0));
    99101
    100102        if (fDoubleInsets && fPrimaryIcon) {
    101103            onto->DrawBitmap(fPrimaryIcon, iconFrame);
    102             frame.left = iconFrame.right + 1;
     104            point.x = iconFrame.right + 1;
    103105        }
    104106
    105107        onto->SetDrawingMode(B_OP_COPY);
    struct MediaListItem::Renderer {  
    108110        BFont font = be_plain_font;
    109111        font_height fontInfo;
    110112        font.GetHeight(&fontInfo);
    111         float lineHeight = fontInfo.ascent + fontInfo.descent
    112             + fontInfo.leading;
     113
    113114        onto->SetFont(&font);
    114         onto->MovePenTo(frame.left + 8, frame.top
    115             + ((frame.Height() - (lineHeight)) / 2)
    116             + (fontInfo.ascent + fontInfo.descent) - 1);
     115        onto->MovePenTo(point.x + 8, frame.top
     116            + fontInfo.ascent + (frame.Height()
     117            - ceilf(fontInfo.ascent + fontInfo.descent)) / 2.0f);
    117118        onto->DrawString(fTitle);
    118119
    119120        onto->SetHighColor(highColor);