Get rid of image_info_ from WebPChunk struct.

The image_info_ was used only in GetImageCanvasWidthHeight(). So, now
we infer it from data there.
This removal fixes a bug: earlier, 'image_info' wasn't initialized in
the WebPMuxCreate() flow, and so the canvas width/height were being
calculated to be zero.

Also, a related refactoring: Combine CreateImageInfo() and
CreateDataFromImageInfo() into a single function CreateFrameTileData().

Change-Id: I7b0afb0d36dc6e13b9d6a1135fb027aa4e03716c
This commit is contained in:
Urvang Joshi
2012-07-04 18:49:08 +05:30
parent 135ca69eb7
commit c0e8859d81
4 changed files with 113 additions and 125 deletions

View File

@ -46,7 +46,6 @@ void ChunkInit(WebPChunk* const chunk) {
WebPChunk* ChunkRelease(WebPChunk* const chunk) {
WebPChunk* next;
if (chunk == NULL) return NULL;
free(chunk->image_info_);
if (chunk->owner_) {
WebPDataClear(&chunk->data_);
}
@ -122,9 +121,7 @@ static int ChunkSearchListToSet(WebPChunk** chunk_list, uint32_t nth,
//------------------------------------------------------------------------------
// Chunk writer methods.
WebPMuxError ChunkAssignDataImageInfo(WebPChunk* chunk,
const WebPData* const data,
WebPImageInfo* image_info,
WebPMuxError ChunkAssignData(WebPChunk* chunk, const WebPData* const data,
int copy_data, uint32_t tag) {
// For internally allocated chunks, always copy data & make it owner of data.
if (tag == kChunks[IDX_VP8X].tag || tag == kChunks[IDX_LOOP].tag) {
@ -149,10 +146,6 @@ WebPMuxError ChunkAssignDataImageInfo(WebPChunk* chunk,
}
}
if (tag == kChunks[IDX_VP8].tag || tag == kChunks[IDX_VP8L].tag) {
chunk->image_info_ = image_info;
}
chunk->tag_ = tag;
return WEBP_MUX_OK;