[squeak-dev] Re: Bug reading gray PNG
Javier Díaz Reinoso
javier_diaz_r at mac.com
Thu Jan 6 22:20:30 UTC 2011
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:
> 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
|