OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBBoxRecord.h" | 9 #include "SkBBoxRecord.h" |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 // pad on left and right by half of max vertical glyph extents | 169 // pad on left and right by half of max vertical glyph extents |
170 SkScalar pad = (metrics.fTop - metrics.fBottom) / 2; | 170 SkScalar pad = (metrics.fTop - metrics.fBottom) / 2; |
171 bbox.fLeft += pad; | 171 bbox.fLeft += pad; |
172 bbox.fRight -= pad; | 172 bbox.fRight -= pad; |
173 | 173 |
174 if (this->transformBounds(bbox, &paint)) { | 174 if (this->transformBounds(bbox, &paint)) { |
175 INHERITED::drawPosText(text, byteLength, pos, paint); | 175 INHERITED::drawPosText(text, byteLength, pos, paint); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 void SkBBoxRecord::drawPosTextBounded(const void* text, size_t byteLength, | |
180 const SkPoint pos[], const SkRect& bbox, | |
181 const SkPaint& paint) { | |
tomhudson
2013/08/07 15:48:39
Is it worth putting in an SkASSERT here that the b
| |
182 if (this->transformBounds(bbox, &paint)) { | |
183 INHERITED::drawPosText(text, byteLength, pos, paint); | |
184 } | |
185 } | |
186 | |
179 void SkBBoxRecord::drawPosTextH(const void* text, size_t byteLength, const SkSca lar xpos[], | 187 void SkBBoxRecord::drawPosTextH(const void* text, size_t byteLength, const SkSca lar xpos[], |
180 SkScalar constY, const SkPaint& paint) { | 188 SkScalar constY, const SkPaint& paint) { |
181 SkRect bbox; | 189 SkRect bbox; |
182 size_t numChars = paint.countText(text, byteLength); | 190 size_t numChars = paint.countText(text, byteLength); |
183 if (numChars > 0) { | 191 if (numChars > 0) { |
184 bbox.fLeft = xpos[0]; | 192 bbox.fLeft = xpos[0]; |
185 bbox.fRight = xpos[numChars - 1]; | 193 bbox.fRight = xpos[numChars - 1]; |
186 // if we had a guarantee that these will be monotonically increasing, th is could be sped up | 194 // if we had a guarantee that these will be monotonically increasing, th is could be sped up |
187 for (size_t i = 1; i < numChars; ++i) { | 195 for (size_t i = 1; i < numChars; ++i) { |
188 if (xpos[i] < bbox.fLeft) { | 196 if (xpos[i] < bbox.fLeft) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 } | 283 } |
276 | 284 |
277 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { | 285 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { |
278 this->getTotalMatrix().mapRect(&outBounds); | 286 this->getTotalMatrix().mapRect(&outBounds); |
279 this->handleBBox(outBounds); | 287 this->handleBBox(outBounds); |
280 return true; | 288 return true; |
281 } | 289 } |
282 | 290 |
283 return false; | 291 return false; |
284 } | 292 } |
OLD | NEW |