image/src/FrozenImage.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 #include "FrozenImage.h"
     8 using namespace mozilla::gfx;
    10 namespace mozilla {
    11 namespace image {
    13 NS_IMPL_ISUPPORTS(FrozenImage, imgIContainer)
    15 nsIntRect
    16 FrozenImage::FrameRect(uint32_t /* aWhichFrame - ignored */)
    17 {
    18   return InnerImage()->FrameRect(FRAME_FIRST);
    19 }
    21 void
    22 FrozenImage::IncrementAnimationConsumers()
    23 {
    24   // Do nothing. This will prevent animation from starting if there are no other
    25   // instances of this image.
    26 }
    28 void
    29 FrozenImage::DecrementAnimationConsumers()
    30 {
    31   // Do nothing.
    32 }
    34 NS_IMETHODIMP
    35 FrozenImage::GetAnimated(bool* aAnimated)
    36 {
    37   bool dummy;
    38   nsresult rv = InnerImage()->GetAnimated(&dummy);
    39   if (NS_SUCCEEDED(rv)) {
    40     *aAnimated = false;
    41   }
    42   return rv;
    43 }
    45 NS_IMETHODIMP_(TemporaryRef<SourceSurface>)
    46 FrozenImage::GetFrame(uint32_t aWhichFrame,
    47                       uint32_t aFlags)
    48 {
    49   return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
    50 }
    52 NS_IMETHODIMP_(bool)
    53 FrozenImage::FrameIsOpaque(uint32_t aWhichFrame)
    54 {
    55   return InnerImage()->FrameIsOpaque(FRAME_FIRST);
    56 }
    58 NS_IMETHODIMP
    59 FrozenImage::GetImageContainer(layers::LayerManager* aManager,
    60                                layers::ImageContainer** _retval)
    61 {
    62   // XXX(seth): GetImageContainer does not currently support anything but the
    63   // current frame. We work around this by always returning null, but if it ever
    64   // turns out that FrozenImage is widely used on codepaths that can actually
    65   // benefit from GetImageContainer, it would be a good idea to fix that method
    66   // for performance reasons.
    68   *_retval = nullptr;
    69   return NS_OK;
    70 }
    72 NS_IMETHODIMP
    73 FrozenImage::Draw(gfxContext* aContext,
    74                   GraphicsFilter aFilter,
    75                   const gfxMatrix& aUserSpaceToImageSpace,
    76                   const gfxRect& aFill,
    77                   const nsIntRect& aSubimage,
    78                   const nsIntSize& aViewportSize,
    79                   const SVGImageContext* aSVGContext,
    80                   uint32_t /* aWhichFrame - ignored */,
    81                   uint32_t aFlags)
    82 {
    83   return InnerImage()->Draw(aContext, aFilter, aUserSpaceToImageSpace,
    84                             aFill, aSubimage, aViewportSize, aSVGContext,
    85                             FRAME_FIRST, aFlags);
    86 }
    88 NS_IMETHODIMP_(void)
    89 FrozenImage::RequestRefresh(const mozilla::TimeStamp& aTime)
    90 {
    91   // Do nothing.
    92 }
    94 NS_IMETHODIMP
    95 FrozenImage::GetAnimationMode(uint16_t* aAnimationMode)
    96 {
    97   *aAnimationMode = kNormalAnimMode;
    98   return NS_OK;
    99 }
   101 NS_IMETHODIMP
   102 FrozenImage::SetAnimationMode(uint16_t aAnimationMode)
   103 {
   104   // Do nothing.
   105   return NS_OK;
   106 }
   108 NS_IMETHODIMP
   109 FrozenImage::ResetAnimation()
   110 {
   111   // Do nothing.
   112   return NS_OK;
   113 }
   115 NS_IMETHODIMP_(float)
   116 FrozenImage::GetFrameIndex(uint32_t aWhichFrame)
   117 {
   118   MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument");
   119   return 0;
   120 }
   122 } // namespace image
   123 } // namespace mozilla

mercurial