summaryrefslogtreecommitdiffstats
path: root/ui/gfx/codec
diff options
context:
space:
mode:
authorreed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 03:02:30 +0000
committerreed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 03:02:30 +0000
commitf37ff7167ee2ac92e6643a7587af74b880c86b89 (patch)
tree00129b82828fa77e088e92b6dfbb95212a057e8a /ui/gfx/codec
parent6a5fe3a5529ddcc9e0a9029231f2912dd588631d (diff)
downloadchromium_src-f37ff7167ee2ac92e6643a7587af74b880c86b89.zip
chromium_src-f37ff7167ee2ac92e6643a7587af74b880c86b89.tar.gz
chromium_src-f37ff7167ee2ac92e6643a7587af74b880c86b89.tar.bz2
remove PNGCodec::CreateSkBitmapFromBGRAFormat -- not referenced
optimizations I was attempting.. until I discovered it is never called. 1. need to set opaque to true when we can (it never does in the current code) 2. the scale by alpha is numerically off by 1 for opaque-alpha BUG=302003 Review URL: https://codereview.chromium.org/25251004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/codec')
-rw-r--r--ui/gfx/codec/png_codec.cc25
-rw-r--r--ui/gfx/codec/png_codec.h5
2 files changed, 0 insertions, 30 deletions
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc
index 30e4eb6..d0b348f 100644
--- a/ui/gfx/codec/png_codec.cc
+++ b/ui/gfx/codec/png_codec.cc
@@ -470,31 +470,6 @@ bool PNGCodec::Decode(const unsigned char* input, size_t input_size,
return true;
}
-// static
-SkBitmap* PNGCodec::CreateSkBitmapFromBGRAFormat(
- const std::vector<unsigned char>& bgra, int width, int height) {
- SkBitmap* bitmap = new SkBitmap();
- bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
- bitmap->allocPixels();
-
- bool opaque = false;
- unsigned char* bitmap_data =
- reinterpret_cast<unsigned char*>(bitmap->getAddr32(0, 0));
- for (int i = width * height * 4 - 4; i >= 0; i -= 4) {
- unsigned char alpha = bgra[i + 3];
- if (!opaque && alpha != 255) {
- opaque = false;
- }
- bitmap_data[i + 3] = alpha;
- bitmap_data[i] = (bgra[i] * alpha) >> 8;
- bitmap_data[i + 1] = (bgra[i + 1] * alpha) >> 8;
- bitmap_data[i + 2] = (bgra[i + 2] * alpha) >> 8;
- }
-
- bitmap->setIsOpaque(opaque);
- return bitmap;
-}
-
// Encoder --------------------------------------------------------------------
//
// This section of the code is based on nsPNGEncoder.cpp in Mozilla
diff --git a/ui/gfx/codec/png_codec.h b/ui/gfx/codec/png_codec.h
index dbb86a5..abb3eaa 100644
--- a/ui/gfx/codec/png_codec.h
+++ b/ui/gfx/codec/png_codec.h
@@ -114,11 +114,6 @@ class GFX_EXPORT PNGCodec {
static bool Decode(const unsigned char* input, size_t input_size,
SkBitmap* bitmap);
- // Create a SkBitmap from a decoded BGRA DIB. The caller owns the returned
- // SkBitmap.
- static SkBitmap* CreateSkBitmapFromBGRAFormat(
- const std::vector<unsigned char>& bgra, int width, int height);
-
private:
DISALLOW_COPY_AND_ASSIGN(PNGCodec);
};