mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Backed out 3 changesets (bug 1254134) for build failures in LayerTreeInvalidation.cpp, entirely unrelated to the current CLOSED TREE
Backed out changeset 5a0d2c853e13 (bug 1254134) Backed out changeset f650dd293a4b (bug 1254134) Backed out changeset 3b6b646ea0e2 (bug 1254134) MozReview-Commit-ID: 2iQvX8NsARG
This commit is contained in:
parent
57f7f7948c
commit
b2731dca9e
@ -24,20 +24,6 @@
|
||||
#include "nsTArray.h" // for AutoTArray, nsTArray_Impl
|
||||
#include "mozilla/layers/ImageHost.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "LayersLogging.h"
|
||||
|
||||
// LayerTreeInvalidation debugging
|
||||
#define LTI_DEBUG 0
|
||||
|
||||
#if LTI_DEBUG
|
||||
# define LTI_DEEPER(aPrefix) nsPrintfCString("%s ", aPrefix).get()
|
||||
# define LTI_DUMP(rgn, label) if (!(rgn).IsEmpty()) printf_stderr("%s%p: " label " portion is %s\n", aPrefix, mLayer.get(), Stringify(rgn).c_str());
|
||||
# define LTI_LOG(...) printf_stderr(__VA_ARGS__)
|
||||
#else
|
||||
# define LTI_DEEPER(aPrefix) nullptr
|
||||
# define LTI_DUMP(rgn, label)
|
||||
# define LTI_LOG(...)
|
||||
#endif
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
@ -45,7 +31,7 @@ namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
struct LayerPropertiesBase;
|
||||
UniquePtr<LayerPropertiesBase> CloneLayerTreePropertiesInternal(Layer* aRoot);
|
||||
UniquePtr<LayerPropertiesBase> CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask = false);
|
||||
|
||||
/**
|
||||
* Get accumulated transform of from the context creating layer to the
|
||||
@ -154,11 +140,11 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
{
|
||||
MOZ_COUNT_CTOR(LayerPropertiesBase);
|
||||
if (aLayer->GetMaskLayer()) {
|
||||
mMaskLayer = CloneLayerTreePropertiesInternal(aLayer->GetMaskLayer());
|
||||
mMaskLayer = CloneLayerTreePropertiesInternal(aLayer->GetMaskLayer(), true);
|
||||
}
|
||||
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
|
||||
Layer* maskLayer = aLayer->GetAncestorMaskLayerAt(i);
|
||||
mAncestorMaskLayers.AppendElement(CloneLayerTreePropertiesInternal(maskLayer));
|
||||
mAncestorMaskLayers.AppendElement(CloneLayerTreePropertiesInternal(maskLayer, true));
|
||||
}
|
||||
if (mUseClipRect) {
|
||||
mClipRect = *aLayer->GetEffectiveClipRect();
|
||||
@ -182,8 +168,7 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
|
||||
virtual void MoveBy(const IntPoint& aOffset);
|
||||
|
||||
nsIntRegion ComputeChange(const char* aPrefix,
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
bool transformChanged = !mTransform.FuzzyEqual(GetTransformForInvalidation(mLayer)) ||
|
||||
@ -211,31 +196,26 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
{
|
||||
aGeometryChanged = true;
|
||||
result = OldTransformedBounds();
|
||||
LTI_DUMP(result, "oldtransform");
|
||||
LTI_DUMP(NewTransformedBounds(), "newtransform");
|
||||
AddRegion(result, NewTransformedBounds());
|
||||
|
||||
// We can't bail out early because we need to update mChildrenChanged.
|
||||
}
|
||||
|
||||
nsIntRegion internal = ComputeChangeInternal(aPrefix, aCallback, aGeometryChanged);
|
||||
LTI_DUMP(internal, "internal");
|
||||
AddRegion(result, internal);
|
||||
LTI_DUMP(mLayer->GetInvalidRegion(), "invalid");
|
||||
AddRegion(result, ComputeChangeInternal(aCallback, aGeometryChanged));
|
||||
AddTransformedRegion(result, mLayer->GetInvalidRegion(), mTransform);
|
||||
|
||||
if (mMaskLayer && otherMask) {
|
||||
nsIntRegion mask = mMaskLayer->ComputeChange(aPrefix, aCallback, aGeometryChanged);
|
||||
LTI_DUMP(mask, "mask");
|
||||
AddTransformedRegion(result, mask, mTransform);
|
||||
AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback, aGeometryChanged),
|
||||
mTransform);
|
||||
}
|
||||
|
||||
for (size_t i = 0;
|
||||
i < std::min(mAncestorMaskLayers.Length(), mLayer->GetAncestorMaskLayerCount());
|
||||
i++)
|
||||
{
|
||||
nsIntRegion mask = mAncestorMaskLayers[i]->ComputeChange(aPrefix, aCallback, aGeometryChanged);
|
||||
LTI_DUMP(mask, "ancestormask");
|
||||
AddTransformedRegion(result, mask, mTransform);
|
||||
AddTransformedRegion(result,
|
||||
mAncestorMaskLayers[i]->ComputeChange(aCallback, aGeometryChanged),
|
||||
mTransform);
|
||||
}
|
||||
|
||||
if (mUseClipRect && otherClip) {
|
||||
@ -243,7 +223,6 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
aGeometryChanged = true;
|
||||
nsIntRegion tmp;
|
||||
tmp.Xor(mClipRect.ToUnknownRect(), otherClip->ToUnknownRect());
|
||||
LTI_DUMP(tmp, "clip");
|
||||
AddRegion(result, tmp);
|
||||
}
|
||||
}
|
||||
@ -263,8 +242,7 @@ struct LayerPropertiesBase : public LayerProperties
|
||||
return TransformRect(mVisibleRegion.ToUnknownRegion().GetBounds(), mTransform);
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(const char* aPrefix,
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
return IntRect();
|
||||
@ -295,8 +273,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRegion ComputeChangeInternal(const char* aPrefix,
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged) override
|
||||
{
|
||||
ContainerLayer* container = mLayer->AsContainerLayer();
|
||||
@ -346,11 +323,9 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
childrenChanged |= true;
|
||||
}
|
||||
// Invalidate any regions of the child that have changed:
|
||||
nsIntRegion region = mChildren[childsOldIndex]->ComputeChange(LTI_DEEPER(aPrefix), aCallback, aGeometryChanged);
|
||||
nsIntRegion region = mChildren[childsOldIndex]->ComputeChange(aCallback, aGeometryChanged);
|
||||
i = childsOldIndex + 1;
|
||||
if (!region.IsEmpty()) {
|
||||
LTI_LOG("%s%p: child %p produced %s\n", aPrefix, mLayer.get(),
|
||||
mChildren[childsOldIndex]->mLayer.get(), Stringify(region).c_str());
|
||||
AddRegion(result, region);
|
||||
childrenChanged |= true;
|
||||
}
|
||||
@ -370,7 +345,6 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
}
|
||||
if (invalidateChildsCurrentArea) {
|
||||
aGeometryChanged = true;
|
||||
LTI_DUMP(child->GetLocalVisibleRegion().ToUnknownRegion(), "invalidateChildsCurrentArea");
|
||||
AddTransformedRegion(result, child->GetLocalVisibleRegion().ToUnknownRegion(),
|
||||
GetTransformForInvalidation(child));
|
||||
if (aCallback) {
|
||||
@ -385,7 +359,6 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
// Process remaining removed children.
|
||||
while (i < mChildren.Length()) {
|
||||
childrenChanged |= true;
|
||||
LTI_DUMP(mChildren[i]->OldTransformedBounds(), "removed child");
|
||||
AddRegion(result, mChildren[i]->OldTransformedBounds());
|
||||
i++;
|
||||
}
|
||||
@ -404,7 +377,6 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
||||
}
|
||||
// else, effective transforms have applied on children.
|
||||
|
||||
LTI_DUMP(invalidOfLayer, "invalidOfLayer");
|
||||
result.OrWith(invalidOfLayer);
|
||||
|
||||
return result;
|
||||
@ -449,8 +421,7 @@ struct ColorLayerProperties : public LayerPropertiesBase
|
||||
, mBounds(aLayer->GetBounds())
|
||||
{ }
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(const char* aPrefix,
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
ColorLayer* color = static_cast<ColorLayer*>(mLayer.get());
|
||||
@ -462,7 +433,6 @@ struct ColorLayerProperties : public LayerPropertiesBase
|
||||
|
||||
nsIntRegion boundsDiff;
|
||||
boundsDiff.Xor(mBounds, color->GetBounds());
|
||||
LTI_DUMP(boundsDiff, "color");
|
||||
|
||||
nsIntRegion result;
|
||||
AddTransformedRegion(result, boundsDiff, mTransform);
|
||||
@ -485,7 +455,7 @@ static ImageHost* GetImageHost(Layer* aLayer)
|
||||
|
||||
struct ImageLayerProperties : public LayerPropertiesBase
|
||||
{
|
||||
explicit ImageLayerProperties(ImageLayer* aImage)
|
||||
explicit ImageLayerProperties(ImageLayer* aImage, bool aIsMask)
|
||||
: LayerPropertiesBase(aImage)
|
||||
, mContainer(aImage->GetContainer())
|
||||
, mImageHost(GetImageHost(aImage))
|
||||
@ -494,45 +464,15 @@ struct ImageLayerProperties : public LayerPropertiesBase
|
||||
, mScaleMode(aImage->GetScaleMode())
|
||||
, mLastProducerID(-1)
|
||||
, mLastFrameID(-1)
|
||||
, mIsMask(aIsMask)
|
||||
{
|
||||
if (mContainer) {
|
||||
mRect.SizeTo(mContainer->GetCurrentSize());
|
||||
}
|
||||
if (mImageHost) {
|
||||
mRect.SizeTo(mImageHost->GetImageSize());
|
||||
mLastProducerID = mImageHost->GetLastProducerID();
|
||||
mLastFrameID = mImageHost->GetLastFrameID();
|
||||
}
|
||||
}
|
||||
|
||||
// For image layers we want to use the image size rather than the
|
||||
// visible region for two reasons:
|
||||
// 1) If the image is mask layer, then the visible region is empty
|
||||
// 2) If the image is partially outside the displayport then the visible
|
||||
// region is truncated, but the compositor is still drawing the full
|
||||
// image each time. Partial composition on the image can result in
|
||||
// the un-composited portion of the image becoming visibly stale in
|
||||
// a checkerboarding area.
|
||||
IntRect NewTransformedBounds() override
|
||||
{
|
||||
IntRect rect;
|
||||
ImageLayer* imageLayer = static_cast<ImageLayer*>(mLayer.get());
|
||||
if (ImageContainer* container = imageLayer->GetContainer()) {
|
||||
rect.SizeTo(container->GetCurrentSize());
|
||||
}
|
||||
if (ImageHost* host = GetImageHost(imageLayer)) {
|
||||
rect.SizeTo(host->GetImageSize());
|
||||
}
|
||||
return TransformRect(rect, GetTransformForInvalidation(mLayer));
|
||||
}
|
||||
|
||||
IntRect OldTransformedBounds() override
|
||||
{
|
||||
return TransformRect(mRect, mTransform);
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(const char* aPrefix,
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
ImageLayer* imageLayer = static_cast<ImageLayer*>(mLayer.get());
|
||||
@ -541,7 +481,6 @@ struct ImageLayerProperties : public LayerPropertiesBase
|
||||
aGeometryChanged = true;
|
||||
IntRect result = NewTransformedBounds();
|
||||
result = result.Union(OldTransformedBounds());
|
||||
LTI_DUMP(result, "image");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -556,7 +495,19 @@ struct ImageLayerProperties : public LayerPropertiesBase
|
||||
(host && host->GetFrameID() != mLastFrameID)) {
|
||||
aGeometryChanged = true;
|
||||
|
||||
LTI_DUMP(NewTransformedBounds(), "bounds");
|
||||
if (mIsMask) {
|
||||
// Mask layers have an empty visible region, so we have to
|
||||
// use the image size instead.
|
||||
IntSize size;
|
||||
if (container) {
|
||||
size = container->GetCurrentSize();
|
||||
}
|
||||
if (host) {
|
||||
size = host->GetImageSize();
|
||||
}
|
||||
IntRect rect(0, 0, size.width, size.height);
|
||||
return TransformRect(rect, GetTransformForInvalidation(mLayer));
|
||||
}
|
||||
return NewTransformedBounds();
|
||||
}
|
||||
|
||||
@ -568,9 +519,9 @@ struct ImageLayerProperties : public LayerPropertiesBase
|
||||
Filter mFilter;
|
||||
gfx::IntSize mScaleToSize;
|
||||
ScaleMode mScaleMode;
|
||||
IntRect mRect;
|
||||
int32_t mLastProducerID;
|
||||
int32_t mLastFrameID;
|
||||
bool mIsMask;
|
||||
};
|
||||
|
||||
struct CanvasLayerProperties : public LayerPropertiesBase
|
||||
@ -582,8 +533,7 @@ struct CanvasLayerProperties : public LayerPropertiesBase
|
||||
mFrameID = mImageHost ? mImageHost->GetFrameID() : -1;
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(const char* aPrefix,
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
CanvasLayer* canvasLayer = static_cast<CanvasLayer*>(mLayer.get());
|
||||
@ -603,12 +553,14 @@ struct CanvasLayerProperties : public LayerPropertiesBase
|
||||
};
|
||||
|
||||
UniquePtr<LayerPropertiesBase>
|
||||
CloneLayerTreePropertiesInternal(Layer* aRoot)
|
||||
CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask /* = false */)
|
||||
{
|
||||
if (!aRoot) {
|
||||
return MakeUnique<LayerPropertiesBase>();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!aIsMask || aRoot->GetType() == Layer::TYPE_IMAGE);
|
||||
|
||||
switch (aRoot->GetType()) {
|
||||
case Layer::TYPE_CONTAINER:
|
||||
case Layer::TYPE_REF:
|
||||
@ -616,7 +568,7 @@ CloneLayerTreePropertiesInternal(Layer* aRoot)
|
||||
case Layer::TYPE_COLOR:
|
||||
return MakeUnique<ColorLayerProperties>(static_cast<ColorLayer*>(aRoot));
|
||||
case Layer::TYPE_IMAGE:
|
||||
return MakeUnique<ImageLayerProperties>(static_cast<ImageLayer*>(aRoot));
|
||||
return MakeUnique<ImageLayerProperties>(static_cast<ImageLayer*>(aRoot), aIsMask);
|
||||
case Layer::TYPE_CANVAS:
|
||||
return MakeUnique<CanvasLayerProperties>(static_cast<CanvasLayer*>(aRoot));
|
||||
case Layer::TYPE_READBACK:
|
||||
@ -676,11 +628,10 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
|
||||
return result;
|
||||
} else {
|
||||
bool geometryChanged = (aGeometryChanged != nullptr) ? *aGeometryChanged : false;
|
||||
nsIntRegion invalid = ComputeChange(" ", aCallback, geometryChanged);
|
||||
nsIntRegion invalid = ComputeChange(aCallback, geometryChanged);
|
||||
if (aGeometryChanged != nullptr) {
|
||||
*aGeometryChanged = geometryChanged;
|
||||
}
|
||||
LTI_LOG("ComputeDifferences returned %s\n", Stringify(invalid).c_str());
|
||||
return invalid;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user