Rename and improve the API to retrieve decoded area

Change-Id: Iec7e0a1361c27dcf2dc8445170ab5b400454fce9
This commit is contained in:
Pascal Massimino 2011-07-12 13:59:51 -07:00 committed by James Zern
parent bf599d74a4
commit c558bdad28
2 changed files with 22 additions and 10 deletions

View File

@ -578,10 +578,20 @@ static const WebPDecBuffer* GetOutputBuffer(const WebPIDecoder* const idec) {
return idec->params_.output;
}
const WebPDecBuffer* WebPIDecGetSamples(const WebPIDecoder* const idec,
int* last_y) {
const WebPDecBuffer* WebPIDecodedArea(const WebPIDecoder* const idec,
int* const left, int* const top,
int* const width, int* const height) {
const WebPDecBuffer* const src = GetOutputBuffer(idec);
if (last_y) *last_y = idec->params_.last_y;
if (left) *left = 0;
if (top) *top = 0;
// TODO(skal): later include handling of rotations.
if (src) {
if (width) *width = src->width;
if (height) *height = idec->params_.last_y;
} else {
if (width) *width = 0;
if (height) *height = 0;
}
return src;
}

View File

@ -249,13 +249,15 @@ uint8_t* WebPIDecGetYUV(const WebPIDecoder* const idec, int* last_y,
uint8_t** u, uint8_t** v,
int* width, int* height, int* stride, int* uv_stride);
// Generic call to retrieve output buffer information.
// Returns NULL in case of error, otherwise returns the pointer to the internal
// representation. This structure is read-only and shouldn't be modified.
// TODO(skal): instead of 'last_y' only, we should pass *left/top/right/bottom,
// to get the visible area. Esp. useful for rotation.
const WebPDecBuffer* WebPIDecGetSamples(const WebPIDecoder* const idec,
int* last_y);
// Generic call to retrieve information about the displayable area.
// If non NULL, the left/right/width/height pointers are filled with the visible
// rectangular area so far.
// Returns NULL in case the incremental decoder object is in an invalid state.
// Otherwise returns the pointer to the internal representation. This structure
// is read-only, tied to WebPIDecoder's lifespan and should not be modified.
const WebPDecBuffer* WebPIDecodedArea(const WebPIDecoder* const idec,
int* const left, int* const top,
int* const width, int* const height);
//-----------------------------------------------------------------------------
// Advanced decoding parametrization