OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkPdfGraphicsState.h" | 8 #include "SkPdfGraphicsState.h" |
9 | 9 |
10 #include "SkDashPathEffect.h" | 10 #include "SkDashPathEffect.h" |
11 #include "SkPdfNativeTokenizer.h" | |
12 | |
13 SkPdfContext::SkPdfContext(SkPdfNativeDoc* doc) | |
14 : fPdfDoc(doc) | |
15 , fTmpPageAllocator(new SkPdfAllocator()) { | |
16 } | |
17 | |
18 SkPdfContext::~SkPdfContext() { | |
19 delete fTmpPageAllocator; | |
20 } | |
21 | 11 |
22 void SkPdfGraphicsState::applyGraphicsState(SkPaint* paint, bool stroking) { | 12 void SkPdfGraphicsState::applyGraphicsState(SkPaint* paint, bool stroking) { |
23 if (stroking) { | 13 if (stroking) { |
24 fStroking.applyGraphicsState(paint); | 14 fStroking.applyGraphicsState(paint); |
25 } else { | 15 } else { |
26 fNonStroking.applyGraphicsState(paint); | 16 fNonStroking.applyGraphicsState(paint); |
27 } | 17 } |
28 | 18 |
29 // TODO(edisonn): Perf, we should load this option from pdfContext->options, | 19 // TODO(edisonn): Perf, we should load this option from pdfContext->options, |
30 // or pdfContext->addPaintOptions(&paint); | 20 // or pdfContext->addPaintOptions(&paint); |
(...skipping 11 matching lines...) Expand all Loading... |
42 } | 32 } |
43 | 33 |
44 // TODO(edisonn): NYI multiple blend modes | 34 // TODO(edisonn): NYI multiple blend modes |
45 if (fBlendModesLength == 1 && fBlendModes[0] != SkXfermode::kSrc_Mode) { | 35 if (fBlendModesLength == 1 && fBlendModes[0] != SkXfermode::kSrc_Mode) { |
46 paint->setXfermodeMode(fBlendModes[0]); | 36 paint->setXfermodeMode(fBlendModes[0]); |
47 } | 37 } |
48 | 38 |
49 //paint->setStrokeMiter(SkDoubleToScalar(fMiterLimit)); | 39 //paint->setStrokeMiter(SkDoubleToScalar(fMiterLimit)); |
50 // TODO(edisonn): impl cap and join | 40 // TODO(edisonn): impl cap and join |
51 } | 41 } |
OLD | NEW |