зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1538969) for wpt reftests failures on transform3d-backface-visibility-001.
Backed out changeset c8e85a802c77 (bug 1538969) Backed out changeset 911386e724bc (bug 1538969) Backed out changeset 2332a2fb02fa (bug 1538969) --HG-- extra : amend_source : 6f1ed1f9f2e978ab6c52a03cde73b225ff09448b
This commit is contained in:
Родитель
a50a0700d4
Коммит
fa2d5b1cec
|
@ -105,8 +105,6 @@ class HTMLVideoElement final : public HTMLMediaElement {
|
|||
return mMediaInfo.mVideo.mRotation;
|
||||
}
|
||||
|
||||
bool HasAlpha() const { return mMediaInfo.mVideo.HasAlpha(); }
|
||||
|
||||
void GetPoster(nsAString& aValue) {
|
||||
GetURIAttr(nsGkAtoms::poster, nullptr, aValue);
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ class RemoteVideoDecoder : public RemoteDataDecoder {
|
|||
if (ok && (size > 0 || presentationTimeUs >= 0)) {
|
||||
RefPtr<layers::Image> img = new SurfaceTextureImage(
|
||||
mSurfaceHandle, inputInfo.mImageSize, false /* NOT continuous */,
|
||||
gl::OriginPos::BottomLeft, mConfig.HasAlpha());
|
||||
gl::OriginPos::BottomLeft);
|
||||
|
||||
RefPtr<VideoData> v = VideoData::CreateFromImage(
|
||||
inputInfo.mDisplaySize, offset,
|
||||
|
|
|
@ -75,14 +75,12 @@ already_AddRefed<gfx::SourceSurface> GLImage::GetAsSourceSurface() {
|
|||
SurfaceTextureImage::SurfaceTextureImage(AndroidSurfaceTextureHandle aHandle,
|
||||
const gfx::IntSize& aSize,
|
||||
bool aContinuous,
|
||||
gl::OriginPos aOriginPos,
|
||||
bool aHasAlpha /* = true */)
|
||||
gl::OriginPos aOriginPos)
|
||||
: GLImage(ImageFormat::SURFACE_TEXTURE),
|
||||
mHandle(aHandle),
|
||||
mSize(aSize),
|
||||
mContinuous(aContinuous),
|
||||
mOriginPos(aOriginPos),
|
||||
mHasAlpha(aHasAlpha) {
|
||||
mOriginPos(aOriginPos) {
|
||||
MOZ_ASSERT(mHandle);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,13 +33,12 @@ class SurfaceTextureImage : public GLImage {
|
|||
public:
|
||||
SurfaceTextureImage(AndroidSurfaceTextureHandle aHandle,
|
||||
const gfx::IntSize& aSize, bool aContinuous,
|
||||
gl::OriginPos aOriginPos, bool aHasAlpha = true);
|
||||
gl::OriginPos aOriginPos);
|
||||
|
||||
gfx::IntSize GetSize() const override { return mSize; }
|
||||
AndroidSurfaceTextureHandle GetHandle() const { return mHandle; }
|
||||
bool GetContinuous() const { return mContinuous; }
|
||||
gl::OriginPos GetOriginPos() const { return mOriginPos; }
|
||||
bool GetHasAlpha() const { return mHasAlpha; }
|
||||
|
||||
already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override {
|
||||
// We can implement this, but currently don't want to because it will cause
|
||||
|
@ -55,7 +54,6 @@ class SurfaceTextureImage : public GLImage {
|
|||
gfx::IntSize mSize;
|
||||
bool mContinuous;
|
||||
gl::OriginPos mOriginPos;
|
||||
const bool mHasAlpha;
|
||||
};
|
||||
|
||||
#endif // MOZ_WIDGET_ANDROID
|
||||
|
|
|
@ -123,8 +123,8 @@ already_AddRefed<TextureClient> ImageClient::CreateTextureClientForImage(
|
|||
SurfaceTextureImage* typedImage = aImage->AsSurfaceTextureImage();
|
||||
texture = AndroidSurfaceTextureData::CreateTextureClient(
|
||||
typedImage->GetHandle(), size, typedImage->GetContinuous(),
|
||||
typedImage->GetOriginPos(), typedImage->GetHasAlpha(),
|
||||
aForwarder->GetTextureForwarder(), TextureFlags::DEFAULT);
|
||||
typedImage->GetOriginPos(), aForwarder->GetTextureForwarder(),
|
||||
TextureFlags::DEFAULT);
|
||||
#endif
|
||||
} else {
|
||||
RefPtr<gfx::SourceSurface> surface = aImage->GetAsSourceSurface();
|
||||
|
|
|
@ -133,12 +133,7 @@ bool ImageLayerComposite::IsOpaque() {
|
|||
return false;
|
||||
}
|
||||
|
||||
// TODO: Handle ScaleMode::NONE where the image
|
||||
// still covers the whole Layer.
|
||||
if (mScaleMode == ScaleMode::STRETCH) {
|
||||
if ((GetContentFlags() & CONTENT_OPAQUE) && !mImageHost->IsOpaque()) {
|
||||
NS_WARNING("Must have an opaque ImageHost if we reported CONTENT_OPAQUE");
|
||||
}
|
||||
return mImageHost->IsOpaque();
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -215,80 +215,6 @@ void LayerManagerComposite::BeginTransactionWithDrawTarget(
|
|||
mTargetBounds = aRect;
|
||||
}
|
||||
|
||||
template <typename Units>
|
||||
static IntRectTyped<Units> TransformRect(const IntRectTyped<Units>& aRect,
|
||||
const Matrix& aTransform,
|
||||
bool aRoundIn = false) {
|
||||
if (aRect.IsEmpty()) {
|
||||
return IntRectTyped<Units>();
|
||||
}
|
||||
|
||||
Rect rect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
rect = aTransform.TransformBounds(rect);
|
||||
if (aRoundIn) {
|
||||
MOZ_ASSERT(aTransform.PreservesAxisAlignedRectangles());
|
||||
rect.RoundIn();
|
||||
} else {
|
||||
rect.RoundOut();
|
||||
}
|
||||
|
||||
IntRect intRect;
|
||||
if (!rect.ToIntRect(&intRect)) {
|
||||
intRect = IntRect::MaxIntRect();
|
||||
}
|
||||
|
||||
return ViewAs<Units>(intRect);
|
||||
}
|
||||
|
||||
template <typename Units>
|
||||
static IntRectTyped<Units> TransformRect(const IntRectTyped<Units>& aRect,
|
||||
const Matrix4x4& aTransform,
|
||||
bool aRoundIn = false) {
|
||||
if (aRect.IsEmpty()) {
|
||||
return IntRectTyped<Units>();
|
||||
}
|
||||
|
||||
Rect rect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
rect = aTransform.TransformAndClipBounds(rect, Rect::MaxIntRect());
|
||||
if (aRoundIn) {
|
||||
rect.RoundIn();
|
||||
} else {
|
||||
rect.RoundOut();
|
||||
}
|
||||
|
||||
IntRect intRect;
|
||||
if (!rect.ToIntRect(&intRect)) {
|
||||
intRect = IntRect::MaxIntRect();
|
||||
}
|
||||
|
||||
return ViewAs<Units>(intRect);
|
||||
}
|
||||
|
||||
template <typename Units, typename MatrixType>
|
||||
static IntRectTyped<Units> TransformRectRoundIn(
|
||||
const IntRectTyped<Units>& aRect, const MatrixType& aTransform) {
|
||||
return TransformRect(aRect, aTransform, true);
|
||||
}
|
||||
|
||||
template <typename Units, typename MatrixType>
|
||||
static void AddTransformedRegion(IntRegionTyped<Units>& aDest,
|
||||
const IntRegionTyped<Units>& aSource,
|
||||
const MatrixType& aTransform) {
|
||||
for (auto iter = aSource.RectIter(); !iter.Done(); iter.Next()) {
|
||||
aDest.Or(aDest, TransformRect(iter.Get(), aTransform));
|
||||
}
|
||||
aDest.SimplifyOutward(20);
|
||||
}
|
||||
|
||||
template <typename Units, typename MatrixType>
|
||||
static void AddTransformedRegionRoundIn(IntRegionTyped<Units>& aDest,
|
||||
const IntRegionTyped<Units>& aSource,
|
||||
const MatrixType& aTransform) {
|
||||
for (auto iter = aSource.RectIter(); !iter.Done(); iter.Next()) {
|
||||
aDest.Or(aDest, TransformRectRoundIn(iter.Get(), aTransform));
|
||||
}
|
||||
}
|
||||
|
||||
void LayerManagerComposite::PostProcessLayers(nsIntRegion& aOpaqueRegion) {
|
||||
LayerIntRegion visible;
|
||||
LayerComposite* rootComposite =
|
||||
|
@ -398,16 +324,17 @@ void LayerManagerComposite::PostProcessLayers(
|
|||
// a giant layer if it is a leaf.
|
||||
Matrix4x4 transform = aLayer->GetEffectiveTransform();
|
||||
Matrix transform2d;
|
||||
bool canTransformOpaqueRegion = false;
|
||||
Maybe<IntPoint> integerTranslation;
|
||||
// If aLayer has a simple transform (only an integer translation) then we
|
||||
// can easily convert aOpaqueRegion into pre-transform coordinates and include
|
||||
// that region.
|
||||
if (transform.Is2D(&transform2d) &&
|
||||
transform2d.PreservesAxisAlignedRectangles()) {
|
||||
Matrix inverse = transform2d;
|
||||
inverse.Invert();
|
||||
AddTransformedRegionRoundIn(localOpaque, opaqueRegion, inverse);
|
||||
canTransformOpaqueRegion = true;
|
||||
if (transform.Is2D(&transform2d)) {
|
||||
if (transform2d.IsIntegerTranslation()) {
|
||||
integerTranslation =
|
||||
Some(IntPoint::Truncate(transform2d.GetTranslation()));
|
||||
localOpaque = opaqueRegion;
|
||||
localOpaque.MoveBy(-*integerTranslation);
|
||||
}
|
||||
}
|
||||
|
||||
// Save the value of localOpaque, which currently stores the region obscured
|
||||
|
@ -467,17 +394,16 @@ void LayerManagerComposite::PostProcessLayers(
|
|||
|
||||
// If we have a simple transform, then we can add our opaque area into
|
||||
// aOpaqueRegion.
|
||||
if (canTransformOpaqueRegion && !aLayer->HasMaskLayers() &&
|
||||
if (integerTranslation && !aLayer->HasMaskLayers() &&
|
||||
aLayer->IsOpaqueForVisibility()) {
|
||||
if (aLayer->IsOpaque()) {
|
||||
localOpaque.OrWith(composite->GetFullyRenderedRegion());
|
||||
}
|
||||
nsIntRegion parentSpaceOpaque;
|
||||
AddTransformedRegionRoundIn(parentSpaceOpaque, localOpaque, transform2d);
|
||||
localOpaque.MoveBy(*integerTranslation);
|
||||
if (aRenderTargetClip) {
|
||||
parentSpaceOpaque.AndWith(aRenderTargetClip->ToUnknownRect());
|
||||
localOpaque.AndWith(aRenderTargetClip->ToUnknownRect());
|
||||
}
|
||||
opaqueRegion.OrWith(parentSpaceOpaque);
|
||||
opaqueRegion.OrWith(localOpaque);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1450,6 +1376,33 @@ Matrix4x4 HostLayer::GetShadowTransform() {
|
|||
return transform;
|
||||
}
|
||||
|
||||
static LayerIntRect TransformRect(const LayerIntRect& aRect,
|
||||
const Matrix4x4& aTransform) {
|
||||
if (aRect.IsEmpty()) {
|
||||
return LayerIntRect();
|
||||
}
|
||||
|
||||
Rect rect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
rect = aTransform.TransformAndClipBounds(rect, Rect::MaxIntRect());
|
||||
rect.RoundOut();
|
||||
|
||||
IntRect intRect;
|
||||
if (!rect.ToIntRect(&intRect)) {
|
||||
intRect = IntRect::MaxIntRect();
|
||||
}
|
||||
|
||||
return ViewAs<LayerPixel>(intRect);
|
||||
}
|
||||
|
||||
static void AddTransformedRegion(LayerIntRegion& aDest,
|
||||
const LayerIntRegion& aSource,
|
||||
const Matrix4x4& aTransform) {
|
||||
for (auto iter = aSource.RectIter(); !iter.Done(); iter.Next()) {
|
||||
aDest.Or(aDest, TransformRect(iter.Get(), aTransform));
|
||||
}
|
||||
aDest.SimplifyOutward(20);
|
||||
}
|
||||
|
||||
// Async animations can move child layers without updating our visible region.
|
||||
// PostProcessLayers will recompute visible regions for layers with an
|
||||
// intermediate surface, but otherwise we need to do it now.
|
||||
|
|
|
@ -32,24 +32,20 @@ class CompositableForwarder;
|
|||
|
||||
already_AddRefed<TextureClient> AndroidSurfaceTextureData::CreateTextureClient(
|
||||
AndroidSurfaceTextureHandle aHandle, gfx::IntSize aSize, bool aContinuous,
|
||||
gl::OriginPos aOriginPos, bool aHasAlpha, LayersIPCChannel* aAllocator,
|
||||
gl::OriginPos aOriginPos, LayersIPCChannel* aAllocator,
|
||||
TextureFlags aFlags) {
|
||||
if (aOriginPos == gl::OriginPos::BottomLeft) {
|
||||
aFlags |= TextureFlags::ORIGIN_BOTTOM_LEFT;
|
||||
}
|
||||
|
||||
return TextureClient::CreateWithData(
|
||||
new AndroidSurfaceTextureData(aHandle, aSize, aContinuous, aHasAlpha),
|
||||
aFlags, aAllocator);
|
||||
new AndroidSurfaceTextureData(aHandle, aSize, aContinuous), aFlags,
|
||||
aAllocator);
|
||||
}
|
||||
|
||||
AndroidSurfaceTextureData::AndroidSurfaceTextureData(
|
||||
AndroidSurfaceTextureHandle aHandle, gfx::IntSize aSize, bool aContinuous,
|
||||
bool aHasAlpha)
|
||||
: mHandle(aHandle),
|
||||
mSize(aSize),
|
||||
mContinuous(aContinuous),
|
||||
mHasAlpha(aHasAlpha) {
|
||||
AndroidSurfaceTextureHandle aHandle, gfx::IntSize aSize, bool aContinuous)
|
||||
: mHandle(aHandle), mSize(aSize), mContinuous(aContinuous) {
|
||||
MOZ_ASSERT(mHandle);
|
||||
}
|
||||
|
||||
|
@ -66,9 +62,8 @@ void AndroidSurfaceTextureData::FillInfo(TextureData::Info& aInfo) const {
|
|||
|
||||
bool AndroidSurfaceTextureData::Serialize(SurfaceDescriptor& aOutDescriptor) {
|
||||
aOutDescriptor = SurfaceTextureDescriptor(
|
||||
mHandle, mSize,
|
||||
mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::R8G8B8X8,
|
||||
mContinuous, false /* do not ignore transform */);
|
||||
mHandle, mSize, gfx::SurfaceFormat::R8G8B8A8, mContinuous,
|
||||
false /* do not ignore transform */);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class AndroidSurfaceTextureData : public TextureData {
|
|||
public:
|
||||
static already_AddRefed<TextureClient> CreateTextureClient(
|
||||
AndroidSurfaceTextureHandle aHandle, gfx::IntSize aSize, bool aContinuous,
|
||||
gl::OriginPos aOriginPos, bool aHasAlpha, LayersIPCChannel* aAllocator,
|
||||
gl::OriginPos aOriginPos, LayersIPCChannel* aAllocator,
|
||||
TextureFlags aFlags);
|
||||
|
||||
~AndroidSurfaceTextureData();
|
||||
|
@ -57,13 +57,11 @@ class AndroidSurfaceTextureData : public TextureData {
|
|||
|
||||
protected:
|
||||
AndroidSurfaceTextureData(AndroidSurfaceTextureHandle aHandle,
|
||||
gfx::IntSize aSize, bool aContinuous,
|
||||
bool aHasAlpha);
|
||||
gfx::IntSize aSize, bool aContinuous);
|
||||
|
||||
const AndroidSurfaceTextureHandle mHandle;
|
||||
const gfx::IntSize mSize;
|
||||
const bool mContinuous;
|
||||
const bool mHasAlpha;
|
||||
};
|
||||
|
||||
class AndroidNativeWindowTextureData : public TextureData {
|
||||
|
|
|
@ -230,10 +230,6 @@ already_AddRefed<Layer> nsVideoFrame::BuildLayer(
|
|||
|
||||
layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||
layer->SetScaleToSize(scaleHint, ScaleMode::STRETCH);
|
||||
|
||||
uint32_t flags = element->HasAlpha() ? 0 : Layer::CONTENT_OPAQUE;
|
||||
layer->SetContentFlags(flags);
|
||||
|
||||
RefPtr<Layer> result = layer.forget();
|
||||
return result.forget();
|
||||
}
|
||||
|
@ -473,17 +469,13 @@ class nsDisplayVideo : public nsDisplayItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override {
|
||||
*aSnap = false;
|
||||
|
||||
HTMLVideoElement* element =
|
||||
static_cast<HTMLVideoElement*>(Frame()->GetContent());
|
||||
if (element->HasAlpha()) {
|
||||
return nsRegion();
|
||||
}
|
||||
return GetBounds(aBuilder, aSnap);
|
||||
}
|
||||
// It would be great if we could override GetOpaqueRegion to return nonempty
|
||||
// here, but it's probably not safe to do so in general. Video frames are
|
||||
// updated asynchronously from decoder threads, and it's possible that
|
||||
// we might have an opaque video frame when GetOpaqueRegion is called, but
|
||||
// when we come to paint, the video frame is transparent or has gone
|
||||
// away completely (e.g. because of a decoder error). The problem would
|
||||
// be especially acute if we have off-main-thread rendering.
|
||||
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override {
|
||||
|
|
Загрузка…
Ссылка в новой задаче