[squeak-dev] The Trunk: Morphic-nice.531.mcz

Bert Freudenberg bert at freudenbergs.de
Sun May 8 19:53:32 UTC 2011


On 08.05.2011, at 13:57, Nicolas Cellier wrote:

> 2011/5/8 Bert Freudenberg <bert at freudenbergs.de>:
>> 
>> On 08.05.2011, at 11:35, commits at source.squeak.org wrote:
>> 
>>> Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
>>> http://source.squeak.org/trunk/Morphic-nice.531.mcz
>>> 
>>> ==================== Summary ====================
>>> 
>>> Name: Morphic-nice.531
>>> Author: nice
>>> Time: 29 April 2011, 9:44:35.371 am
>>> UUID: 1e81083b-8ec1-4a0b-b1ba-5c201990e70e
>>> Ancestors: Morphic-ul.530
>>> 
>>> Quick hack (#fixAlpha) to fix this bug:
>>> 
>>> ((TextStyle defaultFont characterFormAt: $T) magnifyBy: 16) asMorph imageForm asMorph openInWorld
>>> 
>>> This workaround just adds noise and don't solve the root cause.
>>> 
>>> Anyway, invoking #translucentImage: with a non translucent argument just because an #isOpaque flag was not set in an ImageMorph is worth a refactoring IMHO
>>> 
>>> =============== Diff against Morphic-ul.530 ===============
>>> 
>>> Item was added:
>>> + ----- Method: FormCanvas>>translucentImage:at:sourceRect: (in category 'drawing-images') -----
>>> + translucentImage: aForm at: aPoint sourceRect: sourceRect
>>> +     "Workaround because copying 16bits->32bits image does not fill the alpha channel"
>>> +     super translucentImage: aForm at: aPoint sourceRect: sourceRect.
>>> +     aForm isTranslucent ifFalse: [form fixAlpha]!
>> 
>> This is a horrible place to put this "workaround". Drawing will usually go the Display, which usually is a HUGE bitmap. fixAlpha will touch all the pixels in that bitmap, even if you are drawing a tiny image.
>> 
>> - Bert -
>> 
>> 
> 
> Then I have another workaround possible: invoke drawImage: instead of
> translucentImage:
> Would it be ok ?

It already is using drawImage, because 16 bit forms can not be translucent. I uploaded a patch that fixes alpha in the affected portion of the target only.

I'm still a bit uneasy about this, because it impacts performance when it maybe is not needed. Perhaps the Right Thing would be to only put it into #imageForm:forRectangle:, because that is not used in performance-critical code.

- Bert -




More information about the Squeak-dev mailing list