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

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

Issue 2944633002: Use SkPngEncoder in gfx jpeg_codec (Closed)
Patch Set: Cast Created 3 years, 5 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
« no previous file with comments | « ui/gfx/codec/jpeg_codec.cc ('k') | ui/gfx/codec/png_codec.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dc55eacff7b4021031bc2cde8d2e47381b5439c5 100644
--- a/ui/gfx/codec/png_codec.h
+++ b/ui/gfx/codec/png_codec.h
@@ -27,6 +27,8 @@ class Size;
// things, partially downloaded data.
class CODEC_EXPORT PNGCodec {
public:
+ static constexpr int DEFAULT_ZLIB_COMPRESSION = 6;
+
enum ColorFormat {
// 4 bytes per pixel, in RGBA order in memory regardless of endianness.
FORMAT_RGBA,
@@ -35,10 +37,10 @@ class CODEC_EXPORT PNGCodec {
// This is the default Windows DIB order.
FORMAT_BGRA,
- // SkBitmap format. For Encode() kARGB_8888_Config (4 bytes per pixel) and
- // kA8_Config (1 byte per pixel) formats are supported. kA8_Config gets
- // encoded into a grayscale PNG treating alpha as the color intensity.
- // For Decode() kARGB_8888_Config is always used.
+ // SkBitmap format. For Encode() kN32_SkColorType (4 bytes per pixel) and
+ // kAlpha_8_SkColorType (1 byte per pixel) formats are supported.
+ // kAlpha_8_SkColorType gets encoded into a grayscale PNG treating alpha as
+ // the color intensity. For Decode() kN32_SkColorType is always used.
FORMAT_SkBitmap
};
@@ -76,10 +78,10 @@ class CODEC_EXPORT PNGCodec {
const std::vector<Comment>& comments,
std::vector<unsigned char>* output);
- // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed
- // to be kARGB_8888_Config, 32 bits per pixel. The params
- // |discard_transparency| and |output| are passed directly to Encode; refer to
- // Encode for more information.
+ // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed to
+ // be kN32_SkColorType, 32 bits per pixel. The params |discard_transparency|
+ // and |output| are passed directly to Encode; refer to Encode for more
+ // information.
static bool EncodeBGRASkBitmap(const SkBitmap& input,
bool discard_transparency,
std::vector<unsigned char>* output);
@@ -91,10 +93,10 @@ class CODEC_EXPORT PNGCodec {
bool discard_transparency,
std::vector<unsigned char>* output);
- // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed
- // to be kA8_Config, 8 bits per pixel. The bitmap is encoded as a grayscale
- // PNG with alpha used for color intensity. The |output| param is passed
- // directly to Encode; refer to Encode for more information.
+ // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed to
+ // be kAlpha_8_SkColorType, 8 bits per pixel. The bitmap is encoded as a
+ // grayscale PNG with alpha used for color intensity. The |output| param is
+ // passed directly to Encode; refer to Encode for more information.
static bool EncodeA8SkBitmap(const SkBitmap& input,
std::vector<unsigned char>* output);
« no previous file with comments | « ui/gfx/codec/jpeg_codec.cc ('k') | ui/gfx/codec/png_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698