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

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

Issue 344253002: DirectWrite to not round already subpixel metrics. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 HRVM(fTypeface->fDWriteFontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm) , 281 HRVM(fTypeface->fDWriteFontFace->GetDesignGlyphMetrics(&glyphId, 1, &gm) ,
282 "Could not get design metrics."); 282 "Could not get design metrics.");
283 } 283 }
284 284
285 DWRITE_FONT_METRICS dwfm; 285 DWRITE_FONT_METRICS dwfm;
286 fTypeface->fDWriteFontFace->GetMetrics(&dwfm); 286 fTypeface->fDWriteFontFace->GetMetrics(&dwfm);
287 SkScalar advanceX = SkScalarMulDiv(fTextSizeMeasure, 287 SkScalar advanceX = SkScalarMulDiv(fTextSizeMeasure,
288 SkIntToScalar(gm.advanceWidth), 288 SkIntToScalar(gm.advanceWidth),
289 SkIntToScalar(dwfm.designUnitsPerEm)); 289 SkIntToScalar(dwfm.designUnitsPerEm));
290 290
291 if (!this->isSubpixel()) {
292 advanceX = SkScalarRoundToScalar(advanceX);
293 }
294
295 SkVector vecs[1] = { { advanceX, 0 } }; 291 SkVector vecs[1] = { { advanceX, 0 } };
296 if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode || 292 if (DWRITE_MEASURING_MODE_GDI_CLASSIC == fMeasuringMode ||
297 DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode) 293 DWRITE_MEASURING_MODE_GDI_NATURAL == fMeasuringMode)
298 { 294 {
299 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); 295 fG_inv.mapVectors(vecs, SK_ARRAY_COUNT(vecs));
300 } else { 296 } else {
301 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs)); 297 fSkXform.mapVectors(vecs, SK_ARRAY_COUNT(vecs));
302 } 298 }
303 299
304 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX); 300 glyph->fAdvanceX = SkScalarToFixed(vecs[0].fX);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 NULL, //advances 610 NULL, //advances
615 NULL, //offsets 611 NULL, //offsets
616 1, //num glyphs 612 1, //num glyphs
617 FALSE, //sideways 613 FALSE, //sideways
618 FALSE, //rtl 614 FALSE, //rtl
619 geometryToPath.get()), 615 geometryToPath.get()),
620 "Could not create glyph outline."); 616 "Could not create glyph outline.");
621 617
622 path->transform(fSkXform); 618 path->transform(fSkXform);
623 } 619 }
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