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

@ -25,20 +25,10 @@ extern "C" {
//------------------------------------------------------------------------------
// Defines and constants.
// Object to store metadata about images.
typedef struct {
uint32_t x_offset_;
uint32_t y_offset_;
uint32_t duration_;
uint32_t width_;
uint32_t height_;
} WebPImageInfo;
// Chunk object.
typedef struct WebPChunk WebPChunk;
struct WebPChunk {
uint32_t tag_;
WebPImageInfo* image_info_;
int owner_; // True if *data_ memory is owned internally.
// VP8X, Loop, and other internally created chunks
// like frame/tile are always owned.
@ -143,10 +133,8 @@ WebPChunkId ChunkGetIdFromTag(uint32_t tag);
// nth = 0 means "last of the list".
WebPChunk* ChunkSearchList(WebPChunk* first, uint32_t nth, uint32_t tag);
// Fill the chunk with the given data & image_info.
WebPMuxError ChunkAssignDataImageInfo(WebPChunk* chunk,
const WebPData* const data,
WebPImageInfo* image_info,
// Fill the chunk with the given data.
WebPMuxError ChunkAssignData(WebPChunk* chunk, const WebPData* const data,
int copy_data, uint32_t tag);
// Sets 'chunk' at nth position in the 'chunk_list'.