New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 691386 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 2
Type: Bug



Sign in to add a comment

SVG arcs have wrong curvature when printed

Reported by jedwar...@gmail.com, Feb 12 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
1. Go to https://jedwards1211.github.io/react-therion-protractor/#/
2. Click the print button at the top right of the page
3. Compare print preview to what's shown in the body of the page

What is the expected behavior?
arcs in print preview are perfectly circular and match what's shown in the browser window

What went wrong?
Arcs bulge outward from the expected curvature, and don't look circular.  Maybe its a bezier conversion problem?

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 56.0.2924.87  Channel: stable
OS Version: OS X 10.12.3
Flash Version: 

Can't repro in FF or Safari, though they have other SVG issues rendering this page

 

Comment 1 by jedwar...@gmail.com, Feb 12 2017

What the heck, my attachments got deleted because I wasn't Captcha verified
Screen Shot 2017-02-12 at 12.48.07 PM.png
77.3 KB View Download
Screen Shot 2017-02-12 at 12.48.18 PM.png
61.4 KB View Download
Screen Shot 2017-02-12 at 12.49.37 PM.png
101 KB View Download

Comment 2 by f...@opera.com, Feb 12 2017

Cc: caryclark@chromium.org
Components: Internals>Skia Internals>Skia>PDF
Labels: OS-Linux
Status: Available (was: Unconfirmed)
Maybe it's an issue with "reversing" a conic section?

The relevant path appears to be:

 "M -2 0 A 2 2 0 0 0 2 0 Z"

which I guess will map to 2(?) conics or so? IIUC that then round-trips through PDF.

Comment 3 by jedwar...@gmail.com, Feb 12 2017

On Chrome on Android, if I include

    <meta name="viewport" content="initial-scale=1">

Then the issue shows in the browser itself when I zoom out and goes away when I zoom to about 200%!
Cc: halcanary@chromium.org
Sounds like two different bugs.
The original bug where the print preview draws incorrectly may be an error in the Skia to PDF translation.
The bug mentioned in #3 may be related to in incorrect device resolution when the stroke is turned into the fill path.

Comment 5 by jedwar...@gmail.com, Feb 13 2017

The thing that makes me think they're related though is that the arc gets distorted in exactly the same way when it happens on Android Chrome.
Yes, there is common code at the bottom but that code is reached through two different paths.
See https://skia.googlesource.com/skia/+/chrome/m56/src/pdf/SkPDFUtils.cpp#172

The tolerance in converting conics (such as elipticals) to quadratic paths that PDF recognizes is hardcoded to be 0.25.  

A path which is zoomed in a lot such as this:

    "M -2 0 A 2 2 0 0 0 2 0 Z"

Will have a tolerance of 12.5%! (2.0 * 0.25).

This is a limitation of SkPDF that could go away if we checked the current matrix before converting to quadratics.

I meant to say `0.125 == 0.25 / 2.0`, not  `0.125 == 0.25 * 2.0`!
Minimal test case:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>chromium_691386</title>
</head>
<body>
<svg viewBox="-2 -2 4 4"  width="512" height="512">
    <path d="M -1 0 A 1 1 0 0 0 1 0 Z"  stroke="black" stroke-width="0.025px" fill="none">
</svg>
</body>
</html>

Wow, thanks a bunch for the quick fix for this Hal!
Project Member

Comment 13 by bugdroid1@chromium.org, Feb 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e1d7115274ee66ed6875376c4eb24131bb6a8bab

commit e1d7115274ee66ed6875376c4eb24131bb6a8bab
Author: skia-deps-roller <skia-deps-roller@chromium.org>
Date: Mon Feb 13 22:00:04 2017

Roll src/third_party/skia/ a12c15376..d2d6d726f (8 commits).

https://skia.googlesource.com/skia.git/+log/a12c15376ce3..d2d6d726fa3e

$ git log a12c15376..d2d6d726f --date=short --no-merges --format='%ad %ae %s'
2017-02-13 mtklein Fix stack alignment in Windows before_loop/after_loop.
2017-02-13 halcanary tools/git-sync-deps: less verbose when fetch is needed
2017-02-13 csmartdalton Make SkAutoTMalloc movable
2017-02-13 jcgregorio fiddle: Fix JSON output logic.
2017-02-12 halcanary SkPDF: skip shader lookup for SkShader::kColor_GradientType
2017-02-13 herb Move GrTessellator from SkChunckAlloc to SkArenaAlloc.
2017-02-13 halcanary SkPDF: better tolerance path conversion to quadratics
2017-02-09 ztenghui A simple gradient test

Created with:
  roll-dep src/third_party/skia
BUG= 690875 , 691386 

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
TBR=bungeman@google.com

Review-Url: https://codereview.chromium.org/2695823002
Cr-Commit-Position: refs/heads/master@{#450107}

[modify] https://crrev.com/e1d7115274ee66ed6875376c4eb24131bb6a8bab/DEPS

Status: Fixed (was: Available)
I believe this is fixed in m58.  Please verify.

Sign in to add a comment