Manually scale the icon if it was passed as a pixbuf #95

Merged
merged 3 commits into from Oct 3, 2017

Conversation

Projects
None yet
2 participants
Contributor

azzar1 commented Sep 27, 2017

Manually scale the icon if it was passed as a pixbuf.

Collaborator

jhasse commented Sep 27, 2017

This is for HiDPI, right? Do you know an app where this is a problem so I can reproduce it?

Contributor

azzar1 commented Sep 28, 2017

Telegram?

Contributor

azzar1 commented Sep 28, 2017

And yes it's for HiDPI :D

Collaborator

jhasse commented Sep 29, 2017

Can you post a before/after screenshot of the problem this PR is trying to solve?

I don't have a HiDPI screen and tried to emulate it by setting the window scale factor to 2, but GNOME Shell didn't scale correctly.

Contributor

azzar1 commented Oct 3, 2017

Before the fix:
not_ok

After the fix:
ok

Collaborator

jhasse commented Oct 3, 2017

Thanks :)

Your changes look good. Can you test though, if also adding the scale factor here

let qualifiedIconPixmapArray = sortedIconPixmapArray.filter(function(pixmap) {
                // we disqualify any pixmap that is bigger than our requested size
                return pixmap[0] <= iconSize * scale_factor &&
                       pixmap[1] <= iconSize * scale_factor
})

improves the image quality? We wouldn't want to disqualify HiDPI pixbufs.

edit: To clarify: Set scale_factor to St.ThemeContext.get_for_stage(global.stage).scale_factor before the filtering and do

if (height != 0) {
    scale_factor = iconSize / height
}

afterwards (btw: always use braces).

Also: Don't we want to return in case of height == 0 anyway?

Contributor

azzar1 commented Oct 3, 2017

Collaborator

jhasse commented Oct 3, 2017

Ups, yeah you're right. Thank you very much for the PR :)

@jhasse jhasse merged commit 1c839c3 into Ubuntu:master Oct 3, 2017

didrocks added a commit that referenced this pull request Oct 6, 2017

Merge pull request #95 from azzar1/fix-scaling-when-pixbuf
Manually scale the icon if it was passed as a pixbuf

@jhasse jhasse referenced this pull request Oct 20, 2017

Closed

Icon Size #68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment