Bug 845182 - Implement GetDefaultScaleInternal() on Gonk, r=roc
authorMichael Wu <mwu@mozilla.com>
Wed, 01 May 2013 16:04:56 -0400
changeset 130560 3022abb316af57a23915bc44681afd09ef36682f
parent 130479 c29ff6b56977f2c92b3642e5bab7b5eb98fd11cf
child 130561 f7aad2536e3eb2e6277f31c9ad05f68dcc80851c
push id1579
push userphilringnalda@gmail.com
push dateSat, 04 May 2013 04:38:04 +0000
treeherderfx-team@a56432a42a41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs845182
milestone23.0a1
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,