mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Backed out changeset 775fa3ede160 (bug 1294351) for failing in crashtest 647480.html. r=backout
This commit is contained in:
parent
5b24ece193
commit
7ab46a480a
@ -1645,27 +1645,25 @@ CanvasRenderingContext2D::EnsureTarget(const gfx::Rect* aCoveredRect,
|
||||
Redraw();
|
||||
}
|
||||
|
||||
if (!mBufferProvider->PreservesDrawingState() || mBufferProvider != oldBufferProvider) {
|
||||
// Restore clips and transform.
|
||||
mTarget->SetTransform(Matrix());
|
||||
// Restore clips and transform.
|
||||
mTarget->SetTransform(Matrix());
|
||||
|
||||
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
||||
// Cairo doesn't play well with huge clips. When given a very big clip it
|
||||
// will try to allocate big mask surface without taking the target
|
||||
// size into account which can cause OOM. See bug 1034593.
|
||||
// This limits the clip extents to the size of the canvas.
|
||||
// A fix in Cairo would probably be preferable, but requires somewhat
|
||||
// invasive changes.
|
||||
mTarget->PushClipRect(canvasRect);
|
||||
}
|
||||
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
||||
// Cairo doesn't play well with huge clips. When given a very big clip it
|
||||
// will try to allocate big mask surface without taking the target
|
||||
// size into account which can cause OOM. See bug 1034593.
|
||||
// This limits the clip extents to the size of the canvas.
|
||||
// A fix in Cairo would probably be preferable, but requires somewhat
|
||||
// invasive changes.
|
||||
mTarget->PushClipRect(canvasRect);
|
||||
}
|
||||
|
||||
for (const auto& style : mStyleStack) {
|
||||
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
||||
if (clipOrTransform.IsClip()) {
|
||||
mTarget->PushClip(clipOrTransform.clip);
|
||||
} else {
|
||||
mTarget->SetTransform(clipOrTransform.transform);
|
||||
}
|
||||
for (const auto& style : mStyleStack) {
|
||||
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
||||
if (clipOrTransform.IsClip()) {
|
||||
mTarget->PushClip(clipOrTransform.clip);
|
||||
} else {
|
||||
mTarget->SetTransform(clipOrTransform.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1778,20 +1776,18 @@ CanvasRenderingContext2D::ReturnTarget()
|
||||
{
|
||||
if (mTarget && mBufferProvider && mTarget != sErrorTarget) {
|
||||
CurrentState().transform = mTarget->GetTransform();
|
||||
if (!mBufferProvider->PreservesDrawingState()) {
|
||||
for (const auto& style : mStyleStack) {
|
||||
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
||||
if (clipOrTransform.IsClip()) {
|
||||
mTarget->PopClip();
|
||||
}
|
||||
for (const auto& style : mStyleStack) {
|
||||
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
||||
if (clipOrTransform.IsClip()) {
|
||||
mTarget->PopClip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
||||
// With the cairo backend we pushed an extra clip rect which we have to
|
||||
// balance out here. See the comment in EnsureDrawTarget.
|
||||
mTarget->PopClip();
|
||||
}
|
||||
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
||||
// With the cairo backend we pushed an extra clip rect which we have to
|
||||
// balance out here. See the comment in EnsureDrawTarget.
|
||||
mTarget->PopClip();
|
||||
}
|
||||
|
||||
mBufferProvider->ReturnDrawTarget(mTarget.forget());
|
||||
|
@ -65,14 +65,6 @@ public:
|
||||
virtual void OnShutdown() {}
|
||||
|
||||
virtual bool SetForwarder(CompositableForwarder* aFwd) { return true; }
|
||||
|
||||
/**
|
||||
* Return true if this provider preserves the drawing state (clips, transforms,
|
||||
* etc.) across frames. In practice this means users of the provider can skip
|
||||
* popping all of the clips at the end of the frames and pushing them back at
|
||||
* the beginning of the following frames, which can be costly (cf. bug 1294351).
|
||||
*/
|
||||
virtual bool PreservesDrawingState() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -96,7 +88,6 @@ public:
|
||||
|
||||
virtual void ReturnSnapshot(already_AddRefed<gfx::SourceSurface> aSnapshot) override;
|
||||
|
||||
virtual bool PreservesDrawingState() const override { return true; }
|
||||
private:
|
||||
~PersistentBufferProviderBasic();
|
||||
|
||||
@ -137,7 +128,6 @@ public:
|
||||
|
||||
virtual bool SetForwarder(CompositableForwarder* aFwd) override;
|
||||
|
||||
virtual bool PreservesDrawingState() const override { return false; }
|
||||
protected:
|
||||
PersistentBufferProviderShared(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
CompositableForwarder* aFwd,
|
||||
|
Loading…
x
Reference in New Issue
Block a user