LCOV - code coverage report
Current view: top level - gfx/layers/mlgpu - CanvasLayerMLGPU.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 36 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 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 "CanvasLayerMLGPU.h"
       7             : #include "composite/CompositableHost.h"  // for CompositableHost
       8             : #include "gfx2DGlue.h"                  // for ToFilter
       9             : #include "gfxEnv.h"                     // for gfxEnv, etc
      10             : #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
      11             : #include "mozilla/gfx/Point.h"          // for Point
      12             : #include "mozilla/gfx/Rect.h"           // for Rect
      13             : #include "mozilla/layers/Compositor.h"  // for Compositor
      14             : #include "mozilla/layers/Effects.h"     // for EffectChain
      15             : #include "mozilla/layers/ImageHost.h"
      16             : #include "mozilla/mozalloc.h"           // for operator delete
      17             : #include "nsAString.h"
      18             : #include "mozilla/RefPtr.h"                   // for nsRefPtr
      19             : #include "MaskOperation.h"
      20             : #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
      21             : #include "nsString.h"                   // for nsAutoCString
      22             : 
      23             : namespace mozilla {
      24             : namespace layers {
      25             : 
      26             : using namespace mozilla::gfx;
      27             : 
      28           0 : CanvasLayerMLGPU::CanvasLayerMLGPU(LayerManagerMLGPU* aManager)
      29             :   : CanvasLayer(aManager, nullptr)
      30           0 :   , TexturedLayerMLGPU(aManager)
      31             : {
      32           0 : }
      33             : 
      34           0 : CanvasLayerMLGPU::~CanvasLayerMLGPU()
      35             : {
      36           0 :   CleanupResources();
      37           0 : }
      38             : 
      39             : Layer*
      40           0 : CanvasLayerMLGPU::GetLayer()
      41             : {
      42           0 :   return this;
      43             : }
      44             : 
      45             : gfx::SamplingFilter
      46           0 : CanvasLayerMLGPU::GetSamplingFilter()
      47             : {
      48           0 :   gfx::SamplingFilter filter = mSamplingFilter;
      49             : #ifdef ANDROID
      50             :   // Bug 691354
      51             :   // Using the LINEAR filter we get unexplained artifacts.
      52             :   // Use NEAREST when no scaling is required.
      53             :   Matrix matrix;
      54             :   bool is2D = GetEffectiveTransform().Is2D(&matrix);
      55             :   if (is2D && !ThebesMatrix(matrix).HasNonTranslationOrFlip()) {
      56             :     filter = SamplingFilter::POINT;
      57             :   }
      58             : #endif
      59           0 :   return filter;
      60             : }
      61             : 
      62             : void
      63           0 : CanvasLayerMLGPU::PrintInfo(std::stringstream& aStream, const char* aPrefix)
      64             : {
      65           0 :   CanvasLayer::PrintInfo(aStream, aPrefix);
      66           0 :   aStream << "\n";
      67           0 :   if (mHost && mHost->IsAttached()) {
      68           0 :     nsAutoCString pfx(aPrefix);
      69           0 :     pfx += "  ";
      70           0 :     mHost->PrintInfo(aStream, pfx.get());
      71             :   }
      72           0 : }
      73             : 
      74             : void
      75           0 : CanvasLayerMLGPU::CleanupResources()
      76             : {
      77           0 :   if (mHost) {
      78           0 :     mHost->Detach(this);
      79             :   }
      80           0 :   mTexture = nullptr;
      81           0 :   mBigImageTexture = nullptr;
      82           0 :   mHost = nullptr;
      83           0 : }
      84             : 
      85             : void
      86           0 : CanvasLayerMLGPU::Disconnect()
      87             : {
      88           0 :   CleanupResources();
      89           0 : }
      90             : 
      91             : void
      92           0 : CanvasLayerMLGPU::ClearCachedResources()
      93             : {
      94           0 :   CleanupResources();
      95           0 : }
      96             : 
      97             : void
      98           0 : CanvasLayerMLGPU::SetRegionToRender(LayerIntRegion&& aRegion)
      99             : {
     100           0 :   aRegion.AndWith(LayerIntRect::FromUnknownRect(mPictureRect));
     101           0 :   LayerMLGPU::SetRegionToRender(Move(aRegion));
     102           0 : }
     103             : 
     104             : } // namespace layers
     105             : } // namespace mozilla

Generated by: LCOV version 1.13