LCOV - code coverage report
Current view: top level - hal/fallback - FallbackScreenConfiguration.h (source / functions) Hit Total Coverage
Test: output.info Lines: 12 14 85.7 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "Hal.h"
       6             : #include "mozilla/dom/ScreenOrientation.h"
       7             : #include "nsIScreenManager.h"
       8             : #include "nsServiceManagerUtils.h"
       9             : 
      10             : namespace mozilla {
      11             : namespace fallback {
      12             : 
      13             : inline void
      14           1 : GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
      15             : {
      16             :   nsresult rv;
      17             :   nsCOMPtr<nsIScreenManager> screenMgr =
      18           2 :     do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
      19           1 :   if (NS_FAILED(rv)) {
      20           0 :     NS_ERROR("Can't find nsIScreenManager!");
      21           0 :     return;
      22             :   }
      23             : 
      24           1 :   nsIntRect rect;
      25             :   int32_t colorDepth, pixelDepth;
      26             :   dom::ScreenOrientationInternal orientation;
      27           2 :   nsCOMPtr<nsIScreen> screen;
      28             : 
      29           1 :   screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
      30           1 :   screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
      31           1 :   screen->GetColorDepth(&colorDepth);
      32           1 :   screen->GetPixelDepth(&pixelDepth);
      33           2 :   orientation = rect.width >= rect.height
      34           1 :                 ? dom::eScreenOrientation_LandscapePrimary
      35             :                 : dom::eScreenOrientation_PortraitPrimary;
      36             : 
      37             :   *aScreenConfiguration =
      38           1 :       hal::ScreenConfiguration(rect, orientation, 0, colorDepth, pixelDepth);
      39             : }
      40             : 
      41             : }
      42             : }

Generated by: LCOV version 1.13