LCOV - code coverage report
Current view: top level - widget/gtk - WindowSurfaceX11.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 24 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  *
       3             :  * This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "WindowSurfaceX11.h"
       8             : #include "gfxPlatform.h"
       9             : #include "X11UndefineNone.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace widget {
      13             : 
      14           0 : WindowSurfaceX11::WindowSurfaceX11(Display* aDisplay,
      15             :                                    Window aWindow,
      16             :                                    Visual* aVisual,
      17           0 :                                    unsigned int aDepth)
      18             :   : mDisplay(aDisplay)
      19             :   , mWindow(aWindow)
      20             :   , mVisual(aVisual)
      21             :   , mDepth(aDepth)
      22           0 :   , mFormat(GetVisualFormat(aVisual, aDepth))
      23             : {
      24           0 : }
      25             : 
      26             : /* static */
      27             : gfx::SurfaceFormat
      28           0 : WindowSurfaceX11::GetVisualFormat(const Visual* aVisual, unsigned int aDepth)
      29             : {
      30           0 :   switch (aDepth) {
      31             :   case 32:
      32           0 :     if (aVisual->red_mask == 0xff0000 &&
      33           0 :         aVisual->green_mask == 0xff00 &&
      34           0 :         aVisual->blue_mask == 0xff) {
      35           0 :       return gfx::SurfaceFormat::B8G8R8A8;
      36             :     }
      37           0 :     break;
      38             :   case 24:
      39             :     // Only support the BGRX layout, and report it as BGRA to the compositor.
      40             :     // The alpha channel will be discarded when we put the image.
      41             :     // Cairo/pixman lacks some fast paths for compositing BGRX onto BGRA, so
      42             :     // just report it as BGRX directly in that case.
      43           0 :     if (aVisual->red_mask == 0xff0000 &&
      44           0 :         aVisual->green_mask == 0xff00 &&
      45           0 :         aVisual->blue_mask == 0xff) {
      46           0 :       gfx::BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend();
      47           0 :       return backend == gfx::BackendType::CAIRO ? gfx::SurfaceFormat::B8G8R8X8
      48           0 :                                                 : gfx::SurfaceFormat::B8G8R8A8;
      49             :     }
      50           0 :     break;
      51             :   case 16:
      52           0 :     if (aVisual->red_mask == 0xf800 &&
      53           0 :         aVisual->green_mask == 0x07e0 &&
      54           0 :         aVisual->blue_mask == 0x1f) {
      55           0 :       return gfx::SurfaceFormat::R5G6B5_UINT16;
      56             :     }
      57           0 :     break;
      58             :   }
      59             : 
      60           0 :   return gfx::SurfaceFormat::UNKNOWN;
      61             : }
      62             : 
      63             : }  // namespace widget
      64             : }  // namespace mozilla

Generated by: LCOV version 1.13