Bug 845182 - Implement GetDefaultScaleInternal() on Gonk, r=roc
authorMichael Wu <mwu@mozilla.com>
Wed, 01 May 2013 16:04:56 -0400
changeset 141495 3022abb316af57a23915bc44681afd09ef36682f
parent 141414 c29ff6b56977f2c92b3642e5bab7b5eb98fd11cf
child 141496 f7aad2536e3eb2e6277f31c9ad05f68dcc80851c
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs845182
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 845182 - Implement GetDefaultScaleInternal() on Gonk, r=roc
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -536,16 +536,27 @@ nsWindow::MakeFullScreen(bool aFullScree
 }
 
 float
 nsWindow::GetDPI()
 {
     return NativeWindow()->xdpi;
 }
 
+double
+nsWindow::GetDefaultScaleInternal()
+{
+    double rawscale = GetDPI() / 192.0;
+    if (rawscale < 1.25)
+        return 1;
+    else if (rawscale < 1.75)
+        return 1.5;
+    return 2;
+}
+
 LayerManager *
 nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
                           LayersBackend aBackendHint,
                           LayerManagerPersistence aPersistence,
                           bool* aAllowRetaining)
 {
     if (aAllowRetaining)
         *aAllowRetaining = true;
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -88,16 +88,17 @@ public:
     {
         return NS_ERROR_NOT_IMPLEMENTED;
     }
     NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
 
     NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/;
 
     virtual float GetDPI();
+    virtual double GetDefaultScaleInternal();
     virtual mozilla::layers::LayerManager*
         GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
                         LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
                         LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
                         bool* aAllowRetaining = nullptr);
     gfxASurface* GetThebesSurface();
 
     NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,