Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: src/device/xps/SkXPSDevice.cpp

Issue 978443002: Revert of XPS, DM: add SkDocument::CreateXPS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/device/xps/SkXPSDevice.h ('k') | src/doc/SkDocument_XPS.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h"
9
10 #ifndef UNICODE 8 #ifndef UNICODE
11 #define UNICODE 9 #define UNICODE
12 #endif 10 #endif
13 #ifndef _UNICODE 11 #ifndef _UNICODE
14 #define _UNICODE 12 #define _UNICODE
15 #endif 13 #endif
14 #include "SkTypes.h"
16 #include <ObjBase.h> 15 #include <ObjBase.h>
17 #include <XpsObjectModel.h> 16 #include <XpsObjectModel.h>
18 #include <T2EmbApi.h> 17 #include <T2EmbApi.h>
19 #include <FontSub.h> 18 #include <FontSub.h>
20 19
21 #include "SkColor.h" 20 #include "SkColor.h"
22 #include "SkConstexprMath.h" 21 #include "SkConstexprMath.h"
23 #include "SkData.h" 22 #include "SkData.h"
24 #include "SkDraw.h" 23 #include "SkDraw.h"
25 #include "SkDrawProcs.h" 24 #include "SkDrawProcs.h"
26 #include "SkEndian.h" 25 #include "SkEndian.h"
27 #include "SkGeometry.h"
28 #include "SkGlyphCache.h" 26 #include "SkGlyphCache.h"
29 #include "SkHRESULT.h" 27 #include "SkHRESULT.h"
30 #include "SkImageEncoder.h" 28 #include "SkImageEncoder.h"
31 #include "SkIStream.h" 29 #include "SkIStream.h"
32 #include "SkMaskFilter.h" 30 #include "SkMaskFilter.h"
33 #include "SkPaint.h" 31 #include "SkPaint.h"
34 #include "SkPathOps.h" 32 #include "SkPathOps.h"
35 #include "SkPoint.h" 33 #include "SkPoint.h"
36 #include "SkRasterizer.h" 34 #include "SkRasterizer.h"
37 #include "SkSFNTHeader.h" 35 #include "SkSFNTHeader.h"
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 case SkPath::kCubic_Verb: 1356 case SkPath::kCubic_Verb:
1359 segmentTypes.push(XPS_SEGMENT_TYPE_BEZIER); 1357 segmentTypes.push(XPS_SEGMENT_TYPE_BEZIER);
1360 segmentStrokes.push(stroke); 1358 segmentStrokes.push(stroke);
1361 segmentData.push(SkScalarToFLOAT(points[1].fX)); 1359 segmentData.push(SkScalarToFLOAT(points[1].fX));
1362 segmentData.push(SkScalarToFLOAT(points[1].fY)); 1360 segmentData.push(SkScalarToFLOAT(points[1].fY));
1363 segmentData.push(SkScalarToFLOAT(points[2].fX)); 1361 segmentData.push(SkScalarToFLOAT(points[2].fX));
1364 segmentData.push(SkScalarToFLOAT(points[2].fY)); 1362 segmentData.push(SkScalarToFLOAT(points[2].fY));
1365 segmentData.push(SkScalarToFLOAT(points[3].fX)); 1363 segmentData.push(SkScalarToFLOAT(points[3].fX));
1366 segmentData.push(SkScalarToFLOAT(points[3].fY)); 1364 segmentData.push(SkScalarToFLOAT(points[3].fY));
1367 break; 1365 break;
1368 case SkPath::kConic_Verb: {
1369 const SkScalar tol = SK_Scalar1 / 4;
1370 SkAutoConicToQuads converter;
1371 const SkPoint* quads =
1372 converter.computeQuads(points, iter.conicWeight(), tol);
1373 for (int i = 0; i < converter.countQuads(); ++i) {
1374 segmentTypes.push(XPS_SEGMENT_TYPE_QUADRATIC_BEZIER);
1375 segmentStrokes.push(stroke);
1376 segmentData.push(SkScalarToFLOAT(quads[2 * i + 1].fX));
1377 segmentData.push(SkScalarToFLOAT(quads[2 * i + 1].fY));
1378 segmentData.push(SkScalarToFLOAT(quads[2 * i + 2].fX));
1379 segmentData.push(SkScalarToFLOAT(quads[2 * i + 2].fY));
1380 }
1381 break;
1382 }
1383 case SkPath::kClose_Verb: 1366 case SkPath::kClose_Verb:
1384 // we ignore these, and just get the whole segment from 1367 // we ignore these, and just get the whole segment from
1385 // the corresponding line/quad/cubic verbs 1368 // the corresponding line/quad/cubic verbs
1386 break; 1369 break;
1387 default: 1370 default:
1388 SkDEBUGFAIL("unexpected verb"); 1371 SkDEBUGFAIL("unexpected verb");
1389 break; 1372 break;
1390 } 1373 }
1391 } 1374 }
1392 if (xpsFigure.get()) { 1375 if (xpsFigure.get()) {
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 typeface, 2200 typeface,
2218 NULL, 2201 NULL,
2219 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), 2202 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(),
2220 &origin, 2203 &origin,
2221 SkScalarToFLOAT(paint.getTextSize()), 2204 SkScalarToFLOAT(paint.getTextSize()),
2222 XPS_STYLE_SIMULATION_NONE, 2205 XPS_STYLE_SIMULATION_NONE,
2223 *d.fMatrix, 2206 *d.fMatrix,
2224 paint)); 2207 paint));
2225 } 2208 }
2226 2209
2210 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len,
2211 const SkPath& path, const SkMatrix* matrix,
2212 const SkPaint& paint) {
2213 //This will call back into the device to do the drawing.
2214 d.drawTextOnPath((const char*)text, len, path, matrix, paint);
2215 }
2216
2227 void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev, 2217 void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev,
2228 int x, int y, 2218 int x, int y,
2229 const SkPaint&) { 2219 const SkPaint&) {
2230 SkXPSDevice* that = static_cast<SkXPSDevice*>(dev); 2220 SkXPSDevice* that = static_cast<SkXPSDevice*>(dev);
2231 2221
2232 SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; 2222 SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform;
2233 XPS_MATRIX rawTransform = { 2223 XPS_MATRIX rawTransform = {
2234 1.0f, 2224 1.0f,
2235 0.0f, 2225 0.0f,
2236 0.0f, 2226 0.0f,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 IID_PPV_ARGS(&this->fXpsFactory)), 2268 IID_PPV_ARGS(&this->fXpsFactory)),
2279 "Could not create factory for layer."); 2269 "Could not create factory for layer.");
2280 2270
2281 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), 2271 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas),
2282 "Could not create canvas for layer."); 2272 "Could not create canvas for layer.");
2283 } 2273 }
2284 2274
2285 bool SkXPSDevice::allowImageFilter(const SkImageFilter*) { 2275 bool SkXPSDevice::allowImageFilter(const SkImageFilter*) {
2286 return false; 2276 return false;
2287 } 2277 }
OLDNEW
« no previous file with comments | « include/device/xps/SkXPSDevice.h ('k') | src/doc/SkDocument_XPS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698