michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "FrozenImage.h" michael@0: michael@0: using namespace mozilla::gfx; michael@0: michael@0: namespace mozilla { michael@0: namespace image { michael@0: michael@0: NS_IMPL_ISUPPORTS(FrozenImage, imgIContainer) michael@0: michael@0: nsIntRect michael@0: FrozenImage::FrameRect(uint32_t /* aWhichFrame - ignored */) michael@0: { michael@0: return InnerImage()->FrameRect(FRAME_FIRST); michael@0: } michael@0: michael@0: void michael@0: FrozenImage::IncrementAnimationConsumers() michael@0: { michael@0: // Do nothing. This will prevent animation from starting if there are no other michael@0: // instances of this image. michael@0: } michael@0: michael@0: void michael@0: FrozenImage::DecrementAnimationConsumers() michael@0: { michael@0: // Do nothing. michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: FrozenImage::GetAnimated(bool* aAnimated) michael@0: { michael@0: bool dummy; michael@0: nsresult rv = InnerImage()->GetAnimated(&dummy); michael@0: if (NS_SUCCEEDED(rv)) { michael@0: *aAnimated = false; michael@0: } michael@0: return rv; michael@0: } michael@0: michael@0: NS_IMETHODIMP_(TemporaryRef) michael@0: FrozenImage::GetFrame(uint32_t aWhichFrame, michael@0: uint32_t aFlags) michael@0: { michael@0: return InnerImage()->GetFrame(FRAME_FIRST, aFlags); michael@0: } michael@0: michael@0: NS_IMETHODIMP_(bool) michael@0: FrozenImage::FrameIsOpaque(uint32_t aWhichFrame) michael@0: { michael@0: return InnerImage()->FrameIsOpaque(FRAME_FIRST); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: FrozenImage::GetImageContainer(layers::LayerManager* aManager, michael@0: layers::ImageContainer** _retval) michael@0: { michael@0: // XXX(seth): GetImageContainer does not currently support anything but the michael@0: // current frame. We work around this by always returning null, but if it ever michael@0: // turns out that FrozenImage is widely used on codepaths that can actually michael@0: // benefit from GetImageContainer, it would be a good idea to fix that method michael@0: // for performance reasons. michael@0: michael@0: *_retval = nullptr; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: FrozenImage::Draw(gfxContext* aContext, michael@0: GraphicsFilter aFilter, michael@0: const gfxMatrix& aUserSpaceToImageSpace, michael@0: const gfxRect& aFill, michael@0: const nsIntRect& aSubimage, michael@0: const nsIntSize& aViewportSize, michael@0: const SVGImageContext* aSVGContext, michael@0: uint32_t /* aWhichFrame - ignored */, michael@0: uint32_t aFlags) michael@0: { michael@0: return InnerImage()->Draw(aContext, aFilter, aUserSpaceToImageSpace, michael@0: aFill, aSubimage, aViewportSize, aSVGContext, michael@0: FRAME_FIRST, aFlags); michael@0: } michael@0: michael@0: NS_IMETHODIMP_(void) michael@0: FrozenImage::RequestRefresh(const mozilla::TimeStamp& aTime) michael@0: { michael@0: // Do nothing. michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: FrozenImage::GetAnimationMode(uint16_t* aAnimationMode) michael@0: { michael@0: *aAnimationMode = kNormalAnimMode; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: FrozenImage::SetAnimationMode(uint16_t aAnimationMode) michael@0: { michael@0: // Do nothing. michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: FrozenImage::ResetAnimation() michael@0: { michael@0: // Do nothing. michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP_(float) michael@0: FrozenImage::GetFrameIndex(uint32_t aWhichFrame) michael@0: { michael@0: MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument"); michael@0: return 0; michael@0: } michael@0: michael@0: } // namespace image michael@0: } // namespace mozilla