LCOV - code coverage report
Current view: top level - gfx/layers - SourceSurfaceVolatileData.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 8 17 47.1 %
Date: 2017-07-14 16:53:18 Functions: 1 3 33.3 %
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 "SourceSurfaceVolatileData.h"
       7             : 
       8             : #include "gfxAlphaRecovery.h"
       9             : #include "mozilla/Likely.h"
      10             : #include "mozilla/Types.h" // for decltype
      11             : 
      12             : namespace mozilla {
      13             : namespace gfx {
      14             : 
      15             : bool
      16          50 : SourceSurfaceVolatileData::Init(const IntSize &aSize,
      17             :                                 int32_t aStride,
      18             :                                 SurfaceFormat aFormat)
      19             : {
      20          50 :   mSize = aSize;
      21          50 :   mStride = aStride;
      22          50 :   mFormat = aFormat;
      23             : 
      24          50 :   size_t alignment = size_t(1) << gfxAlphaRecovery::GoodAlignmentLog2();
      25          50 :   mVBuf = new VolatileBuffer();
      26          50 :   if (MOZ_UNLIKELY(!mVBuf->Init(aStride * aSize.height, alignment))) {
      27           0 :     mVBuf = nullptr;
      28           0 :     return false;
      29             :   }
      30             : 
      31          50 :   return true;
      32             : }
      33             : 
      34             : void
      35           0 : SourceSurfaceVolatileData::GuaranteePersistance()
      36             : {
      37           0 :   MOZ_ASSERT_UNREACHABLE("Should use SourceSurfaceRawData wrapper!");
      38             : }
      39             : 
      40             : void
      41           0 : SourceSurfaceVolatileData::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
      42             :                                                   size_t& aHeapSizeOut,
      43             :                                                   size_t& aNonHeapSizeOut) const
      44             : {
      45           0 :   if (mVBuf) {
      46           0 :     aHeapSizeOut += mVBuf->HeapSizeOfExcludingThis(aMallocSizeOf);
      47           0 :     aNonHeapSizeOut += mVBuf->NonHeapSizeOfExcludingThis();
      48             :   }
      49           0 : }
      50             : 
      51             : } // namespace gfx
      52             : } // namespace mozilla

Generated by: LCOV version 1.13