| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_CODEC_JPEG_CODEC_H_ | 5 #ifndef UI_GFX_CODEC_JPEG_CODEC_H_ |
| 6 #define UI_GFX_CODEC_JPEG_CODEC_H_ | 6 #define UI_GFX_CODEC_JPEG_CODEC_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 |
| 10 #include <memory> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
| 12 | 14 |
| 13 class SkBitmap; | 15 class SkBitmap; |
| 14 | 16 |
| 15 namespace gfx { | 17 namespace gfx { |
| 16 | 18 |
| 17 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, | 19 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, |
| 18 // which has an inconvenient interface for callers. This is only used for UI | 20 // which has an inconvenient interface for callers. This is only used for UI |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 64 |
| 63 // Decodes the JPEG data contained in input of length input_size. The | 65 // Decodes the JPEG data contained in input of length input_size. The |
| 64 // decoded data will be placed in *output with the dimensions in *w and *h | 66 // decoded data will be placed in *output with the dimensions in *w and *h |
| 65 // on success (returns true). This data will be written in the'format' | 67 // on success (returns true). This data will be written in the'format' |
| 66 // format. On failure, the values of these output variables is undefined. | 68 // format. On failure, the values of these output variables is undefined. |
| 67 static bool Decode(const unsigned char* input, size_t input_size, | 69 static bool Decode(const unsigned char* input, size_t input_size, |
| 68 ColorFormat format, std::vector<unsigned char>* output, | 70 ColorFormat format, std::vector<unsigned char>* output, |
| 69 int* w, int* h); | 71 int* w, int* h); |
| 70 | 72 |
| 71 // Decodes the JPEG data contained in input of length input_size. If | 73 // Decodes the JPEG data contained in input of length input_size. If |
| 72 // successful, a SkBitmap is created and returned. It is up to the caller | 74 // successful, a SkBitmap is created and returned. |
| 73 // to delete the returned bitmap. | 75 static std::unique_ptr<SkBitmap> Decode(const unsigned char* input, |
| 74 static SkBitmap* Decode(const unsigned char* input, size_t input_size); | 76 size_t input_size); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace gfx | 79 } // namespace gfx |
| 78 | 80 |
| 79 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ | 81 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ |
| OLD | NEW |