WEEK 11: Fixed 32bpp text in buttons

This week, I finally got to the bottom of this issue. I will describe the cause and the fix.
Now we have the MacButton widget, which inherits from MacText. Basically, we have MacText, which has a shape drawn around it, and that is MacButton for you (a cursory description). I spent time trying to find something around.
The color we use for rendering text is not the one provided to the widget but the ones stored in _textLines chunks of MacText.
This then led me to drawString() of Font namespace, then to drawChar(), and then to MacFONTFont::drawChar(), where the surface is filled with pixel data at relevant places.

Now, this flow did not have the issue. It worked as expected. I checked this for anything wrong but everything till the surface population seemed correct.
In the end, It turned out to be this. As you can see, values below 255 were inherently supposed to be 8bpp, and that is where the issue lied. I caught this by passing 100 and 150 as the bgcolor for the MacButton widget. When we might expect a gray color in case of 32bpp, I got green and blue. This clearly meant that it was 8bpp behaviour.

I got around this by templating this function for 8bpp and 32bpp surfaces, as the function which calls it is also templated according to surface. The changes are here.

Apart from this, I got an outline of how to implement the PopUpMenuXObj from sev, where I had some doubts regarding when to render the expanded menu list. That is something I would be completing now, along with the window optiones issue I had paused for some time earlier.

Looking for a great week ahead 😀

Leave a Reply

Your email address will not be published. Required fields are marked *