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

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: Fixing memory leak Created 6 years, 10 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 | « content/browser/frame_host/navigation_entry_screenshot_manager.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 abb3eaab32c952195791ff4b9684e86b2a1d5579..5f849c462fc024748b6f9230c0775e997556b2ba 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);
+
// 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'
« no previous file with comments | « content/browser/frame_host/navigation_entry_screenshot_manager.cc ('k') | ui/gfx/codec/png_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698