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 "SkPDFDeviceFlattener.h" | 8 #include "SkPDFDeviceFlattener.h" |
9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void SkPDFDeviceFlattener::drawPosText(const SkDraw& d, const void* text, size_t
len, | 125 void SkPDFDeviceFlattener::drawPosText(const SkDraw& d, const void* text, size_t
len, |
126 const SkScalar pos[], int scalarsPerPos, | 126 const SkScalar pos[], int scalarsPerPos, |
127 const SkPoint& offset, const SkPaint& pai
nt) { | 127 const SkPoint& offset, const SkPaint& pai
nt) { |
128 if (mustPathText(d, paint)) { | 128 if (mustPathText(d, paint)) { |
129 d.drawPosText_asPaths((const char*)text, len, pos, scalarsPerPos, offset
, paint); | 129 d.drawPosText_asPaths((const char*)text, len, pos, scalarsPerPos, offset
, paint); |
130 return; | 130 return; |
131 } | 131 } |
132 INHERITED::drawPosText(d, text, len, pos, scalarsPerPos, offset, paint); | 132 INHERITED::drawPosText(d, text, len, pos, scalarsPerPos, offset, paint); |
133 } | 133 } |
134 | 134 |
135 void SkPDFDeviceFlattener::drawTextOnPath(const SkDraw& d, const void* text, siz
e_t len, | |
136 const SkPath& path, const SkMatrix* ma
trix, | |
137 const SkPaint& paint) { | |
138 if (mustPathText(d, paint) || (matrix && matrix->hasPerspective())) { | |
139 d.drawTextOnPath((const char*)text, len, path, matrix, paint); | |
140 return; | |
141 } | |
142 INHERITED::drawTextOnPath(d, text, len, path, matrix, paint); | |
143 } | |
144 | |
145 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { | 135 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { |
146 // TODO(edisonn): testability, add flag to force return true. | 136 // TODO(edisonn): testability, add flag to force return true. |
147 return d.fMatrix->hasPerspective(); | 137 return d.fMatrix->hasPerspective(); |
148 } | 138 } |
149 | 139 |
150 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { | 140 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { |
151 // TODO(edisonn): testability, add flag to force return true. | 141 // TODO(edisonn): testability, add flag to force return true. |
152 // TODO(edisonn): TBD: How to flatten MaskFilter. | 142 // TODO(edisonn): TBD: How to flatten MaskFilter. |
153 return d.fMatrix->hasPerspective(); | 143 return d.fMatrix->hasPerspective(); |
154 } | 144 } |
OLD | NEW |