Bug 886173 - Preserve playbackRate across pause/play. r=cpearce
[gecko.git] / image / src / ImageMetadata.h
blobc5c5e4c069ed3b1ae5e0539e8e17659dcb5d7b6a
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/StandardInteger.h"
8 #include "mozilla/Util.h"
9 #include "nsSize.h"
11 namespace mozilla {
12 namespace image {
14 class RasterImage;
16 // The metadata about an image that decoders accumulate as they decode.
17 class ImageMetadata
19 public:
20 ImageMetadata()
21 : mHotspotX(-1)
22 , mHotspotY(-1)
23 , mLoopCount(-1)
24 , mIsNonPremultiplied(false)
27 // Set the metadata this object represents on an image.
28 void SetOnImage(RasterImage* image);
30 void SetHotspot(uint16_t hotspotx, uint16_t hotspoty)
32 mHotspotX = hotspotx;
33 mHotspotY = hotspoty;
35 void SetLoopCount(int32_t loopcount)
37 mLoopCount = loopcount;
40 void SetIsNonPremultiplied(bool nonPremult)
42 mIsNonPremultiplied = nonPremult;
45 void SetSize(int32_t width, int32_t height)
47 mSize.construct(nsIntSize(width, height));
50 bool HasSize() const { return !mSize.empty(); }
52 int32_t GetWidth() const { return mSize.ref().width; }
53 int32_t GetHeight() const { return mSize.ref().height; }
55 private:
56 // The hotspot found on cursors, or -1 if none was found.
57 int32_t mHotspotX;
58 int32_t mHotspotY;
60 // The loop count for animated images, or -1 for infinite loop.
61 int32_t mLoopCount;
63 Maybe<nsIntSize> mSize;
65 bool mIsNonPremultiplied;
68 } // namespace image
69 } // namespace mozilla