Bug 1543288 - Update the Print icon and Add rules button position. r=mtigley
[gecko.git] / image / FrozenImage.cpp
blob3e5ba144e13c0f112b82778f38adf63a2e370fe0
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;
11 using layers::ImageContainer;
12 using layers::LayerManager;
14 namespace image {
16 void FrozenImage::IncrementAnimationConsumers() {
17 // Do nothing. This will prevent animation from starting if there are no other
18 // instances of this image.
21 void FrozenImage::DecrementAnimationConsumers() {
22 // Do nothing.
25 NS_IMETHODIMP
26 FrozenImage::GetAnimated(bool* aAnimated) {
27 bool dummy;
28 nsresult rv = InnerImage()->GetAnimated(&dummy);
29 if (NS_SUCCEEDED(rv)) {
30 *aAnimated = false;
32 return rv;
35 NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
36 FrozenImage::GetFrame(uint32_t aWhichFrame, uint32_t aFlags) {
37 return InnerImage()->GetFrame(FRAME_FIRST, aFlags);
40 NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
41 FrozenImage::GetFrameAtSize(const IntSize& aSize, uint32_t aWhichFrame,
42 uint32_t aFlags) {
43 return InnerImage()->GetFrameAtSize(aSize, FRAME_FIRST, aFlags);
46 NS_IMETHODIMP_(bool)
47 FrozenImage::IsImageContainerAvailable(LayerManager* aManager,
48 uint32_t aFlags) {
49 return false;
52 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
53 FrozenImage::GetImageContainer(layers::LayerManager* aManager,
54 uint32_t aFlags) {
55 // XXX(seth): GetImageContainer does not currently support anything but the
56 // current frame. We work around this by always returning null, but if it ever
57 // turns out that FrozenImage is widely used on codepaths that can actually
58 // benefit from GetImageContainer, it would be a good idea to fix that method
59 // for performance reasons.
60 return nullptr;
63 NS_IMETHODIMP_(bool)
64 FrozenImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
65 const IntSize& aSize,
66 uint32_t aFlags) {
67 return false;
70 NS_IMETHODIMP_(ImgDrawResult)
71 FrozenImage::GetImageContainerAtSize(layers::LayerManager* aManager,
72 const gfx::IntSize& aSize,
73 const Maybe<SVGImageContext>& aSVGContext,
74 uint32_t aFlags,
75 layers::ImageContainer** aOutContainer) {
76 // XXX(seth): GetImageContainer does not currently support anything but the
77 // current frame. We work around this by always returning null, but if it ever
78 // turns out that FrozenImage is widely used on codepaths that can actually
79 // benefit from GetImageContainer, it would be a good idea to fix that method
80 // for performance reasons.
81 return ImgDrawResult::NOT_SUPPORTED;
84 NS_IMETHODIMP_(ImgDrawResult)
85 FrozenImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
86 const ImageRegion& aRegion,
87 uint32_t /* aWhichFrame - ignored */,
88 SamplingFilter aSamplingFilter,
89 const Maybe<SVGImageContext>& aSVGContext, uint32_t aFlags,
90 float aOpacity) {
91 return InnerImage()->Draw(aContext, aSize, aRegion, FRAME_FIRST,
92 aSamplingFilter, aSVGContext, aFlags, aOpacity);
95 NS_IMETHODIMP_(void)
96 FrozenImage::RequestRefresh(const TimeStamp& aTime) {
97 // Do nothing.
100 NS_IMETHODIMP
101 FrozenImage::GetAnimationMode(uint16_t* aAnimationMode) {
102 *aAnimationMode = kNormalAnimMode;
103 return NS_OK;
106 NS_IMETHODIMP
107 FrozenImage::SetAnimationMode(uint16_t aAnimationMode) {
108 // Do nothing.
109 return NS_OK;
112 NS_IMETHODIMP
113 FrozenImage::ResetAnimation() {
114 // Do nothing.
115 return NS_OK;
118 NS_IMETHODIMP_(float)
119 FrozenImage::GetFrameIndex(uint32_t aWhichFrame) {
120 MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument");
121 return 0;
124 } // namespace image
125 } // namespace mozilla