Bug 1062886 - Fix one color padded drawing path. r=seth, a=sledru
authorMichael Wu <mwu@mozilla.com>
Mon, 22 Sep 2014 14:21:00 -0400
changeset 216819 232c3b4708b9
parent 216818 d508b53c3dee
child 216820 bca0649c9b79
push id3926
push userryanvm@gmail.com
push date2014-09-22 21:27 +0000
treeherdermozilla-beta@bca0649c9b79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, sledru
bugs1062886
milestone33.0
Bug 1062886 - Fix one color padded drawing path. r=seth, a=sledru
image/src/imgFrame.cpp
image/test/reftest/gif/one-color-offset-ref.gif
image/test/reftest/gif/one-color-offset.gif
image/test/reftest/gif/reftest.list
--- a/image/src/imgFrame.cpp
+++ b/image/src/imgFrame.cpp
@@ -336,33 +336,32 @@ imgFrame::SurfaceForDrawing(bool        
     // Give this surface an alpha channel because there are
     // transparent pixels in the padding or undecoded area
     RefPtr<DrawTarget> target =
       gfxPlatform::GetPlatform()->
         CreateOffscreenContentDrawTarget(size, SurfaceFormat::B8G8R8A8);
     if (!target)
       return SurfaceWithFormat();
 
-    Rect fillRect(aFill.x, aFill.y, aFill.width, aFill.height);
     // Fill 'available' with whatever we've got
     if (mSinglePixel) {
-      target->FillRect(fillRect, ColorPattern(mSinglePixelColor),
+      target->FillRect(ToRect(available), ColorPattern(mSinglePixelColor),
                        DrawOptions(1.0f, CompositionOp::OP_SOURCE));
     } else {
       gfxMatrix imageSpaceToUserSpace = aUserSpaceToImageSpace;
       imageSpaceToUserSpace.Invert();
       SurfacePattern pattern(aSurface,
                              ExtendMode::REPEAT,
                              Matrix(imageSpaceToUserSpace._11,
                                     imageSpaceToUserSpace._21,
                                     imageSpaceToUserSpace._12,
                                     imageSpaceToUserSpace._22,
                                     imageSpaceToUserSpace._31,
                                     imageSpaceToUserSpace._32));
-      target->FillRect(fillRect, pattern);
+      target->FillRect(ToRect(available), pattern);
     }
 
     RefPtr<SourceSurface> newsurf = target->Snapshot();
     return SurfaceWithFormat(new gfxSurfaceDrawable(newsurf, ThebesIntSize(size)), target->GetFormat());
   }
 
   // Not tiling, and we have a surface, so we can account for
   // padding and/or a partial decode just by twiddling parameters.
@@ -415,17 +414,17 @@ bool imgFrame::Draw(gfxContext *aContext
                     mSize.height + aPadding.TopBottom());
   gfxRect subimage(aSubimage.x, aSubimage.y, aSubimage.width, aSubimage.height);
   gfxRect fill = aFill;
 
   NS_ASSERTION(!sourceRect.Intersect(subimage).IsEmpty(),
                "We must be allowed to sample *some* source pixels!");
 
   RefPtr<SourceSurface> surf = GetSurface();
-  if (!surf) {
+  if (!surf && !mSinglePixel) {
     return false;
   }
 
   bool doTile = !imageRect.Contains(sourceRect) &&
                 !(aImageFlags & imgIContainer::FLAG_CLAMP);
   SurfaceWithFormat surfaceResult =
     SurfaceForDrawing(doPadding, doPartialDecode, doTile, aPadding,
                       userSpaceToImageSpace, fill, subimage, sourceRect,
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..14a59ff477a18e87d5d76cfd39452fdc3bb05f0f
GIT binary patch
literal 69
zc${<hbhEHb6krfwXkcVu_|NeF|9{1wER0+Xj0`#qKmd|qV3O(SUwL{h!{VAvm!$OB
Wq{?UKL~0Z*`Qdx+)HV-B25SI~qZLj7
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e6d7c49322b6a0a4402d2ab9c7c1d64ce22d84f8
GIT binary patch
literal 49
zc${<hbhEHb6krfw_`t}(@SoxT|Nn|VSr|Y-hnazyfeQ#3m^fPcSDt>$pRCPb4FEkY
B3~&Gd
--- a/image/test/reftest/gif/reftest.list
+++ b/image/test/reftest/gif/reftest.list
@@ -14,16 +14,19 @@
 
 # a transparent gif that disposes previous frames with clear; we must properly
 # clear each frame to pass.
 random == delaytest.html?transparent-animation.gif transparent-animation-finalframe.gif # incorrect timing dependence (bug 558678)
 
 # test for bug 641198
 skip-if(B2G) random-if(Android) == test_bug641198.html animation2a-finalframe.gif # bug 773482
 
+# Bug 1062886: a gif with a single color and an offset
+== one-color-offset.gif one-color-offset-ref.gif
+
 # webcam-simulacrum.mgif is a hand-edited file containing red.gif and blue.gif,
 # concatenated together with the relevant headers for
 # multipart/x-mixed-replace. Specifically, with the headers in
 # webcam-simulacrum.mjpg^headers^, the web browser will get the following:
 #
 # HTTP 200 OK
 # Content-Type: multipart/x-mixed-replace;boundary=BOUNDARYOMG
 #