aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/device/xps
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-03-03 08:26:00 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-03 08:26:00 -0800
commit00d39bcbfc8394a9b48b86b04ab06ec19091fa43 (patch)
tree2287b3641efeb3175c2eb4af1437c2d0343fecdf /src/device/xps
parent60ff4582ae76aa131aeb20a3e16c89fa3a40a41c (diff)
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
Diffstat (limited to 'src/device/xps')
-rw-r--r--src/device/xps/SkXPSDevice.cpp26
1 files changed, 18 insertions, 8 deletions
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 <ObjBase.h>
#include <XpsObjectModel.h>
#include <T2EmbApi.h>
@@ -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&) {