LCOV - code coverage report
Current view: top level - gfx/layers/mlgpu - LayerMLGPU.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 72 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 17 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 "LayerManagerMLGPU.h"
       7             : #include "RenderPassMLGPU.h"
       8             : #include "RenderViewMLGPU.h"
       9             : #include "FrameBuilder.h"
      10             : #include "mozilla/layers/ImageHost.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace layers {
      14             : 
      15             : using namespace gfx;
      16             : 
      17             : uint64_t LayerMLGPU::sFrameKey = 0;
      18             : 
      19           0 : LayerMLGPU::LayerMLGPU(LayerManagerMLGPU* aManager)
      20             :  : HostLayer(aManager),
      21             :    mFrameKey(0),
      22           0 :    mPrepared(false)
      23             : {
      24           0 : }
      25             : 
      26             : /* static */ void
      27           0 : LayerMLGPU::BeginFrame()
      28             : {
      29           0 :   sFrameKey++;
      30           0 : }
      31             : 
      32             : LayerManagerMLGPU*
      33           0 : LayerMLGPU::GetManager()
      34             : {
      35           0 :   return static_cast<LayerManagerMLGPU*>(mCompositorManager);
      36             : }
      37             : 
      38             : bool
      39           0 : LayerMLGPU::PrepareToRender(FrameBuilder* aBuilder, const RenderTargetIntRect& aClipRect)
      40             : {
      41           0 :   if (mFrameKey == sFrameKey) {
      42           0 :     return mPrepared;
      43             :   }
      44           0 :   mFrameKey = sFrameKey;
      45           0 :   mPrepared = false;
      46             : 
      47           0 :   Layer* layer = GetLayer();
      48             : 
      49             :   // Only container layers may have mixed blend modes.
      50           0 :   MOZ_ASSERT_IF(layer->GetMixBlendMode() != CompositionOp::OP_OVER,
      51             :                 layer->GetType() == Layer::TYPE_CONTAINER);
      52             : 
      53           0 :   mComputedClipRect = aClipRect;
      54             : 
      55           0 :   if (layer->HasMaskLayers()) {
      56           0 :     mMask = aBuilder->AddMaskOperation(this);
      57             :   } else {
      58           0 :     mMask = nullptr;
      59             :   }
      60             : 
      61           0 :   if (!OnPrepareToRender(aBuilder)) {
      62           0 :     return false;
      63             :   }
      64             : 
      65           0 :   mComputedOpacity = layer->GetEffectiveOpacity();
      66           0 :   mPrepared = true;
      67           0 :   return true;
      68             : }
      69             : 
      70             : void
      71           0 : LayerMLGPU::AssignToView(FrameBuilder* aBuilder,
      72             :                          RenderViewMLGPU* aView,
      73             :                          Maybe<gfx::Polygon>&& aGeometry)
      74             : {
      75           0 :   AddBoundsToView(aBuilder, aView, Move(aGeometry));
      76           0 : }
      77             : 
      78             : void
      79           0 : LayerMLGPU::AddBoundsToView(FrameBuilder* aBuilder,
      80             :                             RenderViewMLGPU* aView,
      81             :                             Maybe<gfx::Polygon>&& aGeometry)
      82             : {
      83           0 :   IntRect bounds = GetClippedBoundingBox(aView, aGeometry);
      84           0 :   aView->AddItem(this, bounds, Move(aGeometry));
      85           0 : }
      86             : 
      87             : IntRect
      88           0 : LayerMLGPU::GetClippedBoundingBox(RenderViewMLGPU* aView,
      89             :                                   const Maybe<gfx::Polygon>& aGeometry)
      90             : {
      91           0 :   MOZ_ASSERT(IsPrepared());
      92             : 
      93           0 :   Layer* layer = GetLayer();
      94           0 :   const Matrix4x4& transform = layer->GetEffectiveTransform();
      95             : 
      96             :   Rect rect = aGeometry
      97           0 :               ? aGeometry->BoundingBox()
      98           0 :               : Rect(layer->GetLocalVisibleRegion().GetBounds().ToUnknownRect());
      99           0 :   rect = transform.TransformBounds(rect);
     100           0 :   rect.MoveBy(-aView->GetTargetOffset());
     101           0 :   rect = rect.Intersect(Rect(mComputedClipRect.ToUnknownRect()));
     102             : 
     103           0 :   IntRect bounds;
     104           0 :   rect.RoundOut();
     105           0 :   rect.ToIntRect(&bounds);
     106           0 :   return bounds;
     107             : }
     108             : 
     109             : void
     110           0 : LayerMLGPU::MarkPrepared()
     111             : {
     112           0 :   mFrameKey = sFrameKey;
     113           0 :   mPrepared = true;
     114           0 : }
     115             : 
     116             : bool
     117           0 : LayerMLGPU::IsContentOpaque()
     118             : {
     119           0 :   return GetLayer()->IsOpaque();
     120             : }
     121             : 
     122             : void
     123           0 : LayerMLGPU::SetRegionToRender(LayerIntRegion&& aRegion)
     124             : {
     125           0 :   SetShadowVisibleRegion(Move(aRegion));
     126           0 : }
     127             : 
     128             : void
     129           0 : LayerMLGPU::SetLayerManager(HostLayerManager* aManager)
     130             : {
     131           0 :   LayerManagerMLGPU* manager = aManager->AsLayerManagerMLGPU();
     132           0 :   MOZ_RELEASE_ASSERT(manager);
     133             : 
     134           0 :   HostLayer::SetLayerManager(aManager);
     135           0 :   GetLayer()->SetManager(manager, this);
     136             : 
     137           0 :   if (CompositableHost* host = GetCompositableHost()) {
     138           0 :     host->SetTextureSourceProvider(manager->GetTextureSourceProvider());
     139             :   }
     140             : 
     141           0 :   OnLayerManagerChange(manager);
     142           0 : }
     143             : 
     144           0 : RefLayerMLGPU::RefLayerMLGPU(LayerManagerMLGPU* aManager)
     145             :   : RefLayer(aManager, static_cast<HostLayer*>(this))
     146           0 :   , LayerMLGPU(aManager)
     147             : {
     148           0 : }
     149             : 
     150           0 : RefLayerMLGPU::~RefLayerMLGPU()
     151             : {
     152           0 : }
     153             : 
     154           0 : ColorLayerMLGPU::ColorLayerMLGPU(LayerManagerMLGPU* aManager)
     155             :   : ColorLayer(aManager, static_cast<HostLayer*>(this))
     156           0 :   , LayerMLGPU(aManager)
     157             : {
     158           0 : }
     159             : 
     160           0 : ColorLayerMLGPU::~ColorLayerMLGPU()
     161             : {
     162           0 : }
     163             : 
     164             : } // namespace layers
     165             : } // namespace mozilla

Generated by: LCOV version 1.13