Broken Icon Display on macOS lazarus / 39-Graphics ---------------------------------------------------------------------- msintle · 2024-09-10 19:40 Try the attached icon (for example), it does not display correctly with Trunk, Stable, 3.4, or Fixes (FPCUPDLX). Used to work in earlier versions (pre-3.4 timeline). Any thoughts? ---------------------------------------------------------------------- paweld · 2024-09-11 04:48 And can you specify what according to you is wrong with this icon in Lazarus trunk? I checked with myself on the trunk version and according to me everything is fine ---------------------------------------------------------------------- msintle · 2024-09-11 10:35 macOS. ---------------------------------------------------------------------- circular · 2024-09-11 10:45 How do you use the icon? It would help to provide a test project. ---------------------------------------------------------------------- msintle · 2024-09-11 10:49 Just load it into a TImage, and you will see the problem. ---------------------------------------------------------------------- circular · 2024-09-11 11:14 Ok, so this seems to be an LCL bug. Checking it has not been reported yet: https://gitlab.com/freepascal.org/lazarus/lazarus/- /issues/?sort=created_date&state=opened&label_name%5B%5D=WS%3A%20Cocoa &search=icon&first_page_size=20 https://gitlab.com/freepascal.org/lazarus/lazarus/- /issues/?sort=created_date&state=opened&search=icon&search=macOS&first _page_size=20 The bug seems it hasn't been reported yet. I suggest to make a bug report there: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues Regards ---------------------------------------------------------------------- msintle · 2024-09-11 12:42 Done: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41131 Upvotes appreciated, given the severity of the issue. ---------------------------------------------------------------------- wp · 2024-09-11 13:26 Quote from: msintle on September 10, 2024, 09:40:17 pmTry the attached icon (for example), it does not display correctly [...] What do you expect? Are you aware that an icon file can contain several images, and maybe you just see one of them that you do not expect? Load the ico file as icon of a test application ("Project options" > "Load icon"; there is a scroller below the displayed icon which you can use to look at the other images in the ico. ---------------------------------------------------------------------- circular · 2024-09-11 19:16 Quote from: msintle on September 11, 2024, 02:42:54 pmDone: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41131 Upvotes appreciated, given the severity of the issue. Thank you very much for posting the bug report. The bug is now correctly identified and being fixed. As the developer taking care of it says, it is helpful to have a screenshot when it comes to visual bugs. Is it that you have difficulty making a screenshot? On MacOS, this can be achieved by pressing Shift+Cmd+4 and selecting an area of the screen. ---------------------------------------------------------------------- msintle · 2024-09-11 23:08 Didn't realize it would be such a big deal to nail down the appearance. I have attached both appearances herewith, hope it helps. First image is incorrect, the second is correct. Edit: The bug report has already reproduced the exact issue I am seeing. ---------------------------------------------------------------------- circular · 2024-09-12 06:40 That's great! We can clearly see what part is not drawn. It reduces the ambiguity about what the problem is and whether it will be solved. Thank you very much indeed. ---------------------------------------------------------------------- msintle · 2024-09-12 11:36 Quote from: circular on September 12, 2024, 08:40:02 amThat's great! We can clearly see what part is not drawn. It reduces the ambiguity about what the problem is and whether it will be solved. Thank you very much indeed.  You are absolutely very welcome, can we be hopeful for any fix ETA? ---------------------------------------------------------------------- wp · 2024-09-12 11:59 ETA = estimated time of arrival? Don't ask, we're all volunteers without payment. You could help by working on the issue yourself and send a patch. That's "open source". ---------------------------------------------------------------------- msintle · 2024-09-12 14:22 Quote from: wp on September 12, 2024, 01:59:36 pmETA = estimated time of arrival? Don't ask, we're all volunteers without payment. You could help by working on the issue yourself and send a patch. That's "open source". Yeah I know. We've sponsored some bug bounties for the aarch64 build of Lazarus on Windows, and we could also sponsor bug bounties here too, I suppose. It's just disappointing to have to deal with so many regressions all at once, on top of actually shipping our own code, if you know what I mean? I mean this - and https://forum.lazarus.freepascal.org/index.php/topic,68506.0.html - are regressions pure and simple. One would hope it'd be a matter of just rolling back the errant changes, but what do I know, right? There could be many underlying reasons of which I am currently totally unaware. ---------------------------------------------------------------------- wp · 2024-09-12 14:25 If you use Lazarus/FPC in production you should not base your software on the main (trunk) versions. They are in active development, and it is always possible that bugs creep in. ---------------------------------------------------------------------- msintle · 2024-09-12 14:46 Quote from: wp on September 12, 2024, 04:25:18 pmIf you use Lazarus/FPC in production you should not base your software on the main (trunk) versions. They are in active development, and it is always possible that bugs creep in. That is absolutely correct, but our software actually only runs on the trunk version (for now at least), so we're in a bit of a bind. The good news is that the response here at the forums - and at GitLab - has been absolutely commendable, this is greatly appreciated. Thank you very much once again to everyone involved - I can say easily no commercial company today is likely to match this level of support!!! ---------------------------------------------------------------------- circular · 2024-09-13 05:06 Regarding regressions, this could be avoided with some level of unit testing. Of course writing tests takes time, so we may not have the bandwidth to implement them. There is a framework for unit testing. So it is possible to create unit tests with Lazarus: https://sergworks.wordpress.com/2012/08/31/introduction-to-unit- testing-with-lazarus/ I don't know if there are some for the LCL. Quote from: wp on September 12, 2024, 01:59:36 pmETA = estimated time of arrival? Don't ask, we're all volunteers without payment. You could help by working on the issue yourself and send a patch. That's "open source". While I get your point and agree that we may not be able to solve issues quickly, bugs may impact various people and so there is some motivation to take care of bugs. Regarding the ETA, I guess the answer is simply that we don't have time estimates. And making time estimates... does take time. ---------------------------------------------------------------------- dsiders · 2024-09-13 05:31 Quote from: circular on September 13, 2024, 07:06:36 amI don't know if there are some for the LCL. See $(LazarusDir)/test/. ---------------------------------------------------------------------- circular · 2024-09-14 00:15 Thanks dsiders for locating the test folder. So there is a base structure for testing, however very few tests are implemented. ---------------------------------------------------------------------- wp · 2024-09-14 11:09 How would you write a test for visual issues like this one? ---------------------------------------------------------------------- dsiders · 2024-09-14 20:07 Quote from: wp on September 14, 2024, 01:09:13 pmHow would you write a test for visual issues like this one? Exactly. ---------------------------------------------------------------------- lainz · 2024-09-14 20:26 Take a screenshot of the bitmap area, and compare pixel by pixel with some other bitmap. ---------------------------------------------------------------------- wp · 2024-09-14 20:40 How would you handle transparency then (alpha channel of png images, or mask of ico images)? ---------------------------------------------------------------------- lainz · 2024-09-14 20:54 Quote from: wp on September 14, 2024, 10:40:43 pmHow would you handle transparency then (alpha channel of png images, or mask of ico images)? Easy. Blend the example bitmap (that's the same as the target ico) with a background, that's the same background of the form where is placed the icon. You need to use the same technique used by the LCL to compute the alpha. ---------------------------------------------------------------------- circular · 2024-09-16 07:51 Quote from: lainz on September 14, 2024, 10:54:02 pmQuote from: wp on September 14, 2024, 10:40:43 pmHow would you handle transparency then (alpha channel of png images, or mask of ico images)? You need to use the same technique used by the LCL to compute the alpha. Indeed, that would be a linear blend (dmLinearBlend in BGRABitmap). Though as you said before, one can rely on a screenshot, to have minimal dependencies. ---------------------------------------------------------------------- lainz · 2024-09-16 16:29 Quote from: circular on September 16, 2024, 09:51:47 amQuote from: lainz on September 14, 2024, 10:54:02 pmQuote from: wp on September 14, 2024, 10:40:43 pmHow would you handle transparency then (alpha channel of png images, or mask of ico images)? You need to use the same technique used by the LCL to compute the alpha. Indeed, that would be a linear blend (dmLinearBlend in BGRABitmap). Though as you said before, one can rely on a screenshot, to have minimal dependencies. And what about the gamma correction? in BGRABitmap? ---------------------------------------------------------------------- circular · 2024-09-16 17:40 The gamma correction is when the blend is not linear. When drawing on the canvas, it is using system rendering that is always linear in my experience, so no gamma involved. ---------------------------------------------------------------------- lainz · 2024-09-16 17:53 Quote from: circular on September 16, 2024, 07:40:20 pmThe gamma correction is when the blend is not linear. When drawing on the canvas, it is using system rendering that is always linear in my experience, so no gamma involved. Ok thanks. So BGRABitmap can be used to make the test. ---------------------------------------------------------------------- circular · 2024-09-17 07:46 Well in this case, this could be done purely with the LCL as follows: - on a canvas, fill with a color - then draw the icon (in dev, save the result into a file as BMP) - compare the result with the BMP (pixel by pixel or byte by byte) BGRABitmap could help for the pixel by pixel comparison, though it is not necessary. In fact, in the test, it would be better to have minimal dependencies, to test for the LCL itself. Also BGRABitmap could override the icon format handlers and hide the problem away somehow. ---------------------------------------------------------------------- msintle · 2024-09-17 20:09 This issue has been definitively resolved - thank you all, including rich of course!