Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: ui/gfx/codec/jpeg_codec.h

Issue 2895953003: Use SkJpegEncoder in gfx jpeg_codec (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/codec/jpeg_codec.h
diff --git a/ui/gfx/codec/jpeg_codec.h b/ui/gfx/codec/jpeg_codec.h
index 5d10be59cb1e3f21dcb79e3c2677630decc2d469..2e3b6c7aaedaf36c63ee14147a47f08cefbcd488 100644
--- a/ui/gfx/codec/jpeg_codec.h
+++ b/ui/gfx/codec/jpeg_codec.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "third_party/skia/include/core/SkImageInfo.h"
#include "ui/gfx/codec/codec_export.h"
class SkBitmap;
@@ -23,10 +24,6 @@ namespace gfx {
class CODEC_EXPORT JPEGCodec {
public:
enum ColorFormat {
- // 3 bytes per pixel (packed), in RGB order regardless of endianness.
- // This is the native JPEG format.
- FORMAT_RGB,
-
// 4 bytes per pixel, in RGBA order in mem regardless of endianness.
FORMAT_RGBA,
@@ -49,18 +46,22 @@ class CODEC_EXPORT JPEGCodec {
static LibraryVariant JpegLibraryVariant();
// 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.
+ // given in 'colorType'. 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 unsigned char* input,
+ SkColorType colorType,
dcheng 2017/06/02 15:35:00 Nit: color_type From a symmetry perspective, it's
scroggo_chromium 2017/06/02 17:35:51 Yes. We're in the process of merging Skia's decode
msarett1 2017/06/07 18:01:14 Yes, I think this is a good future goal.
+ int w,
+ int h,
+ int row_byte_width,
+ 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

Powered by Google App Engine
This is Rietveld 408576698