Backed out changeset 177eae915693 (bug 1206581) for bustage
[gecko.git] / image / FrozenImage.cpp
blob0dd2ec3f3e7e50c33e0a9b627609f1de37edf685
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 namespace mozilla {
10 using namespace gfx;
12 namespace image {
14 NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper)
16 void
17 FrozenImage::IncrementAnimationConsumers()
19 // Do nothing. This will prevent animation from starting if there are no other
20 // instances of this image.
23 void
24 FrozenImage::DecrementAnimationConsumers()
26 // Do nothing.
29 NS_IMETHODIMP
30 FrozenImage::GetAnimated(bool* aAnimated)
32 bool dummy;
33 nsresult rv = InnerImage()->GetAnimated(&dummy);
34 if (NS_SUCCEEDED(rv)) {
35 *aAnimated = false;
37 return rv;
40 NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
41 FrozenImage::GetFrame(uint32_t aWhichFrame,
42 uint32_t aFlags)
44 return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
47 NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
48 FrozenImage::GetFrameAtSize(const IntSize& aSize,
49 uint32_t aWhichFrame,
50 uint32_t aFlags)
52 return InnerImage()->GetFrameAtSize(aSize, FRAME_FIRST, aFlags);
55 NS_IMETHODIMP_(bool)
56 FrozenImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
58 return false;
61 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
62 FrozenImage::GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags)
64 // XXX(seth): GetImageContainer does not currently support anything but the
65 // current frame. We work around this by always returning null, but if it ever
66 // turns out that FrozenImage is widely used on codepaths that can actually
67 // benefit from GetImageContainer, it would be a good idea to fix that method
68 // for performance reasons.
69 return nullptr;
72 NS_IMETHODIMP_(DrawResult)
73 FrozenImage::Draw(gfxContext* aContext,
74 const nsIntSize& aSize,
75 const ImageRegion& aRegion,
76 uint32_t /* aWhichFrame - ignored */,
77 Filter aFilter,
78 const Maybe<SVGImageContext>& aSVGContext,
79 uint32_t aFlags)
81 return InnerImage()->Draw(aContext, aSize, aRegion, FRAME_FIRST,
82 aFilter, aSVGContext, aFlags);
85 NS_IMETHODIMP_(void)
86 FrozenImage::RequestRefresh(const TimeStamp& aTime)
88 // Do nothing.
91 NS_IMETHODIMP
92 FrozenImage::GetAnimationMode(uint16_t* aAnimationMode)
94 *aAnimationMode = kNormalAnimMode;
95 return NS_OK;
98 NS_IMETHODIMP
99 FrozenImage::SetAnimationMode(uint16_t aAnimationMode)
101 // Do nothing.
102 return NS_OK;
105 NS_IMETHODIMP
106 FrozenImage::ResetAnimation()
108 // Do nothing.
109 return NS_OK;
112 NS_IMETHODIMP_(float)
113 FrozenImage::GetFrameIndex(uint32_t aWhichFrame)
115 MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument");
116 return 0;
119 } // namespace image
120 } // namespace mozilla