Animated WebP decoder: rectify post-processing when disposing to background.

See the corresponding (correct) logic on Chrome side:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp&l=446

Change-Id: Ife17e24b3263ff6148ffc38849c5e3527d341945
diff --git a/framesequence/jni/FrameSequence_webp.cpp b/framesequence/jni/FrameSequence_webp.cpp
index bced919..602feb7 100644
--- a/framesequence/jni/FrameSequence_webp.cpp
+++ b/framesequence/jni/FrameSequence_webp.cpp
@@ -37,6 +37,15 @@
     return (frame.width == canvasWidth && frame.height == canvasHeight);
 }
 
+// Returns true if the rectangle defined by 'frame' contains pixel (x, y).
+static bool FrameContainsPixel(const WebPIterator& frame, int x, int y) {
+    const int left = frame.x_offset;
+    const int right = left + frame.width;
+    const int top = frame.y_offset;
+    const int bottom = top + frame.height;
+    return x >= left && x < right && y >= top && y < bottom;
+}
+
 // Construct mIsKeyFrame array.
 void FrameSequence_webp::constructDependencyChain() {
     const size_t frameCount = getFrameCount();
@@ -247,8 +256,8 @@
                     const int canvasX = currIter.x_offset + x;
                     Color8888& currPixel = currBuffer[canvasY * currStride + canvasX];
                     // FIXME: Use alpha-blending when alpha is between 0 and 255.
-                    if (!(currPixel & COLOR_8888_ALPHA_MASK) &&
-                            isFullFrame(prevIter, canvasWidth, canvasHeight)) {
+                    if (!(currPixel & COLOR_8888_ALPHA_MASK)
+                            && !FrameContainsPixel(prevIter, canvasX, canvasY)) {
                         const Color8888 prevPixel = prevBuffer[canvasY * prevStride + canvasX];
                         currPixel = prevPixel;
                     }