From 468fec96cd171682405d30b266f71f1766396a07 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Sat, 3 Oct 2009 03:12:20 +0000 Subject: Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes into the gfx namespace. Combine the PNGEncoder and PNGDecoder. There were separate when we had different executables for the browser and renderer, and linked the encoder only in one of them (which saved us some space used by libpng). This hasn't been the case for years, so combining them (again) makes sense. TEST=none BUG=none Review URL: http://codereview.chromium.org/243076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27930 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/autocomplete/autocomplete_popup_view_gtk.cc | 2 +- chrome/browser/bookmarks/bookmark_model.cc | 6 +++--- chrome/browser/browser_theme_provider.cc | 15 +++++++-------- chrome/browser/chrome_plugin_host.cc | 1 - chrome/browser/dom_ui/dom_ui_theme_source.cc | 1 - chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc | 1 - chrome/browser/dom_ui/dom_ui_thumbnail_source.cc | 2 +- chrome/browser/dom_ui/downloads_dom_handler.cc | 3 +-- chrome/browser/dom_ui/fileicon_source.cc | 8 ++++---- chrome/browser/extensions/extension_tabs_module.cc | 6 +++--- .../browser/extensions/sandboxed_extension_unpacker.cc | 4 ++-- chrome/browser/fav_icon_helper.cc | 9 ++++----- chrome/browser/gears_integration.cc | 6 +++--- chrome/browser/gtk/list_store_favicon_loader.cc | 9 +++++---- .../browser/history/expire_history_backend_unittest.cc | 6 +++--- chrome/browser/history/history_backend_unittest.cc | 10 +++++----- chrome/browser/history/history_unittest.cc | 6 +++--- chrome/browser/history/thumbnail_database.cc | 6 +++--- chrome/browser/history/thumbnail_database_unittest.cc | 6 +++--- chrome/browser/history/top_sites.cc | 6 +++--- chrome/browser/icon_loader_linux.cc | 6 +++--- chrome/browser/importer/importer.cc | 4 ++-- chrome/browser/possible_url_model.cc | 4 ++-- .../browser/search_engines/template_url_table_model.cc | 4 ++-- chrome/browser/shell_integration_linux.cc | 4 ++-- chrome/browser/sync/glue/change_processor.cc | 4 ++-- chrome/browser/sync/profile_sync_service.cc | 1 - chrome/browser/thumbnail_store.cc | 6 +++--- chrome/browser/thumbnail_store_unittest.cc | 16 +++++++++------- chrome/browser/views/options/general_page_view.cc | 9 +++++---- chrome/browser/webdata/web_database.cc | 7 +++---- 31 files changed, 87 insertions(+), 91 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc index 450521e..a49055e 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc @@ -488,7 +488,7 @@ gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget, actual_content_width /= PANGO_SCALE; actual_content_height /= PANGO_SCALE; - DCHECK_LT(actual_content_height, kHeightPerResult); // Font is too tall. + //DCHECK_LT(actual_content_height, kHeightPerResult); // Font is too tall. // Center the text within the line. int content_y = std::max(line_rect.y(), line_rect.y() + ((kHeightPerResult - actual_content_height) / 2)); diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index 4769f90..6b3e368 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/bookmarks/bookmark_model.h" +#include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" -#include "base/gfx/png_decoder.h" #include "base/scoped_vector.h" #include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_index.h" @@ -644,7 +644,7 @@ void BookmarkModel::OnFavIconDataAvailable( DCHECK(node); node->set_favicon_load_handle(0); if (know_favicon && data.get() && - PNGDecoder::Decode(&data->data, &fav_icon)) { + gfx::PNGCodec::Decode(&data->data, &fav_icon)) { node->set_favicon(fav_icon); FavIconLoaded(node); } diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index 96f1d29..4be04498 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -4,10 +4,9 @@ #include "chrome/browser/browser_theme_provider.h" +#include "app/gfx/codec/png_codec.h" #include "app/gfx/skbitmap_operations.h" #include "base/file_util.h" -#include "base/gfx/png_decoder.h" -#include "base/gfx/png_encoder.h" #include "base/string_util.h" #include "base/thread.h" #include "base/values.h" @@ -225,7 +224,7 @@ class WriteImagesToDiskTask : public Task { if (found != themed_image_cache_.end()) { SkBitmap* bitmap = found->second; std::vector image_data; - if (!PNGEncoder::EncodeBGRASkBitmap(*bitmap, false, &image_data)) { + if (!gfx::PNGCodec::EncodeBGRASkBitmap(*bitmap, false, &image_data)) { NOTREACHED() << "Image file could not be encoded."; return; } @@ -650,16 +649,16 @@ SkBitmap* BrowserThemeProvider::LoadThemeBitmap(int id) { int image_width = 0; int image_height = 0; - if (!PNGDecoder::Decode(&raw_data.front(), raw_data.size(), - PNGDecoder::FORMAT_BGRA, &png_data, + if (!gfx::PNGCodec::Decode(&raw_data.front(), raw_data.size(), + gfx::PNGCodec::FORMAT_BGRA, &png_data, &image_width, &image_height)) { NOTREACHED() << "Unable to decode theme image resource " << id; return NULL; } - return PNGDecoder::CreateSkBitmapFromBGRAFormat(png_data, - image_width, - image_height); + return gfx::PNGCodec::CreateSkBitmapFromBGRAFormat(png_data, + image_width, + image_height); } else { // TODO(glen): File no-longer exists, we're out of date. We should // clear the theme (or maybe just the pref that points to this diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc index bfb5852..eed0dde 100644 --- a/chrome/browser/chrome_plugin_host.cc +++ b/chrome/browser/chrome_plugin_host.cc @@ -10,7 +10,6 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/png_encoder.h" #include "base/histogram.h" #include "base/message_loop.h" #include "base/path_service.h" diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc index 2fe9f98..565a8fb 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc @@ -7,7 +7,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/theme_provider.h" -#include "base/gfx/png_encoder.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/time.h" diff --git a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc index e946047..653c2ef 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/gfx/png_encoder.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/dom_ui/dom_ui_theme_source.h" #include "chrome/browser/profile.h" diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc index 230389b..acb8276 100644 --- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc +++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc @@ -4,9 +4,9 @@ #include "chrome/browser/dom_ui/dom_ui_thumbnail_source.h" +#include "app/gfx/codec/jpeg_codec.h" #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/gfx/jpeg_codec.h" #include "chrome/browser/profile.h" #include "chrome/browser/thumbnail_store.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/dom_ui/downloads_dom_handler.cc b/chrome/browser/dom_ui/downloads_dom_handler.cc index aa646c0..e13163f 100644 --- a/chrome/browser/dom_ui/downloads_dom_handler.cc +++ b/chrome/browser/dom_ui/downloads_dom_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,6 @@ #include "app/l10n_util.h" #include "base/basictypes.h" -#include "base/gfx/png_encoder.h" #include "base/string_piece.h" #include "base/thread.h" #include "base/time_format.h" diff --git a/chrome/browser/dom_ui/fileicon_source.cc b/chrome/browser/dom_ui/fileicon_source.cc index daf9a43..247f8c5 100644 --- a/chrome/browser/dom_ui/fileicon_source.cc +++ b/chrome/browser/dom_ui/fileicon_source.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/dom_ui/fileicon_source.h" -#include "base/gfx/png_encoder.h" +#include "app/gfx/codec/png_codec.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/common/time_format.h" @@ -40,7 +40,7 @@ void FileIconSource::StartDataRequest(const std::string& path, if (icon) { std::vector png_bytes; - PNGEncoder::EncodeBGRASkBitmap(*icon, false, &png_bytes); + gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &png_bytes); scoped_refptr icon_data = new RefCountedBytes(png_bytes); SendResponse(request_id, icon_data); @@ -63,7 +63,7 @@ void FileIconSource::OnFileIconDataAvailable(IconManager::Handle handle, if (icon) { std::vector png_bytes; - PNGEncoder::EncodeBGRASkBitmap(*icon, false, &png_bytes); + gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &png_bytes); scoped_refptr icon_data = new RefCountedBytes(png_bytes); SendResponse(request_id, icon_data); diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 12028c2..89cb48c 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -4,7 +4,7 @@ #include "chrome/browser/extensions/extension_tabs_module.h" -#include "base/gfx/jpeg_codec.h" +#include "app/gfx/codec/jpeg_codec.h" #include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -785,9 +785,9 @@ bool CaptureVisibleTabFunction::RunImpl() { #endif scoped_refptr jpeg_data(new RefCountedBytes); SkAutoLockPixels screen_capture_lock(screen_capture); - bool encoded = JPEGCodec::Encode( + bool encoded = gfx::JPEGCodec::Encode( reinterpret_cast(screen_capture.getAddr32(0, 0)), - JPEGCodec::FORMAT_BGRA, screen_capture.width(), + gfx::JPEGCodec::FORMAT_BGRA, screen_capture.width(), screen_capture.height(), static_cast(screen_capture.rowBytes()), 90, &jpeg_data->data); diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index e1d600c..7003139 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -6,9 +6,9 @@ #include +#include "app/gfx/codec/png_codec.h" #include "base/crypto/signature_verifier.h" #include "base/file_util.h" -#include "base/gfx/png_encoder.h" #include "base/message_loop.h" #include "base/scoped_handle.h" #include "base/task.h" @@ -171,7 +171,7 @@ void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded( // TODO(mpcomplete): It's lame that we're encoding all images as PNG, even // though they may originally be .jpg, etc. Figure something out. // http://code.google.com/p/chromium/issues/detail?id=12459 - if (!PNGEncoder::EncodeBGRASkBitmap(image, false, &image_data)) { + if (!gfx::PNGCodec::EncodeBGRASkBitmap(image, false, &image_data)) { ReportFailure("Error re-encoding theme image."); return; } diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc index 991376c..f0d7d64 100644 --- a/chrome/browser/fav_icon_helper.cc +++ b/chrome/browser/fav_icon_helper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,9 +6,8 @@ #include "build/build_config.h" +#include "app/gfx/codec/png_codec.h" #include "app/gfx/favicon_size.h" -#include "base/gfx/png_decoder.h" -#include "base/gfx/png_encoder.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/navigation_controller.h" @@ -65,7 +64,7 @@ void FavIconHelper::SetFavIcon( if (GetFaviconService() && !profile()->IsOffTheRecord()) { std::vector image_data; - PNGEncoder::EncodeBGRASkBitmap(sized_image, false, &image_data); + gfx::PNGCodec::EncodeBGRASkBitmap(sized_image, false, &image_data); GetFaviconService()->SetFavicon(i->second.url, i->second.fav_icon_url, image_data); } @@ -88,7 +87,7 @@ void FavIconHelper::FavIconDownloadFailed(int download_id) { void FavIconHelper::UpdateFavIcon(NavigationEntry* entry, const std::vector& data) { SkBitmap image; - PNGDecoder::Decode(&data, &image); + gfx::PNGCodec::Decode(&data, &image); UpdateFavIcon(entry, image); } diff --git a/chrome/browser/gears_integration.cc b/chrome/browser/gears_integration.cc index d7cf898..b6f1d3b 100644 --- a/chrome/browser/gears_integration.cc +++ b/chrome/browser/gears_integration.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/gears_integration.h" -#include "base/gfx/png_encoder.h" +#include "app/gfx/codec/png_codec.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -116,7 +116,7 @@ static GURL ConvertSkBitmapToDataURL(const SkBitmap& icon) { // Get the FavIcon data. std::vector icon_data; - PNGEncoder::EncodeBGRASkBitmap(icon, false, &icon_data); + gfx::PNGCodec::EncodeBGRASkBitmap(icon, false, &icon_data); // Base64-encode it (to make it a data URL). std::string icon_data_str(reinterpret_cast(&icon_data[0]), diff --git a/chrome/browser/gtk/list_store_favicon_loader.cc b/chrome/browser/gtk/list_store_favicon_loader.cc index 68f7547..eb1e327 100644 --- a/chrome/browser/gtk/list_store_favicon_loader.cc +++ b/chrome/browser/gtk/list_store_favicon_loader.cc @@ -6,8 +6,8 @@ #include +#include "app/gfx/codec/png_codec.h" #include "base/gfx/gtk_util.h" -#include "base/gfx/png_decoder.h" #include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/browser/profile.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -71,9 +71,10 @@ void ListStoreFavIconLoader::OnGotFavIcon( if (know_fav_icon && image_data.get() && !image_data->data.empty()) { int width, height; std::vector decoded_data; - if (PNGDecoder::Decode(&image_data->data.front(), image_data->data.size(), - PNGDecoder::FORMAT_BGRA, &decoded_data, &width, - &height)) { + if (gfx::PNGCodec::Decode(&image_data->data.front(), + image_data->data.size(), + gfx::PNGCodec::FORMAT_BGRA, &decoded_data, + &width, &height)) { SkBitmap icon; icon.setConfig(SkBitmap::kARGB_8888_Config, width, height); icon.allocPixels(); diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index 08cdf38..31eab71 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/gfx/codec/jpeg_codec.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/path_service.h" #include "base/scoped_ptr.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -205,7 +205,7 @@ void ExpireHistoryTest::AddExampleData(URLID url_ids[3], Time visit_times[4]) { // Thumbnails for each URL. scoped_ptr thumbnail( - JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); ThumbnailScore score(0.25, true, true, Time::Now()); Time time; diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 9f14f1d..bb92d19 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/gfx/codec/jpeg_codec.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/path_service.h" #include "base/scoped_ptr.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -231,14 +231,14 @@ TEST_F(HistoryBackendTest, DeleteAll) { // Add thumbnails for each page. ThumbnailScore score(0.25, true, true); scoped_ptr google_bitmap( - JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); Time time; GURL gurl; backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, *google_bitmap, score, time); scoped_ptr weewar_bitmap( - JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); + gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap, score, time); @@ -405,7 +405,7 @@ TEST_F(HistoryBackendTest, GetPageThumbnailAfterRedirects) { // Add a thumbnail for the end of that redirect chain. scoped_ptr thumbnail( - JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); backend_->SetPageThumbnail(GURL(thumbnail_url), *thumbnail, ThumbnailScore(0.25, true, true)); diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index be84f01..ce6121a 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -20,12 +20,12 @@ #include #include +#include "app/gfx/codec/jpeg_codec.h" #include "app/sql/connection.h" #include "app/sql/statement.h" #include "base/basictypes.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_vector.h" @@ -668,7 +668,7 @@ TEST_F(HistoryTest, Thumbnails) { ASSERT_TRUE(history->Init(history_dir_, NULL)); scoped_ptr thumbnail( - JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); static const double boringness = 0.25; const GURL url("http://www.google.com/thumbnail_test/"); @@ -687,7 +687,7 @@ TEST_F(HistoryTest, Thumbnails) { // compression and we don't have a similarity measure. EXPECT_TRUE(thumbnail_data_.size()); scoped_ptr decoded_thumbnail( - JPEGCodec::Decode(&thumbnail_data_[0], thumbnail_data_.size())); + gfx::JPEGCodec::Decode(&thumbnail_data_[0], thumbnail_data_.size())); EXPECT_TRUE(decoded_thumbnail.get()); // Request a nonexistent thumbnail and make sure we get diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc index 735440f..ac06464 100644 --- a/chrome/browser/history/thumbnail_database.cc +++ b/chrome/browser/history/thumbnail_database.cc @@ -4,10 +4,10 @@ #include "chrome/browser/history/thumbnail_database.h" +#include "app/gfx/codec/jpeg_codec.h" #include "app/sql/statement.h" #include "app/sql/transaction.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/time.h" #include "base/string_util.h" #include "chrome/browser/history/history_publisher.h" @@ -229,9 +229,9 @@ void ThumbnailDatabase::SetPageThumbnail( // highly detailed images. std::vector jpeg_data; SkAutoLockPixels thumbnail_lock(thumbnail); - bool encoded = JPEGCodec::Encode( + bool encoded = gfx::JPEGCodec::Encode( reinterpret_cast(thumbnail.getAddr32(0, 0)), - JPEGCodec::FORMAT_BGRA, thumbnail.width(), + gfx::JPEGCodec::FORMAT_BGRA, thumbnail.width(), thumbnail.height(), static_cast(thumbnail.rowBytes()), 90, &jpeg_data); diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index d6a93ff..83d67cf 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/gfx/codec/jpeg_codec.h" #include "base/basictypes.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/path_service.h" #include "chrome/browser/history/thumbnail_database.h" #include "chrome/common/chrome_paths.h" @@ -55,7 +55,7 @@ class ThumbnailDatabaseTest : public testing::Test { file_util::Delete(file_name_, false); google_bitmap_.reset( - JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); } virtual void TearDown() { diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc index 48a1751..1206843 100644 --- a/chrome/browser/history/top_sites.cc +++ b/chrome/browser/history/top_sites.cc @@ -4,7 +4,7 @@ #include "chrome/browser/history/top_sites.h" -#include "base/gfx/jpeg_codec.h" +#include "app/gfx/codec/jpeg_codec.h" #include "base/logging.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -45,9 +45,9 @@ bool TopSites::SetPageThumbnail(const GURL& url, image.thumbnail = new RefCountedBytes; SkAutoLockPixels thumbnail_lock(thumbnail); - bool encoded = JPEGCodec::Encode( + bool encoded = gfx::JPEGCodec::Encode( reinterpret_cast(thumbnail.getAddr32(0, 0)), - JPEGCodec::FORMAT_BGRA, thumbnail.width(), + gfx::JPEGCodec::FORMAT_BGRA, thumbnail.width(), thumbnail.height(), static_cast(thumbnail.rowBytes()), 90, &image.thumbnail->data); diff --git a/chrome/browser/icon_loader_linux.cc b/chrome/browser/icon_loader_linux.cc index 05a4935..371a7c3 100644 --- a/chrome/browser/icon_loader_linux.cc +++ b/chrome/browser/icon_loader_linux.cc @@ -8,8 +8,8 @@ #include #include +#include "app/gfx/codec/png_codec.h" #include "base/file_util.h" -#include "base/gfx/png_decoder.h" #include "base/logging.h" #include "base/linux_util.h" #include "base/message_loop.h" @@ -65,8 +65,8 @@ void IconLoader::ParseIcon() { pixel_vector.resize(height * stride); memcpy(const_cast(pixel_vector.data()), BGRA_pixels, height * stride); - bitmap_ = PNGDecoder::CreateSkBitmapFromBGRAFormat(pixel_vector, - width, height); + bitmap_ = gfx::PNGCodec::CreateSkBitmapFromBGRAFormat(pixel_vector, + width, height); free(BGRA_pixels); } } else { diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index 62cbf52..29911f6 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -8,9 +8,9 @@ #include #include "app/gfx/favicon_size.h" +#include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" #include "base/file_util.h" -#include "base/gfx/png_encoder.h" #include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -425,7 +425,7 @@ bool Importer::ReencodeFavicon(const unsigned char* src_data, size_t src_len, } // Encode our bitmap as a PNG. - PNGEncoder::EncodeBGRASkBitmap(decoded, false, png_data); + gfx::PNGCodec::EncodeBGRASkBitmap(decoded, false, png_data); return true; } diff --git a/chrome/browser/possible_url_model.cc b/chrome/browser/possible_url_model.cc index 5a0d0b5..5960ada 100644 --- a/chrome/browser/possible_url_model.cc +++ b/chrome/browser/possible_url_model.cc @@ -4,10 +4,10 @@ #include "chrome/browser/possible_url_model.h" +#include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/table_model_observer.h" -#include "base/gfx/png_decoder.h" #include "chrome/browser/cancelable_request.h" #include "chrome/browser/favicon_service.h" #include "chrome/browser/profile.h" @@ -176,7 +176,7 @@ void PossibleURLModel::OnFavIconAvailable( size_t index = consumer_.GetClientData(favicon_service, h); if (fav_icon_available) { // The decoder will leave our bitmap empty on error. - PNGDecoder::Decode(&data->data, &(fav_icon_map_[index])); + gfx::PNGCodec::Decode(&data->data, &(fav_icon_map_[index])); // Notify the observer. if (!fav_icon_map_[index].isNull() && observer_) diff --git a/chrome/browser/search_engines/template_url_table_model.cc b/chrome/browser/search_engines/template_url_table_model.cc index 59fb294..3b1aaca 100644 --- a/chrome/browser/search_engines/template_url_table_model.cc +++ b/chrome/browser/search_engines/template_url_table_model.cc @@ -4,10 +4,10 @@ #include "chrome/browser/search_engines/template_url_table_model.h" +#include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/table_model_observer.h" -#include "base/gfx/png_decoder.h" #include "chrome/browser/favicon_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/search_engines/template_url.h" @@ -100,7 +100,7 @@ class ModelEntry { GURL icon_url) { load_state_ = LOADED; if (know_favicon && data.get() && - PNGDecoder::Decode(&data->data, &fav_icon_)) { + gfx::PNGCodec::Decode(&data->data, &fav_icon_)) { model_->FavIconAvailable(this); } } diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 11f976e..3034afb 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -13,11 +13,11 @@ #include #include +#include "app/gfx/codec/png_codec.h" #include "base/command_line.h" #include "base/eintr_wrapper.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/png_encoder.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/process_util.h" @@ -152,7 +152,7 @@ class CreateDesktopShortcutTask : public Task { shortcut_filename.ReplaceExtension("png")); std::vector png_data; - PNGEncoder::EncodeBGRASkBitmap(shortcut_info_.favicon, false, &png_data); + gfx::PNGCodec::EncodeBGRASkBitmap(shortcut_info_.favicon, false, &png_data); int bytes_written = file_util::WriteFile(temp_file_path, reinterpret_cast(png_data.data()), png_data.size()); diff --git a/chrome/browser/sync/glue/change_processor.cc b/chrome/browser/sync/glue/change_processor.cc index dc4cc0d..696df04 100644 --- a/chrome/browser/sync/glue/change_processor.cc +++ b/chrome/browser/sync/glue/change_processor.cc @@ -6,7 +6,7 @@ #include "chrome/browser/sync/glue/change_processor.h" -#include "base/gfx/png_encoder.h" +#include "app/gfx/codec/png_codec.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/favicon_service.h" @@ -65,7 +65,7 @@ void ChangeProcessor::EncodeFavicon(const BookmarkNode* src, // Re-encode the BookmarkNode's favicon as a PNG, and pass the data to the // sync subsystem. - if (!PNGEncoder::EncodeBGRASkBitmap(favicon, false, dst)) + if (!gfx::PNGCodec::EncodeBGRASkBitmap(favicon, false, dst)) return; } diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 3db3908..e90d555 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -13,7 +13,6 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/png_encoder.h" #include "base/histogram.h" #include "base/stl_util-inl.h" #include "base/string_util.h" diff --git a/chrome/browser/thumbnail_store.cc b/chrome/browser/thumbnail_store.cc index 19cd9f3..9a5b746 100644 --- a/chrome/browser/thumbnail_store.cc +++ b/chrome/browser/thumbnail_store.cc @@ -7,11 +7,11 @@ #include #include +#include "app/gfx/codec/jpeg_codec.h" #include "app/sql/statement.h" #include "app/sql/transaction.h" #include "base/basictypes.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/md5.h" #include "base/string_util.h" #include "base/thread.h" @@ -77,9 +77,9 @@ bool ThumbnailStore::SetPageThumbnail(const GURL& url, // Encode the SkBitmap to jpeg. scoped_refptr jpeg_data = new RefCountedBytes; SkAutoLockPixels thumbnail_lock(thumbnail); - bool encoded = JPEGCodec::Encode( + bool encoded = gfx::JPEGCodec::Encode( reinterpret_cast(thumbnail.getAddr32(0, 0)), - JPEGCodec::FORMAT_BGRA, thumbnail.width(), + gfx::JPEGCodec::FORMAT_BGRA, thumbnail.width(), thumbnail.height(), static_cast(thumbnail.rowBytes()), 90, &jpeg_data->data); diff --git a/chrome/browser/thumbnail_store_unittest.cc b/chrome/browser/thumbnail_store_unittest.cc index cd249f3..e5a5be0 100644 --- a/chrome/browser/thumbnail_store_unittest.cc +++ b/chrome/browser/thumbnail_store_unittest.cc @@ -9,12 +9,12 @@ #include "chrome/browser/thumbnail_store.h" +#include "app/gfx/codec/jpeg_codec.h" #include "app/sql/connection.h" #include "app/sql/statement.h" #include "base/time.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/gfx/jpeg_codec.h" #include "base/path_service.h" #include "base/ref_counted.h" #include "chrome/common/chrome_paths.h" @@ -70,23 +70,25 @@ void ThumbnailStoreTest::SetUp() { db_name_ = db_name_.AppendASCII("ThumbnailDB"); file_util::Delete(db_name_, false); - google_.reset(JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); - weewar_.reset(JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); + google_.reset(gfx::JPEGCodec::Decode(kGoogleThumbnail, + sizeof(kGoogleThumbnail))); + weewar_.reset(gfx::JPEGCodec::Decode(kWeewarThumbnail, + sizeof(kWeewarThumbnail))); SkAutoLockPixels lock1(*google_); jpeg_google_ = new RefCountedBytes; - JPEGCodec::Encode( + gfx::JPEGCodec::Encode( reinterpret_cast(google_->getAddr32(0, 0)), - JPEGCodec::FORMAT_BGRA, google_->width(), + gfx::JPEGCodec::FORMAT_BGRA, google_->width(), google_->height(), static_cast(google_->rowBytes()), 90, &(jpeg_google_->data)); SkAutoLockPixels lock2(*weewar_); jpeg_weewar_ = new RefCountedBytes; - JPEGCodec::Encode( + gfx::JPEGCodec::Encode( reinterpret_cast(weewar_->getAddr32(0,0)), - JPEGCodec::FORMAT_BGRA, weewar_->width(), + gfx::JPEGCodec::FORMAT_BGRA, weewar_->width(), weewar_->height(), static_cast(weewar_->rowBytes()), 90, &(jpeg_weewar_->data)); diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index 94fb959..e7f9b37 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -5,9 +5,9 @@ #include "chrome/browser/views/options/general_page_view.h" #include "app/combobox_model.h" +#include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/gfx/png_decoder.h" #include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/browser.h" @@ -239,9 +239,10 @@ void CustomHomePagesTableModel::OnGotFavIcon( if (know_fav_icon && image_data.get() && !image_data->data.empty()) { int width, height; std::vector decoded_data; - if (PNGDecoder::Decode(&image_data->data.front(), image_data->data.size(), - PNGDecoder::FORMAT_BGRA, &decoded_data, &width, - &height)) { + if (gfx::PNGCodec::Decode(&image_data->data.front(), + image_data->data.size(), + gfx::PNGCodec::FORMAT_BGRA, &decoded_data, + &width, &height)) { entry->icon.setConfig(SkBitmap::kARGB_8888_Config, width, height); entry->icon.allocPixels(); memcpy(entry->icon.getPixels(), &decoded_data.front(), diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index a4db1c9..e796979 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -8,11 +8,10 @@ #include #include +#include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" #include "app/sql/statement.h" #include "app/sql/transaction.h" -#include "base/gfx/png_decoder.h" -#include "base/gfx/png_encoder.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/browser/history/history_database.h" @@ -187,7 +186,7 @@ bool WebDatabase::SetWebAppImage(const GURL& url, const SkBitmap& image) { return false; std::vector image_data; - PNGEncoder::EncodeBGRASkBitmap(image, false, &image_data); + gfx::PNGCodec::EncodeBGRASkBitmap(image, false, &image_data); s.BindString(0, history::HistoryDatabase::GURLToDatabaseURL(url)); s.BindInt(1, image.width()); @@ -212,7 +211,7 @@ bool WebDatabase::GetWebAppImages(const GURL& url, if (col_bytes > 0) { image_data.resize(col_bytes); memcpy(&image_data[0], s.ColumnBlob(0), col_bytes); - if (PNGDecoder::Decode(&image_data, &image)) { + if (gfx::PNGCodec::Decode(&image_data, &image)) { images->push_back(image); } else { // Should only have valid image data in the db. -- cgit v1.1