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

Side by Side Diff: experimental/PdfViewer/SkPdfGraphicsState.cpp

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update experimental/PdfViewer Created 6 years, 10 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 | « bench/DashBench.cpp ('k') | gm/dashcubics.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 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 11
12 void SkPdfGraphicsState::applyGraphicsState(SkPaint* paint, bool stroking) { 12 void SkPdfGraphicsState::applyGraphicsState(SkPaint* paint, bool stroking) {
13 if (stroking) { 13 if (stroking) {
14 fStroking.applyGraphicsState(paint); 14 fStroking.applyGraphicsState(paint);
15 } else { 15 } else {
16 fNonStroking.applyGraphicsState(paint); 16 fNonStroking.applyGraphicsState(paint);
17 } 17 }
18 18
19 // TODO(edisonn): Perf, we should load this option from pdfContext->options, 19 // TODO(edisonn): Perf, we should load this option from pdfContext->options,
20 // or pdfContext->addPaintOptions(&paint); 20 // or pdfContext->addPaintOptions(&paint);
21 paint->setAntiAlias(true); 21 paint->setAntiAlias(true);
22 22
23 // TODO(edisonn): miter, ... 23 // TODO(edisonn): miter, ...
24 if (stroking) { 24 if (stroking) {
25 paint->setStrokeWidth(SkDoubleToScalar(fLineWidth)); 25 paint->setStrokeWidth(SkDoubleToScalar(fLineWidth));
26 // TODO(edisonn): perf, avoid allocs of the intervals 26 // TODO(edisonn): perf, avoid allocs of the intervals
27 if (fDashArrayLength > 0) { 27 if (fDashArrayLength > 0) {
28 paint->setPathEffect(new SkDashPathEffect(fDashArray, 28 paint->setPathEffect(SkDashPathEffect::Create(fDashArray,
29 fDashArrayLength, 29 fDashArrayLength,
30 fDashPhase))->unref(); 30 fDashPhase))->unref();
31 } 31 }
32 } 32 }
33 33
34 // TODO(edisonn): NYI multiple blend modes 34 // TODO(edisonn): NYI multiple blend modes
35 if (fBlendModesLength == 1 && fBlendModes[0] != SkXfermode::kSrc_Mode) { 35 if (fBlendModesLength == 1 && fBlendModes[0] != SkXfermode::kSrc_Mode) {
36 paint->setXfermodeMode(fBlendModes[0]); 36 paint->setXfermodeMode(fBlendModes[0]);
37 } 37 }
38 38
39 //paint->setStrokeMiter(SkDoubleToScalar(fMiterLimit)); 39 //paint->setStrokeMiter(SkDoubleToScalar(fMiterLimit));
40 // TODO(edisonn): impl cap and join 40 // TODO(edisonn): impl cap and join
41 } 41 }
OLDNEW
« no previous file with comments | « bench/DashBench.cpp ('k') | gm/dashcubics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698