refactoring

This commit is contained in:
Devaev Maxim
2019-03-04 15:07:16 +03:00
parent 3ae8818b3d
commit 5d49018bb2

View File

@@ -123,7 +123,7 @@ static void _jpeg_set_dest_picture(j_compress_ptr jpeg, unsigned char *picture,
))); )));
} }
dest = (struct _mjpg_destination_mgr *) jpeg->dest; dest = (struct _mjpg_destination_mgr *)jpeg->dest;
dest->mgr.init_destination = _jpeg_init_destination; dest->mgr.init_destination = _jpeg_init_destination;
dest->mgr.empty_output_buffer = _jpeg_empty_output_buffer; dest->mgr.empty_output_buffer = _jpeg_empty_output_buffer;
dest->mgr.term_destination = _jpeg_term_destination; dest->mgr.term_destination = _jpeg_term_destination;
@@ -257,7 +257,7 @@ static void _jpeg_write_scanlines_rgb24(
#define JPEG_OUTPUT_BUFFER_SIZE 4096 #define JPEG_OUTPUT_BUFFER_SIZE 4096
static void _jpeg_init_destination(j_compress_ptr jpeg) { static void _jpeg_init_destination(j_compress_ptr jpeg) {
struct _mjpg_destination_mgr *dest = (struct _mjpg_destination_mgr *) jpeg->dest; struct _mjpg_destination_mgr *dest = (struct _mjpg_destination_mgr *)jpeg->dest;
// Allocate the output buffer - it will be released when done with image // Allocate the output buffer - it will be released when done with image
assert((dest->buffer = (JOCTET *)(*jpeg->mem->alloc_small)( assert((dest->buffer = (JOCTET *)(*jpeg->mem->alloc_small)(
@@ -271,7 +271,7 @@ static void _jpeg_init_destination(j_compress_ptr jpeg) {
static boolean _jpeg_empty_output_buffer(j_compress_ptr jpeg) { static boolean _jpeg_empty_output_buffer(j_compress_ptr jpeg) {
// Called whenever local jpeg buffer fills up // Called whenever local jpeg buffer fills up
struct _mjpg_destination_mgr *dest = (struct _mjpg_destination_mgr *) jpeg->dest; struct _mjpg_destination_mgr *dest = (struct _mjpg_destination_mgr *)jpeg->dest;
memcpy(dest->outbuffer_cursor, dest->buffer, JPEG_OUTPUT_BUFFER_SIZE); memcpy(dest->outbuffer_cursor, dest->buffer, JPEG_OUTPUT_BUFFER_SIZE);
dest->outbuffer_cursor += JPEG_OUTPUT_BUFFER_SIZE; dest->outbuffer_cursor += JPEG_OUTPUT_BUFFER_SIZE;
@@ -287,7 +287,7 @@ static void _jpeg_term_destination(j_compress_ptr jpeg) {
// Called by jpeg_finish_compress after all data has been written. // Called by jpeg_finish_compress after all data has been written.
// Usually needs to flush buffer // Usually needs to flush buffer
struct _mjpg_destination_mgr *dest = (struct _mjpg_destination_mgr *) jpeg->dest; struct _mjpg_destination_mgr *dest = (struct _mjpg_destination_mgr *)jpeg->dest;
size_t data_count = JPEG_OUTPUT_BUFFER_SIZE - dest->mgr.free_in_buffer; size_t data_count = JPEG_OUTPUT_BUFFER_SIZE - dest->mgr.free_in_buffer;
// Write any data remaining in the buffer // Write any data remaining in the buffer