mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
cBug 1792313 - Avoid using nscoord for intermediate computation with SVG rectangles. r=tnikkel
Under strong scales, going through the integer coordinate representation loses too much information. This patch tries to keep the same operations while sticking to floating point coordinates. Differential Revision: https://phabricator.services.mozilla.com/D158750
This commit is contained in:
parent
b553b8225d
commit
2213a95042
4
layout/reftests/svg/1792313-ref.svg
Normal file
4
layout/reftests/svg/1792313-ref.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="500" height="500" viewBox="0 0 500 500" version="2.0" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect fill="red" x="-5" y="-5" width="510" height="510"/>
|
||||
<rect fill="blue" x="50" y="50" width="400" height="400"/>
|
||||
</svg>
|
After Width: | Height: | Size: 234 B |
4
layout/reftests/svg/1792313.svg
Normal file
4
layout/reftests/svg/1792313.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="500" height="500" viewBox="0 0 0.1 0.1" version="2.0" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect fill="red" x="-1" y="-1" width="3" height="3"/>
|
||||
<rect fill="blue" x="0.01" y="0.01" width="0.08" height="0.08"/>
|
||||
</svg>
|
After Width: | Height: | Size: 236 B |
@ -628,3 +628,5 @@ fails-if(Android) != mask-resource.html about:blank # The image the test uses is
|
||||
|
||||
fuzzy(0-1,0-150) == mask-opacity-invalidation-1.html mask-opacity-invalidation-1-ref.html # clip-path mask/opacity optimization
|
||||
skip-if(Android) skip-if(cocoaWidget) skip-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)) == transform-animation-on-path.html transform-animation-on-path-ref.html #Bug 1638909
|
||||
|
||||
== 1792313.svg 1792313-ref.svg
|
||||
|
@ -809,17 +809,17 @@ bool SVGGeometryFrame::CreateWebRenderCommands(
|
||||
}
|
||||
|
||||
if (!aDryRun) {
|
||||
nscoord appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel();
|
||||
int32_t appUnitsPerCSSPixel = AppUnitsPerCSSPixel();
|
||||
auto appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel();
|
||||
float scale = (float)AppUnitsPerCSSPixel() / (float)appUnitsPerDevPx;
|
||||
|
||||
auto rect = simplePath.AsRect();
|
||||
auto appRect =
|
||||
nsLayoutUtils::RoundGfxRectToAppRect(rect, appUnitsPerCSSPixel);
|
||||
auto offset = aItem->ToReferenceFrame() - GetPosition();
|
||||
appRect += offset;
|
||||
auto destRect = LayoutDeviceRect::FromAppUnits(appRect, appUnitsPerDevPx);
|
||||
rect.Scale(scale);
|
||||
|
||||
auto wrRect = wr::ToLayoutRect(destRect);
|
||||
auto offset = LayoutDevicePoint::FromAppUnits(
|
||||
aItem->ToReferenceFrame() - GetPosition(), appUnitsPerDevPx);
|
||||
rect.MoveBy(offset.x, offset.y);
|
||||
|
||||
auto wrRect = wr::ToLayoutRect(rect);
|
||||
|
||||
SVGContextPaint* contextPaint =
|
||||
SVGContextPaint::GetContextPaint(GetContent());
|
||||
|
Loading…
Reference in New Issue
Block a user