Bug 1224200. Allow downscaler to get (and ignore) new input lines after it has finished producing all output lines. r=milan a=ritu
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 13 Jan 2016 17:16:32 -0600
changeset 306033 ee694a1db741e9fa9e373e9918c72838e43df994
parent 306032 db934cef3dffc02e56d8725dc6165bd8212dd4c6
child 306034 d1601a071d08512a6e131e82deabc335e4be1c38
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan, ritu
bugs1224200
milestone44.0
Bug 1224200. Allow downscaler to get (and ignore) new input lines after it has finished producing all output lines. r=milan a=ritu
image/Downscaler.cpp
--- a/image/Downscaler.cpp
+++ b/image/Downscaler.cpp
@@ -194,43 +194,44 @@ Downscaler::ClearRow(uint32_t aStartingA
          0, bytesToClear);
 }
 
 void
 Downscaler::CommitRow()
 {
   MOZ_ASSERT(mOutputBuffer, "Should have a current frame");
   MOZ_ASSERT(mCurrentInLine < mOriginalSize.height, "Past end of input");
-  MOZ_ASSERT(mCurrentOutLine < mTargetSize.height, "Past end of output");
 
-  int32_t filterOffset = 0;
-  int32_t filterLength = 0;
-  GetFilterOffsetAndLength(mYFilter, mCurrentOutLine,
-                           &filterOffset, &filterLength);
+  if (mCurrentOutLine < mTargetSize.height) {
+    int32_t filterOffset = 0;
+    int32_t filterLength = 0;
+    GetFilterOffsetAndLength(mYFilter, mCurrentOutLine,
+                             &filterOffset, &filterLength);
 
-  int32_t inLineToRead = filterOffset + mLinesInBuffer;
-  MOZ_ASSERT(mCurrentInLine <= inLineToRead, "Reading past end of input");
-  if (mCurrentInLine == inLineToRead) {
-    skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter,
-                               mWindow[mLinesInBuffer++], mHasAlpha,
-                               supports_sse2());
-  }
-
-  MOZ_ASSERT(mCurrentOutLine < mTargetSize.height,
-             "Writing past end of output");
-
-  while (mLinesInBuffer == filterLength) {
-    DownscaleInputLine();
-
-    if (mCurrentOutLine == mTargetSize.height) {
-      break;  // We're done.
+    int32_t inLineToRead = filterOffset + mLinesInBuffer;
+    MOZ_ASSERT(mCurrentInLine <= inLineToRead, "Reading past end of input");
+    if (mCurrentInLine == inLineToRead) {
+      skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter,
+                                 mWindow[mLinesInBuffer++], mHasAlpha,
+                                 supports_sse2());
     }
 
-    GetFilterOffsetAndLength(mYFilter, mCurrentOutLine,
-                             &filterOffset, &filterLength);
+    MOZ_ASSERT(mCurrentOutLine < mTargetSize.height,
+               "Writing past end of output");
+
+    while (mLinesInBuffer == filterLength) {
+      DownscaleInputLine();
+
+      if (mCurrentOutLine == mTargetSize.height) {
+        break;  // We're done.
+      }
+
+      GetFilterOffsetAndLength(mYFilter, mCurrentOutLine,
+                               &filterOffset, &filterLength);
+    }
   }
 
   mCurrentInLine += 1;
 
   // If we're at the end of the part of the original image that has data, commit
   // rows to shift us to the end.
   if (mCurrentInLine == (mFrameRect.y + mFrameRect.height)) {
     SkipToRow(mOriginalSize.height - 1);