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

Side by Side Diff: src/pdf/SkPDFDeviceFlattener.cpp

Issue 925343003: use common impl for drawTextOnPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move includes to the top Created 5 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
« src/core/SkDevice.cpp ('K') | « src/pdf/SkPDFDeviceFlattener.h ('k') | no next file » | 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 "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
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 }
OLDNEW
« src/core/SkDevice.cpp ('K') | « src/pdf/SkPDFDeviceFlattener.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698