Bug 26747 - REGRESSION (r41238) Repainted portion of a scaled image does not line up with full image
Summary: REGRESSION (r41238) Repainted portion of a scaled image does not line up with...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P1 Normal
Assignee: mitz
URL: http://webkit.org/demos/transitions-a...
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2009-06-25 18:24 PDT by mitz
Modified: 2009-07-16 17:48 PDT (History)
1 user (show)

See Also:


Attachments
Test case (757 bytes, text/html)
2009-06-25 18:25 PDT, mitz
no flags Details
Test case (759 bytes, text/html)
2009-06-25 18:28 PDT, mitz
no flags Details
Patch (4.10 KB, patch)
2009-06-25 22:37 PDT, mitz
no flags Details | Formatted Diff | Diff
Patch (221.23 KB, patch)
2009-07-16 16:34 PDT, mitz
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2009-06-25 18:24:21 PDT
To reproduce, open the attached test case. If the window size is not an integer multiple of the native size of the background image (so it is scaled), you will notice the background image jiggling as it is undergoes repeated partial repaints (a 50%-height band moves down and up across the image, forcing repainting).

The problem goes away if in BitmapImage::draw() in ImageCG.cpp, shouldUseSubimage is forced to false.
Comment 1 mitz 2009-06-25 18:24:43 PDT
<rdar://problem/7009243>
Comment 2 mitz 2009-06-25 18:25:18 PDT
Created attachment 31897 [details]
Test case
Comment 3 mitz 2009-06-25 18:28:56 PDT
Created attachment 31898 [details]
Test case

Fixed typo
Comment 4 mitz 2009-06-25 22:37:10 PDT
Created attachment 31907 [details]
Patch

Since the subimage is always pixel-aligned in the source image’s coordinate space, it can encompass more than the desired source rect. subimageRect is the actual source rect for the subimage. The adjusted destination rect is… adjusted in order to get the desired mapping.

However, there is a problem: this results in drawing outside the desired destination rect. This can be seen in fast/backgrounds/size/backgroundSize15.html . Clipping to destRect solved this, but creates subpixel gaps when the context is transformed, such as in fast/borders/border-image-rotate-transform.html.

I am not sure how to resolve this problem.
Comment 5 mitz 2009-06-27 21:15:48 PDT
I broke this in <http://trac.webkit.org/changeset/41238> by making this code path paint only a portion of the image.
Comment 6 mitz 2009-07-15 13:31:45 PDT
*** Bug 27307 has been marked as a duplicate of this bug. ***
Comment 7 mitz 2009-07-16 16:34:47 PDT
Created attachment 32900 [details]
Patch

Updated the previous patch. Added clipping to the destination rect—drawPattern already does that, so we already have subpixel gaps in that case.
Comment 8 mitz 2009-07-16 17:48:22 PDT
Fixed in <http://trac.webkit.org/projects/webkit/changeset/46002>.