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

Side by Side Diff: src/fonts/SkTestScalerContext.cpp

Issue 939123002: Make fID and MixedID calculations private (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Support android build Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDescriptor.h" 10 #include "SkDescriptor.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 fPaths[index] = path; 110 fPaths[index] = path;
111 } 111 }
112 } 112 }
113 113
114 SkTestTypeface::SkTestTypeface(SkTestFont* testFont, const SkFontStyle& style) 114 SkTestTypeface::SkTestTypeface(SkTestFont* testFont, const SkFontStyle& style)
115 : SkTypeface(style, SkTypefaceCache::NewFontID(), false) 115 : SkTypeface(style, SkTypefaceCache::NewFontID(), false)
116 , fTestFont(testFont) { 116 , fTestFont(testFont) {
117 } 117 }
118 118
119 void SkTestTypeface::getAdvance(SkGlyph* glyph) { 119 void SkTestTypeface::getAdvance(SkGlyph* glyph) {
120 glyph->fAdvanceX = fTestFont->fWidths[SkGlyph::ID2Code(glyph->fID)]; 120 glyph->fAdvanceX = fTestFont->fWidths[glyph->getGlyphID()];
121 glyph->fAdvanceY = 0; 121 glyph->fAdvanceY = 0;
122 } 122 }
123 123
124 void SkTestTypeface::getFontMetrics(SkPaint::FontMetrics* metrics) { 124 void SkTestTypeface::getFontMetrics(SkPaint::FontMetrics* metrics) {
125 *metrics = fTestFont->fMetrics; 125 *metrics = fTestFont->fMetrics;
126 } 126 }
127 127
128 void SkTestTypeface::getMetrics(SkGlyph* glyph) { 128 void SkTestTypeface::getMetrics(SkGlyph* glyph) {
129 glyph->fAdvanceX = fTestFont->fWidths[SkGlyph::ID2Code(glyph->fID)]; 129 glyph->fAdvanceX = fTestFont->fWidths[glyph->getGlyphID()];
130 glyph->fAdvanceY = 0; 130 glyph->fAdvanceY = 0;
131 } 131 }
132 132
133 void SkTestTypeface::getPath(const SkGlyph& glyph, SkPath* path) { 133 void SkTestTypeface::getPath(const SkGlyph& glyph, SkPath* path) {
134 *path = *fTestFont->fPaths[SkGlyph::ID2Code(glyph.fID)]; 134 *path = *fTestFont->fPaths[glyph.getGlyphID()];
135 } 135 }
136 136
137 void SkTestTypeface::onFilterRec(SkScalerContextRec* rec) const { 137 void SkTestTypeface::onFilterRec(SkScalerContextRec* rec) const {
138 rec->setHinting(SkPaint::kNo_Hinting); 138 rec->setHinting(SkPaint::kNo_Hinting);
139 rec->fMaskFormat = SkMask::kA8_Format; 139 rec->fMaskFormat = SkMask::kA8_Format;
140 } 140 }
141 141
142 SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics( 142 SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics(
143 SkAdvancedTypefaceMetrics::PerGlyphInfo , 143 SkAdvancedTypefaceMetrics::PerGlyphInfo ,
144 const uint32_t* glyphIDs, 144 const uint32_t* glyphIDs,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 private: 290 private:
291 SkTestTypeface* fFace; 291 SkTestTypeface* fFace;
292 SkMatrix fMatrix; 292 SkMatrix fMatrix;
293 }; 293 };
294 294
295 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const { 295 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const {
296 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc)); 296 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc));
297 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698