OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 9 |
10 #include "SkScalerContext.h" | 10 #include "SkScalerContext.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 /////////////////////////////////////////////////////////////////////////////// | 58 /////////////////////////////////////////////////////////////////////////////// |
59 | 59 |
60 #ifdef SK_DEBUG | 60 #ifdef SK_DEBUG |
61 #define DUMP_RECx | 61 #define DUMP_RECx |
62 #endif | 62 #endif |
63 | 63 |
64 static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag, | 64 static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag, |
65 SkFlattenable::Type ft) { | 65 SkFlattenable::Type ft) { |
66 SkFlattenable* obj = NULL; | 66 SkFlattenable* obj = nullptr; |
67 uint32_t len; | 67 uint32_t len; |
68 const void* data = desc->findEntry(tag, &len); | 68 const void* data = desc->findEntry(tag, &len); |
69 | 69 |
70 if (data) { | 70 if (data) { |
71 SkReadBuffer buffer(data, len); | 71 SkReadBuffer buffer(data, len); |
72 obj = buffer.readFlattenable(ft); | 72 obj = buffer.readFlattenable(ft); |
73 SkASSERT(buffer.offset() == buffer.size()); | 73 SkASSERT(buffer.offset() == buffer.size()); |
74 } | 74 } |
75 return obj; | 75 return obj; |
76 } | 76 } |
77 | 77 |
78 SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc) | 78 SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc) |
79 : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, NULL))
) | 79 : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullpt
r))) |
80 | 80 |
81 , fTypeface(SkRef(typeface)) | 81 , fTypeface(SkRef(typeface)) |
82 , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_
SkDescriptorTag, | 82 , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_
SkDescriptorTag, |
83 SkFlattenable::kSkPathEffect_Type))
) | 83 SkFlattenable::kSkPathEffect_Type))
) |
84 , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_
SkDescriptorTag, | 84 , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_
SkDescriptorTag, |
85 SkFlattenable::kSkMaskFilter_Type))
) | 85 SkFlattenable::kSkMaskFilter_Type))
) |
86 , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_
SkDescriptorTag, | 86 , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_
SkDescriptorTag, |
87 SkFlattenable::kSkRasterizer_Type))
) | 87 SkFlattenable::kSkRasterizer_Type))
) |
88 // Initialize based on our settings. Subclasses can also force this. | 88 // Initialize based on our settings. Subclasses can also force this. |
89 , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != NULL || fRas
terizer != NULL) | 89 , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || f
Rasterizer != nullptr) |
90 | 90 |
91 , fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMask
PreBlend(fRec)) | 91 , fPreBlend(fMaskFilter ? SkMaskGamma::PreBlend() : SkScalerContext::GetMask
PreBlend(fRec)) |
92 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec) | 92 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec) |
93 : SkMaskGamma::PreBlend()) | 93 : SkMaskGamma::PreBlend()) |
94 { | 94 { |
95 #ifdef DUMP_REC | 95 #ifdef DUMP_REC |
96 desc->assertChecksum(); | 96 desc->assertChecksum(); |
97 SkDebugf("SkScalerContext checksum %x count %d length %d\n", | 97 SkDebugf("SkScalerContext checksum %x count %d length %d\n", |
98 desc->getChecksum(), desc->getCount(), desc->getLength()); | 98 desc->getChecksum(), desc->getCount(), desc->getLength()); |
99 SkDebugf(" textsize %g prescale %g preskew %g post [%g %g %g %g]\n", | 99 SkDebugf(" textsize %g prescale %g preskew %g post [%g %g %g %g]\n", |
100 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], | 100 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], |
101 rec->fPost2x2[0][1], rec->fPost2x2[1][0], rec->fPost2x2[1][1]); | 101 rec->fPost2x2[0][1], rec->fPost2x2[1][0], rec->fPost2x2[1][1]); |
102 SkDebugf(" frame %g miter %g hints %d framefill %d format %d join %d\n", | 102 SkDebugf(" frame %g miter %g hints %d framefill %d format %d join %d\n", |
103 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, | 103 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, |
104 rec->fMaskFormat, rec->fStrokeJoin); | 104 rec->fMaskFormat, rec->fStrokeJoin); |
105 SkDebugf(" pathEffect %x maskFilter %x\n", | 105 SkDebugf(" pathEffect %x maskFilter %x\n", |
106 desc->findEntry(kPathEffect_SkDescriptorTag, NULL), | 106 desc->findEntry(kPathEffect_SkDescriptorTag, nullptr), |
107 desc->findEntry(kMaskFilter_SkDescriptorTag, NULL)); | 107 desc->findEntry(kMaskFilter_SkDescriptorTag, nullptr)); |
108 #endif | 108 #endif |
109 } | 109 } |
110 | 110 |
111 SkScalerContext::~SkScalerContext() { | 111 SkScalerContext::~SkScalerContext() { |
112 SkSafeUnref(fPathEffect); | 112 SkSafeUnref(fPathEffect); |
113 SkSafeUnref(fMaskFilter); | 113 SkSafeUnref(fMaskFilter); |
114 SkSafeUnref(fRasterizer); | 114 SkSafeUnref(fRasterizer); |
115 } | 115 } |
116 | 116 |
117 void SkScalerContext::getAdvance(SkGlyph* glyph) { | 117 void SkScalerContext::getAdvance(SkGlyph* glyph) { |
(...skipping 29 matching lines...) Expand all Loading... |
147 | 147 |
148 if (fGenerateImageFromPath) { | 148 if (fGenerateImageFromPath) { |
149 SkPath devPath, fillPath; | 149 SkPath devPath, fillPath; |
150 SkMatrix fillToDevMatrix; | 150 SkMatrix fillToDevMatrix; |
151 | 151 |
152 this->internalGetPath(*glyph, &fillPath, &devPath, &fillToDevMatrix); | 152 this->internalGetPath(*glyph, &fillPath, &devPath, &fillToDevMatrix); |
153 | 153 |
154 if (fRasterizer) { | 154 if (fRasterizer) { |
155 SkMask mask; | 155 SkMask mask; |
156 | 156 |
157 if (fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL, | 157 if (fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr, |
158 fMaskFilter, &mask, | 158 fMaskFilter, &mask, |
159 SkMask::kJustComputeBounds_CreateMode)) { | 159 SkMask::kJustComputeBounds_CreateMode)) { |
160 glyph->fLeft = mask.fBounds.fLeft; | 160 glyph->fLeft = mask.fBounds.fLeft; |
161 glyph->fTop = mask.fBounds.fTop; | 161 glyph->fTop = mask.fBounds.fTop; |
162 glyph->fWidth = SkToU16(mask.fBounds.width()); | 162 glyph->fWidth = SkToU16(mask.fBounds.width()); |
163 glyph->fHeight = SkToU16(mask.fBounds.height()); | 163 glyph->fHeight = SkToU16(mask.fBounds.height()); |
164 } else { | 164 } else { |
165 goto SK_ERROR; | 165 goto SK_ERROR; |
166 } | 166 } |
167 } else { | 167 } else { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 glyph->fMaskFormat = SkMask::kA8_Format; | 199 glyph->fMaskFormat = SkMask::kA8_Format; |
200 } | 200 } |
201 | 201 |
202 if (fMaskFilter) { | 202 if (fMaskFilter) { |
203 SkMask src, dst; | 203 SkMask src, dst; |
204 SkMatrix matrix; | 204 SkMatrix matrix; |
205 | 205 |
206 glyph->toMask(&src); | 206 glyph->toMask(&src); |
207 fRec.getMatrixFrom2x2(&matrix); | 207 fRec.getMatrixFrom2x2(&matrix); |
208 | 208 |
209 src.fImage = NULL; // only want the bounds from the filter | 209 src.fImage = nullptr; // only want the bounds from the filter |
210 if (fMaskFilter->filterMask(&dst, src, matrix, NULL)) { | 210 if (fMaskFilter->filterMask(&dst, src, matrix, nullptr)) { |
211 if (dst.fBounds.isEmpty() || !dst.fBounds.is16Bit()) { | 211 if (dst.fBounds.isEmpty() || !dst.fBounds.is16Bit()) { |
212 goto SK_ERROR; | 212 goto SK_ERROR; |
213 } | 213 } |
214 SkASSERT(dst.fImage == NULL); | 214 SkASSERT(dst.fImage == nullptr); |
215 glyph->fLeft = dst.fBounds.fLeft; | 215 glyph->fLeft = dst.fBounds.fLeft; |
216 glyph->fTop = dst.fBounds.fTop; | 216 glyph->fTop = dst.fBounds.fTop; |
217 glyph->fWidth = SkToU16(dst.fBounds.width()); | 217 glyph->fWidth = SkToU16(dst.fBounds.width()); |
218 glyph->fHeight = SkToU16(dst.fBounds.height()); | 218 glyph->fHeight = SkToU16(dst.fBounds.height()); |
219 glyph->fMaskFormat = dst.fFormat; | 219 glyph->fMaskFormat = dst.fFormat; |
220 } | 220 } |
221 } | 221 } |
222 return; | 222 return; |
223 | 223 |
224 SK_ERROR: | 224 SK_ERROR: |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // the path only makes a mask. This case should have been caught up in | 478 // the path only makes a mask. This case should have been caught up in |
479 // generateMetrics(). | 479 // generateMetrics(). |
480 SkASSERT(!fGenerateImageFromPath || | 480 SkASSERT(!fGenerateImageFromPath || |
481 SkMask::kARGB32_Format != origGlyph.fMaskFormat); | 481 SkMask::kARGB32_Format != origGlyph.fMaskFormat); |
482 | 482 |
483 if (fMaskFilter) { // restore the prefilter bounds | 483 if (fMaskFilter) { // restore the prefilter bounds |
484 tmpGlyph.initGlyphIdFrom(origGlyph); | 484 tmpGlyph.initGlyphIdFrom(origGlyph); |
485 | 485 |
486 // need the original bounds, sans our maskfilter | 486 // need the original bounds, sans our maskfilter |
487 SkMaskFilter* mf = fMaskFilter; | 487 SkMaskFilter* mf = fMaskFilter; |
488 fMaskFilter = NULL; // temp disable | 488 fMaskFilter = nullptr; // temp disable |
489 this->getMetrics(&tmpGlyph); | 489 this->getMetrics(&tmpGlyph); |
490 fMaskFilter = mf; // restore | 490 fMaskFilter = mf; // restore |
491 | 491 |
492 // we need the prefilter bounds to be <= filter bounds | 492 // we need the prefilter bounds to be <= filter bounds |
493 SkASSERT(tmpGlyph.fWidth <= origGlyph.fWidth); | 493 SkASSERT(tmpGlyph.fWidth <= origGlyph.fWidth); |
494 SkASSERT(tmpGlyph.fHeight <= origGlyph.fHeight); | 494 SkASSERT(tmpGlyph.fHeight <= origGlyph.fHeight); |
495 | 495 |
496 if (tmpGlyph.fMaskFormat == origGlyph.fMaskFormat) { | 496 if (tmpGlyph.fMaskFormat == origGlyph.fMaskFormat) { |
497 tmpGlyph.fImage = origGlyph.fImage; | 497 tmpGlyph.fImage = origGlyph.fImage; |
498 } else { | 498 } else { |
499 tmpGlyphImageStorage.reset(tmpGlyph.computeImageSize()); | 499 tmpGlyphImageStorage.reset(tmpGlyph.computeImageSize()); |
500 tmpGlyph.fImage = tmpGlyphImageStorage.get(); | 500 tmpGlyph.fImage = tmpGlyphImageStorage.get(); |
501 } | 501 } |
502 glyph = &tmpGlyph; | 502 glyph = &tmpGlyph; |
503 } | 503 } |
504 | 504 |
505 if (fGenerateImageFromPath) { | 505 if (fGenerateImageFromPath) { |
506 SkPath devPath, fillPath; | 506 SkPath devPath, fillPath; |
507 SkMatrix fillToDevMatrix; | 507 SkMatrix fillToDevMatrix; |
508 SkMask mask; | 508 SkMask mask; |
509 | 509 |
510 this->internalGetPath(*glyph, &fillPath, &devPath, &fillToDevMatrix); | 510 this->internalGetPath(*glyph, &fillPath, &devPath, &fillToDevMatrix); |
511 glyph->toMask(&mask); | 511 glyph->toMask(&mask); |
512 | 512 |
513 if (fRasterizer) { | 513 if (fRasterizer) { |
514 mask.fFormat = SkMask::kA8_Format; | 514 mask.fFormat = SkMask::kA8_Format; |
515 sk_bzero(glyph->fImage, mask.computeImageSize()); | 515 sk_bzero(glyph->fImage, mask.computeImageSize()); |
516 | 516 |
517 if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL, | 517 if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr, |
518 fMaskFilter, &mask, | 518 fMaskFilter, &mask, |
519 SkMask::kJustRenderImage_CreateMode)) { | 519 SkMask::kJustRenderImage_CreateMode)) { |
520 return; | 520 return; |
521 } | 521 } |
522 if (fPreBlend.isApplicable()) { | 522 if (fPreBlend.isApplicable()) { |
523 applyLUTToA8Mask(mask, fPreBlend.fG); | 523 applyLUTToA8Mask(mask, fPreBlend.fG); |
524 } | 524 } |
525 } else { | 525 } else { |
526 SkASSERT(SkMask::kARGB32_Format != mask.fFormat); | 526 SkASSERT(SkMask::kARGB32_Format != mask.fFormat); |
527 generateMask(mask, devPath, fPreBlend); | 527 generateMask(mask, devPath, fPreBlend); |
(...skipping 18 matching lines...) Expand all Loading... |
546 srcM.fRowBytes = SkAlign4(srcM.fBounds.width()); | 546 srcM.fRowBytes = SkAlign4(srcM.fBounds.width()); |
547 size_t size = srcM.computeImageSize(); | 547 size_t size = srcM.computeImageSize(); |
548 a8storage.reset(size); | 548 a8storage.reset(size); |
549 srcM.fImage = (uint8_t*)a8storage.get(); | 549 srcM.fImage = (uint8_t*)a8storage.get(); |
550 extract_alpha(srcM, | 550 extract_alpha(srcM, |
551 (const SkPMColor*)glyph->fImage, glyph->rowBytes()); | 551 (const SkPMColor*)glyph->fImage, glyph->rowBytes()); |
552 } | 552 } |
553 | 553 |
554 fRec.getMatrixFrom2x2(&matrix); | 554 fRec.getMatrixFrom2x2(&matrix); |
555 | 555 |
556 if (fMaskFilter->filterMask(&dstM, srcM, matrix, NULL)) { | 556 if (fMaskFilter->filterMask(&dstM, srcM, matrix, nullptr)) { |
557 int width = SkFastMin32(origGlyph.fWidth, dstM.fBounds.width()); | 557 int width = SkFastMin32(origGlyph.fWidth, dstM.fBounds.width()); |
558 int height = SkFastMin32(origGlyph.fHeight, dstM.fBounds.height()); | 558 int height = SkFastMin32(origGlyph.fHeight, dstM.fBounds.height()); |
559 int dstRB = origGlyph.rowBytes(); | 559 int dstRB = origGlyph.rowBytes(); |
560 int srcRB = dstM.fRowBytes; | 560 int srcRB = dstM.fRowBytes; |
561 | 561 |
562 const uint8_t* src = (const uint8_t*)dstM.fImage; | 562 const uint8_t* src = (const uint8_t*)dstM.fImage; |
563 uint8_t* dst = (uint8_t*)origGlyph.fImage; | 563 uint8_t* dst = (uint8_t*)origGlyph.fImage; |
564 | 564 |
565 if (SkMask::k3D_Format == dstM.fFormat) { | 565 if (SkMask::k3D_Format == dstM.fFormat) { |
566 // we have to copy 3 times as much | 566 // we have to copy 3 times as much |
(...skipping 11 matching lines...) Expand all Loading... |
578 SkMask::FreeImage(dstM.fImage); | 578 SkMask::FreeImage(dstM.fImage); |
579 | 579 |
580 if (fPreBlendForFilter.isApplicable()) { | 580 if (fPreBlendForFilter.isApplicable()) { |
581 applyLUTToA8Mask(srcM, fPreBlendForFilter.fG); | 581 applyLUTToA8Mask(srcM, fPreBlendForFilter.fG); |
582 } | 582 } |
583 } | 583 } |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 void SkScalerContext::getPath(const SkGlyph& glyph, SkPath* path) { | 587 void SkScalerContext::getPath(const SkGlyph& glyph, SkPath* path) { |
588 this->internalGetPath(glyph, NULL, path, NULL); | 588 this->internalGetPath(glyph, nullptr, path, nullptr); |
589 } | 589 } |
590 | 590 |
591 void SkScalerContext::getFontMetrics(SkPaint::FontMetrics* fm) { | 591 void SkScalerContext::getFontMetrics(SkPaint::FontMetrics* fm) { |
592 this->generateFontMetrics(fm); | 592 this->generateFontMetrics(fm); |
593 } | 593 } |
594 | 594 |
595 SkUnichar SkScalerContext::generateGlyphToChar(uint16_t glyph) { | 595 SkUnichar SkScalerContext::generateGlyphToChar(uint16_t glyph) { |
596 return 0; | 596 return 0; |
597 } | 597 } |
598 | 598 |
599 /////////////////////////////////////////////////////////////////////////////// | 599 /////////////////////////////////////////////////////////////////////////////// |
600 | 600 |
601 void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath, | 601 void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath, |
602 SkPath* devPath, SkMatrix* fillToDevMatrix) { | 602 SkPath* devPath, SkMatrix* fillToDevMatrix) { |
603 SkPath path; | 603 SkPath path; |
604 generatePath(glyph, &path); | 604 generatePath(glyph, &path); |
605 | 605 |
606 if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) { | 606 if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) { |
607 SkFixed dx = glyph.getSubXFixed(); | 607 SkFixed dx = glyph.getSubXFixed(); |
608 SkFixed dy = glyph.getSubYFixed(); | 608 SkFixed dy = glyph.getSubYFixed(); |
609 if (dx | dy) { | 609 if (dx | dy) { |
610 path.offset(SkFixedToScalar(dx), SkFixedToScalar(dy)); | 610 path.offset(SkFixedToScalar(dx), SkFixedToScalar(dy)); |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 if (fRec.fFrameWidth > 0 || fPathEffect != NULL) { | 614 if (fRec.fFrameWidth > 0 || fPathEffect != nullptr) { |
615 // need the path in user-space, with only the point-size applied | 615 // need the path in user-space, with only the point-size applied |
616 // so that our stroking and effects will operate the same way they | 616 // so that our stroking and effects will operate the same way they |
617 // would if the user had extracted the path themself, and then | 617 // would if the user had extracted the path themself, and then |
618 // called drawPath | 618 // called drawPath |
619 SkPath localPath; | 619 SkPath localPath; |
620 SkMatrix matrix, inverse; | 620 SkMatrix matrix, inverse; |
621 | 621 |
622 fRec.getMatrixFrom2x2(&matrix); | 622 fRec.getMatrixFrom2x2(&matrix); |
623 if (!matrix.invert(&inverse)) { | 623 if (!matrix.invert(&inverse)) { |
624 // assume fillPath and devPath are already empty. | 624 // assume fillPath and devPath are already empty. |
625 return; | 625 return; |
626 } | 626 } |
627 path.transform(inverse, &localPath); | 627 path.transform(inverse, &localPath); |
628 // now localPath is only affected by the paint settings, and not the can
vas matrix | 628 // now localPath is only affected by the paint settings, and not the can
vas matrix |
629 | 629 |
630 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 630 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); |
631 | 631 |
632 if (fRec.fFrameWidth > 0) { | 632 if (fRec.fFrameWidth > 0) { |
633 rec.setStrokeStyle(fRec.fFrameWidth, | 633 rec.setStrokeStyle(fRec.fFrameWidth, |
634 SkToBool(fRec.fFlags & kFrameAndFill_Flag)); | 634 SkToBool(fRec.fFlags & kFrameAndFill_Flag)); |
635 // glyphs are always closed contours, so cap type is ignored, | 635 // glyphs are always closed contours, so cap type is ignored, |
636 // so we just pass something. | 636 // so we just pass something. |
637 rec.setStrokeParams(SkPaint::kButt_Cap, | 637 rec.setStrokeParams(SkPaint::kButt_Cap, |
638 (SkPaint::Join)fRec.fStrokeJoin, | 638 (SkPaint::Join)fRec.fStrokeJoin, |
639 fRec.fMiterLimit); | 639 fRec.fMiterLimit); |
640 } | 640 } |
641 | 641 |
642 if (fPathEffect) { | 642 if (fPathEffect) { |
643 SkPath effectPath; | 643 SkPath effectPath; |
644 if (fPathEffect->filterPath(&effectPath, localPath, &rec, NULL)) { | 644 if (fPathEffect->filterPath(&effectPath, localPath, &rec, nullptr))
{ |
645 localPath.swap(effectPath); | 645 localPath.swap(effectPath); |
646 } | 646 } |
647 } | 647 } |
648 | 648 |
649 if (rec.needToApply()) { | 649 if (rec.needToApply()) { |
650 SkPath strokePath; | 650 SkPath strokePath; |
651 if (rec.applyToPath(&strokePath, localPath)) { | 651 if (rec.applyToPath(&strokePath, localPath)) { |
652 localPath.swap(strokePath); | 652 localPath.swap(strokePath); |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 // now return stuff to the caller | 656 // now return stuff to the caller |
657 if (fillToDevMatrix) { | 657 if (fillToDevMatrix) { |
658 *fillToDevMatrix = matrix; | 658 *fillToDevMatrix = matrix; |
659 } | 659 } |
660 if (devPath) { | 660 if (devPath) { |
661 localPath.transform(matrix, devPath); | 661 localPath.transform(matrix, devPath); |
662 } | 662 } |
663 if (fillPath) { | 663 if (fillPath) { |
664 fillPath->swap(localPath); | 664 fillPath->swap(localPath); |
665 } | 665 } |
666 } else { // nothing tricky to do | 666 } else { // nothing tricky to do |
667 if (fillToDevMatrix) { | 667 if (fillToDevMatrix) { |
668 fillToDevMatrix->reset(); | 668 fillToDevMatrix->reset(); |
669 } | 669 } |
670 if (devPath) { | 670 if (devPath) { |
671 if (fillPath == NULL) { | 671 if (fillPath == nullptr) { |
672 devPath->swap(path); | 672 devPath->swap(path); |
673 } else { | 673 } else { |
674 *devPath = path; | 674 *devPath = path; |
675 } | 675 } |
676 } | 676 } |
677 | 677 |
678 if (fillPath) { | 678 if (fillPath) { |
679 fillPath->swap(path); | 679 fillPath->swap(path); |
680 } | 680 } |
681 } | 681 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 867 |
868 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 868 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
869 bool allowFailure) const { | 869 bool allowFailure) const { |
870 SkScalerContext* c = this->onCreateScalerContext(desc); | 870 SkScalerContext* c = this->onCreateScalerContext(desc); |
871 | 871 |
872 if (!c && !allowFailure) { | 872 if (!c && !allowFailure) { |
873 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); | 873 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); |
874 } | 874 } |
875 return c; | 875 return c; |
876 } | 876 } |
OLD | NEW |