OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 | 8 |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2219 void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 2219 void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
2220 const SkPaint& paint) { | 2220 const SkPaint& paint) { |
2221 SkASSERT(blob); | 2221 SkASSERT(blob); |
2222 | 2222 |
2223 // FIXME: dispatch to the device instead | 2223 // FIXME: dispatch to the device instead |
2224 | 2224 |
2225 if (x || y) { | 2225 if (x || y) { |
2226 this->translate(x, y); | 2226 this->translate(x, y); |
2227 } | 2227 } |
2228 | 2228 |
2229 SkPaint runPaint = paint; | |
2229 SkTextBlob::RunIterator it(blob); | 2230 SkTextBlob::RunIterator it(blob); |
2230 while (!it.done()) { | 2231 while (!it.done()) { |
2231 size_t textLen = it.glyphCount() * sizeof(uint16_t); | 2232 size_t textLen = it.glyphCount() * sizeof(uint16_t); |
2232 const SkPoint& offset = it.offset(); | 2233 const SkPoint& offset = it.offset(); |
2234 it.applyFontToPaint(&runPaint); | |
reed1
2014/08/22 15:36:41
As long as we always overwrite exactly the same st
| |
2233 | 2235 |
2234 switch (it.positioning()) { | 2236 switch (it.positioning()) { |
2235 case SkTextBlob::kDefault_Positioning: | 2237 case SkTextBlob::kDefault_Positioning: |
2236 this->drawText(it.glyphs(), textLen, offset.x(), offset.y(), paint); | 2238 this->drawText(it.glyphs(), textLen, offset.x(), offset.y(), runPain t); |
2237 break; | 2239 break; |
2238 case SkTextBlob::kHorizontal_Positioning: | 2240 case SkTextBlob::kHorizontal_Positioning: |
2239 this->drawPosTextH(it.glyphs(), textLen, it.pos(), offset.y(), paint ); | 2241 this->drawPosTextH(it.glyphs(), textLen, it.pos(), offset.y(), runPa int); |
2240 break; | 2242 break; |
2241 case SkTextBlob::kFull_Positioning: | 2243 case SkTextBlob::kFull_Positioning: |
2242 this->drawPosText(it.glyphs(), textLen, (const SkPoint*)it.pos(), pa int); | 2244 this->drawPosText(it.glyphs(), textLen, (const SkPoint*)it.pos(), ru nPaint); |
2243 break; | 2245 break; |
2244 default: | 2246 default: |
2245 SkFAIL("unhandled positioning mode"); | 2247 SkFAIL("unhandled positioning mode"); |
2246 } | 2248 } |
2247 | 2249 |
2248 it.next(); | 2250 it.next(); |
2249 } | 2251 } |
2250 | 2252 |
2251 if (x || y) { | 2253 if (x || y) { |
2252 this->translate(-x, -y); | 2254 this->translate(-x, -y); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2590 } | 2592 } |
2591 | 2593 |
2592 if (NULL != matrix) { | 2594 if (NULL != matrix) { |
2593 canvas->concat(*matrix); | 2595 canvas->concat(*matrix); |
2594 } | 2596 } |
2595 } | 2597 } |
2596 | 2598 |
2597 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2599 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2598 fCanvas->restoreToCount(fSaveCount); | 2600 fCanvas->restoreToCount(fSaveCount); |
2599 } | 2601 } |
OLD | NEW |