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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec) | 93 , fPreBlendForFilter(fMaskFilter ? SkScalerContext::GetMaskPreBlend(fRec) |
94 : SkMaskGamma::PreBlend()) | 94 : SkMaskGamma::PreBlend()) |
95 { | 95 { |
96 #ifdef DUMP_REC | 96 #ifdef DUMP_REC |
97 desc->assertChecksum(); | 97 desc->assertChecksum(); |
98 SkDebugf("SkScalerContext checksum %x count %d length %d\n", | 98 SkDebugf("SkScalerContext checksum %x count %d length %d\n", |
99 desc->getChecksum(), desc->getCount(), desc->getLength()); | 99 desc->getChecksum(), desc->getCount(), desc->getLength()); |
100 SkDebugf(" textsize %g prescale %g preskew %g post [%g %g %g %g]\n", | 100 SkDebugf(" textsize %g prescale %g preskew %g post [%g %g %g %g]\n", |
101 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], | 101 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], |
102 rec->fPost2x2[0][1], rec->fPost2x2[1][0], rec->fPost2x2[1][1]); | 102 rec->fPost2x2[0][1], rec->fPost2x2[1][0], rec->fPost2x2[1][1]); |
103 SkDebugf(" frame %g miter %g hints %d framefill %d format %d join %d\n", | 103 SkDebugf(" frame %g miter %g hints %d framefill %d format %d join %d cap %d
\n", |
104 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, | 104 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, |
105 rec->fMaskFormat, rec->fStrokeJoin); | 105 rec->fMaskFormat, rec->fStrokeJoin, rec->fStrokeCap); |
106 SkDebugf(" pathEffect %x maskFilter %x\n", | 106 SkDebugf(" pathEffect %x maskFilter %x\n", |
107 desc->findEntry(kPathEffect_SkDescriptorTag, nullptr), | 107 desc->findEntry(kPathEffect_SkDescriptorTag, nullptr), |
108 desc->findEntry(kMaskFilter_SkDescriptorTag, nullptr)); | 108 desc->findEntry(kMaskFilter_SkDescriptorTag, nullptr)); |
109 #endif | 109 #endif |
110 } | 110 } |
111 | 111 |
112 SkScalerContext::~SkScalerContext() { | 112 SkScalerContext::~SkScalerContext() { |
113 SkSafeUnref(fPathEffect); | 113 SkSafeUnref(fPathEffect); |
114 SkSafeUnref(fMaskFilter); | 114 SkSafeUnref(fMaskFilter); |
115 SkSafeUnref(fRasterizer); | 115 SkSafeUnref(fRasterizer); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 path.transform(inverse, &localPath); | 628 path.transform(inverse, &localPath); |
629 // now localPath is only affected by the paint settings, and not the can
vas matrix | 629 // now localPath is only affected by the paint settings, and not the can
vas matrix |
630 | 630 |
631 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 631 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); |
632 | 632 |
633 if (fRec.fFrameWidth > 0) { | 633 if (fRec.fFrameWidth > 0) { |
634 rec.setStrokeStyle(fRec.fFrameWidth, | 634 rec.setStrokeStyle(fRec.fFrameWidth, |
635 SkToBool(fRec.fFlags & kFrameAndFill_Flag)); | 635 SkToBool(fRec.fFlags & kFrameAndFill_Flag)); |
636 // glyphs are always closed contours, so cap type is ignored, | 636 // glyphs are always closed contours, so cap type is ignored, |
637 // so we just pass something. | 637 // so we just pass something. |
638 rec.setStrokeParams(SkPaint::kButt_Cap, | 638 rec.setStrokeParams((SkPaint::Cap)fRec.fStrokeCap, |
639 (SkPaint::Join)fRec.fStrokeJoin, | 639 (SkPaint::Join)fRec.fStrokeJoin, |
640 fRec.fMiterLimit); | 640 fRec.fMiterLimit); |
641 } | 641 } |
642 | 642 |
643 if (fPathEffect) { | 643 if (fPathEffect) { |
644 SkPath effectPath; | 644 SkPath effectPath; |
645 if (fPathEffect->filterPath(&effectPath, localPath, &rec, nullptr))
{ | 645 if (fPathEffect->filterPath(&effectPath, localPath, &rec, nullptr))
{ |
646 localPath.swap(effectPath); | 646 localPath.swap(effectPath); |
647 } | 647 } |
648 } | 648 } |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 | 880 |
881 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 881 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
882 bool allowFailure) const { | 882 bool allowFailure) const { |
883 SkScalerContext* c = this->onCreateScalerContext(desc); | 883 SkScalerContext* c = this->onCreateScalerContext(desc); |
884 | 884 |
885 if (!c && !allowFailure) { | 885 if (!c && !allowFailure) { |
886 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); | 886 c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); |
887 } | 887 } |
888 return c; | 888 return c; |
889 } | 889 } |
OLD | NEW |