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 | 9 |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const SkPaint& paint) { | 36 const SkPaint& paint) { |
37 if (!mustFlatten(d)) { | 37 if (!mustFlatten(d)) { |
38 INHERITED::drawPoints(d, mode, count, points, paint); | 38 INHERITED::drawPoints(d, mode, count, points, paint); |
39 return; | 39 return; |
40 } | 40 } |
41 | 41 |
42 SkPaint paintFlatten(paint); | 42 SkPaint paintFlatten(paint); |
43 flattenPaint(d, &paintFlatten); | 43 flattenPaint(d, &paintFlatten); |
44 | 44 |
45 SkPoint* flattenedPoints = SkNEW_ARRAY(SkPoint, count); | 45 SkPoint* flattenedPoints = SkNEW_ARRAY(SkPoint, count); |
46 d.fMatrix->mapPoints(flattenedPoints, points, count); | 46 d.fMatrix->mapPoints(flattenedPoints, points, SkToS32(count)); |
47 SkDraw draw(d); | 47 SkDraw draw(d); |
48 SkMatrix identity = SkMatrix::I(); | 48 SkMatrix identity = SkMatrix::I(); |
49 draw.fMatrix = &identity; | 49 draw.fMatrix = &identity; |
50 INHERITED::drawPoints(draw, mode, count, flattenedPoints, paintFlatten); | 50 INHERITED::drawPoints(draw, mode, count, flattenedPoints, paintFlatten); |
51 SkDELETE_ARRAY(flattenedPoints); | 51 SkDELETE_ARRAY(flattenedPoints); |
52 } | 52 } |
53 | 53 |
54 void SkPDFDeviceFlattener::drawRect(const SkDraw& d, const SkRect& r, const SkPa
int& paint) { | 54 void SkPDFDeviceFlattener::drawRect(const SkDraw& d, const SkRect& r, const SkPa
int& paint) { |
55 if (!mustFlatten(d)) { | 55 if (!mustFlatten(d)) { |
56 INHERITED::drawRect(d, r, paint); | 56 INHERITED::drawRect(d, r, paint); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { | 146 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { |
147 // TODO(edisonn): testability, add flag to force return true. | 147 // TODO(edisonn): testability, add flag to force return true. |
148 return d.fMatrix->hasPerspective(); | 148 return d.fMatrix->hasPerspective(); |
149 } | 149 } |
150 | 150 |
151 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { | 151 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { |
152 // TODO(edisonn): testability, add flag to force return true. | 152 // TODO(edisonn): testability, add flag to force return true. |
153 // TODO(edisonn): TBD: How to flatten MaskFilter. | 153 // TODO(edisonn): TBD: How to flatten MaskFilter. |
154 return d.fMatrix->hasPerspective(); | 154 return d.fMatrix->hasPerspective(); |
155 } | 155 } |
OLD | NEW |