From 00d39bcbfc8394a9b48b86b04ab06ec19091fa43 Mon Sep 17 00:00:00 2001 From: halcanary Date: Tue, 3 Mar 2015 08:26:00 -0800 Subject: XPS, DM: add SkDocument::CreateXPS - SkDocument::CreateXPS() function added, returns NULL on non-Windows OS. - DM: (Windows only) an XPSSink is added, fails on non-Windows OS - DM: Common code for PDFSink::draw and XPSSink::draw are factored into draw_skdocument static function. - SkDocument_XPS (Windows only) implementation of SkDocument via SkXPSDevice. - SkDocument_XPS_None (non-Windows) returns NULL for SkDocument::CreateXPS(). - gyp/xps.gyp refactored. - SkXPSDevice::drawTextOnPath removed (see http://crrev.com/925343003 ) - SkXPSDevice::drawPath supports conics via SkAutoConicToQuads. NOPRESUBMIT=true Review URL: https://codereview.chromium.org/963953002 --- src/device/xps/SkXPSDevice.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/device') diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp index c1105a2e94..3bb87b32a3 100644 --- a/src/device/xps/SkXPSDevice.cpp +++ b/src/device/xps/SkXPSDevice.cpp @@ -5,13 +5,14 @@ * found in the LICENSE file. */ +#include "SkTypes.h" + #ifndef UNICODE #define UNICODE #endif #ifndef _UNICODE #define _UNICODE #endif -#include "SkTypes.h" #include #include #include @@ -23,6 +24,7 @@ #include "SkDraw.h" #include "SkDrawProcs.h" #include "SkEndian.h" +#include "SkGeometry.h" #include "SkGlyphCache.h" #include "SkHRESULT.h" #include "SkImageEncoder.h" @@ -1363,6 +1365,21 @@ HRESULT SkXPSDevice::addXpsPathGeometry( segmentData.push(SkScalarToFLOAT(points[3].fX)); segmentData.push(SkScalarToFLOAT(points[3].fY)); break; + case SkPath::kConic_Verb: { + const SkScalar tol = SK_Scalar1 / 4; + SkAutoConicToQuads converter; + const SkPoint* quads = + converter.computeQuads(points, iter.conicWeight(), tol); + for (int i = 0; i < converter.countQuads(); ++i) { + segmentTypes.push(XPS_SEGMENT_TYPE_QUADRATIC_BEZIER); + segmentStrokes.push(stroke); + segmentData.push(SkScalarToFLOAT(quads[2 * i + 1].fX)); + segmentData.push(SkScalarToFLOAT(quads[2 * i + 1].fY)); + segmentData.push(SkScalarToFLOAT(quads[2 * i + 2].fX)); + segmentData.push(SkScalarToFLOAT(quads[2 * i + 2].fY)); + } + break; + } case SkPath::kClose_Verb: // we ignore these, and just get the whole segment from // the corresponding line/quad/cubic verbs @@ -2207,13 +2224,6 @@ void SkXPSDevice::drawPosText(const SkDraw& d, paint)); } -void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len, - const SkPath& path, const SkMatrix* matrix, - const SkPaint& paint) { - //This will call back into the device to do the drawing. - d.drawTextOnPath((const char*)text, len, path, matrix, paint); -} - void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev, int x, int y, const SkPaint&) { -- cgit v1.2.3