diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 17:58:41 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 17:58:41 +0000 |
commit | 3b2591a63e8033c17ba74e522e3def318d6e7377 (patch) | |
tree | d6127171e9bdd2ce17f050b980dc1a8ba194515e /ui/views/controls | |
parent | da596cd33eb81af1a129d71c96384b9b353ae3ae (diff) | |
download | chromium_src-3b2591a63e8033c17ba74e522e3def318d6e7377.zip chromium_src-3b2591a63e8033c17ba74e522e3def318d6e7377.tar.gz chromium_src-3b2591a63e8033c17ba74e522e3def318d6e7377.tar.bz2 |
Add ability to build a canvas with a target scale factor.
This allows ExtractBitmap() to return an ImageSkiaRep.
This simplifies code around using intermediate bitmaps a lot.
BUG=131475
TEST=Compiles
R=oshima,sky
TBR=sadrul
Review URL: https://chromiumcodereview.appspot.com/10562027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls')
-rw-r--r-- | ui/views/controls/button/image_button.cc | 8 | ||||
-rw-r--r-- | ui/views/controls/button/image_button.h | 4 |
2 files changed, 1 insertions, 11 deletions
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc index 1af311b..a1b05c8 100644 --- a/ui/views/controls/button/image_button.cc +++ b/ui/views/controls/button/image_button.cc @@ -75,7 +75,7 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) { // Call the base class first to paint any background/borders. View::OnPaint(canvas); - ui::ScaleFactor current_device_scale_factor = GetCurrentDeviceScaleFactor(); + ui::ScaleFactor current_device_scale_factor = canvas->scale_factor(); gfx::ImageSkia img = GetImageToPaint(current_device_scale_factor); if (!img.isNull()) { @@ -109,12 +109,6 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) { //////////////////////////////////////////////////////////////////////////////// // ImageButton, protected: -ui::ScaleFactor ImageButton::GetCurrentDeviceScaleFactor() { - gfx::Display display = gfx::Screen::GetDisplayNearestWindow( - GetWidget() ? GetWidget()->GetNativeView() : NULL); - return ui::GetScaleFactorFromScale(display.device_scale_factor()); -} - gfx::ImageSkia ImageButton::GetImageToPaint(ui::ScaleFactor scale_factor) { gfx::ImageSkia img; diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h index 413a4bc..5d1ae01 100644 --- a/ui/views/controls/button/image_button.h +++ b/ui/views/controls/button/image_button.h @@ -63,10 +63,6 @@ class VIEWS_EXPORT ImageButton : public CustomButton { } protected: - // Returns the current device scale factor of the view. - // TODO(pkotwicz): Remove this once scale factor can be queried from canvas. - ui::ScaleFactor GetCurrentDeviceScaleFactor(); - // Returns the image to paint. This is invoked from paint and returns a value // from images. // |scale_factor| is the scale factor at which the view is painted and the |