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 #ifndef MOZILLA_IMAGELIB_DYNAMICIMAGE_H_
7 #define MOZILLA_IMAGELIB_DYNAMICIMAGE_H_
9 #include "mozilla/MemoryReporting.h"
10 #include "gfxDrawable.h"
18 * An Image that is dynamically created. The content of the image is provided by
19 * a gfxDrawable. It's anticipated that most uses of DynamicImage will be
22 class DynamicImage
: public Image
28 DynamicImage(gfxDrawable
* aDrawable
)
29 : mDrawable(aDrawable
)
31 MOZ_ASSERT(aDrawable
, "Must have a gfxDrawable to wrap");
34 // Inherited methods from Image.
35 virtual nsresult
Init(const char* aMimeType
, uint32_t aFlags
) MOZ_OVERRIDE
;
37 virtual already_AddRefed
<imgStatusTracker
> GetStatusTracker() MOZ_OVERRIDE
;
38 virtual nsIntRect
FrameRect(uint32_t aWhichFrame
) MOZ_OVERRIDE
;
40 virtual uint32_t SizeOfData() MOZ_OVERRIDE
;
41 virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf
) const MOZ_OVERRIDE
;
42 virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf
) const MOZ_OVERRIDE
;
43 virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE
;
44 virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE
;
45 virtual size_t HeapSizeOfVectorImageDocument(nsACString
* aDocURL
= nullptr) const MOZ_OVERRIDE
;
47 virtual void IncrementAnimationConsumers() MOZ_OVERRIDE
;
48 virtual void DecrementAnimationConsumers() MOZ_OVERRIDE
;
50 virtual uint32_t GetAnimationConsumers() MOZ_OVERRIDE
;
53 virtual nsresult
OnImageDataAvailable(nsIRequest
* aRequest
,
54 nsISupports
* aContext
,
55 nsIInputStream
* aInStr
,
56 uint64_t aSourceOffset
,
57 uint32_t aCount
) MOZ_OVERRIDE
;
58 virtual nsresult
OnImageDataComplete(nsIRequest
* aRequest
,
59 nsISupports
* aContext
,
61 bool aLastPart
) MOZ_OVERRIDE
;
62 virtual nsresult
OnNewSourceData() MOZ_OVERRIDE
;
64 virtual void SetInnerWindowID(uint64_t aInnerWindowId
) MOZ_OVERRIDE
;
65 virtual uint64_t InnerWindowID() const MOZ_OVERRIDE
;
67 virtual bool HasError() MOZ_OVERRIDE
;
68 virtual void SetHasError() MOZ_OVERRIDE
;
70 virtual ImageURL
* GetURI() MOZ_OVERRIDE
;
73 virtual ~DynamicImage() { }
75 nsRefPtr
<gfxDrawable
> mDrawable
;
79 } // namespace mozilla
81 #endif // MOZILLA_IMAGELIB_DYNAMICIMAGE_H_