LCOV - code coverage report
Current view: top level - gfx/layers/basic - BasicContainerLayer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 17 28 60.7 %
Date: 2017-07-14 16:53:18 Functions: 5 8 62.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; 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             : #ifndef GFX_BASICCONTAINERLAYER_H
       7             : #define GFX_BASICCONTAINERLAYER_H
       8             : 
       9             : #include "BasicImplData.h"              // for BasicImplData
      10             : #include "BasicLayers.h"                // for BasicLayerManager
      11             : #include "Layers.h"                     // for Layer, ContainerLayer
      12             : #include "nsDebug.h"                    // for NS_ASSERTION
      13             : #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR
      14             : #include "nsISupportsUtils.h"           // for NS_ADDREF, NS_RELEASE
      15             : #include "mozilla/gfx/Rect.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace layers {
      19             : 
      20             : class BasicContainerLayer : public ContainerLayer, public BasicImplData {
      21             : public:
      22          54 :   explicit BasicContainerLayer(BasicLayerManager* aManager) :
      23          54 :     ContainerLayer(aManager, static_cast<BasicImplData*>(this))
      24             :   {
      25          54 :     MOZ_COUNT_CTOR(BasicContainerLayer);
      26          54 :     mSupportsComponentAlphaChildren = true;
      27          54 :   }
      28             : protected:
      29             :   virtual ~BasicContainerLayer();
      30             : 
      31             : public:
      32         185 :   virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
      33             :   {
      34         185 :     NS_ASSERTION(BasicManager()->InConstruction(),
      35             :                  "Can only set properties in construction phase");
      36         185 :     ContainerLayer::SetVisibleRegion(aRegion);
      37         185 :   }
      38         147 :   virtual bool InsertAfter(Layer* aChild, Layer* aAfter) override
      39             :   {
      40         147 :     if (!BasicManager()->InConstruction()) {
      41           0 :       NS_ERROR("Can only set properties in construction phase");
      42           0 :       return false;
      43             :     }
      44         147 :     return ContainerLayer::InsertAfter(aChild, aAfter);
      45             :   }
      46             : 
      47          69 :   virtual bool RemoveChild(Layer* aChild) override
      48             :   { 
      49          69 :     if (!BasicManager()->InConstruction()) {
      50           0 :       NS_ERROR("Can only set properties in construction phase");
      51           0 :       return false;
      52             :     }
      53          69 :     return ContainerLayer::RemoveChild(aChild);
      54             :   }
      55             : 
      56           0 :   virtual bool RepositionChild(Layer* aChild, Layer* aAfter) override
      57             :   {
      58           0 :     if (!BasicManager()->InConstruction()) {
      59           0 :       NS_ERROR("Can only set properties in construction phase");
      60           0 :       return false;
      61             :     }
      62           0 :     return ContainerLayer::RepositionChild(aChild, aAfter);
      63             :   }
      64             : 
      65             :   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override;
      66             : 
      67             :   /**
      68             :    * Returns true when:
      69             :    * a) no (non-hidden) childrens' visible areas overlap in
      70             :    * (aInRect intersected with this layer's visible region).
      71             :    * b) the (non-hidden) childrens' visible areas cover
      72             :    * (aInRect intersected with this layer's visible region).
      73             :    * c) this layer and all (non-hidden) children have transforms that are translations
      74             :    * by integers.
      75             :    * aInRect is in the root coordinate system.
      76             :    * Child layers with opacity do not contribute to the covered area in check b).
      77             :    * This method can be conservative; it's OK to return false under any
      78             :    * circumstances.
      79             :    */
      80             :   bool ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect);
      81             : 
      82           0 :   void ForceIntermediateSurface() { mUseIntermediateSurface = true; }
      83             : 
      84             :   void SetSupportsComponentAlphaChildren(bool aSupports) { mSupportsComponentAlphaChildren = aSupports; }
      85             : 
      86             :   virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback,
      87             :                         void* aCallbackData,
      88             :                         ReadbackProcessor* aReadback) override;
      89             : 
      90             :   /**
      91             :    * We don't really have a hard restriction for max layer size, but we pick
      92             :    * 4096 to avoid excessive memory usage.
      93             :    */
      94           0 :   virtual int32_t GetMaxLayerSize() override { return 4096; }
      95             : 
      96             : protected:
      97         473 :   BasicLayerManager* BasicManager()
      98             :   {
      99         473 :     return static_cast<BasicLayerManager*>(mManager);
     100             :   }
     101             : };
     102             : 
     103             : } // namespace layers
     104             : } // namespace mozilla
     105             : 
     106             : #endif

Generated by: LCOV version 1.13