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

Side by Side Diff: src/core/SkDrawProcs.h

Issue 1737693006: Change type of SkGlyph::fAdvance[XY] to float. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Should be float, not SkScalar. Created 4 years, 9 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 | « src/core/SkAutoKern.h ('k') | src/core/SkFDot6.h » ('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 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 #ifndef SkDrawProcs_DEFINED 8 #ifndef SkDrawProcs_DEFINED
9 #define SkDrawProcs_DEFINED 9 #define SkDrawProcs_DEFINED
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 SkTextAlignProc(SkPaint::Align align) 44 SkTextAlignProc(SkPaint::Align align)
45 : fAlign(align) { 45 : fAlign(align) {
46 } 46 }
47 47
48 // Returns the glyph position, which may be rounded or not by the caller 48 // Returns the glyph position, which may be rounded or not by the caller
49 // e.g. subpixel doesn't round. 49 // e.g. subpixel doesn't round.
50 void operator()(const SkPoint& loc, const SkGlyph& glyph, SkPoint* dst) { 50 void operator()(const SkPoint& loc, const SkGlyph& glyph, SkPoint* dst) {
51 if (SkPaint::kLeft_Align == fAlign) { 51 if (SkPaint::kLeft_Align == fAlign) {
52 dst->set(loc.fX, loc.fY); 52 dst->set(loc.fX, loc.fY);
53 } else if (SkPaint::kCenter_Align == fAlign) { 53 } else if (SkPaint::kCenter_Align == fAlign) {
54 dst->set(loc.fX - SkFixedToScalar(glyph.fAdvanceX >> 1), 54 dst->set(loc.fX - SkFloatToScalar(glyph.fAdvanceX) / 2,
55 loc.fY - SkFixedToScalar(glyph.fAdvanceY >> 1)); 55 loc.fY - SkFloatToScalar(glyph.fAdvanceY) / 2);
56 } else { 56 } else {
57 SkASSERT(SkPaint::kRight_Align == fAlign); 57 SkASSERT(SkPaint::kRight_Align == fAlign);
58 dst->set(loc.fX - SkFixedToScalar(glyph.fAdvanceX), 58 dst->set(loc.fX - SkFloatToScalar(glyph.fAdvanceX),
59 loc.fY - SkFixedToScalar(glyph.fAdvanceY)); 59 loc.fY - SkFloatToScalar(glyph.fAdvanceY));
60 } 60 }
61 } 61 }
62 private: 62 private:
63 const SkPaint::Align fAlign; 63 const SkPaint::Align fAlign;
64 }; 64 };
65 65
66 #endif 66 #endif
OLDNEW
« no previous file with comments | « src/core/SkAutoKern.h ('k') | src/core/SkFDot6.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698