LCOV - code coverage report
Current view: top level - gfx/layers/mlgpu - PaintedLayerMLGPU.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 52 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             : * This Source Code Form is subject to the terms of the Mozilla Public
       3             : * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "PaintedLayerMLGPU.h"
       7             : #include "LayerManagerMLGPU.h"
       8             : #include "mozilla/layers/LayersHelpers.h"
       9             : 
      10             : namespace mozilla {
      11             : 
      12             : using namespace gfx;
      13             : 
      14             : namespace layers {
      15             : 
      16           0 : PaintedLayerMLGPU::PaintedLayerMLGPU(LayerManagerMLGPU* aManager)
      17             :  : PaintedLayer(aManager, static_cast<HostLayer*>(this)),
      18           0 :    LayerMLGPU(aManager)
      19             : {
      20           0 :   MOZ_COUNT_CTOR(PaintedLayerMLGPU);
      21           0 : }
      22             : 
      23           0 : PaintedLayerMLGPU::~PaintedLayerMLGPU()
      24             : {
      25           0 :   MOZ_COUNT_DTOR(PaintedLayerMLGPU);
      26             : 
      27           0 :   CleanupResources();
      28           0 : }
      29             : 
      30             : bool
      31           0 : PaintedLayerMLGPU::OnPrepareToRender(FrameBuilder* aBuilder)
      32             : {
      33           0 :   if (!mHost) {
      34           0 :     return false;
      35             :   }
      36             : 
      37           0 :   mTexture = mHost->AcquireTextureSource();
      38           0 :   if (!mTexture) {
      39           0 :     return false;
      40             :   }
      41           0 :   mTextureOnWhite = mHost->AcquireTextureSourceOnWhite();
      42             : 
      43             : #ifndef MOZ_IGNORE_PAINT_WILL_RESAMPLE
      44             :   // Note: we don't set PaintWillResample on our ContentTextureHost. The old
      45             :   // compositor must do this since ContentHost is responsible for issuing
      46             :   // draw calls, but in AL we can handle it directly here.
      47             :   //
      48             :   // Note that when AL performs CPU-based occlusion culling (the default
      49             :   // behavior), we might break up the visible region again. If that turns
      50             :   // out to be a problem, we can factor this into ForEachDrawRect instead.
      51           0 :   if (MayResample()) {
      52           0 :     LayerIntRegion visible = Move(GetShadowVisibleRegion());
      53           0 :     visible = visible.GetBounds();
      54           0 :     SetShadowVisibleRegion(Move(visible));
      55             :   }
      56             : #endif
      57           0 :   return true;
      58             : }
      59             : 
      60             : bool
      61           0 : PaintedLayerMLGPU::SetCompositableHost(CompositableHost* aHost)
      62             : {
      63           0 :   switch (aHost->GetType()) {
      64             :     case CompositableType::CONTENT_SINGLE:
      65             :     case CompositableType::CONTENT_DOUBLE:
      66           0 :       mHost = static_cast<ContentHostBase*>(aHost)->AsContentHostTexture();
      67           0 :       if (!mHost) {
      68           0 :         gfxWarning() << "ContentHostBase is not a ContentHostTexture";
      69             :       }
      70           0 :       return true;
      71             :     default:
      72           0 :       return false;
      73             :   }
      74             : }
      75             : 
      76             : CompositableHost*
      77           0 : PaintedLayerMLGPU::GetCompositableHost()
      78             : {
      79           0 :   return mHost;
      80             : }
      81             : 
      82             : void
      83           0 : PaintedLayerMLGPU::CleanupResources()
      84             : {
      85           0 :   if (mHost) {
      86           0 :     mHost->Detach(this);
      87             :   }
      88           0 :   mTexture = nullptr;
      89           0 :   mTextureOnWhite = nullptr;
      90           0 :   mHost = nullptr;
      91           0 : }
      92             : 
      93             : void
      94           0 : PaintedLayerMLGPU::PrintInfo(std::stringstream& aStream, const char* aPrefix)
      95             : {
      96           0 :   PaintedLayer::PrintInfo(aStream, aPrefix);
      97           0 :   if (mHost && mHost->IsAttached()) {
      98           0 :     aStream << "\n";
      99           0 :     nsAutoCString pfx(aPrefix);
     100           0 :     pfx += "  ";
     101           0 :     mHost->PrintInfo(aStream, pfx.get());
     102             :   }
     103           0 : }
     104             : 
     105             : void
     106           0 : PaintedLayerMLGPU::Disconnect()
     107             : {
     108           0 :   CleanupResources();
     109           0 : }
     110             : 
     111             : bool
     112           0 : PaintedLayerMLGPU::IsContentOpaque()
     113             : {
     114           0 :   return !!(GetContentFlags() & CONTENT_OPAQUE);
     115             : }
     116             : 
     117             : void
     118           0 : PaintedLayerMLGPU::CleanupCachedResources()
     119             : {
     120           0 :   CleanupResources();
     121           0 : }
     122             : 
     123             : } // namespace layers
     124             : } // namespace mozilla

Generated by: LCOV version 1.13