mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 23:30:46 +00:00
Bug 640444: Self-copies end up changing all buffer content, so we need to read back the entire buffer after swapping. r=Bas a=b
This commit is contained in:
parent
0f1e24c309
commit
8617d00c98
@ -222,6 +222,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
PaintState result;
|
||||
result.mDidSelfCopy = PR_FALSE;
|
||||
float curXRes = aLayer->GetXResolution();
|
||||
float curYRes = aLayer->GetYResolution();
|
||||
|
||||
@ -336,6 +337,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size());
|
||||
nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
|
||||
MovePixels(mBuffer, srcRect, dest, curXRes, curYRes);
|
||||
result.mDidSelfCopy = PR_TRUE;
|
||||
// Don't set destBuffer; we special-case self-copies, and
|
||||
// just did the necessary work above.
|
||||
mBufferRect = destBufferRect;
|
||||
|
@ -110,12 +110,14 @@ public:
|
||||
* by ThebesLayerBuffer and must be redrawn on the screen.
|
||||
* mRegionToInvalidate is set when the buffer has changed from
|
||||
* opaque to transparent or vice versa, since the details of rendering can
|
||||
* depend on the buffer type.
|
||||
* depend on the buffer type. mDidSelfCopy is true if we kept our buffer
|
||||
* but used MovePixels() to shift its content.
|
||||
*/
|
||||
struct PaintState {
|
||||
nsRefPtr<gfxContext> mContext;
|
||||
nsIntRegion mRegionToDraw;
|
||||
nsIntRegion mRegionToInvalidate;
|
||||
PRPackedBool mDidSelfCopy;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -428,6 +428,7 @@ protected:
|
||||
const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aExtendedRegionToDraw,
|
||||
const nsIntRegion& aRegionToInvalidate,
|
||||
PRBool aDidSelfCopy,
|
||||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData)
|
||||
{
|
||||
@ -608,6 +609,7 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
SetAntialiasingFlags(this, state.mContext);
|
||||
PaintBuffer(state.mContext,
|
||||
state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate,
|
||||
state.mDidSelfCopy,
|
||||
aCallback, aCallbackData);
|
||||
Mutated();
|
||||
} else {
|
||||
@ -1800,6 +1802,7 @@ private:
|
||||
const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aExtendedRegionToDraw,
|
||||
const nsIntRegion& aRegionToInvalidate,
|
||||
PRBool aDidSelfCopy,
|
||||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData);
|
||||
|
||||
@ -1860,21 +1863,27 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
|
||||
const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aExtendedRegionToDraw,
|
||||
const nsIntRegion& aRegionToInvalidate,
|
||||
PRBool aDidSelfCopy,
|
||||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData)
|
||||
{
|
||||
Base::PaintBuffer(aContext,
|
||||
aRegionToDraw, aExtendedRegionToDraw, aRegionToInvalidate,
|
||||
aDidSelfCopy,
|
||||
aCallback, aCallbackData);
|
||||
if (!HasShadow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIntRegion updatedRegion;
|
||||
if (mIsNewBuffer) {
|
||||
if (mIsNewBuffer || aDidSelfCopy) {
|
||||
// A buffer reallocation clears both buffers. The front buffer has all the
|
||||
// content by now, but the back buffer is still clear. Here, in effect, we
|
||||
// are saying to copy all of the pixels of the front buffer to the back.
|
||||
// Also when we self-copied in the buffer, the buffer space
|
||||
// changes and some changed buffer content isn't reflected in the
|
||||
// draw or invalidate region (on purpose!). When this happens, we
|
||||
// need to read back the entire buffer too.
|
||||
updatedRegion = mVisibleRegion;
|
||||
mIsNewBuffer = false;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user