LCOV - code coverage report
Current view: top level - gfx/layers/basic - BasicBorderLayer.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 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 "BasicLayersImpl.h"            // for FillRectWithMask, etc
       7             : #include "Layers.h"                     // for ColorLayer, etc
       8             : #include "BasicImplData.h"              // for BasicImplData
       9             : #include "BasicLayers.h"                // for BasicLayerManager
      10             : #include "gfxContext.h"                 // for gfxContext, etc
      11             : #include "gfxRect.h"                    // for gfxRect
      12             : #include "gfx2DGlue.h"
      13             : #include "mozilla/mozalloc.h"           // for operator new
      14             : #include "nsCOMPtr.h"                   // for already_AddRefed
      15             : #include "nsDebug.h"                    // for NS_ASSERTION
      16             : #include "nsISupportsImpl.h"            // for Layer::AddRef, etc
      17             : #include "nsRect.h"                     // for mozilla::gfx::IntRect
      18             : #include "nsRegion.h"                   // for nsIntRegion
      19             : #include "mozilla/gfx/PathHelpers.h"
      20             : 
      21             : using namespace mozilla::gfx;
      22             : 
      23             : namespace mozilla {
      24             : namespace layers {
      25             : 
      26             : class BasicBorderLayer : public BorderLayer, public BasicImplData {
      27             : public:
      28           0 :   explicit BasicBorderLayer(BasicLayerManager* aLayerManager) :
      29           0 :     BorderLayer(aLayerManager, static_cast<BasicImplData*>(this))
      30             :   {
      31           0 :     MOZ_COUNT_CTOR(BasicBorderLayer);
      32           0 :   }
      33             : 
      34             : protected:
      35           0 :   virtual ~BasicBorderLayer()
      36           0 :   {
      37           0 :     MOZ_COUNT_DTOR(BasicBorderLayer);
      38           0 :   }
      39             : 
      40             : public:
      41           0 :   virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
      42             :   {
      43           0 :     NS_ASSERTION(BasicManager()->InConstruction(),
      44             :                  "Can only set properties in construction phase");
      45           0 :     BorderLayer::SetVisibleRegion(aRegion);
      46           0 :   }
      47             : 
      48           0 :   virtual void Paint(DrawTarget* aDT,
      49             :                      const gfx::Point& aDeviceOffset,
      50             :                      Layer* aMaskLayer) override
      51             :   {
      52           0 :     if (IsHidden()) {
      53           0 :       return;
      54             :     }
      55             : 
      56             :     // We currently assume that we never have rounded corners,
      57             :     // and that all borders have the same width and color.
      58             : 
      59           0 :     ColorPattern color(mColors[0]);
      60           0 :     StrokeOptions strokeOptions(mWidths[0]);
      61             : 
      62           0 :     Rect rect = mRect.ToUnknownRect();
      63           0 :     rect.Deflate(mWidths[0] / 2.0);
      64           0 :     aDT->StrokeRect(rect, color, strokeOptions);
      65             :   }
      66             : 
      67             : protected:
      68           0 :   BasicLayerManager* BasicManager()
      69             :   {
      70           0 :     return static_cast<BasicLayerManager*>(mManager);
      71             :   }
      72             : };
      73             : 
      74             : already_AddRefed<BorderLayer>
      75           0 : BasicLayerManager::CreateBorderLayer()
      76             : {
      77           0 :   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
      78           0 :   RefPtr<BorderLayer> layer = new BasicBorderLayer(this);
      79           0 :   return layer.forget();
      80             : }
      81             : 
      82             : } // namespace layers
      83             : } // namespace mozilla

Generated by: LCOV version 1.13