Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "FrozenImage.h" |
michael@0 | 7 | |
michael@0 | 8 | using namespace mozilla::gfx; |
michael@0 | 9 | |
michael@0 | 10 | namespace mozilla { |
michael@0 | 11 | namespace image { |
michael@0 | 12 | |
michael@0 | 13 | NS_IMPL_ISUPPORTS(FrozenImage, imgIContainer) |
michael@0 | 14 | |
michael@0 | 15 | nsIntRect |
michael@0 | 16 | FrozenImage::FrameRect(uint32_t /* aWhichFrame - ignored */) |
michael@0 | 17 | { |
michael@0 | 18 | return InnerImage()->FrameRect(FRAME_FIRST); |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | void |
michael@0 | 22 | FrozenImage::IncrementAnimationConsumers() |
michael@0 | 23 | { |
michael@0 | 24 | // Do nothing. This will prevent animation from starting if there are no other |
michael@0 | 25 | // instances of this image. |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | void |
michael@0 | 29 | FrozenImage::DecrementAnimationConsumers() |
michael@0 | 30 | { |
michael@0 | 31 | // Do nothing. |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | NS_IMETHODIMP |
michael@0 | 35 | FrozenImage::GetAnimated(bool* aAnimated) |
michael@0 | 36 | { |
michael@0 | 37 | bool dummy; |
michael@0 | 38 | nsresult rv = InnerImage()->GetAnimated(&dummy); |
michael@0 | 39 | if (NS_SUCCEEDED(rv)) { |
michael@0 | 40 | *aAnimated = false; |
michael@0 | 41 | } |
michael@0 | 42 | return rv; |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | NS_IMETHODIMP_(TemporaryRef<SourceSurface>) |
michael@0 | 46 | FrozenImage::GetFrame(uint32_t aWhichFrame, |
michael@0 | 47 | uint32_t aFlags) |
michael@0 | 48 | { |
michael@0 | 49 | return InnerImage()->GetFrame(FRAME_FIRST, aFlags); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | NS_IMETHODIMP_(bool) |
michael@0 | 53 | FrozenImage::FrameIsOpaque(uint32_t aWhichFrame) |
michael@0 | 54 | { |
michael@0 | 55 | return InnerImage()->FrameIsOpaque(FRAME_FIRST); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | NS_IMETHODIMP |
michael@0 | 59 | FrozenImage::GetImageContainer(layers::LayerManager* aManager, |
michael@0 | 60 | layers::ImageContainer** _retval) |
michael@0 | 61 | { |
michael@0 | 62 | // XXX(seth): GetImageContainer does not currently support anything but the |
michael@0 | 63 | // current frame. We work around this by always returning null, but if it ever |
michael@0 | 64 | // turns out that FrozenImage is widely used on codepaths that can actually |
michael@0 | 65 | // benefit from GetImageContainer, it would be a good idea to fix that method |
michael@0 | 66 | // for performance reasons. |
michael@0 | 67 | |
michael@0 | 68 | *_retval = nullptr; |
michael@0 | 69 | return NS_OK; |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | NS_IMETHODIMP |
michael@0 | 73 | FrozenImage::Draw(gfxContext* aContext, |
michael@0 | 74 | GraphicsFilter aFilter, |
michael@0 | 75 | const gfxMatrix& aUserSpaceToImageSpace, |
michael@0 | 76 | const gfxRect& aFill, |
michael@0 | 77 | const nsIntRect& aSubimage, |
michael@0 | 78 | const nsIntSize& aViewportSize, |
michael@0 | 79 | const SVGImageContext* aSVGContext, |
michael@0 | 80 | uint32_t /* aWhichFrame - ignored */, |
michael@0 | 81 | uint32_t aFlags) |
michael@0 | 82 | { |
michael@0 | 83 | return InnerImage()->Draw(aContext, aFilter, aUserSpaceToImageSpace, |
michael@0 | 84 | aFill, aSubimage, aViewportSize, aSVGContext, |
michael@0 | 85 | FRAME_FIRST, aFlags); |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | NS_IMETHODIMP_(void) |
michael@0 | 89 | FrozenImage::RequestRefresh(const mozilla::TimeStamp& aTime) |
michael@0 | 90 | { |
michael@0 | 91 | // Do nothing. |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | NS_IMETHODIMP |
michael@0 | 95 | FrozenImage::GetAnimationMode(uint16_t* aAnimationMode) |
michael@0 | 96 | { |
michael@0 | 97 | *aAnimationMode = kNormalAnimMode; |
michael@0 | 98 | return NS_OK; |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | NS_IMETHODIMP |
michael@0 | 102 | FrozenImage::SetAnimationMode(uint16_t aAnimationMode) |
michael@0 | 103 | { |
michael@0 | 104 | // Do nothing. |
michael@0 | 105 | return NS_OK; |
michael@0 | 106 | } |
michael@0 | 107 | |
michael@0 | 108 | NS_IMETHODIMP |
michael@0 | 109 | FrozenImage::ResetAnimation() |
michael@0 | 110 | { |
michael@0 | 111 | // Do nothing. |
michael@0 | 112 | return NS_OK; |
michael@0 | 113 | } |
michael@0 | 114 | |
michael@0 | 115 | NS_IMETHODIMP_(float) |
michael@0 | 116 | FrozenImage::GetFrameIndex(uint32_t aWhichFrame) |
michael@0 | 117 | { |
michael@0 | 118 | MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument"); |
michael@0 | 119 | return 0; |
michael@0 | 120 | } |
michael@0 | 121 | |
michael@0 | 122 | } // namespace image |
michael@0 | 123 | } // namespace mozilla |