LCOV - code coverage report
Current view: top level - gfx/layers/client - ClientTextLayer.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 34 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: 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 ClientTextLayer : public TextLayer,
      21             :                         public ClientLayer {
      22             : public:
      23           0 :   explicit ClientTextLayer(ClientLayerManager* aLayerManager) :
      24             :     TextLayer(aLayerManager, static_cast<ClientLayer*>(this)),
      25           0 :     mSwapped(false)
      26             :   {
      27           0 :     MOZ_COUNT_CTOR(ClientTextLayer);
      28           0 :   }
      29             : 
      30             : protected:
      31           0 :   virtual ~ClientTextLayer()
      32           0 :   {
      33           0 :     MOZ_COUNT_DTOR(ClientTextLayer);
      34           0 :   }
      35             : 
      36             : public:
      37           0 :   virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
      38             :   {
      39           0 :     NS_ASSERTION(ClientManager()->InConstruction(),
      40             :                  "Can only set properties in construction phase");
      41           0 :     TextLayer::SetVisibleRegion(aRegion);
      42           0 :   }
      43             : 
      44           0 :   virtual void RenderLayer()
      45             :   {
      46           0 :     RenderMaskLayers(this);
      47           0 :   }
      48             : 
      49           0 :   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
      50             :   {
      51           0 :     NS_ASSERTION(!mSwapped, "Trying to access glyph array after it's been swapped!");
      52           0 :     aAttrs = TextLayerAttributes(GetBounds(), nsTArray<GlyphArray>(), uintptr_t(mFont.get()));
      53           0 :     aAttrs.get_TextLayerAttributes().glyphs().SwapElements(mGlyphs);
      54           0 :     mSwapped = true;
      55           0 :   }
      56             : 
      57           0 :   virtual void SetGlyphs(nsTArray<GlyphArray>&& aGlyphs)
      58             :   {
      59           0 :     TextLayer::SetGlyphs(Move(aGlyphs));
      60           0 :     mSwapped = false;
      61           0 :   }
      62             : 
      63           0 :   virtual Layer* AsLayer() { return this; }
      64           0 :   virtual ShadowableLayer* AsShadowableLayer() { return this; }
      65             : 
      66             : protected:
      67           0 :   ClientLayerManager* ClientManager()
      68             :   {
      69           0 :     return static_cast<ClientLayerManager*>(mManager);
      70             :   }
      71             : 
      72             :   bool mSwapped;
      73             : };
      74             : 
      75             : already_AddRefed<TextLayer>
      76           0 : ClientLayerManager::CreateTextLayer()
      77             : {
      78           0 :   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
      79             :   RefPtr<ClientTextLayer> layer =
      80           0 :     new ClientTextLayer(this);
      81           0 :   CREATE_SHADOW(Text);
      82           0 :   return layer.forget();
      83             : }
      84             : 
      85             : } // namespace layers
      86             : } // namespace mozilla

Generated by: LCOV version 1.13