OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 std::unique_ptr<JPEGImageEncoderState> JPEGImageEncoderState::create( | 135 std::unique_ptr<JPEGImageEncoderState> JPEGImageEncoderState::create( |
136 const IntSize& imageSize, | 136 const IntSize& imageSize, |
137 const double& quality, | 137 const double& quality, |
138 Vector<unsigned char>* output) { | 138 Vector<unsigned char>* output) { |
139 if (imageSize.width() <= 0 || imageSize.height() <= 0) | 139 if (imageSize.width() <= 0 || imageSize.height() <= 0) |
140 return nullptr; | 140 return nullptr; |
141 | 141 |
142 std::unique_ptr<JPEGImageEncoderStateImpl> encoderState = | 142 std::unique_ptr<JPEGImageEncoderStateImpl> encoderState = |
143 makeUnique<JPEGImageEncoderStateImpl>(); | 143 WTF::makeUnique<JPEGImageEncoderStateImpl>(); |
144 | 144 |
145 jpeg_compress_struct* cinfo = encoderState->cinfo(); | 145 jpeg_compress_struct* cinfo = encoderState->cinfo(); |
146 jpeg_error_mgr* error = encoderState->error(); | 146 jpeg_error_mgr* error = encoderState->error(); |
147 cinfo->err = jpeg_std_error(error); | 147 cinfo->err = jpeg_std_error(error); |
148 error->error_exit = handleError; | 148 error->error_exit = handleError; |
149 | 149 |
150 SET_JUMP_BUFFER(cinfo, nullptr); | 150 SET_JUMP_BUFFER(cinfo, nullptr); |
151 | 151 |
152 JPEGOutputBuffer* destination = encoderState->outputBuffer(); | 152 JPEGOutputBuffer* destination = encoderState->outputBuffer(); |
153 destination->output = output; | 153 destination->output = output; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 std::unique_ptr<JPEGImageEncoderState> encoderState = | 250 std::unique_ptr<JPEGImageEncoderState> encoderState = |
251 JPEGImageEncoderState::create(imageData.size(), quality, output); | 251 JPEGImageEncoderState::create(imageData.size(), quality, output); |
252 if (!encoderState) | 252 if (!encoderState) |
253 return false; | 253 return false; |
254 | 254 |
255 return JPEGImageEncoder::encodeWithPreInitializedState( | 255 return JPEGImageEncoder::encodeWithPreInitializedState( |
256 std::move(encoderState), imageData.pixels()); | 256 std::move(encoderState), imageData.pixels()); |
257 } | 257 } |
258 | 258 |
259 } // namespace blink | 259 } // namespace blink |
OLD | NEW |