Bug 1318283: UpdateFilter can sometimes invalidate the draw target. Back out the previous speculative patch. r=mstange
authorMilan Sreckovic <milan@mozilla.com>
Tue, 03 Jan 2017 12:01:11 -0500
changeset 327859 3e71fdb434e7ed4eb652bc15534cfbed4c0b96e7
parent 327858 06698dfb37848558b9edaa6fb947bab0259fa3d9
child 327860 56915773d15ad473e210ca732150d8674ecc8720
push id85304
push userphilringnalda@gmail.com
push dateWed, 04 Jan 2017 02:47:06 +0000
treeherdermozilla-inbound@6176579defcb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1318283
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1318283: UpdateFilter can sometimes invalidate the draw target. Back out the previous speculative patch. r=mstange MozReview-Commit-ID: 8u2sjS9dyLu
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContext2D.h
--- 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();