package com.gh.gamecenter.common.image

import com.facebook.imagepipeline.common.ImageDecodeOptions
import com.facebook.imagepipeline.decoder.ImageDecoder
import com.facebook.imagepipeline.image.CloseableImage
import com.facebook.imagepipeline.image.EncodedImage
import com.facebook.imagepipeline.image.QualityInfo

class EmptyDecoder : ImageDecoder {
    override fun decode(
        encodedImage: EncodedImage,
        length: Int,
        qualityInfo: QualityInfo,
        options: ImageDecodeOptions
    ): CloseableImage {
        return object : CloseableImage() {
            override fun close() {
                // do nothing
            }

            override fun getWidth(): Int {
                return 0
            }

            override fun getHeight(): Int {
                return 0
            }

            override fun getSizeInBytes(): Int {
                return 0
            }

            override fun isClosed(): Boolean {
                return true
            }
        }
    }
}