summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 18:28:24 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 18:28:24 +0000
commitaa310e9f8b2e3d5c8efc4ad977ee43e3e9349606 (patch)
tree3f89d116d7850b430c65fd5daabb86792956177e /chrome
parent569b1106f62d531c11f857f08961f41efe2b272e (diff)
downloadchromium_src-aa310e9f8b2e3d5c8efc4ad977ee43e3e9349606.zip
chromium_src-aa310e9f8b2e3d5c8efc4ad977ee43e3e9349606.tar.gz
chromium_src-aa310e9f8b2e3d5c8efc4ad977ee43e3e9349606.tar.bz2
Add a PNGEncoder helper function that takes an SkBitmap,
which is how PNGEncode is used almost everywhere. This should be strictly no functional change, except for the ImageFilterPeer::DataReady case, where we now take an SkAutoLockPixels where previously we did not. Review URL: http://codereview.chromium.org/18347 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rwxr-xr-x[-rw-r--r--]chrome/browser/fav_icon_helper.cc7
-rwxr-xr-x[-rw-r--r--]chrome/browser/gears_integration.cc8
-rwxr-xr-x[-rw-r--r--]chrome/browser/importer/importer.cc5
-rwxr-xr-x[-rw-r--r--]chrome/browser/webdata/web_database.cc6
-rwxr-xr-x[-rw-r--r--]chrome/common/security_filter_peer.cc9
5 files changed, 6 insertions, 29 deletions
diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc
index 6722336fb..cd6808b 100644..100755
--- a/chrome/browser/fav_icon_helper.cc
+++ b/chrome/browser/fav_icon_helper.cc
@@ -84,12 +84,7 @@ void FavIconHelper::SetFavIcon(
if (GetHistoryService() && !profile()->IsOffTheRecord()) {
std::vector<unsigned char> image_data;
- SkAutoLockPixels icon_lock(sized_image);
- PNGEncoder::Encode(
- reinterpret_cast<unsigned char*>(sized_image.getPixels()),
- PNGEncoder::FORMAT_BGRA, sized_image.width(),
- sized_image.height(), sized_image.width()* 4, false,
- &image_data);
+ PNGEncoder::EncodeBGRASkBitmap(sized_image, false, &image_data);
GetHistoryService()->SetFavIcon(i->second.url, i->second.fav_icon_url,
image_data);
}
diff --git a/chrome/browser/gears_integration.cc b/chrome/browser/gears_integration.cc
index 580acba..0801cd6 100644..100755
--- a/chrome/browser/gears_integration.cc
+++ b/chrome/browser/gears_integration.cc
@@ -117,13 +117,7 @@ static GURL ConvertSkBitmapToDataURL(const SkBitmap& icon) {
// Get the FavIcon data.
std::vector<unsigned char> icon_data;
- {
- SkAutoLockPixels icon_lock(icon);
- PNGEncoder::Encode(static_cast<unsigned char*>(icon.getPixels()),
- PNGEncoder::FORMAT_BGRA, icon.width(),
- icon.height(), icon.width()* 4, false,
- &icon_data);
- }
+ PNGEncoder::EncodeBGRASkBitmap(icon, false, &icon_data);
// Base64-encode it (to make it a data URL).
std::string icon_data_str(reinterpret_cast<char*>(&icon_data[0]),
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 52a035d..f3cb392 100644..100755
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -389,10 +389,7 @@ bool Importer::ReencodeFavicon(const unsigned char* src_data, size_t src_len,
}
// Encode our bitmap as a PNG.
- SkAutoLockPixels decoded_lock(decoded);
- PNGEncoder::Encode(reinterpret_cast<unsigned char*>(decoded.getPixels()),
- PNGEncoder::FORMAT_BGRA, decoded.width(),
- decoded.height(), decoded.width() * 4, false, png_data);
+ PNGEncoder::EncodeBGRASkBitmap(decoded, false, png_data);
return true;
}
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index af78244..83fa217 100644..100755
--- a/chrome/browser/webdata/web_database.cc
+++ b/chrome/browser/webdata/web_database.cc
@@ -201,11 +201,7 @@ bool WebDatabase::SetWebAppImage(const GURL& url,
}
std::vector<unsigned char> image_data;
-
- SkAutoLockPixels pixel_lock(image);
- PNGEncoder::Encode(reinterpret_cast<unsigned char*>(image.getPixels()),
- PNGEncoder::FORMAT_BGRA, image.width(),
- image.height(), image.width() * 4, false, &image_data);
+ PNGEncoder::EncodeBGRASkBitmap(image, false, &image_data);
s.bind_string(0, history::HistoryDatabase::GURLToDatabaseURL(url));
s.bind_int(1, image.width());
diff --git a/chrome/common/security_filter_peer.cc b/chrome/common/security_filter_peer.cc
index 58db3ee..e984bc4 100644..100755
--- a/chrome/common/security_filter_peer.cc
+++ b/chrome/common/security_filter_peer.cc
@@ -298,13 +298,8 @@ bool ImageFilterPeer::DataReady() {
// Now encode it to a PNG.
std::vector<unsigned char> output;
- unsigned char* input =
- static_cast<unsigned char*>(canvas.getDevice()->accessBitmap(false).
- getPixels());
- if (!PNGEncoder::Encode(input,
- PNGEncoder::FORMAT_BGRA,
- image.width(), image.height(),
- image.width() * 4, false, &output)) {
+ if (!PNGEncoder::EncodeBGRASkBitmap(canvas.getDevice()->accessBitmap(false),
+ false, &output)) {
return false;
}