OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #include "SkDraw.h" | 8 #include "SkDraw.h" |
9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
10 #include "SkBounder.h" | 10 #include "SkBounder.h" |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 const SkMatrix* ctm = fMatrix; | 2005 const SkMatrix* ctm = fMatrix; |
2006 const SkPaint* paintRef = &paint; | 2006 const SkPaint* paintRef = &paint; |
2007 SkPaint paintCopy; | 2007 SkPaint paintCopy; |
2008 uint32_t procFlags = fProcs ? fProcs->fFlags : 0; | 2008 uint32_t procFlags = fProcs ? fProcs->fFlags : 0; |
2009 if (procFlags & SkDrawProcs::kUseScaledGlyphs_Flag) { | 2009 if (procFlags & SkDrawProcs::kUseScaledGlyphs_Flag) { |
2010 paintCopy = paint; | 2010 paintCopy = paint; |
2011 paintCopy.setTextSize(SkDrawProcs::kBaseDFFontSize); | 2011 paintCopy.setTextSize(SkDrawProcs::kBaseDFFontSize); |
2012 paintRef = &paintCopy; | 2012 paintRef = &paintCopy; |
2013 } | 2013 } |
2014 if (procFlags & SkDrawProcs::kSkipBakedGlyphTransform_Flag) { | 2014 if (procFlags & SkDrawProcs::kSkipBakedGlyphTransform_Flag) { |
2015 ctm = NULL; | 2015 ctm = &SkMatrix::I(); |
2016 } | 2016 } |
2017 SkAutoGlyphCache autoCache(*paintRef, &fDevice->fLeakyProperties, ctm); | 2017 SkAutoGlyphCache autoCache(*paintRef, &fDevice->fLeakyProperties, ctm); |
2018 #else | 2018 #else |
2019 SkAutoGlyphCache autoCache(paint, &fDevice->fLeakyProperties, fMatrix); | 2019 SkAutoGlyphCache autoCache(paint, &fDevice->fLeakyProperties, fMatrix); |
2020 #endif | 2020 #endif |
2021 SkGlyphCache* cache = autoCache.getCache(); | 2021 SkGlyphCache* cache = autoCache.getCache(); |
2022 | 2022 |
2023 SkAAClipBlitterWrapper wrapper; | 2023 SkAAClipBlitterWrapper wrapper; |
2024 SkAutoBlitterChoose blitterChooser; | 2024 SkAutoBlitterChoose blitterChooser; |
2025 SkBlitter* blitter = NULL; | 2025 SkBlitter* blitter = NULL; |
2026 if (needsRasterTextBlit(*this)) { | 2026 if (needsRasterTextBlit(*this)) { |
2027 blitterChooser.choose(*fBitmap, *fMatrix, paint); | 2027 blitterChooser.choose(*fBitmap, *fMatrix, paint); |
2028 blitter = blitterChooser.get(); | 2028 blitter = blitterChooser.get(); |
2029 if (fRC->isAA()) { | 2029 if (fRC->isAA()) { |
2030 wrapper.init(*fRC, blitter); | 2030 wrapper.init(*fRC, blitter); |
2031 blitter = wrapper.getBlitter(); | 2031 blitter = wrapper.getBlitter(); |
2032 } | 2032 } |
2033 } | 2033 } |
2034 | 2034 |
2035 const char* stop = text + byteLength; | 2035 const char* stop = text + byteLength; |
2036 AlignProc alignProc = pick_align_proc(paint.getTextAlign()); | 2036 AlignProc alignProc = pick_align_proc(paint.getTextAlign()); |
2037 SkDraw1Glyph d1g; | 2037 SkDraw1Glyph d1g; |
2038 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); | 2038 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); |
| 2039 #if SK_DISTANCEFIELD_FONTS |
| 2040 TextMapState tms(*ctm, constY); |
| 2041 #else |
2039 TextMapState tms(*fMatrix, constY); | 2042 TextMapState tms(*fMatrix, constY); |
| 2043 #endif |
2040 TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition); | 2044 TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition); |
2041 | 2045 |
2042 if (cache->isSubpixel()) { | 2046 if (cache->isSubpixel()) { |
2043 // maybe we should skip the rounding if linearText is set | 2047 // maybe we should skip the rounding if linearText is set |
2044 SkAxisAlignment baseline = SkComputeAxisAlignmentForHText(*fMatrix); | 2048 SkAxisAlignment baseline = SkComputeAxisAlignmentForHText(*fMatrix); |
2045 | 2049 |
2046 SkFixed fxMask = ~0; | 2050 SkFixed fxMask = ~0; |
2047 SkFixed fyMask = ~0; | 2051 SkFixed fyMask = ~0; |
2048 if (kX_SkAxisAlignment == baseline) { | 2052 if (kX_SkAxisAlignment == baseline) { |
2049 fyMask = 0; | 2053 fyMask = 0; |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 mask->fImage = SkMask::AllocImage(size); | 2883 mask->fImage = SkMask::AllocImage(size); |
2880 memset(mask->fImage, 0, mask->computeImageSize()); | 2884 memset(mask->fImage, 0, mask->computeImageSize()); |
2881 } | 2885 } |
2882 | 2886 |
2883 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2887 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2884 draw_into_mask(*mask, devPath, style); | 2888 draw_into_mask(*mask, devPath, style); |
2885 } | 2889 } |
2886 | 2890 |
2887 return true; | 2891 return true; |
2888 } | 2892 } |
OLD | NEW |