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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 SkPaint paint(origPaint); | 1893 SkPaint paint(origPaint); |
1894 SkScalar matrixScale = paint.setupForAsPaths(); | 1894 SkScalar matrixScale = paint.setupForAsPaths(); |
1895 | 1895 |
1896 SkMatrix matrix; | 1896 SkMatrix matrix; |
1897 matrix.setScale(matrixScale, matrixScale); | 1897 matrix.setScale(matrixScale, matrixScale); |
1898 | 1898 |
1899 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); | 1899 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); |
1900 SkAutoGlyphCache autoCache(paint, NULL, NULL); | 1900 SkAutoGlyphCache autoCache(paint, NULL, NULL); |
1901 SkGlyphCache* cache = autoCache.getCache(); | 1901 SkGlyphCache* cache = autoCache.getCache(); |
1902 | 1902 |
| 1903 // After SkGlyphCache is detached, the path effect should be set to NULL in |
| 1904 // SkPaint. And the path for text will be filled, so SkPaint should be set |
| 1905 // to fill style, w/ the exception of hairline stroked text w/o path effect. |
| 1906 if (origPaint.getStyle() == SkPaint::kStroke_Style && |
| 1907 origPaint.getStrokeWidth() == 0 && origPaint.getPathEffect() == NULL) { |
| 1908 paint.setStyle(SkPaint::kStroke_Style); |
| 1909 } else { |
| 1910 paint.setStyle(SkPaint::kFill_Style); |
| 1911 } |
| 1912 |
| 1913 paint.setPathEffect(NULL); |
| 1914 |
1903 const char* stop = text + byteLength; | 1915 const char* stop = text + byteLength; |
1904 AlignProc_scalar alignProc = pick_align_proc_scalar(paint.getTextAlign()); | 1916 AlignProc_scalar alignProc = pick_align_proc_scalar(paint.getTextAlign()); |
1905 TextMapState tms(SkMatrix::I(), constY); | 1917 TextMapState tms(SkMatrix::I(), constY); |
1906 TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition); | 1918 TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition); |
1907 | 1919 |
1908 while (text < stop) { | 1920 while (text < stop) { |
1909 const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0); | 1921 const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0); |
1910 if (glyph.fWidth) { | 1922 if (glyph.fWidth) { |
1911 const SkPath* path = cache->findPath(glyph); | 1923 const SkPath* path = cache->findPath(glyph); |
1912 if (path) { | 1924 if (path) { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 mask->fImage = SkMask::AllocImage(size); | 2840 mask->fImage = SkMask::AllocImage(size); |
2829 memset(mask->fImage, 0, mask->computeImageSize()); | 2841 memset(mask->fImage, 0, mask->computeImageSize()); |
2830 } | 2842 } |
2831 | 2843 |
2832 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2844 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2833 draw_into_mask(*mask, devPath, style); | 2845 draw_into_mask(*mask, devPath, style); |
2834 } | 2846 } |
2835 | 2847 |
2836 return true; | 2848 return true; |
2837 } | 2849 } |
OLD | NEW |