[squeak-dev] Re: Bug reading gray PNG

Andreas Raab andreas.raab at gmx.de
Fri Jan 7 08:27:06 UTC 2011


On 1/6/2011 11:20 PM, Javier Díaz Reinoso wrote:
> On 06/01/2011, at 17:02, Andreas Raab wrote:
>
>> On 1/6/2011 10:53 PM, Javier Díaz Reinoso wrote:
>>> Fail with a 217x125 gray PNG in PNGReadWriter>>copyPixelsGray:, reverting to the previous version works.
>>
>> Can you share the file you're using? Even better, write a test that illustrates the failure?
>>
>> Thanks,
>>   - Andreas
>>
> Is not the image, is bad aritmethic, try with thisScanline ->  217:

But do you have an example PNG file that causes the problem to happen? 
I'm sure the issue it's obvious to you but it's not for me.

Cheers,
   - Andreas

>> 0 to: thisScanline size - 1 // 4 do: [ :i |
>> 		| ii word |
>> 		ii := i * 4.
>> 		"This somewhat weird mixture of (#* and #+) with (#bitShift: and #bitOr:)
>> 		is to make use of faster arithmetic bytecodes, but not of slow largeintegers."
>> 		word :=
>> 			(((thisScanline at: ii + 1) * 256 +
>> 			(thisScanline at: ii + 2) * 256 +
>> 			(thisScanline at: ii + 3)) bitShift: 8) bitOr:
>> 			(thisScanline at: ii + 4).<======
>
>




More information about the Squeak-dev mailing list