Back out bug 622072 because it caused bug 645987
This commit is contained in:
@@ -893,6 +893,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void Initialize(const Data& aData);
|
||||
virtual void Updated(const nsIntRect& aRect);
|
||||
virtual void Paint(gfxContext* aContext);
|
||||
|
||||
virtual void PaintWithOpacity(gfxContext* aContext,
|
||||
@@ -903,12 +904,13 @@ protected:
|
||||
{
|
||||
return static_cast<BasicLayerManager*>(mManager);
|
||||
}
|
||||
void UpdateSurface();
|
||||
|
||||
nsRefPtr<gfxASurface> mSurface;
|
||||
nsRefPtr<mozilla::gl::GLContext> mGLContext;
|
||||
PRUint32 mCanvasFramebuffer;
|
||||
|
||||
nsIntRect mUpdatedRect;
|
||||
|
||||
PRPackedBool mGLBufferIsPremultiplied;
|
||||
PRPackedBool mNeedsYFlip;
|
||||
};
|
||||
@@ -918,6 +920,8 @@ BasicCanvasLayer::Initialize(const Data& aData)
|
||||
{
|
||||
NS_ASSERTION(mSurface == nsnull, "BasicCanvasLayer::Initialize called twice!");
|
||||
|
||||
mUpdatedRect.Empty();
|
||||
|
||||
if (aData.mSurface) {
|
||||
mSurface = aData.mSurface;
|
||||
NS_ASSERTION(aData.mGLContext == nsnull,
|
||||
@@ -937,11 +941,12 @@ BasicCanvasLayer::Initialize(const Data& aData)
|
||||
}
|
||||
|
||||
void
|
||||
BasicCanvasLayer::UpdateSurface()
|
||||
BasicCanvasLayer::Updated(const nsIntRect& aRect)
|
||||
{
|
||||
if (!mDirty)
|
||||
return;
|
||||
mDirty = PR_FALSE;
|
||||
NS_ASSERTION(mUpdatedRect.IsEmpty(),
|
||||
"CanvasLayer::Updated called more than once in a transaction!");
|
||||
|
||||
mUpdatedRect.UnionRect(mUpdatedRect, aRect);
|
||||
|
||||
if (mGLContext) {
|
||||
nsRefPtr<gfxImageSurface> isurf =
|
||||
@@ -971,6 +976,9 @@ BasicCanvasLayer::UpdateSurface()
|
||||
if (currentFramebuffer != mCanvasFramebuffer)
|
||||
mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mCanvasFramebuffer);
|
||||
|
||||
// For simplicity, we read the entire framebuffer for now -- in
|
||||
// the future we should use mUpdatedRect, though with WebGL we don't
|
||||
// have an easy way to generate one.
|
||||
mGLContext->ReadPixelsIntoImageSurface(0, 0,
|
||||
mBounds.width, mBounds.height,
|
||||
isurf);
|
||||
@@ -989,13 +997,15 @@ BasicCanvasLayer::UpdateSurface()
|
||||
// stick our surface into mSurface, so that the Paint() path is the same
|
||||
mSurface = isurf;
|
||||
}
|
||||
|
||||
// sanity
|
||||
NS_ASSERTION(mUpdatedRect.IsEmpty() || mBounds.Contains(mUpdatedRect),
|
||||
"CanvasLayer: Updated rect bigger than bounds!");
|
||||
}
|
||||
|
||||
void
|
||||
BasicCanvasLayer::Paint(gfxContext* aContext)
|
||||
{
|
||||
UpdateSurface();
|
||||
FireDidTransactionCallback();
|
||||
PaintWithOpacity(aContext, GetEffectiveOpacity());
|
||||
}
|
||||
|
||||
@@ -1027,6 +1037,8 @@ BasicCanvasLayer::PaintWithOpacity(gfxContext* aContext,
|
||||
if (mNeedsYFlip) {
|
||||
aContext->SetMatrix(m);
|
||||
}
|
||||
|
||||
mUpdatedRect.Empty();
|
||||
}
|
||||
|
||||
class BasicReadbackLayer : public ReadbackLayer,
|
||||
@@ -2545,6 +2557,9 @@ public:
|
||||
|
||||
virtual void Initialize(const Data& aData);
|
||||
|
||||
virtual void Updated(const nsIntRect& aRect)
|
||||
{}
|
||||
|
||||
virtual already_AddRefed<gfxSharedImageSurface>
|
||||
Swap(gfxSharedImageSurface* newFront);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user