summaryrefslogtreecommitdiffstats
path: root/ui/gfx/image/image_skia_rep.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-03 03:35:31 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-03 03:35:31 +0000
commit98a33e204007a3c434d7f40acfc4ba6556ea5d37 (patch)
treebc250f99990f2bfaff9e9d46f9cd98b01d9fac24 /ui/gfx/image/image_skia_rep.cc
parentb142b0b65e64b25833628759f5d534ff7920b6cb (diff)
downloadchromium_src-98a33e204007a3c434d7f40acfc4ba6556ea5d37.zip
chromium_src-98a33e204007a3c434d7f40acfc4ba6556ea5d37.tar.gz
chromium_src-98a33e204007a3c434d7f40acfc4ba6556ea5d37.tar.bz2
Loading/Creating images for mutiple scale factors on the fly
This allow us not to load all (1x and 2x) resources at startup time, and also unload resources when they become unnecessary. * Converted Menu's radio button to use ImageSkiaSource * Converted Network related icons to use ImageSkiaSource I'll create separate CL to load resources in the ResourceBundle on the fly. BUG=122992 TEST=ImageSkiaTest.* Review URL: https://chromiumcodereview.appspot.com/10694045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145251 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/image/image_skia_rep.cc')
-rw-r--r--ui/gfx/image/image_skia_rep.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui/gfx/image/image_skia_rep.cc b/ui/gfx/image/image_skia_rep.cc
index fe38230..be0331a 100644
--- a/ui/gfx/image/image_skia_rep.cc
+++ b/ui/gfx/image/image_skia_rep.cc
@@ -4,6 +4,8 @@
#include "ui/gfx/image/image_skia_rep.h"
+#include "ui/gfx/size.h"
+
namespace gfx {
ImageSkiaRep::ImageSkiaRep()
@@ -13,13 +15,13 @@ ImageSkiaRep::ImageSkiaRep()
ImageSkiaRep::~ImageSkiaRep() {
}
-ImageSkiaRep::ImageSkiaRep(int width, int height,
+ImageSkiaRep::ImageSkiaRep(const gfx::Size& size,
ui::ScaleFactor scale_factor)
: scale_factor_(scale_factor) {
float scale = ui::GetScaleFactorScale(scale_factor);
bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
- static_cast<int>(width * scale),
- static_cast<int>(height * scale));
+ static_cast<int>(size.width() * scale),
+ static_cast<int>(size.height() * scale));
bitmap_.allocPixels();
}