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

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

Issue 2895953003: Use SkJpegEncoder in gfx jpeg_codec (Closed)
Patch Set: Remove brackets Created 3 years, 6 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 fbc07903ebc8a5cae6f5b6b36dbacc119c91632f..1fdd143e8d757cb21cbd125f48f6939b710f586e 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,25 @@ 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,
+ int quality,
+ std::vector<unsigned char>* output);
+
+ // Encodes the 'input' bitmap. 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.
+ //
+ // quality: an integer in the range 0-100, where 100 is the highest quality.
+ static bool Encode(const SkBitmap& input,
+ 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