Ticket #707: patchifftransparency.diff

File patchifftransparency.diff, 1.1 KB (added by Carl Eugen Hoyos, 15 years ago)
  • libavcodec/iff.c

    diff --git a/libavcodec/iff.c b/libavcodec/iff.c
    index 7a11d43..c0e4eb4 100644
    a b static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)  
    165165            pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample);
    166166        }
    167167    }
     168    if (s->masking == MASK_HAS_TRANSPARENT_COLOR &&
     169        s->transparency < 1 << avctx->bits_per_coded_sample)
     170        pal[s->transparency] &= 0xFFFFFF;
    168171    return 0;
    169172}
    170173
    static int extract_header(AVCodecContext *const avctx,  
    216219        s->flags        = bytestream_get_byte(&buf);
    217220        s->transparency = bytestream_get_be16(&buf);
    218221        s->masking      = bytestream_get_byte(&buf);
    219         if (s->masking == MASK_HAS_TRANSPARENT_COLOR) {
    220             av_log(avctx, AV_LOG_ERROR, "Transparency not supported\n");
    221             return AVERROR_PATCHWELCOME;
    222         } else if (s->masking != MASK_NONE) {
     222        if (s->masking != MASK_NONE && s->masking != MASK_HAS_TRANSPARENT_COLOR) {
    223223            av_log(avctx, AV_LOG_ERROR, "Masking not supported\n");
    224224            return AVERROR_PATCHWELCOME;
    225225        }