2013-03-11 05:43:38 +04:00
|
|
|
/* -*- 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 {
|
2014-07-10 19:00:31 +04:00
|
|
|
|
|
|
|
using namespace gfx;
|
|
|
|
|
2013-03-11 05:43:38 +04:00
|
|
|
namespace image {
|
|
|
|
|
2014-07-14 23:21:34 +04:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper)
|
2013-03-11 05:43:38 +04:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2013-03-13 00:42:09 +04:00
|
|
|
bool dummy;
|
|
|
|
nsresult rv = InnerImage()->GetAnimated(&dummy);
|
2013-03-11 05:43:38 +04:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
*aAnimated = false;
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
2013-03-11 05:43:38 +04:00
|
|
|
FrozenImage::GetFrame(uint32_t aWhichFrame,
|
2013-12-13 12:34:24 +04:00
|
|
|
uint32_t aFlags)
|
2013-03-11 05:43:38 +04:00
|
|
|
{
|
2013-12-13 12:34:24 +04:00
|
|
|
return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
|
2013-03-11 05:43:38 +04:00
|
|
|
}
|
|
|
|
|
2015-09-19 23:34:09 +03:00
|
|
|
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
|
|
|
FrozenImage::GetFrameAtSize(const IntSize& aSize,
|
|
|
|
uint32_t aWhichFrame,
|
|
|
|
uint32_t aFlags)
|
|
|
|
{
|
|
|
|
return InnerImage()->GetFrameAtSize(aSize, FRAME_FIRST, aFlags);
|
|
|
|
}
|
|
|
|
|
2015-05-13 10:23:44 +03:00
|
|
|
NS_IMETHODIMP_(bool)
|
|
|
|
FrozenImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-03-18 05:40:16 +03:00
|
|
|
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
|
|
|
FrozenImage::GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags)
|
2013-03-11 05:43:38 +04:00
|
|
|
{
|
|
|
|
// 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.
|
2015-03-18 05:40:16 +03:00
|
|
|
return nullptr;
|
2013-03-11 05:43:38 +04:00
|
|
|
}
|
|
|
|
|
2015-02-05 00:50:56 +03:00
|
|
|
NS_IMETHODIMP_(DrawResult)
|
2013-03-11 05:43:38 +04:00
|
|
|
FrozenImage::Draw(gfxContext* aContext,
|
2014-08-23 00:12:38 +04:00
|
|
|
const nsIntSize& aSize,
|
|
|
|
const ImageRegion& aRegion,
|
2013-03-11 05:43:38 +04:00
|
|
|
uint32_t /* aWhichFrame - ignored */,
|
2015-10-06 03:18:10 +03:00
|
|
|
Filter aFilter,
|
2014-08-23 00:12:38 +04:00
|
|
|
const Maybe<SVGImageContext>& aSVGContext,
|
2013-03-11 05:43:38 +04:00
|
|
|
uint32_t aFlags)
|
|
|
|
{
|
2014-08-23 00:12:38 +04:00
|
|
|
return InnerImage()->Draw(aContext, aSize, aRegion, FRAME_FIRST,
|
|
|
|
aFilter, aSVGContext, aFlags);
|
2013-03-11 05:43:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(void)
|
2014-07-10 19:00:31 +04:00
|
|
|
FrozenImage::RequestRefresh(const TimeStamp& aTime)
|
2013-03-11 05:43:38 +04:00
|
|
|
{
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2013-04-26 02:58:20 +04:00
|
|
|
NS_IMETHODIMP_(float)
|
|
|
|
FrozenImage::GetFrameIndex(uint32_t aWhichFrame)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-11 05:43:38 +04:00
|
|
|
} // namespace image
|
|
|
|
} // namespace mozilla
|