Bug 1027380 - Paint flashing from an inactive layer manager saturates the transparent layers. r=mattwoodrow

--HG--
extra : rebase_source : 7444cf86fc14bd811d836d4c788958bf3790f572
This commit is contained in:
Benoit Girard 2014-06-19 14:22:17 -04:00
Родитель 6777a8c00a
Коммит 868c2e128c
5 изменённых файлов: 26 добавлений и 12 удалений

Просмотреть файл

@ -213,6 +213,7 @@ public:
* and is used for drawing into the widget.
*/
virtual bool IsWidgetLayerManager() { return true; }
virtual bool IsInactiveLayerManager() { return false; }
/**
* Start a new transaction. Nested transactions are not allowed so

Просмотреть файл

@ -210,10 +210,12 @@ public:
bool mPushedOpaqueRect;
};
BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
mPhase(PHASE_NONE),
mWidget(aWidget)
, mDoubleBuffering(BufferMode::BUFFER_NONE), mUsingDefaultTarget(false)
BasicLayerManager::BasicLayerManager(nsIWidget* aWidget)
: mPhase(PHASE_NONE)
, mWidget(aWidget)
, mDoubleBuffering(BufferMode::BUFFER_NONE)
, mType(BLM_WIDGET)
, mUsingDefaultTarget(false)
, mTransactionIncomplete(false)
, mCompositorMightResample(false)
{
@ -221,13 +223,16 @@ BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
NS_ASSERTION(aWidget, "Must provide a widget");
}
BasicLayerManager::BasicLayerManager() :
mPhase(PHASE_NONE),
mWidget(nullptr)
, mDoubleBuffering(BufferMode::BUFFER_NONE), mUsingDefaultTarget(false)
BasicLayerManager::BasicLayerManager(BasicLayerManagerType aType)
: mPhase(PHASE_NONE)
, mWidget(nullptr)
, mDoubleBuffering(BufferMode::BUFFER_NONE)
, mType(aType)
, mUsingDefaultTarget(false)
, mTransactionIncomplete(false)
{
MOZ_COUNT_CTOR(BasicLayerManager);
MOZ_ASSERT(mType != BLM_WIDGET);
}
BasicLayerManager::~BasicLayerManager()

Просмотреть файл

@ -45,13 +45,18 @@ class BasicLayerManager :
public LayerManager
{
public:
enum BasicLayerManagerType {
BLM_WIDGET,
BLM_OFFSCREEN,
BLM_INACTIVE
};
/**
* Construct a BasicLayerManager which will have no default
* target context. SetDefaultTarget or BeginTransactionWithTarget
* must be called for any rendering to happen. ThebesLayers will not
* be retained.
*/
BasicLayerManager();
BasicLayerManager(BasicLayerManagerType aType);
/**
* Construct a BasicLayerManager which will have no default
* target context. SetDefaultTarget or BeginTransactionWithTarget
@ -89,6 +94,7 @@ public:
void ClearRetainerWidget() { mWidget = nullptr; }
virtual bool IsWidgetLayerManager() { return mWidget != nullptr; }
virtual bool IsInactiveLayerManager() { return mType == BLM_INACTIVE; }
virtual void BeginTransaction();
virtual void BeginTransactionWithTarget(gfxContext* aTarget);
@ -183,6 +189,7 @@ protected:
nsRefPtr<ImageFactory> mFactory;
BufferMode mDoubleBuffering;
BasicLayerManagerType mType;
bool mUsingDefaultTarget;
bool mTransactionIncomplete;
bool mCompositorMightResample;

Просмотреть файл

@ -2826,7 +2826,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
tempManager = data->mInactiveManager;
}
if (!tempManager) {
tempManager = new BasicLayerManager();
tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
}
// We need to grab these before calling AddLayerDisplayItem because it will overwrite them.
@ -3891,7 +3891,8 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
entry->mCommonClipCount);
}
if (presContext->GetPaintFlashing()) {
if (presContext->GetPaintFlashing() &&
!aLayer->Manager()->IsInactiveLayerManager()) {
gfxContextAutoSaveRestore save(aContext);
if (shouldDrawRectsSeparately) {
if (aClip == DrawRegionClip::DRAW_SNAPPED) {

Просмотреть файл

@ -1280,7 +1280,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
NS_WARNING("Nowhere to paint into");
return;
}
layerManager = new BasicLayerManager();
layerManager = new BasicLayerManager(BasicLayerManager::BLM_OFFSCREEN);
}
// Store the existing layer builder to reinstate it on return.