Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Image::SizeAsFloat() and unsnapped rectangle in ImagePainter #20831

Merged
merged 1 commit into from Dec 19, 2019

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Dec 18, 2019

The pixel-snapping of the destination rectangle can end up distorting
the geometry use for painting an SVG image preserveAspectRatio is used -
the larger the aspect ratio, the larger the error.
By passing the unsnapped rectangle to LayoutImageResource::GetImage, and
using Image::SizeAsFloat() to compute the source rectangle of the image,
e can minimize the error and allow the Image in question (an SVGImage)
to perform compensation for the difference in aspect ratio between the
snapped and unsnapped rectangles. This means that the painted result
will better approximate the intended rendering.

Also clean up accesses to the LayoutImageResource and ImageResourceContent
by adding and using local variables for them.

Bug: 812239
Change-Id: I0778648e7dd6fcca778a95123509f15b3519564c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969831
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#726375}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

The pixel-snapping of the destination rectangle can end up distorting
the geometry use for painting an SVG image preserveAspectRatio is used -
the larger the aspect ratio, the larger the error.
By passing the unsnapped rectangle to LayoutImageResource::GetImage, and
using Image::SizeAsFloat() to compute the source rectangle of the image,
e can minimize the error and allow the Image in question (an SVGImage)
to perform compensation for the difference in aspect ratio between the
snapped and unsnapped rectangles. This means that the painted result
will better approximate the intended rendering.

Also clean up accesses to the LayoutImageResource and ImageResourceContent
by adding and using local variables for them.

Bug: 812239
Change-Id: I0778648e7dd6fcca778a95123509f15b3519564c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969831
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#726375}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants