From 00e4e5f0f9e3e5df3f075acaa21b166c5960450a Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Fri, 9 Oct 2009 00:58:57 +0000 Subject: Revert r28489 as it broke the linux build. TBR=rafaelw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28495 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/image_loading_tracker.cc | 40 +++++++--------------- chrome/browser/extensions/image_loading_tracker.h | 4 +-- 2 files changed, 14 insertions(+), 30 deletions(-) (limited to 'chrome/browser/extensions') diff --git a/chrome/browser/extensions/image_loading_tracker.cc b/chrome/browser/extensions/image_loading_tracker.cc index 211a07b4..e141391 100644 --- a/chrome/browser/extensions/image_loading_tracker.cc +++ b/chrome/browser/extensions/image_loading_tracker.cc @@ -29,19 +29,13 @@ class ImageLoadingTracker::LoadImageTask : public Task { // we use to communicate back to the entity that wants the image after we // decode it. |path| is the path to load the image from. |index| is an // identifier for the image that we pass back to the caller. - // |max_size| is the maximum size for the loaded image. If the image is - // larger, it will be resized to fit. It is optional. LoadImageTask(ImageLoadingTracker* tracker, const ExtensionResource& resource, - size_t index, - gfx::Size* max_size) + size_t index) : callback_loop_(MessageLoop::current()), tracker_(tracker), resource_(resource), - index_(index){ - if (max_size) - max_size_.reset(new gfx::Size(*max_size)); - } + index_(index) {} void ReportBack(SkBitmap* image) { DCHECK(image); @@ -71,18 +65,15 @@ class ImageLoadingTracker::LoadImageTask : public Task { return; // Unable to decode. } - if (max_size_.get()) { - if (decoded->width() > max_size_->width() || - decoded->height() > max_size_->height()) { - // The bitmap is not the correct size, re-sample. - int new_width = decoded->width(); - int new_height = decoded->height(); - // Calculate what dimensions to use within the constraints (16x16 max). - calc_favicon_target_size(&new_width, &new_height); - *decoded = skia::ImageOperations::Resize( - *decoded, skia::ImageOperations::RESIZE_LANCZOS3, - new_width, new_height); - } + if (decoded->width() != kFavIconSize || decoded->height() != kFavIconSize) { + // The bitmap is not the correct size, re-sample. + int new_width = decoded->width(); + int new_height = decoded->height(); + // Calculate what dimensions to use within the constraints (16x16 max). + calc_favicon_target_size(&new_width, &new_height); + *decoded = skia::ImageOperations::Resize( + *decoded, skia::ImageOperations::RESIZE_LANCZOS3, + new_width, new_height); } ReportBack(decoded.release()); @@ -100,20 +91,15 @@ class ImageLoadingTracker::LoadImageTask : public Task { // The index of the icon being loaded. size_t index_; - - // The max size for the image. If the image is larger than this, it will be - // scaled down. - scoped_ptr max_size_; }; //////////////////////////////////////////////////////////////////////////////// // ImageLoadingTracker -void ImageLoadingTracker::PostLoadImageTask(const ExtensionResource& resource, - gfx::Size* max_size) { +void ImageLoadingTracker::PostLoadImageTask(const ExtensionResource& resource) { MessageLoop* file_loop = g_browser_process->file_thread()->message_loop(); file_loop->PostTask(FROM_HERE, new LoadImageTask(this, resource, - posted_count_++, max_size)); + posted_count_++)); } void ImageLoadingTracker::OnImageLoaded(SkBitmap* image, size_t index) { diff --git a/chrome/browser/extensions/image_loading_tracker.h b/chrome/browser/extensions/image_loading_tracker.h index 732e0e2..9732a00 100644 --- a/chrome/browser/extensions/image_loading_tracker.h +++ b/chrome/browser/extensions/image_loading_tracker.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ -#include "base/gfx/size.h" #include "base/ref_counted.h" class ExtensionResource; @@ -46,8 +45,7 @@ class ImageLoadingTracker // Specify image resource to load. This method must be called a number of // times equal to the |image_count| arugment to the constructor. Calling it // any more or less than that is an error. - void PostLoadImageTask(const ExtensionResource& resource, - gfx::Size* max_size); + void PostLoadImageTask(const ExtensionResource& resource); private: class LoadImageTask; -- cgit v1.1