Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: src/core/SkDraw.cpp

Issue 284763010: fix the rendering error for drawPosText_asPaths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: also fix the rendering error for text with path effects Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698