зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1037028 - More namespace cleanups in imglib, r=seth
This commit is contained in:
Родитель
e8878fb125
Коммит
dbb44f9da7
|
@ -13,12 +13,13 @@
|
||||||
#include "Orientation.h"
|
#include "Orientation.h"
|
||||||
#include "SVGImageContext.h"
|
#include "SVGImageContext.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::gfx;
|
|
||||||
using mozilla::layers::LayerManager;
|
|
||||||
using mozilla::layers::ImageContainer;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
using namespace gfx;
|
||||||
|
using layers::LayerManager;
|
||||||
|
using layers::ImageContainer;
|
||||||
|
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
class ClippedImageCachedSurface
|
class ClippedImageCachedSurface
|
||||||
|
|
|
@ -26,7 +26,7 @@ class DrawSingleTileCallback;
|
||||||
*/
|
*/
|
||||||
class ClippedImage : public ImageWrapper
|
class ClippedImage : public ImageWrapper
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::SourceSurface SourceSurface;
|
typedef gfx::SourceSurface SourceSurface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
@ -37,10 +37,10 @@ public:
|
||||||
NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
|
NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;
|
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE;
|
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD_(mozilla::TemporaryRef<SourceSurface>)
|
NS_IMETHOD_(TemporaryRef<SourceSurface>)
|
||||||
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE;
|
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager,
|
NS_IMETHOD GetImageContainer(layers::LayerManager* aManager,
|
||||||
mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE;
|
layers::ImageContainer** _retval) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD Draw(gfxContext* aContext,
|
NS_IMETHOD Draw(gfxContext* aContext,
|
||||||
GraphicsFilter aFilter,
|
GraphicsFilter aFilter,
|
||||||
const gfxMatrix& aUserSpaceToImageSpace,
|
const gfxMatrix& aUserSpaceToImageSpace,
|
||||||
|
@ -60,7 +60,7 @@ protected:
|
||||||
virtual ~ClippedImage();
|
virtual ~ClippedImage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mozilla::TemporaryRef<SourceSurface>
|
TemporaryRef<SourceSurface>
|
||||||
GetFrameInternal(const nsIntSize& aViewportSize,
|
GetFrameInternal(const nsIntSize& aViewportSize,
|
||||||
const SVGImageContext* aSVGContext,
|
const SVGImageContext* aSVGContext,
|
||||||
uint32_t aWhichFrame,
|
uint32_t aWhichFrame,
|
||||||
|
|
|
@ -24,7 +24,7 @@ static const char* sDiscardTimeoutPref = "image.mem.min_discard_timeout_ms";
|
||||||
/* static */ uint32_t DiscardTracker::sMaxDecodedImageKB = 42 * 1024;
|
/* static */ uint32_t DiscardTracker::sMaxDecodedImageKB = 42 * 1024;
|
||||||
/* static */ uint32_t DiscardTracker::sHardLimitDecodedImageKB = 0;
|
/* static */ uint32_t DiscardTracker::sHardLimitDecodedImageKB = 0;
|
||||||
/* static */ PRLock * DiscardTracker::sAllocationLock = nullptr;
|
/* static */ PRLock * DiscardTracker::sAllocationLock = nullptr;
|
||||||
/* static */ mozilla::Mutex* DiscardTracker::sNodeListMutex = nullptr;
|
/* static */ Mutex* DiscardTracker::sNodeListMutex = nullptr;
|
||||||
/* static */ Atomic<bool> DiscardTracker::sShutdown(false);
|
/* static */ Atomic<bool> DiscardTracker::sShutdown(false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -123,14 +123,14 @@ class DiscardTracker
|
||||||
static nsCOMPtr<nsITimer> sTimer;
|
static nsCOMPtr<nsITimer> sTimer;
|
||||||
static bool sInitialized;
|
static bool sInitialized;
|
||||||
static bool sTimerOn;
|
static bool sTimerOn;
|
||||||
static mozilla::Atomic<bool> sDiscardRunnablePending;
|
static Atomic<bool> sDiscardRunnablePending;
|
||||||
static uint64_t sCurrentDecodedImageBytes;
|
static uint64_t sCurrentDecodedImageBytes;
|
||||||
static uint32_t sMinDiscardTimeoutMs;
|
static uint32_t sMinDiscardTimeoutMs;
|
||||||
static uint32_t sMaxDecodedImageKB;
|
static uint32_t sMaxDecodedImageKB;
|
||||||
static uint32_t sHardLimitDecodedImageKB;
|
static uint32_t sHardLimitDecodedImageKB;
|
||||||
// Lock for safegarding the 64-bit sCurrentDecodedImageBytes
|
// Lock for safegarding the 64-bit sCurrentDecodedImageBytes
|
||||||
static PRLock *sAllocationLock;
|
static PRLock *sAllocationLock;
|
||||||
static mozilla::Mutex* sNodeListMutex;
|
static Mutex* sNodeListMutex;
|
||||||
static Atomic<bool> sShutdown;
|
static Atomic<bool> sShutdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
#include "imgIContainer.h"
|
#include "imgIContainer.h"
|
||||||
|
|
||||||
using namespace mozilla::image;
|
namespace mozilla {
|
||||||
using namespace mozilla;
|
namespace image {
|
||||||
|
|
||||||
FrameAnimator::FrameAnimator(FrameBlender& aFrameBlender,
|
FrameAnimator::FrameAnimator(FrameBlender& aFrameBlender,
|
||||||
uint16_t aAnimationMode)
|
uint16_t aAnimationMode)
|
||||||
|
@ -177,7 +177,7 @@ FrameAnimator::AdvanceFrame(TimeStamp aTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameAnimator::RefreshResult
|
FrameAnimator::RefreshResult
|
||||||
FrameAnimator::RequestRefresh(const mozilla::TimeStamp& aTime)
|
FrameAnimator::RequestRefresh(const TimeStamp& aTime)
|
||||||
{
|
{
|
||||||
// only advance the frame if the current time is greater than or
|
// only advance the frame if the current time is greater than or
|
||||||
// equal to the current frame's end time.
|
// equal to the current frame's end time.
|
||||||
|
@ -263,4 +263,5 @@ FrameAnimator::GetFirstFrameRefreshArea() const
|
||||||
return mFirstFrameRefreshArea;
|
return mFirstFrameRefreshArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace image
|
||||||
|
} // namespace mozilla
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
* Returns the result of that blending, including whether the current frame
|
* Returns the result of that blending, including whether the current frame
|
||||||
* changed and what the resulting dirty rectangle is.
|
* changed and what the resulting dirty rectangle is.
|
||||||
*/
|
*/
|
||||||
RefreshResult RequestRefresh(const mozilla::TimeStamp& aTime);
|
RefreshResult RequestRefresh(const TimeStamp& aTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call when this image is finished decoding so we know that there aren't any
|
* Call when this image is finished decoding so we know that there aren't any
|
||||||
|
@ -136,14 +136,14 @@ private: // methods
|
||||||
* @returns a RefreshResult that shows whether the frame was successfully
|
* @returns a RefreshResult that shows whether the frame was successfully
|
||||||
* advanced, and its resulting dirty rect.
|
* advanced, and its resulting dirty rect.
|
||||||
*/
|
*/
|
||||||
RefreshResult AdvanceFrame(mozilla::TimeStamp aTime);
|
RefreshResult AdvanceFrame(TimeStamp aTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time the frame we're currently displaying is supposed to end.
|
* Get the time the frame we're currently displaying is supposed to end.
|
||||||
*
|
*
|
||||||
* In the error case, returns an "infinity" timestamp.
|
* In the error case, returns an "infinity" timestamp.
|
||||||
*/
|
*/
|
||||||
mozilla::TimeStamp GetCurrentImgFrameEndTime() const;
|
TimeStamp GetCurrentImgFrameEndTime() const;
|
||||||
|
|
||||||
private: // data
|
private: // data
|
||||||
//! Area of the first frame that needs to be redrawn on subsequent loops.
|
//! Area of the first frame that needs to be redrawn on subsequent loops.
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
#include "pixman.h"
|
#include "pixman.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::image;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
#include "FrameSequence.h"
|
#include "FrameSequence.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
class imgFrame;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
|
class imgFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FrameBlender stores and gives access to imgFrames. It also knows how to
|
* FrameBlender stores and gives access to imgFrames. It also knows how to
|
||||||
* blend frames from previous to next, looping if necessary.
|
* blend frames from previous to next, looping if necessary.
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
void SetSize(nsIntSize aSize) { mSize = aSize; }
|
void SetSize(nsIntSize aSize) { mSize = aSize; }
|
||||||
|
|
||||||
size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxMemoryLocation aLocation,
|
size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxMemoryLocation aLocation,
|
||||||
mozilla::MallocSizeOf aMallocSizeOf) const;
|
MallocSizeOf aMallocSizeOf) const;
|
||||||
|
|
||||||
void ResetAnimation();
|
void ResetAnimation();
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
|
|
||||||
#include "FrameSequence.h"
|
#include "FrameSequence.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::image;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ public:
|
||||||
uint32_t GetNumFrames() const;
|
uint32_t GetNumFrames() const;
|
||||||
|
|
||||||
size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxMemoryLocation aLocation,
|
size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxMemoryLocation aLocation,
|
||||||
mozilla::MallocSizeOf aMallocSizeOf) const;
|
MallocSizeOf aMallocSizeOf) const;
|
||||||
|
|
||||||
private: // data
|
private: // data
|
||||||
//! All the frames of the image
|
//! All the frames of the image
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include "FrozenImage.h"
|
#include "FrozenImage.h"
|
||||||
|
|
||||||
using namespace mozilla::gfx;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
using namespace gfx;
|
||||||
|
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper)
|
NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper)
|
||||||
|
@ -86,7 +87,7 @@ FrozenImage::Draw(gfxContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
FrozenImage::RequestRefresh(const mozilla::TimeStamp& aTime)
|
FrozenImage::RequestRefresh(const TimeStamp& aTime)
|
||||||
{
|
{
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace image {
|
||||||
*/
|
*/
|
||||||
class FrozenImage : public ImageWrapper
|
class FrozenImage : public ImageWrapper
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::SourceSurface SourceSurface;
|
typedef gfx::SourceSurface SourceSurface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
const SVGImageContext* aSVGContext,
|
const SVGImageContext* aSVGContext,
|
||||||
uint32_t aWhichFrame,
|
uint32_t aWhichFrame,
|
||||||
uint32_t aFlags) MOZ_OVERRIDE;
|
uint32_t aFlags) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD_(void) RequestRefresh(const mozilla::TimeStamp& aTime) MOZ_OVERRIDE;
|
NS_IMETHOD_(void) RequestRefresh(const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetAnimationMode(uint16_t* aAnimationMode) MOZ_OVERRIDE;
|
NS_IMETHOD GetAnimationMode(uint16_t* aAnimationMode) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD SetAnimationMode(uint16_t aAnimationMode) MOZ_OVERRIDE;
|
NS_IMETHOD SetAnimationMode(uint16_t aAnimationMode) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD ResetAnimation() MOZ_OVERRIDE;
|
NS_IMETHOD ResetAnimation() MOZ_OVERRIDE;
|
||||||
|
|
|
@ -80,8 +80,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* The components that make up SizeOfData().
|
* The components that make up SizeOfData().
|
||||||
*/
|
*/
|
||||||
virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
virtual size_t HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const = 0;
|
||||||
virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
virtual size_t HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const = 0;
|
||||||
virtual size_t NonHeapSizeOfDecoded() const = 0;
|
virtual size_t NonHeapSizeOfDecoded() const = 0;
|
||||||
virtual size_t OutOfProcessSizeOfDecoded() const = 0;
|
virtual size_t OutOfProcessSizeOfDecoded() const = 0;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ protected:
|
||||||
*
|
*
|
||||||
* Otherwise, this method updates mLastRefreshTime to aTime & returns false.
|
* Otherwise, this method updates mLastRefreshTime to aTime & returns false.
|
||||||
*/
|
*/
|
||||||
bool HadRecentRefresh(const mozilla::TimeStamp& aTime);
|
bool HadRecentRefresh(const TimeStamp& aTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decides whether animation should or should not be happening,
|
* Decides whether animation should or should not be happening,
|
||||||
|
|
|
@ -236,7 +236,7 @@ ImageFactory::CreateRasterImage(nsIRequest* aRequest,
|
||||||
|
|
||||||
nsAutoCString ref;
|
nsAutoCString ref;
|
||||||
aURI->GetRef(ref);
|
aURI->GetRef(ref);
|
||||||
mozilla::net::nsMediaFragmentURIParser parser(ref);
|
net::nsMediaFragmentURIParser parser(ref);
|
||||||
if (parser.HasResolution()) {
|
if (parser.HasResolution()) {
|
||||||
newImage->SetRequestedResolution(parser.GetResolution());
|
newImage->SetRequestedResolution(parser.GetResolution());
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsXPCOMCID.h"
|
#include "nsXPCOMCID.h"
|
||||||
|
|
||||||
using namespace mozilla::image;
|
namespace mozilla {
|
||||||
|
namespace image {
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageMetadata::SetOnImage(RasterImage* image)
|
ImageMetadata::SetOnImage(RasterImage* image)
|
||||||
|
@ -31,3 +32,6 @@ ImageMetadata::SetOnImage(RasterImage* image)
|
||||||
image->SetFrameAsNonPremult(i, mIsNonPremultiplied);
|
image->SetFrameAsNonPremult(i, mIsNonPremultiplied);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace image
|
||||||
|
} // namespace mozilla
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
|
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
|
|
||||||
using mozilla::gfx::DataSourceSurface;
|
|
||||||
using mozilla::gfx::SourceSurface;
|
|
||||||
using mozilla::layers::LayerManager;
|
|
||||||
using mozilla::layers::ImageContainer;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
using gfx::DataSourceSurface;
|
||||||
|
using gfx::SourceSurface;
|
||||||
|
using layers::LayerManager;
|
||||||
|
using layers::ImageContainer;
|
||||||
|
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
// Inherited methods from Image.
|
// Inherited methods from Image.
|
||||||
|
@ -45,13 +46,13 @@ ImageWrapper::SizeOfData()
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ImageWrapper::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
|
ImageWrapper::HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
return mInnerImage->HeapSizeOfSourceWithComputedFallback(aMallocSizeOf);
|
return mInnerImage->HeapSizeOfSourceWithComputedFallback(aMallocSizeOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ImageWrapper::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
|
ImageWrapper::HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
return mInnerImage->HeapSizeOfDecodedWithComputedFallback(aMallocSizeOf);
|
return mInnerImage->HeapSizeOfDecodedWithComputedFallback(aMallocSizeOf);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +277,7 @@ ImageWrapper::RequestDiscard()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
ImageWrapper::RequestRefresh(const mozilla::TimeStamp& aTime)
|
ImageWrapper::RequestRefresh(const TimeStamp& aTime)
|
||||||
{
|
{
|
||||||
return mInnerImage->RequestRefresh(aTime);
|
return mInnerImage->RequestRefresh(aTime);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +313,7 @@ ImageWrapper::GetFirstFrameDelay()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
ImageWrapper::SetAnimationStartTime(const mozilla::TimeStamp& aTime)
|
ImageWrapper::SetAnimationStartTime(const TimeStamp& aTime)
|
||||||
{
|
{
|
||||||
mInnerImage->SetAnimationStartTime(aTime);
|
mInnerImage->SetAnimationStartTime(aTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ public:
|
||||||
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
|
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual uint32_t SizeOfData() MOZ_OVERRIDE;
|
virtual uint32_t SizeOfData() MOZ_OVERRIDE;
|
||||||
virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
virtual size_t HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
||||||
virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
virtual size_t HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
|
||||||
virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE;
|
virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE;
|
||||||
virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE;
|
virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,14 @@
|
||||||
|
|
||||||
#include "OrientedImage.h"
|
#include "OrientedImage.h"
|
||||||
|
|
||||||
using namespace mozilla::gfx;
|
|
||||||
|
|
||||||
using std::swap;
|
using std::swap;
|
||||||
using mozilla::layers::LayerManager;
|
|
||||||
using mozilla::layers::ImageContainer;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
using namespace gfx;
|
||||||
|
using layers::LayerManager;
|
||||||
|
using layers::ImageContainer;
|
||||||
|
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED0(OrientedImage, ImageWrapper)
|
NS_IMPL_ISUPPORTS_INHERITED0(OrientedImage, ImageWrapper)
|
||||||
|
@ -107,7 +108,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a surface to draw into.
|
// Create a surface to draw into.
|
||||||
mozilla::RefPtr<DrawTarget> target =
|
RefPtr<DrawTarget> target =
|
||||||
gfxPlatform::GetPlatform()->
|
gfxPlatform::GetPlatform()->
|
||||||
CreateOffscreenContentDrawTarget(IntSize(width, height), surfaceFormat);
|
CreateOffscreenContentDrawTarget(IntSize(width, height), surfaceFormat);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace image {
|
||||||
*/
|
*/
|
||||||
class OrientedImage : public ImageWrapper
|
class OrientedImage : public ImageWrapper
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::SourceSurface SourceSurface;
|
typedef gfx::SourceSurface SourceSurface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
@ -34,10 +34,10 @@ public:
|
||||||
NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
|
NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;
|
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE;
|
NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD_(mozilla::TemporaryRef<SourceSurface>)
|
NS_IMETHOD_(TemporaryRef<SourceSurface>)
|
||||||
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE;
|
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager,
|
NS_IMETHOD GetImageContainer(layers::LayerManager* aManager,
|
||||||
mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE;
|
layers::ImageContainer** _retval) MOZ_OVERRIDE;
|
||||||
NS_IMETHOD Draw(gfxContext* aContext,
|
NS_IMETHOD Draw(gfxContext* aContext,
|
||||||
GraphicsFilter aFilter,
|
GraphicsFilter aFilter,
|
||||||
const gfxMatrix& aUserSpaceToImageSpace,
|
const gfxMatrix& aUserSpaceToImageSpace,
|
||||||
|
|
|
@ -53,10 +53,12 @@
|
||||||
#include "ipc/Nuwa.h"
|
#include "ipc/Nuwa.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace mozilla;
|
namespace mozilla {
|
||||||
using namespace mozilla::gfx;
|
|
||||||
using namespace mozilla::image;
|
using namespace gfx;
|
||||||
using namespace mozilla::layers;
|
using namespace layers;
|
||||||
|
|
||||||
|
namespace image {
|
||||||
|
|
||||||
// a mask for flags that will affect the decoding
|
// a mask for flags that will affect the decoding
|
||||||
#define DECODE_FLAGS_MASK (imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA | imgIContainer::FLAG_DECODE_NO_COLORSPACE_CONVERSION)
|
#define DECODE_FLAGS_MASK (imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA | imgIContainer::FLAG_DECODE_NO_COLORSPACE_CONVERSION)
|
||||||
|
@ -371,9 +373,6 @@ private:
|
||||||
nsAutoPtr<ScaleRequest> mScaleRequest;
|
nsAutoPtr<ScaleRequest> mScaleRequest;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace image {
|
|
||||||
|
|
||||||
/* static */ StaticRefPtr<RasterImage::DecodePool> RasterImage::DecodePool::sSingleton;
|
/* static */ StaticRefPtr<RasterImage::DecodePool> RasterImage::DecodePool::sSingleton;
|
||||||
static nsCOMPtr<nsIThread> sScaleWorkerThread = nullptr;
|
static nsCOMPtr<nsIThread> sScaleWorkerThread = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -121,8 +121,6 @@ class nsIRequest;
|
||||||
* it's not allocated until the second frame is added.
|
* it's not allocated until the second frame is added.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ScaleRequest;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
@ -133,6 +131,7 @@ class Image;
|
||||||
|
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
|
class ScaleRequest;
|
||||||
class Decoder;
|
class Decoder;
|
||||||
class FrameAnimator;
|
class FrameAnimator;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include "imgIScriptedNotificationObserver.h"
|
#include "imgIScriptedNotificationObserver.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
|
||||||
using namespace mozilla::image;
|
namespace mozilla {
|
||||||
|
namespace image {
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner)
|
NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner)
|
||||||
|
|
||||||
|
@ -47,3 +48,6 @@ ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
|
||||||
return mInner->IsAnimated(aRequest);
|
return mInner->IsAnimated(aRequest);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace image
|
||||||
|
} // namespace mozilla
|
||||||
|
|
|
@ -31,9 +31,11 @@
|
||||||
|
|
||||||
using std::max;
|
using std::max;
|
||||||
using std::min;
|
using std::min;
|
||||||
using namespace mozilla::gfx;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
using namespace gfx;
|
||||||
|
|
||||||
namespace image {
|
namespace image {
|
||||||
|
|
||||||
class CachedSurface;
|
class CachedSurface;
|
||||||
|
@ -218,7 +220,7 @@ public:
|
||||||
, mMaxCost(aSurfaceCacheSize)
|
, mMaxCost(aSurfaceCacheSize)
|
||||||
, mAvailableCost(aSurfaceCacheSize)
|
, mAvailableCost(aSurfaceCacheSize)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||||
if (os)
|
if (os)
|
||||||
os->AddObserver(mMemoryPressureObserver, "memory-pressure", false);
|
os->AddObserver(mMemoryPressureObserver, "memory-pressure", false);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +228,7 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual ~SurfaceCacheImpl()
|
virtual ~SurfaceCacheImpl()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||||
if (os)
|
if (os)
|
||||||
os->RemoveObserver(mMemoryPressureObserver, "memory-pressure");
|
os->RemoveObserver(mMemoryPressureObserver, "memory-pressure");
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,9 @@ struct SurfaceCache
|
||||||
* @param aImageKey Key data identifying which image the surface belongs to.
|
* @param aImageKey Key data identifying which image the surface belongs to.
|
||||||
* @param aSurfaceKey Key data which uniquely identifies the requested surface.
|
* @param aSurfaceKey Key data which uniquely identifies the requested surface.
|
||||||
*/
|
*/
|
||||||
static void Insert(mozilla::gfx::DrawTarget* aTarget,
|
static void Insert(gfx::DrawTarget* aTarget,
|
||||||
const ImageKey aImageKey,
|
const ImageKey aImageKey,
|
||||||
const SurfaceKey& aSurfaceKey);
|
const SurfaceKey& aSurfaceKey);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks if a surface of a given size could possibly be stored in the cache.
|
* Checks if a surface of a given size could possibly be stored in the cache.
|
||||||
|
|
|
@ -364,7 +364,7 @@ VectorImage::FrameRect(uint32_t aWhichFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
|
VectorImage::HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
// We're not storing the source data -- we just feed that directly to
|
// We're not storing the source data -- we just feed that directly to
|
||||||
// our helper SVG document as we receive it, for it to parse.
|
// our helper SVG document as we receive it, for it to parse.
|
||||||
|
@ -376,7 +376,7 @@ VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocS
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
VectorImage::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
|
VectorImage::HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
// If implementing this, we'll need to restructure our callers to make sure
|
// If implementing this, we'll need to restructure our callers to make sure
|
||||||
// any amount we return is attributed to the vector images measure (i.e.
|
// any amount we return is attributed to the vector images measure (i.e.
|
||||||
|
@ -503,7 +503,7 @@ VectorImage::ShouldAnimate()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
VectorImage::SetAnimationStartTime(const mozilla::TimeStamp& aTime)
|
VectorImage::SetAnimationStartTime(const TimeStamp& aTime)
|
||||||
{
|
{
|
||||||
// We don't care about animation start time.
|
// We don't care about animation start time.
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ VectorImage::GetWidth(int32_t* aWidth)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
/* [notxpcom] void requestRefresh ([const] in TimeStamp aTime); */
|
/* [notxpcom] void requestRefresh ([const] in TimeStamp aTime); */
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
VectorImage::RequestRefresh(const mozilla::TimeStamp& aTime)
|
VectorImage::RequestRefresh(const TimeStamp& aTime)
|
||||||
{
|
{
|
||||||
if (HadRecentRefresh(aTime)) {
|
if (HadRecentRefresh(aTime)) {
|
||||||
return;
|
return;
|
||||||
|
@ -755,7 +755,7 @@ VectorImage::GetFrame(uint32_t aWhichFrame,
|
||||||
/* [noscript] ImageContainer getImageContainer(); */
|
/* [noscript] ImageContainer getImageContainer(); */
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
VectorImage::GetImageContainer(LayerManager* aManager,
|
VectorImage::GetImageContainer(LayerManager* aManager,
|
||||||
mozilla::layers::ImageContainer** _retval)
|
layers::ImageContainer** _retval)
|
||||||
{
|
{
|
||||||
*_retval = nullptr;
|
*_retval = nullptr;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -915,7 +915,7 @@ VectorImage::CreateDrawableAndShow(const SVGDrawingParameters& aParams)
|
||||||
return Show(svgDrawable, aParams);
|
return Show(svgDrawable, aParams);
|
||||||
|
|
||||||
// Try to create an offscreen surface.
|
// Try to create an offscreen surface.
|
||||||
mozilla::RefPtr<mozilla::gfx::DrawTarget> target =
|
RefPtr<gfx::DrawTarget> target =
|
||||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size(), gfx::SurfaceFormat::B8G8R8A8);
|
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size(), gfx::SurfaceFormat::B8G8R8A8);
|
||||||
|
|
||||||
// If we couldn't create the draw target, it was probably because it would end
|
// If we couldn't create the draw target, it was probably because it would end
|
||||||
|
|
|
@ -42,8 +42,8 @@ public:
|
||||||
uint32_t aFlags);
|
uint32_t aFlags);
|
||||||
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
|
virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const;
|
virtual size_t HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const;
|
||||||
virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const;
|
virtual size_t HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const;
|
||||||
virtual size_t NonHeapSizeOfDecoded() const;
|
virtual size_t NonHeapSizeOfDecoded() const;
|
||||||
virtual size_t OutOfProcessSizeOfDecoded() const;
|
virtual size_t OutOfProcessSizeOfDecoded() const;
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,12 @@ static bool gDisableOptimize = false;
|
||||||
#include "mozilla/CheckedInt.h"
|
#include "mozilla/CheckedInt.h"
|
||||||
#include "mozilla/gfx/Tools.h"
|
#include "mozilla/gfx/Tools.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::gfx;
|
namespace mozilla {
|
||||||
using namespace mozilla::image;
|
|
||||||
|
using namespace gfx;
|
||||||
|
|
||||||
|
namespace image {
|
||||||
|
|
||||||
static UserDataKey kVolatileBuffer;
|
static UserDataKey kVolatileBuffer;
|
||||||
|
|
||||||
|
@ -750,7 +753,7 @@ void imgFrame::SetCompositingFailed(bool val)
|
||||||
// |aMallocSizeOf|. If that fails (because the platform doesn't support it) or
|
// |aMallocSizeOf|. If that fails (because the platform doesn't support it) or
|
||||||
// it's non-heap memory, we fall back to computing the size analytically.
|
// it's non-heap memory, we fall back to computing the size analytically.
|
||||||
size_t
|
size_t
|
||||||
imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocation, mozilla::MallocSizeOf aMallocSizeOf) const
|
imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocation, MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
// aMallocSizeOf is only used if aLocation==gfxMemoryLocation::IN_PROCESS_HEAP. It
|
// aMallocSizeOf is only used if aLocation==gfxMemoryLocation::IN_PROCESS_HEAP. It
|
||||||
// should be nullptr otherwise.
|
// should be nullptr otherwise.
|
||||||
|
@ -787,3 +790,6 @@ imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocat
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace image
|
||||||
|
} // namespace mozilla
|
||||||
|
|
|
@ -13,13 +13,16 @@
|
||||||
#include "gfxDrawable.h"
|
#include "gfxDrawable.h"
|
||||||
#include "imgIContainer.h"
|
#include "imgIContainer.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace image {
|
||||||
|
|
||||||
class imgFrame
|
class imgFrame
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::Color Color;
|
typedef gfx::Color Color;
|
||||||
typedef mozilla::gfx::DataSourceSurface DataSourceSurface;
|
typedef gfx::DataSourceSurface DataSourceSurface;
|
||||||
typedef mozilla::gfx::IntSize IntSize;
|
typedef gfx::IntSize IntSize;
|
||||||
typedef mozilla::gfx::SourceSurface SourceSurface;
|
typedef gfx::SourceSurface SourceSurface;
|
||||||
typedef mozilla::gfx::SurfaceFormat SurfaceFormat;
|
typedef gfx::SurfaceFormat SurfaceFormat;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
imgFrame();
|
imgFrame();
|
||||||
|
@ -67,7 +70,7 @@ public:
|
||||||
|
|
||||||
void SetDiscardable();
|
void SetDiscardable();
|
||||||
|
|
||||||
mozilla::TemporaryRef<SourceSurface> GetSurface();
|
TemporaryRef<SourceSurface> GetSurface();
|
||||||
|
|
||||||
Color
|
Color
|
||||||
SinglePixelColor()
|
SinglePixelColor()
|
||||||
|
@ -80,11 +83,11 @@ public:
|
||||||
return mSinglePixel;
|
return mSinglePixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::TemporaryRef<SourceSurface> CachedSurface();
|
TemporaryRef<SourceSurface> CachedSurface();
|
||||||
|
|
||||||
size_t SizeOfExcludingThisWithComputedFallbackIfHeap(
|
size_t SizeOfExcludingThisWithComputedFallbackIfHeap(
|
||||||
gfxMemoryLocation aLocation,
|
gfxMemoryLocation aLocation,
|
||||||
mozilla::MallocSizeOf aMallocSizeOf) const;
|
MallocSizeOf aMallocSizeOf) const;
|
||||||
|
|
||||||
uint8_t GetPaletteDepth() const { return mPaletteDepth; }
|
uint8_t GetPaletteDepth() const { return mPaletteDepth; }
|
||||||
uint32_t PaletteDataLength() const {
|
uint32_t PaletteDataLength() const {
|
||||||
|
@ -117,15 +120,15 @@ private: // methods
|
||||||
SourceSurface* aSurface);
|
SourceSurface* aSurface);
|
||||||
|
|
||||||
private: // data
|
private: // data
|
||||||
mozilla::RefPtr<DataSourceSurface> mImageSurface;
|
RefPtr<DataSourceSurface> mImageSurface;
|
||||||
mozilla::RefPtr<SourceSurface> mOptSurface;
|
RefPtr<SourceSurface> mOptSurface;
|
||||||
|
|
||||||
IntSize mSize;
|
IntSize mSize;
|
||||||
nsIntPoint mOffset;
|
nsIntPoint mOffset;
|
||||||
|
|
||||||
nsIntRect mDecoded;
|
nsIntRect mDecoded;
|
||||||
|
|
||||||
mutable mozilla::Mutex mDecodedMutex;
|
mutable Mutex mDecodedMutex;
|
||||||
|
|
||||||
// The palette and image data for images that are paletted, since Cairo
|
// The palette and image data for images that are paletted, since Cairo
|
||||||
// doesn't support these images.
|
// doesn't support these images.
|
||||||
|
@ -142,8 +145,8 @@ private: // data
|
||||||
/** Indicates how many readers currently have locked this frame */
|
/** Indicates how many readers currently have locked this frame */
|
||||||
int32_t mLockCount;
|
int32_t mLockCount;
|
||||||
|
|
||||||
mozilla::RefPtr<mozilla::VolatileBuffer> mVBuf;
|
RefPtr<VolatileBuffer> mVBuf;
|
||||||
mozilla::VolatileBufferPtr<uint8_t> mVBufPtr;
|
VolatileBufferPtr<uint8_t> mVBufPtr;
|
||||||
|
|
||||||
SurfaceFormat mFormat;
|
SurfaceFormat mFormat;
|
||||||
uint8_t mPaletteDepth;
|
uint8_t mPaletteDepth;
|
||||||
|
@ -157,8 +160,6 @@ private: // data
|
||||||
bool mInformedDiscardTracker;
|
bool mInformedDiscardTracker;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace image {
|
|
||||||
// An RAII class to ensure it's easy to balance locks and unlocks on
|
// An RAII class to ensure it's easy to balance locks and unlocks on
|
||||||
// imgFrames.
|
// imgFrames.
|
||||||
class AutoFrameLocker
|
class AutoFrameLocker
|
||||||
|
@ -183,7 +184,8 @@ namespace image {
|
||||||
imgFrame* mFrame;
|
imgFrame* mFrame;
|
||||||
bool mSucceeded;
|
bool mSucceeded;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
} // namespace image
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif /* imgFrame_h */
|
#endif /* imgFrame_h */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче