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

Unified Diff: ui/gfx/image/image_skia.cc

Issue 11028064: Resize images for hi-dpi based on a custom PNG chunk added by GRIT r78, and roll GRIT r78 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: back out ChromeBrowserMainPartsLinux::PreProfileInit change, add RoundToInt, move image loading to … Created 8 years, 2 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
« ui/base/resource/resource_bundle.cc ('K') | « ui/gfx/image/image_skia.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia.cc
diff --git a/ui/gfx/image/image_skia.cc b/ui/gfx/image/image_skia.cc
index e86b5e0228f64cd378e307b4cb002c54d7f81ff2..bb17dc4517152505a0e423b03bf42ebe18fabe2d 100644
--- a/ui/gfx/image/image_skia.cc
+++ b/ui/gfx/image/image_skia.cc
@@ -181,6 +181,21 @@ ImageSkia::ImageSkia(ImageSkiaSource* source, const gfx::Size& size)
DetachStorageFromThread();
}
+ImageSkia::ImageSkia(ImageSkiaSource* source, ui::ScaleFactor scale_factor) {
+ DCHECK(source);
+ ImageSkiaRep image = source->GetImageForScale(scale_factor);
+ if (image.is_null()) {
+ storage_ = NULL;
+ delete source;
+ return;
+ }
+ Size size_in_dip(image.GetWidth(), image.GetHeight());
+ storage_ = new internal::ImageSkiaStorage(source, size_in_dip);
oshima 2012/10/10 21:43:29 Can you add new constructor ImageSkiaStorage(sourc
benrg 2012/10/11 01:22:02 Like this? It's a bit awkward because of the failu
+ // No other thread has reference to this, so it's safe to detach the thread.
+ DetachStorageFromThread();
oshima 2012/10/10 21:43:29 DetachStorageFromThread should be called after Add
+ AddRepresentation(image);
+}
+
ImageSkia::ImageSkia(const SkBitmap& bitmap) {
Init(ImageSkiaRep(bitmap, ui::SCALE_FACTOR_100P));
// No other thread has reference to this, so it's safe to detach the thread.
« ui/base/resource/resource_bundle.cc ('K') | « ui/gfx/image/image_skia.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698