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. |