/src/mozilla-central/image/FrozenImage.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
5 | | |
6 | | #include "FrozenImage.h" |
7 | | |
8 | | namespace mozilla { |
9 | | |
10 | | using namespace gfx; |
11 | | using layers::ImageContainer; |
12 | | using layers::LayerManager; |
13 | | |
14 | | namespace image { |
15 | | |
16 | | void |
17 | | FrozenImage::IncrementAnimationConsumers() |
18 | 0 | { |
19 | 0 | // Do nothing. This will prevent animation from starting if there are no other |
20 | 0 | // instances of this image. |
21 | 0 | } |
22 | | |
23 | | void |
24 | | FrozenImage::DecrementAnimationConsumers() |
25 | 0 | { |
26 | 0 | // Do nothing. |
27 | 0 | } |
28 | | |
29 | | NS_IMETHODIMP |
30 | | FrozenImage::GetAnimated(bool* aAnimated) |
31 | 0 | { |
32 | 0 | bool dummy; |
33 | 0 | nsresult rv = InnerImage()->GetAnimated(&dummy); |
34 | 0 | if (NS_SUCCEEDED(rv)) { |
35 | 0 | *aAnimated = false; |
36 | 0 | } |
37 | 0 | return rv; |
38 | 0 | } |
39 | | |
40 | | NS_IMETHODIMP_(already_AddRefed<SourceSurface>) |
41 | | FrozenImage::GetFrame(uint32_t aWhichFrame, |
42 | | uint32_t aFlags) |
43 | 0 | { |
44 | 0 | return InnerImage()->GetFrame(FRAME_FIRST, aFlags); |
45 | 0 | } |
46 | | |
47 | | NS_IMETHODIMP_(already_AddRefed<SourceSurface>) |
48 | | FrozenImage::GetFrameAtSize(const IntSize& aSize, |
49 | | uint32_t aWhichFrame, |
50 | | uint32_t aFlags) |
51 | 0 | { |
52 | 0 | return InnerImage()->GetFrameAtSize(aSize, FRAME_FIRST, aFlags); |
53 | 0 | } |
54 | | |
55 | | NS_IMETHODIMP_(bool) |
56 | | FrozenImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags) |
57 | 0 | { |
58 | 0 | return false; |
59 | 0 | } |
60 | | |
61 | | NS_IMETHODIMP_(already_AddRefed<ImageContainer>) |
62 | | FrozenImage::GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags) |
63 | 0 | { |
64 | 0 | // XXX(seth): GetImageContainer does not currently support anything but the |
65 | 0 | // current frame. We work around this by always returning null, but if it ever |
66 | 0 | // turns out that FrozenImage is widely used on codepaths that can actually |
67 | 0 | // benefit from GetImageContainer, it would be a good idea to fix that method |
68 | 0 | // for performance reasons. |
69 | 0 | return nullptr; |
70 | 0 | } |
71 | | |
72 | | NS_IMETHODIMP_(bool) |
73 | | FrozenImage::IsImageContainerAvailableAtSize(LayerManager* aManager, |
74 | | const IntSize& aSize, |
75 | | uint32_t aFlags) |
76 | 0 | { |
77 | 0 | return false; |
78 | 0 | } |
79 | | |
80 | | NS_IMETHODIMP_(ImgDrawResult) |
81 | | FrozenImage::GetImageContainerAtSize(layers::LayerManager* aManager, |
82 | | const gfx::IntSize& aSize, |
83 | | const Maybe<SVGImageContext>& aSVGContext, |
84 | | uint32_t aFlags, |
85 | | layers::ImageContainer** aOutContainer) |
86 | 0 | { |
87 | 0 | // XXX(seth): GetImageContainer does not currently support anything but the |
88 | 0 | // current frame. We work around this by always returning null, but if it ever |
89 | 0 | // turns out that FrozenImage is widely used on codepaths that can actually |
90 | 0 | // benefit from GetImageContainer, it would be a good idea to fix that method |
91 | 0 | // for performance reasons. |
92 | 0 | return ImgDrawResult::NOT_SUPPORTED; |
93 | 0 | } |
94 | | |
95 | | NS_IMETHODIMP_(ImgDrawResult) |
96 | | FrozenImage::Draw(gfxContext* aContext, |
97 | | const nsIntSize& aSize, |
98 | | const ImageRegion& aRegion, |
99 | | uint32_t /* aWhichFrame - ignored */, |
100 | | SamplingFilter aSamplingFilter, |
101 | | const Maybe<SVGImageContext>& aSVGContext, |
102 | | uint32_t aFlags, |
103 | | float aOpacity) |
104 | 0 | { |
105 | 0 | return InnerImage()->Draw(aContext, aSize, aRegion, FRAME_FIRST, |
106 | 0 | aSamplingFilter, aSVGContext, aFlags, aOpacity); |
107 | 0 | } |
108 | | |
109 | | NS_IMETHODIMP_(void) |
110 | | FrozenImage::RequestRefresh(const TimeStamp& aTime) |
111 | 0 | { |
112 | 0 | // Do nothing. |
113 | 0 | } |
114 | | |
115 | | NS_IMETHODIMP |
116 | | FrozenImage::GetAnimationMode(uint16_t* aAnimationMode) |
117 | 0 | { |
118 | 0 | *aAnimationMode = kNormalAnimMode; |
119 | 0 | return NS_OK; |
120 | 0 | } |
121 | | |
122 | | NS_IMETHODIMP |
123 | | FrozenImage::SetAnimationMode(uint16_t aAnimationMode) |
124 | 0 | { |
125 | 0 | // Do nothing. |
126 | 0 | return NS_OK; |
127 | 0 | } |
128 | | |
129 | | NS_IMETHODIMP |
130 | | FrozenImage::ResetAnimation() |
131 | 0 | { |
132 | 0 | // Do nothing. |
133 | 0 | return NS_OK; |
134 | 0 | } |
135 | | |
136 | | NS_IMETHODIMP_(float) |
137 | | FrozenImage::GetFrameIndex(uint32_t aWhichFrame) |
138 | 0 | { |
139 | 0 | MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument"); |
140 | 0 | return 0; |
141 | 0 | } |
142 | | |
143 | | } // namespace image |
144 | | } // namespace mozilla |