Lines 120-126
Link Here
|
120 |
// tell libjpeg where to write the next data |
120 |
// tell libjpeg where to write the next data |
121 |
cinfo->dest->next_output_byte = &(*state->out)[state->image_buffer_used]; |
121 |
cinfo->dest->next_output_byte = &(*state->out)[state->image_buffer_used]; |
122 |
cinfo->dest->free_in_buffer = state->out->size() - state->image_buffer_used; |
122 |
cinfo->dest->free_in_buffer = state->out->size() - state->image_buffer_used; |
123 |
return 1; |
123 |
return TRUE; |
124 |
} |
124 |
} |
125 |
|
125 |
|
126 |
// Cleans up the JpegEncoderState to prepare for returning in the final form. |
126 |
// Cleans up the JpegEncoderState to prepare for returning in the final form. |
Lines 261-267
Link Here
|
261 |
cinfo.data_precision = 8; |
261 |
cinfo.data_precision = 8; |
262 |
|
262 |
|
263 |
jpeg_set_defaults(&cinfo); |
263 |
jpeg_set_defaults(&cinfo); |
264 |
jpeg_set_quality(&cinfo, quality, 1); // quality here is 0-100 |
264 |
jpeg_set_quality(&cinfo, quality, TRUE); // quality here is 0-100 |
265 |
|
265 |
|
266 |
// set up the destination manager |
266 |
// set up the destination manager |
267 |
jpeg_destination_mgr destmgr; |
267 |
jpeg_destination_mgr destmgr; |
Lines 273-279
Link Here
|
273 |
JpegEncoderState state(output); |
273 |
JpegEncoderState state(output); |
274 |
cinfo.client_data = &state; |
274 |
cinfo.client_data = &state; |
275 |
|
275 |
|
276 |
jpeg_start_compress(&cinfo, 1); |
276 |
jpeg_start_compress(&cinfo, TRUE); |
277 |
|
277 |
|
278 |
// feed it the rows, doing necessary conversions for the color format |
278 |
// feed it the rows, doing necessary conversions for the color format |
279 |
#ifdef JCS_EXTENSIONS |
279 |
#ifdef JCS_EXTENSIONS |
Lines 359-365
Link Here
|
359 |
// set to a positive value if TRUE is returned. A FALSE return should only |
359 |
// set to a positive value if TRUE is returned. A FALSE return should only |
360 |
// be used when I/O suspension is desired." |
360 |
// be used when I/O suspension is desired." |
361 |
boolean FillInputBuffer(j_decompress_ptr cinfo) { |
361 |
boolean FillInputBuffer(j_decompress_ptr cinfo) { |
362 |
return false; |
362 |
return FALSE; |
363 |
} |
363 |
} |
364 |
|
364 |
|
365 |
// Skip data in the buffer. Since we have all the data at once, this operation |
365 |
// Skip data in the buffer. Since we have all the data at once, this operation |
Lines 487-493
Link Here
|
487 |
cinfo.client_data = &state; |
487 |
cinfo.client_data = &state; |
488 |
|
488 |
|
489 |
// fill the file metadata into our buffer |
489 |
// fill the file metadata into our buffer |
490 |
if (jpeg_read_header(&cinfo, true) != JPEG_HEADER_OK) |
490 |
if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK) |
491 |
return false; |
491 |
return false; |
492 |
|
492 |
|
493 |
// we want to always get RGB data out |
493 |
// we want to always get RGB data out |