[Spice-devel] [PATCH spice-html5] support decompressing LZ_IMAGE_TYPE_XXXA images

Aric Stewart aric at codeweavers.com
Tue Oct 9 08:32:26 PDT 2012


You are correct I will remove that line and resend.

-aric

On 10/9/12 8:48 AM, Jeremy White wrote:
>> -function convert_spice_lz_rgb_to_web(context, lz_rgb)
>> +function convert_spice_lz_to_web(context, lz_image)
>> {
>> -    var u8 = new Uint8Array(lz_rgb.data);
>>      var at;
>> -    if (lz_rgb.type != LZ_IMAGE_TYPE_RGB32 && lz_rgb.type != LZ_IMAGE_TYPE_RGBA)
>> -        return undefined;
>> -
>> -    var ret = context.createImageData(lz_rgb.width, lz_rgb.height);
>> +    if (lz_image.type === LZ_IMAGE_TYPE_RGB32 || lz_image.type === LZ_IMAGE_TYPE_RGBA)
>> +    {
>> +        var u8 = new Uint8Array(lz_image.data);
>> +        var ret = context.createImageData(lz_image.width, lz_image.height);
>>
>> -    at = lz_rgb32_decompress(u8, 0, ret.data, LZ_IMAGE_TYPE_RGB32, lz_rgb.type != LZ_IMAGE_TYPE_RGBA);
>> -    if (lz_rgb.type == LZ_IMAGE_TYPE_RGBA)
>> -        lz_rgb32_decompress(u8, at, ret.data, LZ_IMAGE_TYPE_RGBA, false);
>> +        at = lz_rgb32_decompress(u8, 0, ret.data, LZ_IMAGE_TYPE_RGB32, lz_image.type != LZ_IMAGE_TYPE_RGBA);
>> +        if (lz_image.type == LZ_IMAGE_TYPE_RGBA)
>> +            lz_rgb32_decompress(u8, at, ret.data, LZ_IMAGE_TYPE_RGBA, false);
>> +    }
>> +    else if (lz_image.type === LZ_IMAGE_TYPE_XXXA)
>> +    {
>> +        var u8 = new Uint8Array(lz_image.data);
>> +        var ret = context.createImageData(lz_image.width, lz_image.height);
>> +        var i = lz_image.width * lz_image.height * 4;
>> +        do {ret.data[i--]=0;} while( i > 0);
> 
>             ^^^^^^
> 
> Is this really necessary?  Doesn't createImageData purport to create
> the images as transparent black already?
> 
> Cheers,
> 
> Jeremy
> 


More information about the Spice-devel mailing list