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

Side by Side Diff: src/ports/SkFontHost_win_dw.cpp

Issue 271673004: DirectWrite to not round already subpixel metrics. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkTypes.h" 8 #include "SkTypes.h"
9 #undef GetGlyphIndices 9 #undef GetGlyphIndices
10 10
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 HRVM(fTypeface->fDWriteFontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm) , 852 HRVM(fTypeface->fDWriteFontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm) ,
853 "Could not get design metrics."); 853 "Could not get design metrics.");
854 } 854 }
855 855
856 DWRITE_FONT_METRICS dwfm; 856 DWRITE_FONT_METRICS dwfm;
857 fTypeface->fDWriteFontFace->GetMetrics(&dwfm); 857 fTypeface->fDWriteFontFace->GetMetrics(&dwfm);
858 SkScalar advanceX = SkScalarMulDiv(fTextSizeMeasure, 858 SkScalar advanceX = SkScalarMulDiv(fTextSizeMeasure,
859 SkIntToScalar(gm.advanceWidth), 859 SkIntToScalar(gm.advanceWidth),
860 SkIntToScalar(dwfm.designUnitsPerEm)); 860 SkIntToScalar(dwfm.designUnitsPerEm));
861 861
862 if (!this->isSubpixel()) {
863 advanceX = SkScalarRoundToScalar(advanceX);
864 }
865
866 SkVector vecs[1] = { { advanceX, 0 } }; 862 SkVector vecs[1] = { { advanceX, 0 } };
867 if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode || 863 if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode ||
868 DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode) 864 DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode)
869 { 865 {
870 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); 866 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs));
871 } else { 867 } else {
872 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); 868 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs));
873 } 869 }
874 870
875 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX); 871 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX);
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 } 1998 }
2003 1999
2004 #include "SkFontMgr_indirect.h" 2000 #include "SkFontMgr_indirect.h"
2005 SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { 2001 SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) {
2006 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); 2002 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite());
2007 if (impl.get() == NULL) { 2003 if (impl.get() == NULL) {
2008 return NULL; 2004 return NULL;
2009 } 2005 }
2010 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); 2006 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy));
2011 } 2007 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698