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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 SkScalar x, SkScalar y, const SkPaint& paint
) { | 116 SkScalar x, SkScalar y, const SkPaint& paint
) { |
117 if (mustPathText(d, paint)) { | 117 if (mustPathText(d, paint)) { |
118 d.drawText_asPaths((const char*)text, len, x, y, paint); | 118 d.drawText_asPaths((const char*)text, len, x, y, paint); |
119 return; | 119 return; |
120 } | 120 } |
121 | 121 |
122 INHERITED::drawText(d, text, len, x, y, paint); | 122 INHERITED::drawText(d, text, len, x, y, paint); |
123 } | 123 } |
124 | 124 |
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[], SkScalar constY, | 126 const SkScalar pos[], int scalarsPerPos, |
127 int scalarsPerPos, const SkPaint& paint)
{ | 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, constY, scalarsPerPos
, 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, constY,scalarsPerPos, 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, | 135 void SkPDFDeviceFlattener::drawTextOnPath(const SkDraw& d, const void* text, siz
e_t len, |
136 const SkPath& path, const SkMatrix* ma
trix, | 136 const SkPath& path, const SkMatrix* ma
trix, |
137 const SkPaint& paint) { | 137 const SkPaint& paint) { |
138 if (mustPathText(d, paint) || (matrix && matrix->hasPerspective())) { | 138 if (mustPathText(d, paint) || (matrix && matrix->hasPerspective())) { |
139 d.drawTextOnPath((const char*)text, len, path, matrix, paint); | 139 d.drawTextOnPath((const char*)text, len, path, matrix, paint); |
140 return; | 140 return; |
141 } | 141 } |
142 INHERITED::drawTextOnPath(d, text, len, path, matrix, paint); | 142 INHERITED::drawTextOnPath(d, text, len, path, matrix, paint); |
143 } | 143 } |
144 | 144 |
145 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { | 145 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { |
146 // TODO(edisonn): testability, add flag to force return true. | 146 // TODO(edisonn): testability, add flag to force return true. |
147 return d.fMatrix->hasPerspective(); | 147 return d.fMatrix->hasPerspective(); |
148 } | 148 } |
149 | 149 |
150 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { | 150 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { |
151 // TODO(edisonn): testability, add flag to force return true. | 151 // TODO(edisonn): testability, add flag to force return true. |
152 // TODO(edisonn): TBD: How to flatten MaskFilter. | 152 // TODO(edisonn): TBD: How to flatten MaskFilter. |
153 return d.fMatrix->hasPerspective(); | 153 return d.fMatrix->hasPerspective(); |
154 } | 154 } |
OLD | NEW |