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" |
11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
12 #include "SkDescriptor.h" | 12 #include "SkDescriptor.h" |
13 #include "SkDraw.h" | 13 #include "SkDraw.h" |
14 #include "SkFontHost.h" | 14 #include "SkFontHost.h" |
15 #include "SkGlyph.h" | 15 #include "SkGlyph.h" |
16 #include "SkMaskFilter.h" | 16 #include "SkMaskFilter.h" |
17 #include "SkMaskGamma.h" | 17 #include "SkMaskGamma.h" |
18 #include "SkReadBuffer.h" | 18 #include "SkReadBuffer.h" |
19 #include "SkWriteBuffer.h" | 19 #include "SkWriteBuffer.h" |
20 #include "SkPathEffect.h" | 20 #include "SkPathEffect.h" |
21 #include "SkRasterizer.h" | 21 #include "SkRasterizer.h" |
22 #include "SkRasterClip.h" | 22 #include "SkRasterClip.h" |
23 #include "SkStroke.h" | 23 #include "SkStroke.h" |
24 #include "SkThread.h" | 24 #include "SkThread.h" |
25 | 25 |
26 #ifdef SK_BUILD_FOR_ANDROID | |
27 #include "SkTypeface_android.h" | |
28 #endif | |
29 | |
30 #define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3) | 26 #define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3) |
31 | 27 |
32 void SkGlyph::toMask(SkMask* mask) const { | 28 void SkGlyph::toMask(SkMask* mask) const { |
33 SkASSERT(mask); | 29 SkASSERT(mask); |
34 | 30 |
35 mask->fImage = (uint8_t*)fImage; | 31 mask->fImage = (uint8_t*)fImage; |
36 mask->fBounds.set(fLeft, fTop, fLeft + fWidth, fTop + fHeight); | 32 mask->fBounds.set(fLeft, fTop, fLeft + fWidth, fTop + fHeight); |
37 mask->fRowBytes = this->rowBytes(); | 33 mask->fRowBytes = this->rowBytes(); |
38 mask->fFormat = static_cast<SkMask::Format>(fMaskFormat); | 34 mask->fFormat = static_cast<SkMask::Format>(fMaskFormat); |
39 } | 35 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 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", |
105 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], | 101 rec->fTextSize, rec->fPreScaleX, rec->fPreSkewX, rec->fPost2x2[0][0], |
106 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]); |
107 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\n", |
108 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, | 104 rec->fFrameWidth, rec->fMiterLimit, rec->fHints, rec->fFrameAndFill, |
109 rec->fMaskFormat, rec->fStrokeJoin); | 105 rec->fMaskFormat, rec->fStrokeJoin); |
110 SkDebugf(" pathEffect %x maskFilter %x\n", | 106 SkDebugf(" pathEffect %x maskFilter %x\n", |
111 desc->findEntry(kPathEffect_SkDescriptorTag, NULL), | 107 desc->findEntry(kPathEffect_SkDescriptorTag, NULL), |
112 desc->findEntry(kMaskFilter_SkDescriptorTag, NULL)); | 108 desc->findEntry(kMaskFilter_SkDescriptorTag, NULL)); |
113 #endif | 109 #endif |
114 #ifdef SK_BUILD_FOR_ANDROID | |
115 uint32_t len; | |
116 const void* data = desc->findEntry(kAndroidOpts_SkDescriptorTag, &len); | |
117 if (data) { | |
118 SkReadBuffer buffer(data, len); | |
119 fPaintOptionsAndroid.unflatten(buffer); | |
120 SkASSERT(buffer.offset() == buffer.size()); | |
121 } | |
122 #endif | |
123 } | 110 } |
124 | 111 |
125 SkScalerContext::~SkScalerContext() { | 112 SkScalerContext::~SkScalerContext() { |
126 SkSafeUnref(fPathEffect); | 113 SkSafeUnref(fPathEffect); |
127 SkSafeUnref(fMaskFilter); | 114 SkSafeUnref(fMaskFilter); |
128 SkSafeUnref(fRasterizer); | 115 SkSafeUnref(fRasterizer); |
129 } | 116 } |
130 | 117 |
131 void SkScalerContext::getAdvance(SkGlyph* glyph) { | 118 void SkScalerContext::getAdvance(SkGlyph* glyph) { |
132 // mark us as just having a valid advance | 119 // mark us as just having a valid advance |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
806 bool allowFailure) const { | 793 bool allowFailure) const { |
807 SkScalerContext* c = this->onCreateScalerContext(desc); | 794 SkScalerContext* c = this->onCreateScalerContext(desc); |
808 | 795 |
809 if (!c && !allowFailure) { | 796 if (!c && !allowFailure) { |
810 c = SkNEW_ARGS(SkScalerContext_Empty, | 797 c = SkNEW_ARGS(SkScalerContext_Empty, |
811 (const_cast<SkTypeface*>(this), desc)); | 798 (const_cast<SkTypeface*>(this), desc)); |
812 } | 799 } |
813 return c; | 800 return c; |
814 } | 801 } |
OLD | NEW |