зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1418816) for reftest perma failure bugs/289480.html a=backout
Backed out changeset d722f5a4a8af (bug 1418816) Backed out changeset 75d9a625be06 (bug 1418816) Backed out changeset 807f0f510c25 (bug 1418816) Backed out changeset 3c4cec04f28d (bug 1418816)
This commit is contained in:
Родитель
49ae56e475
Коммит
bd4f30e2a0
|
@ -60,23 +60,5 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSu
|
|||
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
||||
}
|
||||
|
||||
gfx::IntPoint
|
||||
ImageLayer::GetTopLeftTilePos(const gfx::IntRect& aDestRect,
|
||||
const gfx::IntRect& aFillRect,
|
||||
const gfx::IntSize& aRepeatSize)
|
||||
{
|
||||
int x = aDestRect.x;
|
||||
while (aRepeatSize.width && x > aFillRect.x) {
|
||||
x -= aRepeatSize.width;
|
||||
}
|
||||
|
||||
int y = aDestRect.y;
|
||||
while (aRepeatSize.width && y > aFillRect.y) {
|
||||
y -= aRepeatSize.height;
|
||||
}
|
||||
|
||||
return gfx::IntPoint(x, y);
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -61,25 +61,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Set the repeat size.
|
||||
* IntSize(0, 0) means do not repeat.
|
||||
*/
|
||||
void SetRepeatSize(const gfx::IntSize& aRepeatSize)
|
||||
{
|
||||
if (mRepeatSize == aRepeatSize) {
|
||||
return;
|
||||
}
|
||||
mRepeatSize = aRepeatSize;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
ImageContainer* GetContainer() { return mContainer; }
|
||||
gfx::SamplingFilter GetSamplingFilter() { return mSamplingFilter; }
|
||||
const gfx::IntSize& GetScaleToSize() { return mScaleToSize; }
|
||||
ScaleMode GetScaleMode() { return mScaleMode; }
|
||||
const gfx::IntSize& GetRepeatSize() { return mRepeatSize; }
|
||||
|
||||
MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE)
|
||||
|
||||
|
@ -98,18 +84,10 @@ protected:
|
|||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
||||
virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
|
||||
|
||||
/*
|
||||
* Calculate the position of the top-left tile for repeated images.
|
||||
*/
|
||||
static gfx::IntPoint GetTopLeftTilePos(const gfx::IntRect& aDestRect,
|
||||
const gfx::IntRect& aFillRect,
|
||||
const gfx::IntSize& aRepeatSize);
|
||||
|
||||
RefPtr<ImageContainer> mContainer;
|
||||
gfx::SamplingFilter mSamplingFilter;
|
||||
gfx::IntSize mScaleToSize;
|
||||
ScaleMode mScaleMode;
|
||||
gfx::IntSize mRepeatSize;
|
||||
gfx::Matrix4x4 mEffectiveTransformForBuffer;
|
||||
};
|
||||
|
||||
|
|
|
@ -2199,7 +2199,6 @@ ImageLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
|||
if (mSamplingFilter != SamplingFilter::GOOD) {
|
||||
AppendToString(aStream, mSamplingFilter, " [filter=", "]");
|
||||
}
|
||||
AppendToString(aStream, mRepeatSize, " [repeatSize=", "]");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -77,10 +77,7 @@ protected:
|
|||
|
||||
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override
|
||||
{
|
||||
aAttrs = ImageLayerAttributes(mSamplingFilter,
|
||||
mScaleToSize,
|
||||
mScaleMode,
|
||||
mRepeatSize);
|
||||
aAttrs = ImageLayerAttributes(mSamplingFilter, mScaleToSize, mScaleMode);
|
||||
}
|
||||
|
||||
virtual Layer* AsLayer() override { return this; }
|
||||
|
|
|
@ -103,31 +103,11 @@ ImageLayerComposite::RenderLayer(const IntRect& aClipRect,
|
|||
RenderWithAllMasks(this, mCompositor, aClipRect,
|
||||
[&](EffectChain& effectChain, const IntRect& clipRect) {
|
||||
mImageHost->SetTextureSourceProvider(mCompositor);
|
||||
|
||||
const IntRect destRect(IntPoint(0, 0), mImageHost->GetImageSize());
|
||||
const IntRect fillRect = mVisibleRegion.GetBounds().ToUnknownRect();
|
||||
const IntPoint topLeft = GetTopLeftTilePos(destRect, fillRect, mRepeatSize);
|
||||
|
||||
for (int x = topLeft.x; x < fillRect.XMost(); x += mRepeatSize.width) {
|
||||
for (int y = topLeft.y; y < fillRect.YMost(); y += mRepeatSize.height) {
|
||||
Matrix4x4 tileTransform = GetEffectiveTransformForBuffer();
|
||||
tileTransform.PreTranslate(x - destRect.x, y - destRect.y, 0);
|
||||
|
||||
mImageHost->Composite(mCompositor, this, effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
tileTransform,
|
||||
GetSamplingFilter(),
|
||||
clipRect);
|
||||
|
||||
if (!mRepeatSize.height) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!mRepeatSize.width) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mImageHost->Composite(mCompositor, this, effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
GetEffectiveTransformForBuffer(),
|
||||
GetSamplingFilter(),
|
||||
clipRect);
|
||||
});
|
||||
mImageHost->BumpFlashCounter();
|
||||
}
|
||||
|
|
|
@ -638,7 +638,6 @@ LayerTransactionParent::SetLayerAttributes(const OpSetLayerAttributes& aOp)
|
|||
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
|
||||
imageLayer->SetSamplingFilter(attrs.samplingFilter());
|
||||
imageLayer->SetScaleToSize(attrs.scaleToSize(), attrs.scaleMode());
|
||||
imageLayer->SetRepeatSize(attrs.repeatSize());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -306,13 +306,7 @@ struct RefLayerAttributes {
|
|||
LayersId id;
|
||||
EventRegionsOverride eventRegionsOverride;
|
||||
};
|
||||
|
||||
struct ImageLayerAttributes {
|
||||
SamplingFilter samplingFilter;
|
||||
IntSize scaleToSize;
|
||||
ScaleMode scaleMode;
|
||||
IntSize repeatSize;
|
||||
};
|
||||
struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
|
||||
|
||||
union SpecificLayerAttributes {
|
||||
null_t;
|
||||
|
|
|
@ -78,23 +78,17 @@ ImageLayerMLGPU::IsContentOpaque()
|
|||
void
|
||||
ImageLayerMLGPU::SetRenderRegion(LayerIntRegion&& aRegion)
|
||||
{
|
||||
LayerIntRect bounds;
|
||||
|
||||
switch (mScaleMode) {
|
||||
case ScaleMode::STRETCH:
|
||||
// See bug 1264142.
|
||||
bounds = LayerIntRect(aRegion.GetBounds().X(), aRegion.GetBounds().Y(),
|
||||
mScaleToSize.width, mScaleToSize.height);
|
||||
aRegion.AndWith(LayerIntRect(0, 0, mScaleToSize.width, mScaleToSize.height));
|
||||
break;
|
||||
default:
|
||||
// Clamp the visible region to the texture size. (see bug 1396507)
|
||||
MOZ_ASSERT(mScaleMode == ScaleMode::SCALE_NONE);
|
||||
bounds = LayerIntRect(aRegion.GetBounds().X(), aRegion.GetBounds().Y(),
|
||||
mPictureRect.Width(), mPictureRect.Height());
|
||||
aRegion.AndWith(LayerIntRect(0, 0, mPictureRect.Width(), mPictureRect.Height()));
|
||||
break;
|
||||
}
|
||||
|
||||
aRegion.AndWith(bounds);
|
||||
LayerMLGPU::SetRenderRegion(std::move(aRegion));
|
||||
}
|
||||
|
||||
|
@ -110,43 +104,6 @@ ImageLayerMLGPU::CleanupResources()
|
|||
mHost = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
ImageLayerMLGPU::AssignToView(FrameBuilder* aBuilder,
|
||||
RenderViewMLGPU* aView,
|
||||
Maybe<Polygon>&& aGeometry)
|
||||
{
|
||||
LayerIntRegion visible = GetShadowVisibleRegion();
|
||||
|
||||
const IntRect destRect(IntPoint(0, 0), mHost->GetImageSize());
|
||||
const IntRect fillRect = mVisibleRegion.GetBounds().ToUnknownRect();
|
||||
const IntPoint topLeft = GetTopLeftTilePos(destRect, fillRect, mRepeatSize);
|
||||
|
||||
for (int x = topLeft.x; x < fillRect.XMost(); x += mRepeatSize.width) {
|
||||
for (int y = topLeft.y; y < fillRect.YMost(); y += mRepeatSize.height) {
|
||||
mDestOrigin = gfx::IntPoint(x - destRect.x, y - destRect.y);
|
||||
LayerIntRegion region = LayerIntRect(x - destRect.x, y - destRect.y,
|
||||
destRect.width, destRect.height);
|
||||
SetShadowVisibleRegion(region);
|
||||
|
||||
// Similarily to the tiled case in PaintedLayerMLGPU, we assign
|
||||
// the same layer to the same view multiple times. The origin
|
||||
// and visible region have been updated for each iteration, and
|
||||
// the visible region is restored afterwards.
|
||||
Maybe<Polygon> geometry = aGeometry;
|
||||
LayerMLGPU::AssignToView(aBuilder, aView, std::move(geometry));
|
||||
|
||||
if (!mRepeatSize.height) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!mRepeatSize.width) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetShadowVisibleRegion(visible);
|
||||
}
|
||||
|
||||
void
|
||||
ImageLayerMLGPU::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
|
|
|
@ -43,12 +43,6 @@ protected:
|
|||
~ImageLayerMLGPU() override;
|
||||
|
||||
void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
||||
|
||||
// We override this to support repeated images
|
||||
void AssignToView(FrameBuilder* aBuilder,
|
||||
RenderViewMLGPU* aView,
|
||||
Maybe<gfx::Polygon>&& aGeometry) override;
|
||||
|
||||
void CleanupResources();
|
||||
|
||||
private:
|
||||
|
|
|
@ -465,7 +465,6 @@ TexturedRenderPass::Info::Info(const ItemInfo& aItem, PaintedLayerMLGPU* aLayer)
|
|||
TexturedRenderPass::Info::Info(const ItemInfo& aItem, TexturedLayerMLGPU* aLayer)
|
||||
: item(aItem),
|
||||
textureSize(aLayer->GetTexture()->GetSize()),
|
||||
destOrigin(aLayer->GetDestOrigin()),
|
||||
scale(aLayer->GetPictureScale()),
|
||||
decomposeIntoNoRepeatRects(false)
|
||||
{
|
||||
|
|
|
@ -41,10 +41,6 @@ public:
|
|||
return Nothing();
|
||||
}
|
||||
|
||||
gfx::Point GetDestOrigin() const {
|
||||
return mDestOrigin;
|
||||
}
|
||||
|
||||
// Mask layers aren't prepared like normal layers. They are bound as
|
||||
// mask operations are built. Mask layers are never tiled (they are
|
||||
// scaled to a lower resolution if too big), so this pathway returns
|
||||
|
@ -67,7 +63,6 @@ protected:
|
|||
RefPtr<TextureSource> mTexture;
|
||||
RefPtr<TextureSource> mBigImageTexture;
|
||||
gfx::IntRect mPictureRect;
|
||||
gfx::IntPoint mDestOrigin;
|
||||
};
|
||||
|
||||
// This is a pseudo layer that wraps a tile in an ImageLayer backed by a
|
||||
|
|
|
@ -3617,9 +3617,8 @@ nsDisplayBackgroundImage::GetInitData(nsDisplayListBuilder* aBuilder,
|
|||
return InitData{ aBuilder, aFrame,
|
||||
aBackgroundStyle, image,
|
||||
aBackgroundRect, state.mFillArea,
|
||||
state.mDestArea, state.mRepeatSize,
|
||||
aLayer, isRasterImage,
|
||||
shouldFixToViewport };
|
||||
state.mDestArea, aLayer,
|
||||
isRasterImage, shouldFixToViewport };
|
||||
}
|
||||
|
||||
nsDisplayBackgroundImage::nsDisplayBackgroundImage(
|
||||
|
@ -3633,7 +3632,6 @@ nsDisplayBackgroundImage::nsDisplayBackgroundImage(
|
|||
, mBackgroundRect(aInitData.backgroundRect)
|
||||
, mFillRect(aInitData.fillArea)
|
||||
, mDestRect(aInitData.destArea)
|
||||
, mRepeatSize(aInitData.repeatSize)
|
||||
, mLayer(aInitData.layer)
|
||||
, mIsRasterImage(aInitData.isRasterImage)
|
||||
, mShouldFixToViewport(aInitData.shouldFixToViewport)
|
||||
|
@ -4095,6 +4093,11 @@ nsDisplayBackgroundImage::CanOptimizeToImageLayer(
|
|||
return false;
|
||||
}
|
||||
|
||||
// We currently can't handle tiled backgrounds.
|
||||
if (!mDestRect.Contains(mFillRect)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// For 'contain' and 'cover', we allow any pixel of the image to be sampled
|
||||
// because there isn't going to be any spriting/atlasing going on.
|
||||
const nsStyleImageLayers::Layer& layer =
|
||||
|
@ -4115,12 +4118,6 @@ nsDisplayBackgroundImage::GetDestRect() const
|
|||
return mDestRect;
|
||||
}
|
||||
|
||||
nsSize
|
||||
nsDisplayBackgroundImage::GetRepeatSize() const
|
||||
{
|
||||
return mRepeatSize;
|
||||
}
|
||||
|
||||
already_AddRefed<imgIContainer>
|
||||
nsDisplayBackgroundImage::GetImage()
|
||||
{
|
||||
|
@ -4812,17 +4809,12 @@ nsDisplayImageContainer::ConfigureLayer(
|
|||
const LayoutDeviceRect destRect(
|
||||
LayoutDeviceIntRect::FromAppUnitsToNearest(GetDestRect(), factor));
|
||||
|
||||
float xScale = destRect.width / containerSize.width;
|
||||
float yScale = destRect.height / containerSize.height;
|
||||
|
||||
const LayoutDevicePoint p = destRect.TopLeft();
|
||||
Matrix transform = Matrix::Translation(p.x + aParameters.mOffset.x,
|
||||
p.y + aParameters.mOffset.y);
|
||||
transform.PreScale(xScale, yScale);
|
||||
transform.PreScale(destRect.width / containerSize.width,
|
||||
destRect.height / containerSize.height);
|
||||
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||
aLayer->SetRepeatSize(GetRepeatSize().ScaleToNearestPixels(1.0f / xScale,
|
||||
1.0f / yScale,
|
||||
factor));
|
||||
}
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
|
|
|
@ -3890,7 +3890,6 @@ public:
|
|||
virtual void UpdateDrawResult(mozilla::image::ImgDrawResult aResult) = 0;
|
||||
virtual already_AddRefed<imgIContainer> GetImage() = 0;
|
||||
virtual nsRect GetDestRect() const = 0;
|
||||
virtual nsSize GetRepeatSize() const { return nsSize(0, 0); }
|
||||
|
||||
bool SupportsOptimizingToImage() const override { return true; }
|
||||
};
|
||||
|
@ -4418,7 +4417,6 @@ public:
|
|||
nsRect backgroundRect;
|
||||
nsRect fillArea;
|
||||
nsRect destArea;
|
||||
nsSize repeatSize;
|
||||
uint32_t layer;
|
||||
bool isRasterImage;
|
||||
bool shouldFixToViewport;
|
||||
|
@ -4525,7 +4523,6 @@ public:
|
|||
nsDisplayListBuilder* aBuilder) override;
|
||||
already_AddRefed<imgIContainer> GetImage() override;
|
||||
nsRect GetDestRect() const override;
|
||||
nsSize GetRepeatSize() const override;
|
||||
|
||||
void UpdateDrawResult(mozilla::image::ImgDrawResult aResult) override
|
||||
{
|
||||
|
@ -4596,7 +4593,6 @@ protected:
|
|||
nsRect mBackgroundRect; // relative to the reference frame
|
||||
nsRect mFillRect;
|
||||
nsRect mDestRect;
|
||||
nsSize mRepeatSize;
|
||||
/* Bounds of this display item */
|
||||
nsRect mBounds;
|
||||
uint32_t mLayer;
|
||||
|
|
Загрузка…
Ссылка в новой задаче