Chromium Code Reviews| Index: ui/gfx/codec/jpeg_codec.h |
| diff --git a/ui/gfx/codec/jpeg_codec.h b/ui/gfx/codec/jpeg_codec.h |
| index fbc07903ebc8a5cae6f5b6b36dbacc119c91632f..0ac772e36d0b604088cb318ed9f3201e0d4a1337 100644 |
| --- a/ui/gfx/codec/jpeg_codec.h |
| +++ b/ui/gfx/codec/jpeg_codec.h |
| @@ -10,6 +10,8 @@ |
| #include <memory> |
| #include <vector> |
| +#include "third_party/skia/include/core/SkImageInfo.h" |
| +#include "third_party/skia/include/core/SkPixmap.h" |
| #include "ui/gfx/codec/codec_export.h" |
| class SkBitmap; |
| @@ -35,19 +37,20 @@ class CODEC_EXPORT JPEGCodec { |
| FORMAT_SkBitmap |
| }; |
| - // Encodes the given raw 'input' data, with each pixel being represented as |
| - // given in 'format'. The encoded JPEG data will be written into the supplied |
| - // vector and true will be returned on success. On failure (false), the |
| - // contents of the output buffer are undefined. |
| + // Encodes the given raw 'input' pixmap, which includes a pointer to pixels |
| + // as well as information describing the pixel format. The encoded JPEG data |
| + // will be written into the supplied vector and true will be returned on |
| + // success. On failure (false), the contents of the output buffer are |
| + // undefined. |
| // |
| // w, h: dimensions of the image |
| // row_byte_width: the width in bytes of each row. This may be greater than |
| // w * bytes_per_pixel if there is extra padding at the end of each row |
| // (often, each row is padded to the next machine word). |
| // quality: an integer in the range 0-100, where 100 is the highest quality. |
| - static bool Encode(const unsigned char* input, ColorFormat format, |
| - int w, int h, int row_byte_width, |
| - int quality, std::vector<unsigned char>* output); |
| + static bool Encode(const SkPixmap& input, |
|
dcheng
2017/06/12 20:35:43
Any reason not to use SkBitmap? This avoids all th
msarett1
2017/06/12 20:57:56
This is a good question, especially because there
dcheng
2017/06/12 21:00:15
Adding an overload is fine. I'd be ok with SkPixma
msarett1
2017/06/12 21:43:11
Done.
|
| + int quality, |
| + std::vector<unsigned char>* output); |
| // Decodes the JPEG data contained in input of length input_size. The |
| // decoded data will be placed in *output with the dimensions in *w and *h |