Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: chromecast/graphics/cast_screen.cc

Issue 1972433002: [Chromecast] Handle device scale factor correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set device scale factor correctly Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromecast/graphics/cast_screen.cc
diff --git a/chromecast/graphics/cast_screen.cc b/chromecast/graphics/cast_screen.cc
index b88d75a61c2a643d14b0663b696d2454102861a2..9898f938331484ddb11218c8dae14a42f7fb3307 100644
--- a/chromecast/graphics/cast_screen.cc
+++ b/chromecast/graphics/cast_screen.cc
@@ -18,32 +18,11 @@ namespace {
const int64_t kDisplayId = 1;
-const int k720pWidth = 1280;
-const int k720pHeight = 720;
-
-// When CastScreen is first initialized, we may not have any display info
-// available. These constants hold the initial size that we default to, and
-// the size can be updated when we have actual display info at hand with
-// UpdateDisplaySize().
-const int kInitDisplayWidth = k720pWidth;
-const int kInitDisplayHeight = k720pHeight;
-
} // namespace
CastScreen::~CastScreen() {
}
-void CastScreen::SetDisplayResizeCallback(const DisplayResizeCallback& cb) {
- DCHECK(!cb.is_null());
- display_resize_cb_ = cb;
-}
-
-void CastScreen::UpdateDisplaySize(const gfx::Size& size) {
- display_.SetScaleAndBounds(1.0f, gfx::Rect(size));
- if (!display_resize_cb_.is_null())
- display_resize_cb_.Run(Size(size.width(), size.height()));
-}
-
gfx::Point CastScreen::GetCursorScreenPoint() {
return aura::Env::GetInstance()->last_mouse_location();
}
@@ -88,9 +67,10 @@ void CastScreen::AddObserver(display::DisplayObserver* observer) {}
void CastScreen::RemoveObserver(display::DisplayObserver* observer) {}
-CastScreen::CastScreen() : display_(kDisplayId) {
- display_.SetScaleAndBounds(1.0f,
- gfx::Rect(kInitDisplayWidth, kInitDisplayHeight));
+CastScreen::CastScreen(const gfx::Size& size) : display_(kDisplayId) {
+ // Device scale factor computed relative to 720p display
+ const float device_scale_factor = size.height() / 720.0f;
+ display_.SetScaleAndBounds(device_scale_factor, gfx::Rect(size));
}
} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698