| Index: ui/views/controls/button/image_button.cc
|
| diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc
|
| index a93a1dc59338c50ddfefa7b03b82f33a6bf2895d..de5c12c2f9eeb7b01b5076490dbf4d2388235838 100644
|
| --- a/ui/views/controls/button/image_button.cc
|
| +++ b/ui/views/controls/button/image_button.cc
|
| @@ -74,6 +74,15 @@ gfx::Size ImageButton::GetPreferredSize() {
|
| }
|
| return preferred_size_;
|
| }
|
| +static float GetScaleFactor() {
|
| + switch (ui::GetMaxScaleFactor()) {
|
| + case ui::SCALE_FACTOR_140P:
|
| + return 1.4f;
|
| + case ui::SCALE_FACTOR_180P:
|
| + return 1.8f;
|
| + }
|
| + return 1.0f;
|
| +}
|
|
|
| void ImageButton::OnPaint(gfx::Canvas* canvas) {
|
| // Call the base class first to paint any background/borders.
|
| @@ -83,13 +92,18 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) {
|
|
|
| if (!img.isNull()) {
|
| gfx::Point position = ComputeImagePaintPosition(img);
|
| + static float scale = GetScaleFactor();
|
| + scale = 1;
|
| + // TODO: store and reset the transform.... this implementation will accumulate errors.
|
| + canvas->Scale( scale, scale);
|
| if (!background_image_.isNull())
|
| canvas->DrawImageInt(background_image_, position.x(), position.y());
|
|
|
| - canvas->DrawImageInt(img, position.x(), position.y());
|
| + canvas->DrawImageInt(img, 0, 0);//position.x(), position.y());
|
|
|
| if (!overlay_image_.isNull())
|
| canvas->DrawImageInt(overlay_image_, position.x(), position.y());
|
| + canvas->Scale( 1/scale, 1/scale);
|
| }
|
| OnPaintFocusBorder(canvas);
|
| }
|
|
|