mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-16 06:54:00 +00:00
Bug 780260 - Add serial numbers to Images and use it to check if an image has been painted to its BasicShadowableImageLayer already. r=cjones
This commit is contained in:
parent
072ab750db
commit
c7942e6ad6
@ -32,6 +32,10 @@ using mozilla::gfx::SourceSurface;
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
uint64_t Image::sSerialCounter = 0;
|
||||
mozilla::Mutex Image::sSerialMutex("mozilla.layers.Image.sSerialMutex");
|
||||
|
||||
|
||||
already_AddRefed<Image>
|
||||
ImageFactory::CreateImage(const Image::Format *aFormats,
|
||||
PRUint32 aNumFormats,
|
||||
|
@ -143,16 +143,24 @@ public:
|
||||
void SetBackendData(LayersBackend aBackend, ImageBackendData* aData)
|
||||
{ mBackendData[aBackend] = aData; }
|
||||
|
||||
uint64_t GetSerial() { return mSerial; }
|
||||
|
||||
protected:
|
||||
Image(void* aImplData, Format aFormat) :
|
||||
mImplData(aImplData),
|
||||
mFormat(aFormat)
|
||||
{}
|
||||
{
|
||||
MutexAutoLock lock(sSerialMutex);
|
||||
mSerial = ++sSerialCounter;
|
||||
}
|
||||
|
||||
nsAutoPtr<ImageBackendData> mBackendData[mozilla::layers::LAYERS_LAST];
|
||||
|
||||
void* mImplData;
|
||||
uint64_t mSerial;
|
||||
Format mFormat;
|
||||
static uint64_t sSerialCounter;
|
||||
static mozilla::Mutex sSerialMutex;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,8 @@ class BasicShadowableImageLayer : public BasicImageLayer,
|
||||
public:
|
||||
BasicShadowableImageLayer(BasicShadowLayerManager* aManager) :
|
||||
BasicImageLayer(aManager),
|
||||
mBufferIsOpaque(false)
|
||||
mBufferIsOpaque(false),
|
||||
mLastPaintedImageSerial(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicShadowableImageLayer);
|
||||
}
|
||||
@ -243,6 +244,7 @@ private:
|
||||
SurfaceDescriptor mBackBufferU;
|
||||
SurfaceDescriptor mBackBufferV;
|
||||
gfxIntSize mCbCrSize;
|
||||
uint64_t mLastPaintedImageSerial;
|
||||
};
|
||||
|
||||
void
|
||||
@ -371,6 +373,8 @@ BasicShadowableImageLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
|
||||
|
||||
if (!BasicManager()->AllocBuffer(mSize, type, &mBackBuffer))
|
||||
NS_RUNTIMEABORT("creating ImageLayer 'front buffer' failed!");
|
||||
} else if (mLastPaintedImageSerial == image->GetSerial()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoOpenSurface backSurface(OPEN_READ_WRITE, mBackBuffer);
|
||||
@ -382,6 +386,7 @@ BasicShadowableImageLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
|
||||
|
||||
BasicManager()->PaintedImage(BasicManager()->Hold(this),
|
||||
mBackBuffer);
|
||||
mLastPaintedImageSerial = image->GetSerial();
|
||||
}
|
||||
|
||||
class BasicShadowImageLayer : public ShadowImageLayer, public BasicImplData {
|
||||
|
Loading…
x
Reference in New Issue
Block a user