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

Unified Diff: ui/gfx/screen_android.cc

Issue 11886074: Use correct favicon scale factor on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments added; GetWidth() renamed to GetDisplayWidth() etc. Created 7 years, 11 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: ui/gfx/screen_android.cc
diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc
index a80582e077d22e1ff373c70f50f66cec6a534778..0da3f250fb144e579b92e5642c4b638ae528a709 100644
--- a/ui/gfx/screen_android.cc
+++ b/ui/gfx/screen_android.cc
@@ -5,7 +5,9 @@
#include "ui/gfx/screen.h"
#include "base/logging.h"
+#include "ui/gfx/android/device_info.h"
#include "ui/gfx/display.h"
+#include "ui/gfx/size_conversions.h"
namespace gfx {
@@ -14,7 +16,7 @@ class ScreenAndroid : public Screen {
ScreenAndroid() {}
bool IsDIPEnabled() OVERRIDE {
- return false;
+ return true;
}
gfx::Point GetCursorScreenPoint() OVERRIDE {
@@ -27,8 +29,18 @@ class ScreenAndroid : public Screen {
}
gfx::Display GetPrimaryDisplay() const OVERRIDE {
- NOTIMPLEMENTED() << "crbug.com/117839 tracks implementation";
- return gfx::Display(0, gfx::Rect(0, 0, 1, 1));
+ gfx::DeviceInfo device_info;
+ const float device_scale_factor = device_info.GetDIPScale();
+ const gfx::Rect bounds_in_pixels =
+ gfx::Rect(
+ device_info.GetDisplayWidth(),
+ device_info.GetDisplayHeight());
+ const gfx::Rect bounds_in_dip =
+ gfx::Rect(gfx::ToRoundedSize(gfx::ScaleSize(
+ bounds_in_pixels.size(), 1.0f / device_scale_factor)));
+ gfx::Display display(0, bounds_in_dip);
+ display.set_device_scale_factor(device_scale_factor);
+ return display;
}
gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const OVERRIDE {

Powered by Google App Engine
This is Rietveld 408576698