diff options
author | sky <sky@chromium.org> | 2015-06-18 09:24:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-18 16:24:57 +0000 |
commit | b2afc80c28194355a327afc86a3ac0a4bf9ec692 (patch) | |
tree | 0278f3ba67f178be0b8923a7270a6f9ff9fbdd4a | |
parent | c3cbf801393eff10b8fe91e862ff63fd7c59da8c (diff) | |
download | chromium_src-b2afc80c28194355a327afc86a3ac0a4bf9ec692.zip chromium_src-b2afc80c28194355a327afc86a3ac0a4bf9ec692.tar.gz chromium_src-b2afc80c28194355a327afc86a3ac0a4bf9ec692.tar.bz2 |
Plumbs through device scale factor when widget is available
BUG=none
TEST=none
R=sadrul@chromium.org
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/1184123008
Cr-Commit-Position: refs/heads/master@{#335059}
-rw-r--r-- | components/view_manager/native_viewport/platform_viewport_common.cc | 9 | ||||
-rw-r--r-- | content/browser/compositor/software_output_device_ozone_unittest.cc | 3 | ||||
-rw-r--r-- | content/common/gpu/media/rendering_helper.cc | 5 | ||||
-rw-r--r-- | ui/aura/window_tree_host_ozone.cc | 3 | ||||
-rw-r--r-- | ui/aura/window_tree_host_ozone.h | 3 | ||||
-rw-r--r-- | ui/aura/window_tree_host_win.cc | 3 | ||||
-rw-r--r-- | ui/aura/window_tree_host_win.h | 3 | ||||
-rw-r--r-- | ui/ozone/demo/ozone_demo.cc | 3 | ||||
-rw-r--r-- | ui/ozone/platform/caca/caca_window.cc | 2 | ||||
-rw-r--r-- | ui/ozone/platform/cast/platform_window_cast.cc | 2 | ||||
-rw-r--r-- | ui/ozone/platform/drm/host/drm_window_host.cc | 2 | ||||
-rw-r--r-- | ui/ozone/platform/egltest/ozone_platform_egltest.cc | 2 | ||||
-rw-r--r-- | ui/ozone/platform/test/test_window.cc | 2 | ||||
-rw-r--r-- | ui/platform_window/android/platform_window_android.cc | 2 | ||||
-rw-r--r-- | ui/platform_window/platform_window_delegate.h | 3 | ||||
-rw-r--r-- | ui/platform_window/win/win_window.cc | 3 | ||||
-rw-r--r-- | ui/platform_window/x11/x11_window.cc | 3 |
17 files changed, 31 insertions, 22 deletions
diff --git a/components/view_manager/native_viewport/platform_viewport_common.cc b/components/view_manager/native_viewport/platform_viewport_common.cc index bf20626..7656c42 100644 --- a/components/view_manager/native_viewport/platform_viewport_common.cc +++ b/components/view_manager/native_viewport/platform_viewport_common.cc @@ -56,8 +56,6 @@ class PlatformViewportCommon : public PlatformViewport, CHECK(!platform_window_); metrics_ = mojo::ViewportMetrics::New(); - // TODO(sky): make density real. - metrics_->device_pixel_ratio = 1.f; metrics_->size_in_pixels = mojo::Size::From(bounds.size()); #if defined(OS_WIN) @@ -86,9 +84,8 @@ class PlatformViewportCommon : public PlatformViewport, // ui::PlatformWindowDelegate: void OnBoundsChanged(const gfx::Rect& new_bounds) override { - // TODO(fsamuel): Use the real device_scale_factor. delegate_->OnMetricsChanged(new_bounds.size(), - 1.f /* device_scale_factor */); + metrics_->device_pixel_ratio); } void OnDamageRect(const gfx::Rect& damaged_region) override {} @@ -163,7 +160,9 @@ class PlatformViewportCommon : public PlatformViewport, void OnLostCapture() override {} - void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override { + void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) override { + metrics_->device_pixel_ratio = device_pixel_ratio; delegate_->OnAcceleratedWidgetAvailable(widget, metrics_->device_pixel_ratio); } diff --git a/content/browser/compositor/software_output_device_ozone_unittest.cc b/content/browser/compositor/software_output_device_ozone_unittest.cc index 99c55bd..19d5c56 100644 --- a/content/browser/compositor/software_output_device_ozone_unittest.cc +++ b/content/browser/compositor/software_output_device_ozone_unittest.cc @@ -38,7 +38,8 @@ class TestPlatformWindowDelegate : public ui::PlatformWindowDelegate { void OnClosed() override {} void OnWindowStateChanged(ui::PlatformWindowState new_state) override {} void OnLostCapture() override {} - void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override { + void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) override { widget_ = widget; } void OnActivationChanged(bool active) override {} diff --git a/content/common/gpu/media/rendering_helper.cc b/content/common/gpu/media/rendering_helper.cc index 06252a5..b67106e5 100644 --- a/content/common/gpu/media/rendering_helper.cc +++ b/content/common/gpu/media/rendering_helper.cc @@ -124,9 +124,10 @@ class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { void OnLostCapture() override {}; - void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override { + void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) override { accelerated_widget_ = widget; - }; + } void OnActivationChanged(bool active) override {}; diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc index fd2854c..8671e3a 100644 --- a/ui/aura/window_tree_host_ozone.cc +++ b/ui/aura/window_tree_host_ozone.cc @@ -101,7 +101,8 @@ void WindowTreeHostOzone::OnLostCapture() { } void WindowTreeHostOzone::OnAcceleratedWidgetAvailable( - gfx::AcceleratedWidget widget) { + gfx::AcceleratedWidget widget, + float device_pixel_ratio) { widget_ = widget; CreateCompositor(widget_); } diff --git a/ui/aura/window_tree_host_ozone.h b/ui/aura/window_tree_host_ozone.h index 67f01d9..b356a30 100644 --- a/ui/aura/window_tree_host_ozone.h +++ b/ui/aura/window_tree_host_ozone.h @@ -48,7 +48,8 @@ class AURA_EXPORT WindowTreeHostOzone : public WindowTreeHost, void OnClosed() override; void OnWindowStateChanged(ui::PlatformWindowState new_state) override; void OnLostCapture() override; - void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; + void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) override; void OnActivationChanged(bool active) override; // Platform-specific part of this WindowTreeHost. diff --git a/ui/aura/window_tree_host_win.cc b/ui/aura/window_tree_host_win.cc index 3252093..6f879ab 100644 --- a/ui/aura/window_tree_host_win.cc +++ b/ui/aura/window_tree_host_win.cc @@ -151,7 +151,8 @@ void WindowTreeHostWin::OnLostCapture() { } void WindowTreeHostWin::OnAcceleratedWidgetAvailable( - gfx::AcceleratedWidget widget) { + gfx::AcceleratedWidget widget, + float device_pixel_ratio) { widget_ = widget; CreateCompositor(widget); } diff --git a/ui/aura/window_tree_host_win.h b/ui/aura/window_tree_host_win.h index 6d0054c..e49890d 100644 --- a/ui/aura/window_tree_host_win.h +++ b/ui/aura/window_tree_host_win.h @@ -47,7 +47,8 @@ class AURA_EXPORT WindowTreeHostWin void OnClosed() override; void OnWindowStateChanged(ui::PlatformWindowState new_state) override; void OnLostCapture() override; - void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; + void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) override; void OnActivationChanged(bool active) override; bool has_capture_; diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc index b5b3ac8..3e1a37f 100644 --- a/ui/ozone/demo/ozone_demo.cc +++ b/ui/ozone/demo/ozone_demo.cc @@ -144,7 +144,8 @@ class DemoWindow : public ui::PlatformWindowDelegate { void OnClosed() override {} void OnWindowStateChanged(ui::PlatformWindowState new_state) override {} void OnLostCapture() override {} - void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override { + void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) override { DCHECK_NE(widget, gfx::kNullAcceleratedWidget); widget_ = widget; } diff --git a/ui/ozone/platform/caca/caca_window.cc b/ui/ozone/platform/caca/caca_window.cc index f0dc0a7..c4e0a4a 100644 --- a/ui/ozone/platform/caca/caca_window.cc +++ b/ui/ozone/platform/caca/caca_window.cc @@ -36,7 +36,7 @@ CacaWindow::CacaWindow(PlatformWindowDelegate* delegate, weak_ptr_factory_(this) { widget_ = manager_->AddWindow(this); ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); - delegate_->OnAcceleratedWidgetAvailable(widget_); + delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); } CacaWindow::~CacaWindow() { diff --git a/ui/ozone/platform/cast/platform_window_cast.cc b/ui/ozone/platform/cast/platform_window_cast.cc index c9ea0ed..b0f6630 100644 --- a/ui/ozone/platform/cast/platform_window_cast.cc +++ b/ui/ozone/platform/cast/platform_window_cast.cc @@ -12,7 +12,7 @@ PlatformWindowCast::PlatformWindowCast(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) : delegate_(delegate), bounds_(bounds) { widget_ = (bounds.width() << 16) + bounds.height(); - delegate_->OnAcceleratedWidgetAvailable(widget_); + delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); } gfx::Rect PlatformWindowCast::GetBounds() { diff --git a/ui/ozone/platform/drm/host/drm_window_host.cc b/ui/ozone/platform/drm/host/drm_window_host.cc index 4ce21c3..6d336d3 100644 --- a/ui/ozone/platform/drm/host/drm_window_host.cc +++ b/ui/ozone/platform/drm/host/drm_window_host.cc @@ -52,7 +52,7 @@ void DrmWindowHost::Initialize() { sender_->AddChannelObserver(this); PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); - delegate_->OnAcceleratedWidgetAvailable(widget_); + delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); } gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc index 31f35a6..2ec2a66 100644 --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc +++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc @@ -122,7 +122,7 @@ EgltestWindow::EgltestWindow(PlatformWindowDelegate* delegate, bounds_(bounds), window_id_(SHIM_NO_WINDOW_ID) { window_id_ = eglplatform_shim_->ShimCreateWindow(); - delegate_->OnAcceleratedWidgetAvailable(window_id_); + delegate_->OnAcceleratedWidgetAvailable(window_id_, 1.f); ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); } diff --git a/ui/ozone/platform/test/test_window.cc b/ui/ozone/platform/test/test_window.cc index 2890ccf..a6a79ee 100644 --- a/ui/ozone/platform/test/test_window.cc +++ b/ui/ozone/platform/test/test_window.cc @@ -19,7 +19,7 @@ TestWindow::TestWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) : delegate_(delegate), manager_(manager), bounds_(bounds) { widget_ = manager_->AddWindow(this); - delegate_->OnAcceleratedWidgetAvailable(widget_); + delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); } TestWindow::~TestWindow() { diff --git a/ui/platform_window/android/platform_window_android.cc b/ui/platform_window/android/platform_window_android.cc index 6d6af40..eac8fea 100644 --- a/ui/platform_window/android/platform_window_android.cc +++ b/ui/platform_window/android/platform_window_android.cc @@ -84,7 +84,7 @@ void PlatformWindowAndroid::SurfaceCreated(JNIEnv* env, base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); window_ = ANativeWindow_fromSurface(env, jsurface); } - delegate_->OnAcceleratedWidgetAvailable(window_); + delegate_->OnAcceleratedWidgetAvailable(window_, device_pixel_ratio); } void PlatformWindowAndroid::SurfaceDestroyed(JNIEnv* env, jobject obj) { diff --git a/ui/platform_window/platform_window_delegate.h b/ui/platform_window/platform_window_delegate.h index b215275..67c63a7 100644 --- a/ui/platform_window/platform_window_delegate.h +++ b/ui/platform_window/platform_window_delegate.h @@ -43,7 +43,8 @@ class PlatformWindowDelegate { virtual void OnLostCapture() = 0; - virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) = 0; + virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, + float device_pixel_ratio) = 0; virtual void OnActivationChanged(bool active) = 0; }; diff --git a/ui/platform_window/win/win_window.cc b/ui/platform_window/win/win_window.cc index 936b250..c2554d4 100644 --- a/ui/platform_window/win/win_window.cc +++ b/ui/platform_window/win/win_window.cc @@ -171,7 +171,8 @@ LRESULT WinWindow::OnCreate(CREATESTRUCT* create_struct) { tracked_objects::ScopedTracker tracking_profile( FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 WinWindow::OnCreate")); - delegate_->OnAcceleratedWidgetAvailable(hwnd()); + // TODO(sky): provide real scale factor. + delegate_->OnAcceleratedWidgetAvailable(hwnd(), 1.f); return 0; } diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc index ed6d353..0646315 100644 --- a/ui/platform_window/x11/x11_window.cc +++ b/ui/platform_window/x11/x11_window.cc @@ -198,7 +198,8 @@ void X11Window::Show() { size_hints.win_gravity = StaticGravity; XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); - delegate_->OnAcceleratedWidgetAvailable(xwindow_); + // TODO(sky): provide real scale factor. + delegate_->OnAcceleratedWidgetAvailable(xwindow_, 1.f); XMapWindow(xdisplay_, xwindow_); |