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

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

Issue 79283004: Minor fixes for distance field fonts: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/GrBitmapTextContext.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 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 } 1995 }
1996 1996
1997 if (ShouldDrawTextAsPaths(paint, *fMatrix)) { 1997 if (ShouldDrawTextAsPaths(paint, *fMatrix)) {
1998 this->drawPosText_asPaths(text, byteLength, pos, constY, 1998 this->drawPosText_asPaths(text, byteLength, pos, constY,
1999 scalarsPerPosition, paint); 1999 scalarsPerPosition, paint);
2000 return; 2000 return;
2001 } 2001 }
2002 2002
2003 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); 2003 SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
2004 #if SK_DISTANCEFIELD_FONTS 2004 #if SK_DISTANCEFIELD_FONTS
2005 const SkMatrix* ctm = fMatrix; 2005 const SkMatrix* ctm = fMatrix;
bsalomon 2013/11/20 22:18:06 Would it be simpler to turn this into: const SkMa
jvanverth1 2013/11/21 14:25:40 My plan is to rip out all of the distance field co
2006 SkMatrix identity;
2007 identity.setIdentity();
bsalomon 2013/11/20 22:18:06 setIdentity() should probably be marked deprecated
jvanverth1 2013/11/21 14:25:40 Done.
2006 const SkPaint* paintRef = &paint; 2008 const SkPaint* paintRef = &paint;
2007 SkPaint paintCopy; 2009 SkPaint paintCopy;
2008 uint32_t procFlags = fProcs ? fProcs->fFlags : 0; 2010 uint32_t procFlags = fProcs ? fProcs->fFlags : 0;
2009 if (procFlags & SkDrawProcs::kUseScaledGlyphs_Flag) { 2011 if (procFlags & SkDrawProcs::kUseScaledGlyphs_Flag) {
2010 paintCopy = paint; 2012 paintCopy = paint;
2011 paintCopy.setTextSize(SkDrawProcs::kBaseDFFontSize); 2013 paintCopy.setTextSize(SkDrawProcs::kBaseDFFontSize);
2012 paintRef = &paintCopy; 2014 paintRef = &paintCopy;
2013 } 2015 }
2014 if (procFlags & SkDrawProcs::kSkipBakedGlyphTransform_Flag) { 2016 if (procFlags & SkDrawProcs::kSkipBakedGlyphTransform_Flag) {
2015 ctm = NULL; 2017 ctm = &identity;
2016 } 2018 }
2017 SkAutoGlyphCache autoCache(*paintRef, &fDevice->fLeakyProperties, ctm); 2019 SkAutoGlyphCache autoCache(*paintRef, &fDevice->fLeakyProperties, ctm);
2018 #else 2020 #else
2019 SkAutoGlyphCache autoCache(paint, &fDevice->fLeakyProperties, fMatrix); 2021 SkAutoGlyphCache autoCache(paint, &fDevice->fLeakyProperties, fMatrix);
2020 #endif 2022 #endif
2021 SkGlyphCache* cache = autoCache.getCache(); 2023 SkGlyphCache* cache = autoCache.getCache();
2022 2024
2023 SkAAClipBlitterWrapper wrapper; 2025 SkAAClipBlitterWrapper wrapper;
2024 SkAutoBlitterChoose blitterChooser; 2026 SkAutoBlitterChoose blitterChooser;
2025 SkBlitter* blitter = NULL; 2027 SkBlitter* blitter = NULL;
2026 if (needsRasterTextBlit(*this)) { 2028 if (needsRasterTextBlit(*this)) {
2027 blitterChooser.choose(*fBitmap, *fMatrix, paint); 2029 blitterChooser.choose(*fBitmap, *fMatrix, paint);
2028 blitter = blitterChooser.get(); 2030 blitter = blitterChooser.get();
2029 if (fRC->isAA()) { 2031 if (fRC->isAA()) {
2030 wrapper.init(*fRC, blitter); 2032 wrapper.init(*fRC, blitter);
2031 blitter = wrapper.getBlitter(); 2033 blitter = wrapper.getBlitter();
2032 } 2034 }
2033 } 2035 }
2034 2036
2035 const char* stop = text + byteLength; 2037 const char* stop = text + byteLength;
2036 AlignProc alignProc = pick_align_proc(paint.getTextAlign()); 2038 AlignProc alignProc = pick_align_proc(paint.getTextAlign());
2037 SkDraw1Glyph d1g; 2039 SkDraw1Glyph d1g;
2038 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint); 2040 SkDraw1Glyph::Proc proc = d1g.init(this, blitter, cache, paint);
2041 #if SK_DISTANCEFIELD_FONTS
2042 TextMapState tms(*ctm, constY);
2043 #else
2039 TextMapState tms(*fMatrix, constY); 2044 TextMapState tms(*fMatrix, constY);
2045 #endif
2040 TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition); 2046 TextMapState::Proc tmsProc = tms.pickProc(scalarsPerPosition);
2041 2047
2042 if (cache->isSubpixel()) { 2048 if (cache->isSubpixel()) {
2043 // maybe we should skip the rounding if linearText is set 2049 // maybe we should skip the rounding if linearText is set
2044 SkAxisAlignment baseline = SkComputeAxisAlignmentForHText(*fMatrix); 2050 SkAxisAlignment baseline = SkComputeAxisAlignmentForHText(*fMatrix);
2045 2051
2046 SkFixed fxMask = ~0; 2052 SkFixed fxMask = ~0;
2047 SkFixed fyMask = ~0; 2053 SkFixed fyMask = ~0;
2048 if (kX_SkAxisAlignment == baseline) { 2054 if (kX_SkAxisAlignment == baseline) {
2049 fyMask = 0; 2055 fyMask = 0;
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2879 mask->fImage = SkMask::AllocImage(size); 2885 mask->fImage = SkMask::AllocImage(size);
2880 memset(mask->fImage, 0, mask->computeImageSize()); 2886 memset(mask->fImage, 0, mask->computeImageSize());
2881 } 2887 }
2882 2888
2883 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2889 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2884 draw_into_mask(*mask, devPath, style); 2890 draw_into_mask(*mask, devPath, style);
2885 } 2891 }
2886 2892
2887 return true; 2893 return true;
2888 } 2894 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698