Bug 1318283: UpdateFilter can sometimes invalidate the draw target. Back out the previous speculative patch. r=mstange
MozReview-Commit-ID: 8u2sjS9dyLu
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -1869,20 +1869,19 @@ CanvasRenderingContext2D::GetHeight() co
{
return mHeight;
}
NS_IMETHODIMP
CanvasRenderingContext2D::SetDimensions(int32_t aWidth, int32_t aHeight)
{
bool retainBuffer = false;
- // See bug 1318283 as to why we are disabling this optimization.
- // Based on the results of the investigation, this may go away
- // completely or come back.
- // retainBuffer = (aWidth == mWidth && aHeight == mHeight);
+ if (aWidth == mWidth && aHeight == mHeight) {
+ retainBuffer = true;
+ }
ClearTarget(retainBuffer);
// Zero sized surfaces can cause problems.
mZero = false;
if (aHeight == 0) {
aHeight = 1;
mZero = true;
}
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -994,16 +994,17 @@ protected:
/**
* Calls UpdateFilter if the canvas's WriteOnly state has changed between the
* last call to UpdateFilter and now.
*/
const gfx::FilterDescription& EnsureUpdatedFilter() {
bool isWriteOnly = mCanvasElement && mCanvasElement->IsWriteOnly();
if (CurrentState().filterSourceGraphicTainted != isWriteOnly) {
UpdateFilter();
+ EnsureTarget();
}
MOZ_ASSERT(CurrentState().filterSourceGraphicTainted == isWriteOnly);
return CurrentState().filter;
}
bool NeedToCalculateBounds()
{
return NeedToDrawShadow() || NeedToApplyFilter();