LCOV - code coverage report
Current view: top level - gfx/layers/client - ClientColorLayer.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 27 27 100.0 %
Date: 2017-07-14 16:53:18 Functions: 10 10 100.0 %
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             : #include "ClientLayerManager.h"         // for ClientLayerManager, etc
       7             : #include "Layers.h"                     // for ColorLayer, etc
       8             : #include "mozilla/layers/LayersMessages.h"  // for ColorLayerAttributes, etc
       9             : #include "mozilla/mozalloc.h"           // for operator new
      10             : #include "nsCOMPtr.h"                   // for already_AddRefed
      11             : #include "nsDebug.h"                    // for NS_ASSERTION
      12             : #include "nsISupportsImpl.h"            // for Layer::AddRef, etc
      13             : #include "nsRegion.h"                   // for nsIntRegion
      14             : 
      15             : namespace mozilla {
      16             : namespace layers {
      17             : 
      18             : using namespace mozilla::gfx;
      19             : 
      20             : class ClientColorLayer : public ColorLayer,
      21             :                          public ClientLayer {
      22             : public:
      23           4 :   explicit ClientColorLayer(ClientLayerManager* aLayerManager) :
      24           4 :     ColorLayer(aLayerManager, static_cast<ClientLayer*>(this))
      25             :   {
      26           4 :     MOZ_COUNT_CTOR(ClientColorLayer);
      27           4 :   }
      28             : 
      29             : protected:
      30           4 :   virtual ~ClientColorLayer()
      31           4 :   {
      32           2 :     MOZ_COUNT_DTOR(ClientColorLayer);
      33           6 :   }
      34             : 
      35             : public:
      36           5 :   virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
      37             :   {
      38           5 :     NS_ASSERTION(ClientManager()->InConstruction(),
      39             :                  "Can only set properties in construction phase");
      40           5 :     ColorLayer::SetVisibleRegion(aRegion);
      41           5 :   }
      42             : 
      43           5 :   virtual void RenderLayer()
      44             :   {
      45           5 :     RenderMaskLayers(this);
      46           5 :   }
      47             : 
      48           4 :   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
      49             :   {
      50           4 :     aAttrs = ColorLayerAttributes(GetColor(), GetBounds());
      51           4 :   }
      52             : 
      53          10 :   virtual Layer* AsLayer() { return this; }
      54          11 :   virtual ShadowableLayer* AsShadowableLayer() { return this; }
      55             : 
      56             : protected:
      57           5 :   ClientLayerManager* ClientManager()
      58             :   {
      59           5 :     return static_cast<ClientLayerManager*>(mManager);
      60             :   }
      61             : };
      62             : 
      63             : already_AddRefed<ColorLayer>
      64           4 : ClientLayerManager::CreateColorLayer()
      65             : {
      66           4 :   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
      67             :   RefPtr<ClientColorLayer> layer =
      68           8 :     new ClientColorLayer(this);
      69           4 :   CREATE_SHADOW(Color);
      70           8 :   return layer.forget();
      71             : }
      72             : 
      73             : } // namespace layers
      74             : } // namespace mozilla

Generated by: LCOV version 1.13