Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
|
|
|
#ifndef imgFrame_h
|
|
|
|
#define imgFrame_h
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2013-07-04 18:45:57 +00:00
|
|
|
#include "mozilla/Mutex.h"
|
2014-02-25 03:37:51 +00:00
|
|
|
#include "mozilla/VolatileBuffer.h"
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsSize.h"
|
|
|
|
#include "gfxPattern.h"
|
2010-08-13 13:30:27 +00:00
|
|
|
#include "gfxDrawable.h"
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
#include "gfxImageSurface.h"
|
|
|
|
#if defined(XP_WIN)
|
|
|
|
#include "gfxWindowsSurface.h"
|
|
|
|
#elif defined(XP_MACOSX)
|
|
|
|
#include "gfxQuartzImageSurface.h"
|
|
|
|
#endif
|
|
|
|
#include "nsAutoPtr.h"
|
2012-04-17 22:04:15 +00:00
|
|
|
#include "imgIContainer.h"
|
2013-10-07 23:15:59 +00:00
|
|
|
#include "gfxColor.h"
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2014-02-25 03:37:51 +00:00
|
|
|
/*
|
|
|
|
* This creates a gfxImageSurface which will unlock the buffer on destruction
|
|
|
|
*/
|
|
|
|
|
|
|
|
class LockedImageSurface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static gfxImageSurface *
|
|
|
|
CreateSurface(mozilla::VolatileBuffer *vbuf,
|
|
|
|
const gfxIntSize& size,
|
|
|
|
gfxImageFormat format);
|
|
|
|
static mozilla::TemporaryRef<mozilla::VolatileBuffer>
|
|
|
|
AllocateBuffer(const gfxIntSize& size, gfxImageFormat format);
|
|
|
|
};
|
|
|
|
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
class imgFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
imgFrame();
|
|
|
|
~imgFrame();
|
|
|
|
|
2013-09-24 20:45:13 +00:00
|
|
|
nsresult Init(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, gfxImageFormat aFormat, uint8_t aPaletteDepth = 0);
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
nsresult Optimize();
|
|
|
|
|
2014-03-02 16:17:26 +00:00
|
|
|
bool Draw(gfxContext *aContext, GraphicsFilter aFilter,
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
const gfxMatrix &aUserSpaceToImageSpace, const gfxRect& aFill,
|
2012-04-17 22:04:15 +00:00
|
|
|
const nsIntMargin &aPadding, const nsIntRect &aSubimage,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aImageFlags = imgIContainer::FLAG_NONE);
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
|
|
|
nsresult ImageUpdated(const nsIntRect &aUpdateRect);
|
2013-07-15 18:38:59 +00:00
|
|
|
bool GetIsDirty() const;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
|
|
|
nsIntRect GetRect() const;
|
2013-09-24 20:45:13 +00:00
|
|
|
gfxImageFormat GetFormat() const;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetNeedsBackground() const;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t GetImageBytesPerRow() const;
|
|
|
|
uint32_t GetImageDataLength() const;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetIsPaletted() const;
|
|
|
|
bool GetHasAlpha() const;
|
2012-08-22 15:56:38 +00:00
|
|
|
void GetImageData(uint8_t **aData, uint32_t *length) const;
|
2013-06-14 13:42:01 +00:00
|
|
|
uint8_t* GetImageData() const;
|
2012-08-22 15:56:38 +00:00
|
|
|
void GetPaletteData(uint32_t **aPalette, uint32_t *length) const;
|
2013-06-14 13:42:01 +00:00
|
|
|
uint32_t* GetPaletteData() const;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2013-12-06 09:45:24 +00:00
|
|
|
int32_t GetRawTimeout() const;
|
|
|
|
void SetRawTimeout(int32_t aTimeout);
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetFrameDisposalMethod() const;
|
|
|
|
void SetFrameDisposalMethod(int32_t aFrameDisposalMethod);
|
|
|
|
int32_t GetBlendMethod() const;
|
|
|
|
void SetBlendMethod(int32_t aBlendMethod);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ImageComplete() const;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
|
|
|
void SetHasNoAlpha();
|
2012-03-23 22:10:50 +00:00
|
|
|
void SetAsNonPremult(bool aIsNonPremult);
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetCompositingFailed() const;
|
|
|
|
void SetCompositingFailed(bool val);
|
2009-11-12 23:18:40 +00:00
|
|
|
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
nsresult LockImageData();
|
|
|
|
nsresult UnlockImageData();
|
2013-07-04 18:45:57 +00:00
|
|
|
void ApplyDirtToSurfaces();
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2014-02-25 03:37:51 +00:00
|
|
|
void SetDiscardable();
|
|
|
|
|
|
|
|
nsresult GetSurface(gfxASurface **aSurface)
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
{
|
|
|
|
*aSurface = ThebesSurface();
|
|
|
|
NS_IF_ADDREF(*aSurface);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-02-25 03:37:51 +00:00
|
|
|
nsresult GetPattern(gfxPattern **aPattern)
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
{
|
|
|
|
if (mSinglePixel)
|
|
|
|
*aPattern = new gfxPattern(mSinglePixelColor);
|
|
|
|
else
|
|
|
|
*aPattern = new gfxPattern(ThebesSurface());
|
|
|
|
NS_ADDREF(*aPattern);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-02-25 03:37:51 +00:00
|
|
|
bool IsSinglePixel()
|
|
|
|
{
|
|
|
|
return mSinglePixel;
|
|
|
|
}
|
|
|
|
|
2014-04-03 01:32:54 +00:00
|
|
|
gfxASurface* CachedThebesSurface()
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
{
|
|
|
|
if (mOptSurface)
|
|
|
|
return mOptSurface;
|
2011-05-05 21:14:27 +00:00
|
|
|
#if defined(XP_WIN)
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
if (mWinSurface)
|
|
|
|
return mWinSurface;
|
|
|
|
#elif defined(XP_MACOSX)
|
|
|
|
if (mQuartzSurface)
|
|
|
|
return mQuartzSurface;
|
|
|
|
#endif
|
2014-02-25 03:37:51 +00:00
|
|
|
if (mImageSurface)
|
|
|
|
return mImageSurface;
|
2014-04-03 01:32:54 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfxASurface* ThebesSurface()
|
|
|
|
{
|
|
|
|
gfxASurface *sur = CachedThebesSurface();
|
|
|
|
if (sur)
|
|
|
|
return sur;
|
2014-02-25 03:37:51 +00:00
|
|
|
if (mVBuf) {
|
|
|
|
mozilla::VolatileBufferPtr<uint8_t> ref(mVBuf);
|
|
|
|
if (ref.WasBufferPurged())
|
|
|
|
return nullptr;
|
|
|
|
|
2014-04-03 01:32:54 +00:00
|
|
|
gfxImageSurface *imgSur =
|
2014-02-25 03:37:51 +00:00
|
|
|
LockedImageSurface::CreateSurface(mVBuf, mSize, mFormat);
|
|
|
|
#if defined(XP_MACOSX)
|
|
|
|
// Manually addref and release to make sure the cairo surface isn't lost
|
2014-04-03 01:32:54 +00:00
|
|
|
NS_ADDREF(imgSur);
|
|
|
|
gfxQuartzImageSurface *quartzSur = new gfxQuartzImageSurface(imgSur);
|
2014-02-25 03:37:51 +00:00
|
|
|
// quartzSur does not hold on to the gfxImageSurface
|
2014-04-03 01:32:54 +00:00
|
|
|
NS_RELEASE(imgSur);
|
2014-02-25 03:37:51 +00:00
|
|
|
return quartzSur;
|
|
|
|
#else
|
2014-04-03 01:32:54 +00:00
|
|
|
return imgSur;
|
2014-02-25 03:37:51 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
// We can return null here if we're single pixel optimized
|
|
|
|
// or a paletted image. However, one has to check for paletted
|
|
|
|
// image data first before attempting to get a surface, so
|
|
|
|
// this is only valid for single pixel optimized images
|
|
|
|
MOZ_ASSERT(mSinglePixel, "No image surface and not a single pixel!");
|
|
|
|
return nullptr;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2012-02-20 03:51:48 +00:00
|
|
|
size_t SizeOfExcludingThisWithComputedFallbackIfHeap(
|
2013-09-24 20:45:13 +00:00
|
|
|
gfxMemoryLocation aLocation,
|
2013-06-23 12:03:39 +00:00
|
|
|
mozilla::MallocSizeOf aMallocSizeOf) const;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t GetPaletteDepth() const { return mPaletteDepth; }
|
|
|
|
uint32_t PaletteDataLength() const {
|
2013-06-28 18:52:04 +00:00
|
|
|
if (!mPaletteDepth)
|
|
|
|
return 0;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
return ((1 << mPaletteDepth) * sizeof(uint32_t));
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2013-06-14 13:42:01 +00:00
|
|
|
private: // methods
|
|
|
|
|
2010-08-13 13:30:02 +00:00
|
|
|
struct SurfaceWithFormat {
|
2010-08-13 13:30:27 +00:00
|
|
|
nsRefPtr<gfxDrawable> mDrawable;
|
2013-09-24 20:45:13 +00:00
|
|
|
gfxImageFormat mFormat;
|
2010-08-13 13:30:02 +00:00
|
|
|
SurfaceWithFormat() {}
|
2013-09-24 20:45:13 +00:00
|
|
|
SurfaceWithFormat(gfxDrawable* aDrawable, gfxImageFormat aFormat)
|
2010-08-13 13:30:27 +00:00
|
|
|
: mDrawable(aDrawable), mFormat(aFormat) {}
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsValid() { return !!mDrawable; }
|
2010-08-13 13:30:02 +00:00
|
|
|
};
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
SurfaceWithFormat SurfaceForDrawing(bool aDoPadding,
|
|
|
|
bool aDoPartialDecode,
|
|
|
|
bool aDoTile,
|
2010-08-13 13:30:02 +00:00
|
|
|
const nsIntMargin& aPadding,
|
|
|
|
gfxMatrix& aUserSpaceToImageSpace,
|
|
|
|
gfxRect& aFill,
|
|
|
|
gfxRect& aSubimage,
|
|
|
|
gfxRect& aSourceRect,
|
2014-03-02 16:17:26 +00:00
|
|
|
gfxRect& aImageRect,
|
|
|
|
gfxASurface* aSurface);
|
2010-03-12 10:08:25 +00:00
|
|
|
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
private: // data
|
|
|
|
nsRefPtr<gfxImageSurface> mImageSurface;
|
|
|
|
nsRefPtr<gfxASurface> mOptSurface;
|
2011-05-05 21:14:27 +00:00
|
|
|
#if defined(XP_WIN)
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
nsRefPtr<gfxWindowsSurface> mWinSurface;
|
|
|
|
#elif defined(XP_MACOSX)
|
|
|
|
nsRefPtr<gfxQuartzImageSurface> mQuartzSurface;
|
|
|
|
#endif
|
|
|
|
|
2014-04-03 01:32:54 +00:00
|
|
|
nsRefPtr<gfxASurface> mDrawSurface;
|
|
|
|
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
nsIntSize mSize;
|
|
|
|
nsIntPoint mOffset;
|
|
|
|
|
|
|
|
nsIntRect mDecoded;
|
|
|
|
|
2013-07-15 18:38:59 +00:00
|
|
|
mutable mozilla::Mutex mDirtyMutex;
|
2013-07-04 18:45:57 +00:00
|
|
|
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
// The palette and image data for images that are paletted, since Cairo
|
|
|
|
// doesn't support these images.
|
|
|
|
// The paletted data comes first, then the image data itself.
|
|
|
|
// Total length is PaletteDataLength() + GetImageDataLength().
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t* mPalettedImageData;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2012-03-23 22:10:50 +00:00
|
|
|
// Note that the data stored in gfxRGBA is *non-alpha-premultiplied*.
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
gfxRGBA mSinglePixelColor;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mTimeout; // -1 means display forever
|
|
|
|
int32_t mDisposalMethod;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2012-09-26 15:33:06 +00:00
|
|
|
/** Indicates how many readers currently have locked this frame */
|
|
|
|
int32_t mLockCount;
|
|
|
|
|
2014-02-25 03:37:51 +00:00
|
|
|
mozilla::RefPtr<mozilla::VolatileBuffer> mVBuf;
|
|
|
|
|
2013-09-24 20:45:13 +00:00
|
|
|
gfxImageFormat mFormat;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t mPaletteDepth;
|
|
|
|
int8_t mBlendMethod;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mSinglePixel;
|
|
|
|
bool mFormatChanged;
|
|
|
|
bool mCompositingFailed;
|
2012-03-23 22:10:50 +00:00
|
|
|
bool mNonPremult;
|
2014-02-25 03:37:51 +00:00
|
|
|
bool mDiscardable;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
|
2012-03-15 20:30:41 +00:00
|
|
|
/** Have we called DiscardTracker::InformAllocation()? */
|
|
|
|
bool mInformedDiscardTracker;
|
|
|
|
|
2013-07-04 18:45:57 +00:00
|
|
|
bool mDirty;
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
};
|
|
|
|
|
2012-09-26 15:33:06 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace image {
|
|
|
|
// An RAII class to ensure it's easy to balance locks and unlocks on
|
|
|
|
// imgFrames.
|
|
|
|
class AutoFrameLocker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AutoFrameLocker(imgFrame* frame)
|
|
|
|
: mFrame(frame)
|
|
|
|
, mSucceeded(NS_SUCCEEDED(frame->LockImageData()))
|
|
|
|
{}
|
|
|
|
|
|
|
|
~AutoFrameLocker()
|
|
|
|
{
|
|
|
|
if (mSucceeded) {
|
|
|
|
mFrame->UnlockImageData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Whether the lock request succeeded.
|
|
|
|
bool Succeeded() { return mSucceeded; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
imgFrame* mFrame;
|
|
|
|
bool mSucceeded;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
#endif /* imgFrame_h */
|