image/FrozenImage.cpp
author Guido Urdaneta <guidou@chromium.org>
Wed, 06 Mar 2019 12:35:06 +0000
changeset 522276 fff147f5ba18269e1d3d1dc1861718f42c4aefe0
parent 505383 6f3709b3878117466168c40affa7bca0b60cf75b
child 533364 3e3ebfd849558d6011dec7b53ea5942ba1da8867
permissions -rw-r--r--
Bug 1526801 [wpt PR 15292] - [PeerConnection] Fire signalingstatechange event at the right time, a=testonly Automatic update from web-platform-tests [PeerConnection] Fire signalingstatechange event at the right time Prior to this CL, the event was fired before the transceiver state was updated, in contradiction with the spec, which says it should be fired after the transceiver state is updated. Bug: 920200 Change-Id: I757cc0161a5da4888cd628619180e24a54dc732b Reviewed-on: https://chromium-review.googlesource.com/c/1458203 Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#634609} -- wpt-commits: 0f4203743c56377734f9682abb015d56d6a1a71e wpt-pr: 15292

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "FrozenImage.h"

namespace mozilla {

using namespace gfx;
using layers::ImageContainer;
using layers::LayerManager;

namespace image {

void FrozenImage::IncrementAnimationConsumers() {
  // Do nothing. This will prevent animation from starting if there are no other
  // instances of this image.
}

void FrozenImage::DecrementAnimationConsumers() {
  // Do nothing.
}

NS_IMETHODIMP
FrozenImage::GetAnimated(bool* aAnimated) {
  bool dummy;
  nsresult rv = InnerImage()->GetAnimated(&dummy);
  if (NS_SUCCEEDED(rv)) {
    *aAnimated = false;
  }
  return rv;
}

NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
FrozenImage::GetFrame(uint32_t aWhichFrame, uint32_t aFlags) {
  return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
}

NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
FrozenImage::GetFrameAtSize(const IntSize& aSize, uint32_t aWhichFrame,
                            uint32_t aFlags) {
  return InnerImage()->GetFrameAtSize(aSize, FRAME_FIRST, aFlags);
}

NS_IMETHODIMP_(bool)
FrozenImage::IsImageContainerAvailable(LayerManager* aManager,
                                       uint32_t aFlags) {
  return false;
}

NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
FrozenImage::GetImageContainer(layers::LayerManager* aManager,
                               uint32_t aFlags) {
  // XXX(seth): GetImageContainer does not currently support anything but the
  // current frame. We work around this by always returning null, but if it ever
  // turns out that FrozenImage is widely used on codepaths that can actually
  // benefit from GetImageContainer, it would be a good idea to fix that method
  // for performance reasons.
  return nullptr;
}

NS_IMETHODIMP_(bool)
FrozenImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                             const IntSize& aSize,
                                             uint32_t aFlags) {
  return false;
}

NS_IMETHODIMP_(ImgDrawResult)
FrozenImage::GetImageContainerAtSize(layers::LayerManager* aManager,
                                     const gfx::IntSize& aSize,
                                     const Maybe<SVGImageContext>& aSVGContext,
                                     uint32_t aFlags,
                                     layers::ImageContainer** aOutContainer) {
  // XXX(seth): GetImageContainer does not currently support anything but the
  // current frame. We work around this by always returning null, but if it ever
  // turns out that FrozenImage is widely used on codepaths that can actually
  // benefit from GetImageContainer, it would be a good idea to fix that method
  // for performance reasons.
  return ImgDrawResult::NOT_SUPPORTED;
}

NS_IMETHODIMP_(ImgDrawResult)
FrozenImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
                  const ImageRegion& aRegion,
                  uint32_t /* aWhichFrame - ignored */,
                  SamplingFilter aSamplingFilter,
                  const Maybe<SVGImageContext>& aSVGContext, uint32_t aFlags,
                  float aOpacity) {
  return InnerImage()->Draw(aContext, aSize, aRegion, FRAME_FIRST,
                            aSamplingFilter, aSVGContext, aFlags, aOpacity);
}

NS_IMETHODIMP_(void)
FrozenImage::RequestRefresh(const TimeStamp& aTime) {
  // Do nothing.
}

NS_IMETHODIMP
FrozenImage::GetAnimationMode(uint16_t* aAnimationMode) {
  *aAnimationMode = kNormalAnimMode;
  return NS_OK;
}

NS_IMETHODIMP
FrozenImage::SetAnimationMode(uint16_t aAnimationMode) {
  // Do nothing.
  return NS_OK;
}

NS_IMETHODIMP
FrozenImage::ResetAnimation() {
  // Do nothing.
  return NS_OK;
}

NS_IMETHODIMP_(float)
FrozenImage::GetFrameIndex(uint32_t aWhichFrame) {
  MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument");
  return 0;
}

}  // namespace image
}  // namespace mozilla