aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-01-05 10:01:25 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-05 10:01:25 -0800
commit40c85e41b8be96f47f03a34bb2938696037afad4 (patch)
tree8bbf87e64661d0434a948dd3d7dd7a6a921eff82 /src
parentf1cdead599715dbae30278bffa4528bd1664f61f (diff)
Revert of Revert of enable conics gm (patchset #1 id:1 of https://codereview.chromium.org/811863006/)
Reason for revert: maybe this wasn't the cause of the chromeos crash? Original issue's description: > Revert of enable conics gm (patchset #3 id:40001 of https://codereview.chromium.org/835593002/) > > Reason for revert: > did I break the build? > > Original issue's description: > > enable conics gm > > > > BUG=skia: > > TBR= > > > > Committed: https://skia.googlesource.com/skia/+/03119ba4f815bc2c2774a9349ca8278ab1695072 > > TBR=egdaniel@google.com > NOTREECHECKS=true > NOTRY=true > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/ede901c7a2e21a44552b8c1436d9521ce33f4de5 TBR=egdaniel@google.com,reed@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/836773002
Diffstat (limited to 'src')
-rw-r--r--src/pdf/SkPDFUtils.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
index d034270e07..e488f7da06 100644
--- a/src/pdf/SkPDFUtils.cpp
+++ b/src/pdf/SkPDFUtils.cpp
@@ -95,6 +95,13 @@ void SkPDFUtils::AppendCubic(SkScalar ctl1X, SkScalar ctl1Y,
content->writeText(cmd.c_str());
}
+static void append_quad(const SkPoint quad[], SkWStream* content) {
+ SkPoint cubic[4];
+ SkConvertQuadToCubic(quad, cubic);
+ SkPDFUtils::AppendCubic(cubic[1].fX, cubic[1].fY, cubic[2].fX, cubic[2].fY,
+ cubic[3].fX, cubic[3].fY, content);
+}
+
// static
void SkPDFUtils::AppendRectangle(const SkRect& rect, SkWStream* content) {
// Skia has 0,0 at top left, pdf at bottom left. Do the right thing.
@@ -130,9 +137,7 @@ void SkPDFUtils::EmitPath(const SkPath& path, SkPaint::Style paintStyle,
SkDynamicMemoryWStream currentSegment;
SkPoint args[4];
SkPath::Iter iter(path, false);
- for (SkPath::Verb verb = iter.next(args);
- verb != SkPath::kDone_Verb;
- verb = iter.next(args)) {
+ for (SkPath::Verb verb = iter.next(args); verb != SkPath::kDone_Verb; verb = iter.next(args)) {
// args gets all the points, even the implicit first point.
switch (verb) {
case SkPath::kMove_Verb:
@@ -150,14 +155,18 @@ void SkPDFUtils::EmitPath(const SkPath& path, SkPaint::Style paintStyle,
fillState = kNonSingleLine_SkipFillState;
}
break;
- case SkPath::kQuad_Verb: {
- SkPoint cubic[4];
- SkConvertQuadToCubic(args, cubic);
- AppendCubic(cubic[1].fX, cubic[1].fY, cubic[2].fX, cubic[2].fY,
- cubic[3].fX, cubic[3].fY, &currentSegment);
+ case SkPath::kQuad_Verb:
+ append_quad(args, &currentSegment);
fillState = kNonSingleLine_SkipFillState;
break;
- }
+ case SkPath::kConic_Verb: {
+ const SkScalar tol = SK_Scalar1 / 4;
+ SkAutoConicToQuads converter;
+ const SkPoint* quads = converter.computeQuads(args, iter.conicWeight(), tol);
+ for (int i = 0; i < converter.countQuads(); ++i) {
+ append_quad(&quads[i * 2], &currentSegment);
+ }
+ } break;
case SkPath::kCubic_Verb:
AppendCubic(args[1].fX, args[1].fY, args[2].fX, args[2].fY,
args[3].fX, args[3].fY, &currentSegment);