-
-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add anti aliasing support for thumbnails #705
base: master
Are you sure you want to change the base?
Conversation
@lwouis, first, thanks for creating this awesome project. I have been a heavy |
Thank you for sharing this PR! I'm interested to look into it more. I have played with interpolation previously. In the past I ran into performance issues, especially when the screens are 4k, and thus the thumbnails we get from the system are multiple megabytes each. This means I will have to test the performance of your change, which is not an easy thing to do, as well as study the qualitative image improvements involved. Some interpolation algos have downsides in certain scenarios. I'll look into this as soon as I have some free time. Again, thank you very much for sharing your work! 👍 |
Hi @owwlo! So I could finally test your work. The visual results are, I would agree, an improvement. Not a huge one, but still it's easier to read text on the thumbnails with your change. Now when I tested the performance, I noticed, as I expected, a slowdown (left is before, right is after): You can see on the right how the blue bar are wider generally, meaning more time needed to display AltTab's UI. And you can see at the bottom that on a few invocations with the shortcut, the image scaling alone took half a second. This is extra work that you added to process the image, and that is a net negative on the responsiveness. The thing is that In this article, the person is subclassing Finally, how is |
Hey @lwouis, Thanks a lot for the results and... wow! It indeed slows down the process by a lot! I didn't expect it could cost that much(1016ms vs 2124ms). I will learn to profile the code in my next PR.
I will try that!
I highly suspect it's
Good point! I will add a dropdown menu. |
Hey @lwouis, some updates: [About overriding I did some experiments to override
[Make The dropdown is added with options:
Some profiling: ====== I agree this is not a huge improvement in any way. But as an AltTab heavy user(thanks again for founding such an awesome project!), after a month of trying this feature, it indeed brings some lightness every time I press alt-tab. I do realize that the performance penalties in some cases could be heavy... so if you would like to put this feature on hold, I would totally understand. Let me know what you think. |
Hey @owwlo, sorry for the late response! I would like to dig deeper into the topic before moving forward to integrating this enhancement. I'd like to learn more about
I'm thinking that modern computers are really fast at graphics scaling, especially when leveraging the GPU properly, and that there must be ways to make the images better with almost no performance cost. |
@lwouis, sooooo sorry for the late reply. I got tied up with work recently. 2 weeks ago, I was playing with it during the weekend but didn't get much progress.
Interestingly, I tried the exact same snippet. I tried
I would totally agree, and I will definitely keep digging and will keep you posted in this thread(hopefully, will clear all the stuff on my hand by the end of this week 🤞 🤞 ). |
I did above. It's pretty much it. The only missing thing I guess is replacing the type with For the
I know how it is! Some days I feel overwhelmed with this project, as people keep pilling on the tickets, and very few people contribute. So take your time, and hopefully we improve image quality eventually 👍 |
@lwouis, just to share some interesting findings: Here is my codebase setup:
I tweak As you can see, they both produce identical results. @lwouis, do you see anything I missed in my experiments :) ? I even thought about the Retina Resolution(I used non-retina display to capture the results above). I tried the same code on my 13' rMBP built-in display and barely see the difference either. |
@owwlo that's weird. Here is a branch where I added the changes. It's the latest commit on that branch. It's basically what I wrote above, that you say you did without success. With that code change, I see the impact. When I replace |
@lwouis, just curious, do you use Big Sur? I searched online around and found https://developer.apple.com/forums/thread/658797?login=true&page=1#671189022. |
@owwlo oh that may explain our difference in behavior. I'm on macOS Catalina (10.15.7). |
@owwlo I was decompiling HyperSwitch today, and found how they render some thumbnails. Here's some code they call: CGContextSetShouldAntialias(rax, 0x0);
CGContextSetAllowsAntialiasing(r15, 0x0);
CGContextSetInterpolationQuality(r15, r12); That being said, they don't do on-the-fly screenshots, but use the slower public APIs like This reminded me of this PR. It's kind of a shame we never finished it. Do you think you could look at it again? |
796a3c3
to
a67d123
Compare
👀 🤔 |
7d7d9cf
to
8abb9b4
Compare
With it being OFF:
ON"