introduce a generic WebPPictureHasTransparency() function

VP8-lossy will now avoid writing an ALPH chunk if the
alpha values are trivial.

+ changed DumpPicture() accordingly in cwebp
+ prevented the -d option to be active with lossless
 (DumpPicture wouldn't work).

Change-Id: I34fdb108a2b6207e93fa6cd00b1d2509a8e1dc4b
This commit is contained in:
Pascal Massimino
2012-06-04 15:50:05 -07:00
parent d2b6c6c03b
commit 437999fb77
5 changed files with 41 additions and 13 deletions

View File

@ -281,7 +281,7 @@ static int EncodeAlpha(const uint8_t* data, int width, int height, int stride,
// Main calls
void VP8EncInitAlpha(VP8Encoder* enc) {
enc->has_alpha_ = (enc->pic_->a != NULL);
enc->has_alpha_ = WebPPictureHasTransparency(enc->pic_);
enc->alpha_data_ = NULL;
enc->alpha_data_size_ = 0;
}