Commit d3f5bbc1 authored by oshima@chromium.org's avatar oshima@chromium.org

Notification for device scale factor change

BUG=105165
TEST=updated compositor test to cover OnDeviceScaleFactorChagned.

Review URL: https://chromiumcodereview.appspot.com/10391165

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137571 0039d316-1c4b-4281-b951-d872f2087c98
parent 3bd85867
...@@ -230,6 +230,11 @@ void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { ...@@ -230,6 +230,11 @@ void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) {
canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0); canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0);
} }
void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged(
float device_scale_factor) {
// Redrawing will take care of scale factor change.
}
// static // static
gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) { gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) {
return image ? return image ?
......
...@@ -139,6 +139,7 @@ class ASH_EXPORT ImageGrid { ...@@ -139,6 +139,7 @@ class ASH_EXPORT ImageGrid {
// ui::LayerDelegate implementation: // ui::LayerDelegate implementation:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
private: private:
friend class TestAPI; friend class TestAPI;
......
...@@ -1103,6 +1103,12 @@ void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { ...@@ -1103,6 +1103,12 @@ void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
} }
} }
void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
float device_scale_factor) {
// TODO(fsamuel|rbyers): Notify renderer that the device scale factor has
// changed. crbug.com/128267.
}
void RenderWidgetHostViewAura::OnWindowDestroying() { void RenderWidgetHostViewAura::OnWindowDestroying() {
} }
......
...@@ -161,6 +161,7 @@ class RenderWidgetHostViewAura ...@@ -161,6 +161,7 @@ class RenderWidgetHostViewAura
virtual bool CanFocus() OVERRIDE; virtual bool CanFocus() OVERRIDE;
virtual void OnCaptureLost() OVERRIDE; virtual void OnCaptureLost() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
virtual void OnWindowDestroying() OVERRIDE; virtual void OnWindowDestroying() OVERRIDE;
virtual void OnWindowDestroyed() OVERRIDE; virtual void OnWindowDestroyed() OVERRIDE;
virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE;
......
...@@ -559,6 +559,10 @@ void WebContentsViewAura::OnCaptureLost() { ...@@ -559,6 +559,10 @@ void WebContentsViewAura::OnCaptureLost() {
void WebContentsViewAura::OnPaint(gfx::Canvas* canvas) { void WebContentsViewAura::OnPaint(gfx::Canvas* canvas) {
} }
void WebContentsViewAura::OnDeviceScaleFactorChanged(
float device_scale_factor) {
}
void WebContentsViewAura::OnWindowDestroying() { void WebContentsViewAura::OnWindowDestroying() {
} }
......
...@@ -106,6 +106,7 @@ class CONTENT_EXPORT WebContentsViewAura ...@@ -106,6 +106,7 @@ class CONTENT_EXPORT WebContentsViewAura
virtual bool CanFocus() OVERRIDE; virtual bool CanFocus() OVERRIDE;
virtual void OnCaptureLost() OVERRIDE; virtual void OnCaptureLost() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
virtual void OnWindowDestroying() OVERRIDE; virtual void OnWindowDestroying() OVERRIDE;
virtual void OnWindowDestroyed() OVERRIDE; virtual void OnWindowDestroyed() OVERRIDE;
virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE;
......
...@@ -64,6 +64,7 @@ class DemoWindowDelegate : public aura::WindowDelegate { ...@@ -64,6 +64,7 @@ class DemoWindowDelegate : public aura::WindowDelegate {
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
canvas->DrawColor(color_, SkXfermode::kSrc_Mode); canvas->DrawColor(color_, SkXfermode::kSrc_Mode);
} }
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {}
virtual void OnWindowDestroying() OVERRIDE {} virtual void OnWindowDestroying() OVERRIDE {}
virtual void OnWindowDestroyed() OVERRIDE {} virtual void OnWindowDestroyed() OVERRIDE {}
virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE {} virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE {}
......
...@@ -69,6 +69,10 @@ void TestWindowDelegate::OnCaptureLost() { ...@@ -69,6 +69,10 @@ void TestWindowDelegate::OnCaptureLost() {
void TestWindowDelegate::OnPaint(gfx::Canvas* canvas) { void TestWindowDelegate::OnPaint(gfx::Canvas* canvas) {
} }
void TestWindowDelegate::OnDeviceScaleFactorChanged(
float device_scale_factor) {
}
void TestWindowDelegate::OnWindowDestroying() { void TestWindowDelegate::OnWindowDestroying() {
} }
......
...@@ -38,6 +38,7 @@ class TestWindowDelegate : public WindowDelegate { ...@@ -38,6 +38,7 @@ class TestWindowDelegate : public WindowDelegate {
virtual bool CanFocus() OVERRIDE; virtual bool CanFocus() OVERRIDE;
virtual void OnCaptureLost() OVERRIDE; virtual void OnCaptureLost() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
virtual void OnWindowDestroying() OVERRIDE; virtual void OnWindowDestroying() OVERRIDE;
virtual void OnWindowDestroyed() OVERRIDE; virtual void OnWindowDestroyed() OVERRIDE;
virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE;
......
...@@ -794,6 +794,11 @@ void Window::OnPaintLayer(gfx::Canvas* canvas) { ...@@ -794,6 +794,11 @@ void Window::OnPaintLayer(gfx::Canvas* canvas) {
delegate_->OnPaint(canvas); delegate_->OnPaint(canvas);
} }
void Window::OnDeviceScaleFactorChanged(float device_scale_factor) {
if (delegate_)
delegate_->OnDeviceScaleFactorChanged(device_scale_factor);
}
void Window::UpdateLayerName(const std::string& name) { void Window::UpdateLayerName(const std::string& name) {
#if !defined(NDEBUG) #if !defined(NDEBUG)
DCHECK(layer()); DCHECK(layer());
......
...@@ -395,6 +395,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate, ...@@ -395,6 +395,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
// Overridden from ui::LayerDelegate: // Overridden from ui::LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
// Updates the layer name with a name based on the window's name and id. // Updates the layer name with a name based on the window's name and id.
void UpdateLayerName(const std::string& name); void UpdateLayerName(const std::string& name);
......
...@@ -64,6 +64,9 @@ class AURA_EXPORT WindowDelegate { ...@@ -64,6 +64,9 @@ class AURA_EXPORT WindowDelegate {
// Asks the delegate to paint window contents into the supplied canvas. // Asks the delegate to paint window contents into the supplied canvas.
virtual void OnPaint(gfx::Canvas* canvas) = 0; virtual void OnPaint(gfx::Canvas* canvas) = 0;
// Called when the window's device scale factor has changed.
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0;
// Called from Window's destructor before OnWindowDestroyed and before the // Called from Window's destructor before OnWindowDestroyed and before the
// children have been destroyed and the window has been removed from its // children have been destroyed and the window has been removed from its
// parent. // parent.
......
...@@ -377,6 +377,8 @@ void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) { ...@@ -377,6 +377,8 @@ void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) {
RecomputeTransform(); RecomputeTransform();
RecomputeDrawsContentAndUVRect(); RecomputeDrawsContentAndUVRect();
SchedulePaint(gfx::Rect(bounds_.size())); SchedulePaint(gfx::Rect(bounds_.size()));
if (delegate_)
delegate_->OnDeviceScaleFactorChanged(device_scale_factor);
for (size_t i = 0; i < children_.size(); ++i) for (size_t i = 0; i < children_.size(); ++i)
children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); children_[i]->OnDeviceScaleFactorChanged(device_scale_factor);
} }
......
...@@ -21,6 +21,9 @@ class COMPOSITOR_EXPORT LayerDelegate { ...@@ -21,6 +21,9 @@ class COMPOSITOR_EXPORT LayerDelegate {
// clipped to the Layer's invalid rect. // clipped to the Layer's invalid rect.
virtual void OnPaintLayer(gfx::Canvas* canvas) = 0; virtual void OnPaintLayer(gfx::Canvas* canvas) = 0;
// Called when the layer's device scale factor has changed.
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0;
protected: protected:
virtual ~LayerDelegate() {} virtual ~LayerDelegate() {}
}; };
......
...@@ -132,6 +132,9 @@ class ColoredLayer : public Layer, public LayerDelegate { ...@@ -132,6 +132,9 @@ class ColoredLayer : public Layer, public LayerDelegate {
canvas->DrawColor(color_); canvas->DrawColor(color_);
} }
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
}
private: private:
SkColor color_; SkColor color_;
}; };
...@@ -212,7 +215,7 @@ class LayerWithRealCompositorTest : public testing::Test { ...@@ -212,7 +215,7 @@ class LayerWithRealCompositorTest : public testing::Test {
// LayerDelegate that paints colors to the layer. // LayerDelegate that paints colors to the layer.
class TestLayerDelegate : public LayerDelegate { class TestLayerDelegate : public LayerDelegate {
public: public:
explicit TestLayerDelegate() : color_index_(0) {} explicit TestLayerDelegate() { reset(); }
virtual ~TestLayerDelegate() {} virtual ~TestLayerDelegate() {}
void AddColor(SkColor color) { void AddColor(SkColor color) {
...@@ -226,6 +229,10 @@ class TestLayerDelegate : public LayerDelegate { ...@@ -226,6 +229,10 @@ class TestLayerDelegate : public LayerDelegate {
return StringPrintf("%.1f %.1f", scale_x_, scale_y_); return StringPrintf("%.1f %.1f", scale_x_, scale_y_);
} }
float device_scale_factor() const {
return device_scale_factor_;
}
// Overridden from LayerDelegate: // Overridden from LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
SkBitmap contents = canvas->ExtractBitmap(); SkBitmap contents = canvas->ExtractBitmap();
...@@ -237,10 +244,15 @@ class TestLayerDelegate : public LayerDelegate { ...@@ -237,10 +244,15 @@ class TestLayerDelegate : public LayerDelegate {
scale_y_ = matrix.getScaleY(); scale_y_ = matrix.getScaleY();
} }
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
device_scale_factor_ = device_scale_factor;
}
void reset() { void reset() {
color_index_ = 0; color_index_ = 0;
paint_size_.SetSize(0, 0); paint_size_.SetSize(0, 0);
scale_x_ = scale_y_ = 0.0f; scale_x_ = scale_y_ = 0.0f;
device_scale_factor_ = 0.0f;
} }
private: private:
...@@ -249,6 +261,7 @@ class TestLayerDelegate : public LayerDelegate { ...@@ -249,6 +261,7 @@ class TestLayerDelegate : public LayerDelegate {
gfx::Size paint_size_; gfx::Size paint_size_;
float scale_x_; float scale_x_;
float scale_y_; float scale_y_;
float device_scale_factor_;
DISALLOW_COPY_AND_ASSIGN(TestLayerDelegate); DISALLOW_COPY_AND_ASSIGN(TestLayerDelegate);
}; };
...@@ -270,6 +283,8 @@ class DrawTreeLayerDelegate : public LayerDelegate { ...@@ -270,6 +283,8 @@ class DrawTreeLayerDelegate : public LayerDelegate {
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
painted_ = true; painted_ = true;
} }
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
}
bool painted_; bool painted_;
...@@ -286,6 +301,8 @@ class NullLayerDelegate : public LayerDelegate { ...@@ -286,6 +301,8 @@ class NullLayerDelegate : public LayerDelegate {
// Overridden from LayerDelegate: // Overridden from LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
} }
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
}
DISALLOW_COPY_AND_ASSIGN(NullLayerDelegate); DISALLOW_COPY_AND_ASSIGN(NullLayerDelegate);
}; };
...@@ -1000,6 +1017,9 @@ class SchedulePaintLayerDelegate : public LayerDelegate { ...@@ -1000,6 +1017,9 @@ class SchedulePaintLayerDelegate : public LayerDelegate {
last_clip_rect_ = gfx::SkRectToRect(sk_clip_rect); last_clip_rect_ = gfx::SkRectToRect(sk_clip_rect);
} }
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
}
int paint_count_; int paint_count_;
Layer* layer_; Layer* layer_;
gfx::Rect schedule_paint_rect_; gfx::Rect schedule_paint_rect_;
...@@ -1071,6 +1091,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { ...@@ -1071,6 +1091,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
EXPECT_EQ("200x220", size_in_pixel.ToString()); EXPECT_EQ("200x220", size_in_pixel.ToString());
size_in_pixel = l1->web_layer().bounds(); size_in_pixel = l1->web_layer().bounds();
EXPECT_EQ("140x180", size_in_pixel.ToString()); EXPECT_EQ("140x180", size_in_pixel.ToString());
// No scale change, so no scale notification.
EXPECT_EQ(0.0f, root_delegate.device_scale_factor());
EXPECT_EQ(0.0f, l1_delegate.device_scale_factor());
RunPendingMessages(); RunPendingMessages();
EXPECT_EQ("200x220", root_delegate.paint_size().ToString()); EXPECT_EQ("200x220", root_delegate.paint_size().ToString());
...@@ -1085,6 +1108,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { ...@@ -1085,6 +1108,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
EXPECT_EQ("400x440", size_in_pixel.ToString()); EXPECT_EQ("400x440", size_in_pixel.ToString());
size_in_pixel = l1->web_layer().bounds(); size_in_pixel = l1->web_layer().bounds();
EXPECT_EQ("280x360", size_in_pixel.ToString()); EXPECT_EQ("280x360", size_in_pixel.ToString());
// New scale factor must have been notified.
EXPECT_EQ(2.0f, root_delegate.device_scale_factor());
EXPECT_EQ(2.0f, l1_delegate.device_scale_factor());
// Canvas size must have been scaled down up. // Canvas size must have been scaled down up.
RunPendingMessages(); RunPendingMessages();
...@@ -1102,6 +1128,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { ...@@ -1102,6 +1128,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
EXPECT_EQ("200x220", size_in_pixel.ToString()); EXPECT_EQ("200x220", size_in_pixel.ToString());
size_in_pixel = l1->web_layer().bounds(); size_in_pixel = l1->web_layer().bounds();
EXPECT_EQ("140x180", size_in_pixel.ToString()); EXPECT_EQ("140x180", size_in_pixel.ToString());
// New scale factor must have been notified.
EXPECT_EQ(1.0f, root_delegate.device_scale_factor());
EXPECT_EQ(1.0f, l1_delegate.device_scale_factor());
// Canvas size must have been scaled down too. // Canvas size must have been scaled down too.
RunPendingMessages(); RunPendingMessages();
...@@ -1112,8 +1141,12 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { ...@@ -1112,8 +1141,12 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
root_delegate.reset(); root_delegate.reset();
l1_delegate.reset(); l1_delegate.reset();
// Just changing the size shouldn't trigger repaint. // Just changing the size shouldn't notify the scale change nor
// trigger repaint.
GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(1000, 1000)); GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(1000, 1000));
// No scale change, so no scale notification.
EXPECT_EQ(0.0f, root_delegate.device_scale_factor());
EXPECT_EQ(0.0f, l1_delegate.device_scale_factor());
RunPendingMessages(); RunPendingMessages();
EXPECT_EQ("0x0", root_delegate.paint_size().ToString()); EXPECT_EQ("0x0", root_delegate.paint_size().ToString());
EXPECT_EQ("0.0 0.0", root_delegate.ToScaleString()); EXPECT_EQ("0.0 0.0", root_delegate.ToScaleString());
...@@ -1139,6 +1172,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) { ...@@ -1139,6 +1172,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) {
EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
gfx::Size size_in_pixel = l1->web_layer().bounds(); gfx::Size size_in_pixel = l1->web_layer().bounds();
EXPECT_EQ("140x180", size_in_pixel.ToString()); EXPECT_EQ("140x180", size_in_pixel.ToString());
EXPECT_EQ(0.0f, l1_delegate.device_scale_factor());
RunPendingMessages(); RunPendingMessages();
EXPECT_EQ("140x180", l1_delegate.paint_size().ToString()); EXPECT_EQ("140x180", l1_delegate.paint_size().ToString());
...@@ -1159,6 +1193,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) { ...@@ -1159,6 +1193,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) {
EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
size_in_pixel = l1->web_layer().bounds(); size_in_pixel = l1->web_layer().bounds();
EXPECT_EQ("280x360", size_in_pixel.ToString()); EXPECT_EQ("280x360", size_in_pixel.ToString());
EXPECT_EQ(2.0f, l1_delegate.device_scale_factor());
RunPendingMessages(); RunPendingMessages();
EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); EXPECT_EQ("280x360", l1_delegate.paint_size().ToString());
EXPECT_EQ("2.0 2.0", l1_delegate.ToScaleString()); EXPECT_EQ("2.0 2.0", l1_delegate.ToScaleString());
...@@ -1179,6 +1214,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_NoScaleCanvas) { ...@@ -1179,6 +1214,9 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_NoScaleCanvas) {
GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500));
GetCompositor()->SetRootLayer(root.get()); GetCompositor()->SetRootLayer(root.get());
// Scale factor change is notified regardless of scale_canvas flag.
EXPECT_EQ(2.0f, l1_delegate.device_scale_factor());
RunPendingMessages(); RunPendingMessages();
EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); EXPECT_EQ("280x360", l1_delegate.paint_size().ToString());
EXPECT_EQ("1.0 1.0", l1_delegate.ToScaleString()); EXPECT_EQ("1.0 1.0", l1_delegate.ToScaleString());
......
...@@ -1230,6 +1230,10 @@ void View::OnPaintLayer(gfx::Canvas* canvas) { ...@@ -1230,6 +1230,10 @@ void View::OnPaintLayer(gfx::Canvas* canvas) {
PaintCommon(canvas); PaintCommon(canvas);
} }
void View::OnDeviceScaleFactorChanged(float device_scale_factor) {
// Repainting with new scale factor will paint the content at the right scale.
}
void View::ReorderLayers() { void View::ReorderLayers() {
View* v = this; View* v = this;
while (v && !v->layer()) while (v && !v->layer())
......
...@@ -996,6 +996,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, ...@@ -996,6 +996,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// Overridden from ui::LayerDelegate: // Overridden from ui::LayerDelegate:
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
// Finds the layer that this view paints to (it may belong to an ancestor // Finds the layer that this view paints to (it may belong to an ancestor
// view), then reorders the immediate children of that layer to match the // view), then reorders the immediate children of that layer to match the
......
...@@ -784,6 +784,10 @@ void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { ...@@ -784,6 +784,10 @@ void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) {
delegate_->OnNativeWidgetPaint(canvas); delegate_->OnNativeWidgetPaint(canvas);
} }
void NativeWidgetAura::OnDeviceScaleFactorChanged(float device_scale_factor) {
// Repainting with new scale factor will paint the content at the right scale.
}
void NativeWidgetAura::OnWindowDestroying() { void NativeWidgetAura::OnWindowDestroying() {
delegate_->OnNativeWidgetDestroying(); delegate_->OnNativeWidgetDestroying();
......
...@@ -144,6 +144,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, ...@@ -144,6 +144,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate,
virtual bool CanFocus() OVERRIDE; virtual bool CanFocus() OVERRIDE;
virtual void OnCaptureLost() OVERRIDE; virtual void OnCaptureLost() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
virtual void OnWindowDestroying() OVERRIDE; virtual void OnWindowDestroying() OVERRIDE;
virtual void OnWindowDestroyed() OVERRIDE; virtual void OnWindowDestroyed() OVERRIDE;
virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment