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

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

Issue 2944633002: Use SkPngEncoder in gfx jpeg_codec (Closed)
Patch Set: 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/png_codec.h
diff --git a/ui/gfx/codec/png_codec.h b/ui/gfx/codec/png_codec.h
index 335b58affb051041b480d876cff5f13e37674489..db63c54f734f08264933182602611aac6d15b8c9 100644
--- a/ui/gfx/codec/png_codec.h
+++ b/ui/gfx/codec/png_codec.h
@@ -11,6 +11,8 @@
#include <vector>
#include "base/macros.h"
+#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;
@@ -51,28 +53,16 @@ class CODEC_EXPORT PNGCodec {
std::string text;
};
- // Encodes the given raw 'input' data, with each pixel being represented as
- // given in 'format'. The encoded PNG 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 PNG 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.
//
// When writing alpha values, the input colors are assumed to be post
// multiplied.
//
- // size: 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).
- // discard_transparency: when true, and when the input data format includes
- // alpha values, these alpha values will be discarded and only RGB will be
- // written to the resulting file. Otherwise, alpha values in the input
- // will be preserved.
// comments: comments to be written in the png's metadata.
- static bool Encode(const unsigned char* input,
- ColorFormat format,
- const Size& size,
- int row_byte_width,
- bool discard_transparency,
+ static bool Encode(const SkPixmap& input,
const std::vector<Comment>& comments,
std::vector<unsigned char>* output);

Powered by Google App Engine
This is Rietveld 408576698