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

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

Issue 136453009: Fix for Issue 331895: Make gesturenav screenshot greyscale (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improving the logic for format detection in EncodeWithCompressionLevel() Created 6 years, 11 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 abb3eaab32c952195791ff4b9684e86b2a1d5579..41f5d219e59f9b4e2372d0dcfffb18a53fb5f229 100644
--- a/ui/gfx/codec/png_codec.h
+++ b/ui/gfx/codec/png_codec.h
@@ -37,8 +37,10 @@ class GFX_EXPORT PNGCodec {
// This is the default Windows DIB order.
FORMAT_BGRA,
- // 4 bytes per pixel, in pre-multiplied kARGB_8888_Config format. For use
- // with directly writing to a skia bitmap.
+ // 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.
FORMAT_SkBitmap
};
@@ -77,9 +79,10 @@ class GFX_EXPORT PNGCodec {
std::vector<unsigned char>* output);
// Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed
- // to be BGRA, 32 bits per pixel. The params |discard_transparency| and
- // |output| are passed directly to Encode; refer to Encode for more
- // information. During the call, an SkAutoLockPixels lock is held on |input|.
+ // 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. During the call, an SkAutoLockPixels lock
+ // is held on |input|.
static bool EncodeBGRASkBitmap(const SkBitmap& input,
bool discard_transparency,
std::vector<unsigned char>* output);
@@ -91,6 +94,14 @@ class GFX_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. During the call,
+ // an SkAutoLockPixels lock is held on |input|.
+ static bool EncodeA8SkBitmap(const SkBitmap& input,
+ std::vector<unsigned char>* output);
Peter Kasting 2014/01/25 03:29:58 Nit: Fix indenting
mfomitchev 2014/01/27 17:15:28 Done.
+
// Decodes the PNG data contained in input of length input_size. The
// decoded data will be placed in *output with the dimensions in *w and *h
// on success (returns true). This data will be written in the 'format'

Powered by Google App Engine
This is Rietveld 408576698