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

Unified Diff: chrome/browser/image_decoder.h

Issue 2715153006: Set desired_image_size when decoding images for NTP Tile icons. (Closed)
Patch Set: comment formatting Created 3 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
Index: chrome/browser/image_decoder.h
diff --git a/chrome/browser/image_decoder.h b/chrome/browser/image_decoder.h
index 2770662f3657eee796a61fa2407fd2592130fd2f..2a0d3225aaf2329bcb382fefd005a2c88b60ba3c 100644
--- a/chrome/browser/image_decoder.h
+++ b/chrome/browser/image_decoder.h
@@ -15,6 +15,10 @@
#include "base/sequenced_task_runner.h"
#include "base/synchronization/lock.h"
+namespace gfx {
+class Size;
+} // namespace gfx
+
class SkBitmap;
// This is a helper class for decoding images safely in a sandboxed service. To
@@ -83,10 +87,16 @@ class ImageDecoder {
// Starts asynchronous image decoding. Once finished, the callback will be
// posted back to image_request's |task_runner_|.
+ // For images with multiple frames (e.g. ico files), a frame with a size as
+ // close as possible to |desired_image_frame_size| is chosen (tries to take
+ // one in larger size if there's no precise match). Passing gfx::Size() as
+ // |desired_image_frame_size| is also supported and will result in chosing the
+ // smallest available size.
static void StartWithOptions(ImageRequest* image_request,
std::vector<uint8_t> image_data,
ImageCodec image_codec,
- bool shrink_to_fit);
+ bool shrink_to_fit,
+ const gfx::Size& desired_image_frame_size);
// Deprecated. Use std::vector<uint8_t> version to avoid an extra copy.
static void StartWithOptions(ImageRequest* image_request,
const std::string& image_data,
@@ -106,7 +116,8 @@ class ImageDecoder {
void StartWithOptionsImpl(ImageRequest* image_request,
std::vector<uint8_t> image_data,
ImageCodec image_codec,
- bool shrink_to_fit);
+ bool shrink_to_fit,
+ const gfx::Size& desired_image_frame_size);
void CancelImpl(ImageRequest* image_request);
« no previous file with comments | « chrome/browser/chromeos/hats/hats_notification_controller_unittest.cc ('k') | chrome/browser/image_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698