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

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

Issue 1175253004: initialize font metrics for pdf (found by valgrind) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix cast Created 5 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 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 "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void SkTestTypeface::onFilterRec(SkScalerContextRec* rec) const { 138 void SkTestTypeface::onFilterRec(SkScalerContextRec* rec) const {
139 rec->setHinting(SkPaint::kNo_Hinting); 139 rec->setHinting(SkPaint::kNo_Hinting);
140 } 140 }
141 141
142 SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics( 142 SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics(
143 PerGlyphInfo , 143 PerGlyphInfo ,
144 const uint32_t* glyphIDs, 144 const uint32_t* glyphIDs,
145 uint32_t glyphIDsCount) const { 145 uint32_t glyphIDsCount) const {
146 // pdf only 146 // pdf only
147 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; 147 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
148 info->fFontName.set(fTestFont->fName);
149 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
150 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
151 info->fLastGlyphID = static_cast<uint16_t>(fTestFont->fCharCodesCount - 1);
148 info->fEmSize = 0; 152 info->fEmSize = 0;
149 info->fLastGlyphID = SkToU16(onCountGlyphs() - 1); 153 info->fLastGlyphID = SkToU16(onCountGlyphs() - 1);
hal.canary 2015/06/11 15:55:44 info->fLastGlyphID gets set twice.
150 info->fStyle = 0; 154 info->fStyle = 0;
151 info->fFontName.set(fTestFont->fName);
152 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
153 info->fItalicAngle = 0; 155 info->fItalicAngle = 0;
154 info->fAscent = 0; 156 info->fAscent = 0;
155 info->fDescent = 0; 157 info->fDescent = 0;
156 info->fStemV = 0; 158 info->fStemV = 0;
157 info->fCapHeight = 0; 159 info->fCapHeight = 0;
158 info->fBBox = SkIRect::MakeEmpty(); 160 info->fBBox = SkIRect::MakeEmpty();
159 return info; 161 return info;
160 } 162 }
161 163
162 void SkTestTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const { 164 void SkTestTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 286 }
285 287
286 private: 288 private:
287 SkTestTypeface* fFace; 289 SkTestTypeface* fFace;
288 SkMatrix fMatrix; 290 SkMatrix fMatrix;
289 }; 291 };
290 292
291 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const { 293 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const {
292 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc)); 294 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d esc));
293 } 295 }
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