зеркало из https://github.com/mozilla/gecko-dev.git
Bug 984338 - Add a pref to flash layer borders when they are created. r=jrmuizel
This commit is contained in:
Родитель
166a497544
Коммит
26060d4188
|
@ -68,7 +68,8 @@ void
|
|||
Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
const gfx::Rect& aClipRect,
|
||||
const gfx::Matrix4x4& aTransform)
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
uint32_t aFlashCounter)
|
||||
{
|
||||
if (!ShouldDrawDiagnostics(aFlags)) {
|
||||
return;
|
||||
|
@ -80,33 +81,35 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
|
|||
while (const nsIntRect* rect = screenIter.Next())
|
||||
{
|
||||
DrawDiagnostics(aFlags | DIAGNOSTIC_REGION_RECT,
|
||||
ToRect(*rect), aClipRect, aTransform);
|
||||
ToRect(*rect), aClipRect, aTransform, aFlashCounter);
|
||||
}
|
||||
}
|
||||
|
||||
DrawDiagnostics(aFlags, ToRect(aVisibleRegion.GetBounds()),
|
||||
aClipRect, aTransform);
|
||||
aClipRect, aTransform, aFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
|
||||
const gfx::Rect& aVisibleRect,
|
||||
const gfx::Rect& aClipRect,
|
||||
const gfx::Matrix4x4& aTransform)
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
uint32_t aFlashCounter)
|
||||
{
|
||||
if (!ShouldDrawDiagnostics(aFlags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DrawDiagnosticsInternal(aFlags, aVisibleRect,
|
||||
aClipRect, aTransform);
|
||||
DrawDiagnosticsInternal(aFlags, aVisibleRect, aClipRect, aTransform,
|
||||
aFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
|
||||
const gfx::Rect& aVisibleRect,
|
||||
const gfx::Rect& aClipRect,
|
||||
const gfx::Matrix4x4& aTransform)
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
uint32_t aFlashCounter)
|
||||
{
|
||||
#ifdef MOZ_B2G
|
||||
int lWidth = 4;
|
||||
|
@ -142,6 +145,13 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
|
|||
color.b *= 0.7f;
|
||||
}
|
||||
|
||||
if (mDiagnosticTypes & DIAGNOSTIC_FLASH_BORDERS) {
|
||||
float flash = (float)aFlashCounter / (float)DIAGNOSTIC_FLASH_COUNTER_MAX;
|
||||
color.r *= flash;
|
||||
color.g *= flash;
|
||||
color.b *= flash;
|
||||
}
|
||||
|
||||
EffectChain effects;
|
||||
|
||||
effects.mPrimaryEffect = new EffectSolidColor(color);
|
||||
|
|
|
@ -397,16 +397,22 @@ public:
|
|||
mDiagnosticTypes = aDiagnostics;
|
||||
}
|
||||
|
||||
DiagnosticTypes GetDiagnosticTypes() const
|
||||
{
|
||||
return mDiagnosticTypes;
|
||||
}
|
||||
|
||||
void DrawDiagnostics(DiagnosticFlags aFlags,
|
||||
const gfx::Rect& visibleRect,
|
||||
const gfx::Rect& aClipRect,
|
||||
const gfx::Matrix4x4& transform);
|
||||
const gfx::Matrix4x4& transform,
|
||||
uint32_t aFlashCounter = DIAGNOSTIC_FLASH_COUNTER_MAX);
|
||||
|
||||
void DrawDiagnostics(DiagnosticFlags aFlags,
|
||||
const nsIntRegion& visibleRegion,
|
||||
const gfx::Rect& aClipRect,
|
||||
const gfx::Matrix4x4& transform);
|
||||
|
||||
const gfx::Matrix4x4& transform,
|
||||
uint32_t aFlashCounter = DIAGNOSTIC_FLASH_COUNTER_MAX);
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
virtual const char* Name() const = 0;
|
||||
|
@ -513,7 +519,8 @@ protected:
|
|||
void DrawDiagnosticsInternal(DiagnosticFlags aFlags,
|
||||
const gfx::Rect& aVisibleRect,
|
||||
const gfx::Rect& aClipRect,
|
||||
const gfx::Matrix4x4& transform);
|
||||
const gfx::Matrix4x4& transform,
|
||||
uint32_t aFlashCounter);
|
||||
|
||||
bool ShouldDrawDiagnostics(DiagnosticFlags);
|
||||
|
||||
|
|
|
@ -104,6 +104,9 @@ const DiagnosticTypes DIAGNOSTIC_NONE = 0;
|
|||
const DiagnosticTypes DIAGNOSTIC_TILE_BORDERS = 1 << 0;
|
||||
const DiagnosticTypes DIAGNOSTIC_LAYER_BORDERS = 1 << 1;
|
||||
const DiagnosticTypes DIAGNOSTIC_BIGIMAGE_BORDERS = 1 << 2;
|
||||
const DiagnosticTypes DIAGNOSTIC_FLASH_BORDERS = 1 << 3;
|
||||
|
||||
#define DIAGNOSTIC_FLASH_COUNTER_MAX 100
|
||||
|
||||
/**
|
||||
* Information about the object that is being diagnosed.
|
||||
|
|
|
@ -108,6 +108,7 @@ CanvasLayerComposite::RenderLayer(const nsIntRect& aClipRect)
|
|||
GetEffectiveTransform(),
|
||||
gfx::ToFilter(filter),
|
||||
clipRect);
|
||||
mImageHost->BumpFlashCounter();
|
||||
}
|
||||
|
||||
CompositableHost*
|
||||
|
|
|
@ -27,6 +27,7 @@ CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
|
|||
: mTextureInfo(aTextureInfo)
|
||||
, mCompositor(nullptr)
|
||||
, mLayer(nullptr)
|
||||
, mFlashCounter(0)
|
||||
, mAttached(false)
|
||||
, mKeepAttached(false)
|
||||
{
|
||||
|
|
|
@ -333,11 +333,17 @@ public:
|
|||
|
||||
virtual void RemoveTextureHost(TextureHost* aTexture);
|
||||
|
||||
// Called every time this is composited
|
||||
void BumpFlashCounter() {
|
||||
mFlashCounter = mFlashCounter >= DIAGNOSTIC_FLASH_COUNTER_MAX
|
||||
? DIAGNOSTIC_FLASH_COUNTER_MAX : mFlashCounter + 1;
|
||||
}
|
||||
protected:
|
||||
TextureInfo mTextureInfo;
|
||||
Compositor* mCompositor;
|
||||
Layer* mLayer;
|
||||
RefPtr<CompositableBackendSpecificData> mBackendData;
|
||||
uint32_t mFlashCounter; // used when the pref "layers.flash-borders" is true.
|
||||
bool mAttached;
|
||||
bool mKeepAttached;
|
||||
};
|
||||
|
|
|
@ -193,7 +193,7 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
|||
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT | DIAGNOSTIC_BIGIMAGE;
|
||||
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
|
||||
aTransform);
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,8 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
|||
|
||||
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
|
||||
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,7 +445,7 @@ DeprecatedContentHostBase::Composite(EffectChain& aEffectChain,
|
|||
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT | DIAGNOSTIC_BIGIMAGE;
|
||||
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
|
||||
aTransform);
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +465,8 @@ DeprecatedContentHostBase::Composite(EffectChain& aEffectChain,
|
|||
|
||||
DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
|
||||
diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -127,13 +127,13 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
|||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE|DIAGNOSTIC_BIGIMAGE,
|
||||
rect, aClipRect, aTransform);
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
} while (it->NextTile());
|
||||
it->EndTileIteration();
|
||||
// layer border
|
||||
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
|
||||
gfxPictureRect, aClipRect,
|
||||
aTransform);
|
||||
aTransform, mFlashCounter);
|
||||
} else {
|
||||
IntSize textureSize = source->GetSize();
|
||||
gfx::Rect rect;
|
||||
|
@ -157,7 +157,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
|
|||
aOpacity, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
|
||||
rect, aClipRect,
|
||||
aTransform);
|
||||
aTransform, mFlashCounter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ DeprecatedImageHostSingle::Composite(EffectChain& aEffectChain,
|
|||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE|DIAGNOSTIC_BIGIMAGE,
|
||||
rect, aClipRect, aTransform);
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
} while (it->NextTile());
|
||||
it->EndTileIteration();
|
||||
} else {
|
||||
|
@ -348,7 +348,7 @@ DeprecatedImageHostSingle::Composite(EffectChain& aEffectChain,
|
|||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
|
||||
rect, aClipRect, aTransform);
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
mDeprecatedTextureHost->Unlock();
|
||||
|
|
|
@ -108,6 +108,7 @@ ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect)
|
|||
GetEffectiveTransform(),
|
||||
gfx::ToFilter(mFilter),
|
||||
clipRect);
|
||||
mImageHost->BumpFlashCounter();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -149,7 +149,7 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect)
|
|||
&visibleRegion,
|
||||
mRequiresTiledProperties ? &tiledLayerProps
|
||||
: nullptr);
|
||||
|
||||
mBuffer->BumpFlashCounter();
|
||||
|
||||
if (mRequiresTiledProperties) {
|
||||
mValidRegion = tiledLayerProps.mValidRegion;
|
||||
|
|
|
@ -356,7 +356,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
|
|||
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform);
|
||||
}
|
||||
mCompositor->DrawDiagnostics(DIAGNOSTIC_CONTENT|DIAGNOSTIC_TILE,
|
||||
aScreenRegion, aClipRect, aTransform);
|
||||
aScreenRegion, aClipRect, aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -436,7 +436,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
gfx::Rect rect(aVisibleRect.x, aVisibleRect.y,
|
||||
aVisibleRect.width, aVisibleRect.height);
|
||||
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTENT,
|
||||
rect, aClipRect, aTransform);
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -675,7 +675,8 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget)
|
|||
#endif
|
||||
|
||||
// 0 -> Full-tilt composite
|
||||
if (gfxPrefs::LayersCompositionFrameRate() == 0) {
|
||||
if (gfxPrefs::LayersCompositionFrameRate() == 0
|
||||
|| mLayerManager->GetCompositor()->GetDiagnosticTypes() & DIAGNOSTIC_FLASH_BORDERS) {
|
||||
// Special full-tilt composite mode for performance testing
|
||||
ScheduleComposition();
|
||||
}
|
||||
|
|
|
@ -1322,6 +1322,9 @@ gfxPlatform::GetLayerDiagnosticTypes()
|
|||
if (gfxPrefs::DrawBigImageBorders()) {
|
||||
type |= mozilla::layers::DIAGNOSTIC_BIGIMAGE_BORDERS;
|
||||
}
|
||||
if (gfxPrefs::FlashLayerBorders()) {
|
||||
type |= mozilla::layers::DIAGNOSTIC_FLASH_BORDERS;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ private:
|
|||
DECL_GFX_PREF(Live, "layers.draw-bigimage-borders", DrawBigImageBorders, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.draw-borders", DrawLayerBorders, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.draw-tile-borders", DrawTileBorders, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.flash-borders", FlashLayerBorders, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.draw-layer-info", DrawLayerInfo, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.dump", LayersDump, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.enable-tiles", LayersTilesEnabled, bool, false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче