зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1149923 - Let 2D mask effect can check whether to use IntermediateSurface or not in its own logic. r=roc
This commit is contained in:
Родитель
62a02d2e47
Коммит
866bb24e7e
|
@ -379,11 +379,18 @@ public:
|
|||
/**
|
||||
* Returns true if the matrix has any transform other
|
||||
* than a translation or scale; this is, if there is
|
||||
* no rotation.
|
||||
* rotation.
|
||||
*/
|
||||
bool HasNonAxisAlignedTransform() const {
|
||||
return !FuzzyEqual(_21, 0.0) || !FuzzyEqual(_12, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the matrix has negative scaling (i.e. flip).
|
||||
*/
|
||||
bool HasNegativeScaling() const {
|
||||
return (_11 < 0.0) || (_22 < 0.0);
|
||||
}
|
||||
};
|
||||
|
||||
class Matrix4x4
|
||||
|
|
|
@ -1224,12 +1224,30 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
|
|||
} else {
|
||||
useIntermediateSurface = false;
|
||||
gfx::Matrix contTransform;
|
||||
if (!mEffectiveTransform.Is2D(&contTransform) ||
|
||||
bool checkClipRect = false;
|
||||
bool checkMaskLayers = false;
|
||||
|
||||
if (!mEffectiveTransform.Is2D(&contTransform)) {
|
||||
// In 3D case, always check if we should use IntermediateSurface.
|
||||
checkClipRect = true;
|
||||
checkMaskLayers = true;
|
||||
} else {
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
!contTransform.PreservesAxisAlignedRectangles()) {
|
||||
if (!contTransform.PreservesAxisAlignedRectangles()) {
|
||||
#else
|
||||
gfx::ThebesMatrix(contTransform).HasNonIntegerTranslation()) {
|
||||
if (gfx::ThebesMatrix(contTransform).HasNonIntegerTranslation()) {
|
||||
#endif
|
||||
checkClipRect = true;
|
||||
}
|
||||
/* In 2D case, only translation and/or positive scaling can be done w/o using IntermediateSurface.
|
||||
* Otherwise, when rotation or flip happen, we should check whether to use IntermediateSurface.
|
||||
*/
|
||||
if (contTransform.HasNonAxisAlignedTransform() || contTransform.HasNegativeScaling()) {
|
||||
checkMaskLayers = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkClipRect || checkMaskLayers) {
|
||||
for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
|
||||
const Maybe<ParentLayerIntRect>& clipRect = child->GetEffectiveClipRect();
|
||||
/* We can't (easily) forward our transform to children with a non-empty clip
|
||||
|
@ -1237,8 +1255,11 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
|
|||
* the calculations performed by CalculateScissorRect above.
|
||||
* Nor for a child with a mask layer.
|
||||
*/
|
||||
if ((clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) ||
|
||||
child->HasMaskLayers()) {
|
||||
if (checkClipRect && (clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty())) {
|
||||
useIntermediateSurface = true;
|
||||
break;
|
||||
}
|
||||
if (checkMaskLayers && child->HasMaskLayers()) {
|
||||
useIntermediateSurface = true;
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче