zjupure / GlideWebpDecoder

A Glide WebpDecoder Intergration Library for decoding and displaying webp images
Apache License 2.0
747 stars 91 forks source link

Failure rendering animation #78

Closed dstukalov closed 3 years ago

dstukalov commented 3 years ago

https://github.com/zjupure/GlideWebpDecoder/blob/1e33c7b4cfb77050f950e947b8724628e5e78794/webp_decoder/src/main/java/com/bumptech/glide/integration/webp/decoder/WebpDecoder.java#L278

frameWidth, frameHeight could be 0 due to large sampleSize and small width/height of first frame; the mBitmapProvider.obtain will fail in this case

BattleShipPark commented 3 years ago

10.webp.zip 10.webp is 512x512 and the first frame of 10.webp has 1x1 (webpinfo):

Chunk ANMF at offset 44, length 66 Offset_X: 0 Offset_Y: 0 Width: 1 Height: 1 Duration: 800 Dispose: 0 Blend: 1

When I load that webp with ImageView 257px,257px: int frameWidth = frameInfo.width / sampleSize = 1 / 1 = 1 which can play that webp.

With ImageView 256px,256px: int frameWidth = frameInfo.width / sampleSize = 1 / 2 = 0 Then mBitmapProvider.obtain() throws IllegalStateException, which can not play that webp.

zjupure commented 3 years ago

fix #79