LCOV - code coverage report
Current view: top level - image - PlaybackType.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 4 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 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             : #ifndef mozilla_image_PlaybackType_h
       7             : #define mozilla_image_PlaybackType_h
       8             : 
       9             : #include "imgIContainer.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace image {
      13             : 
      14             : /**
      15             :  * PlaybackType identifies a surface cache entry as either a static surface or
      16             :  * an animation. Note that a specific cache entry is one or the other, but
      17             :  * images may be associated with both types of cache entries, since in some
      18             :  * circumstances we may want to treat an animated image as if it were static.
      19             :  */
      20             : enum class PlaybackType : uint8_t
      21             : {
      22             :   eStatic,   // Calls to DrawableRef() will always return the same surface.
      23             :   eAnimated  // An animation; calls to DrawableRef() may return different
      24             :              // surfaces at different times.
      25             : };
      26             : 
      27             : /**
      28             :  * Given an imgIContainer FRAME_* value, returns the corresponding PlaybackType
      29             :  * for use in surface cache lookups.
      30             :  */
      31             : inline PlaybackType
      32          35 : ToPlaybackType(uint32_t aWhichFrame)
      33             : {
      34          35 :   MOZ_ASSERT(aWhichFrame == imgIContainer::FRAME_FIRST ||
      35             :              aWhichFrame == imgIContainer::FRAME_CURRENT);
      36             :   return aWhichFrame == imgIContainer::FRAME_CURRENT
      37          35 :        ? PlaybackType::eAnimated
      38          35 :        : PlaybackType::eStatic;
      39             : }
      40             : 
      41             : } // namespace image
      42             : } // namespace mozilla
      43             : 
      44             : #endif // mozilla_image_PlaybackType_h

Generated by: LCOV version 1.13