Chromium Code Reviews| Index: third_party/WebKit/Source/platform/image-encoders/ImageEncoder.h |
| diff --git a/third_party/WebKit/Source/platform/image-encoders/ImageEncoder.h b/third_party/WebKit/Source/platform/image-encoders/ImageEncoder.h |
| index b33e72deead2f37e50780ab36ea4c45541e87cc7..c9106c85bb40520c8f8103fc7c8769c4d060ddab 100644 |
| --- a/third_party/WebKit/Source/platform/image-encoders/ImageEncoder.h |
| +++ b/third_party/WebKit/Source/platform/image-encoders/ImageEncoder.h |
| @@ -10,6 +10,7 @@ |
| #include "third_party/skia/include/core/SkStream.h" |
| #include "third_party/skia/include/encode/SkJpegEncoder.h" |
| #include "third_party/skia/include/encode/SkPngEncoder.h" |
| +#include "third_party/skia/include/encode/SkWebpEncoder.h" |
| namespace blink { |
| @@ -42,6 +43,10 @@ class PLATFORM_EXPORT ImageEncoder { |
| const SkPixmap& src, |
| const SkPngEncoder::Options&); |
| + static bool Encode(Vector<unsigned char>* dst, |
| + const SkPixmap& src, |
| + const SkWebpEncoder::Options&); |
| + |
| static std::unique_ptr<ImageEncoder> Create(Vector<unsigned char>* dst, |
| const SkPixmap& src, |
| const SkJpegEncoder::Options&); |
| @@ -60,6 +65,20 @@ class PLATFORM_EXPORT ImageEncoder { |
| */ |
| static int ComputeJpegQuality(double quality); |
| + /** |
| + * Sets Skia encoding options based on the requested quality. |
| + * |
| + * If quality is 1, this will signal a lossless encode. |
| + * |
| + * Otherwise, this will use webp lossy encoding. |
| + * If quality is in [0, 1), this will simply convert to a [0, 100) |
| + * float scale (which is what is used by libwebp). If the quality |
| + * is out of range, this will use the default value. |
|
scroggo_chromium
2017/05/22 13:35:04
What is the default value? Will it be lossy or los
msarett1
2017/05/22 15:33:56
Added comments.
|
| + */ |
| + static SkWebpEncoder::Options ComputeWebpOptions( |
| + double quality, |
| + SkTransferFunctionBehavior unpremulBehavior); |
| + |
| private: |
| ImageEncoder(Vector<unsigned char>* dst) : dst_(dst) {} |