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

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

Issue 1900193002: SkFontHost/FreeType/ToUnicode: add an assert (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-20 (Wednesday) 11:05:56 EDT Created 4 years, 8 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 FT_Fixed advance = 0; 438 FT_Fixed advance = 0;
439 if (FT_Get_Advances(face, gId, 1, FT_LOAD_NO_SCALE, &advance)) { 439 if (FT_Get_Advances(face, gId, 1, FT_LOAD_NO_SCALE, &advance)) {
440 return false; 440 return false;
441 } 441 }
442 SkASSERT(data); 442 SkASSERT(data);
443 *data = advance; 443 *data = advance;
444 return true; 444 return true;
445 } 445 }
446 446
447 static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyph ToUnicode) { 447 static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyph ToUnicode) {
448 glyphToUnicode->setCount(face->num_glyphs); 448 FT_Long numGlyphs = face->num_glyphs;
449 sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * face->num_g lyphs); 449 glyphToUnicode->setCount(SkToInt(numGlyphs));
450 sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * numGlyphs);
450 451
451 FT_UInt glyphIndex; 452 FT_UInt glyphIndex;
452 SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex); 453 SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
453 while (glyphIndex) { 454 while (glyphIndex) {
455 SkASSERT(glyphIndex < SkToUInt(numGlyphs));
454 (*glyphToUnicode)[glyphIndex] = charCode; 456 (*glyphToUnicode)[glyphIndex] = charCode;
455 charCode = FT_Get_Next_Char(face, charCode, &glyphIndex); 457 charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
456 } 458 }
457 } 459 }
458 460
459 SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics( 461 SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
460 PerGlyphInfo perGlyphInfo, 462 PerGlyphInfo perGlyphInfo,
461 const uint32_t* glyphIDs, 463 const uint32_t* glyphIDs,
462 uint32_t glyphIDsCount) const { 464 uint32_t glyphIDsCount) const {
463 #if defined(SK_BUILD_FOR_MAC) 465 #if defined(SK_BUILD_FOR_MAC)
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", 1819 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
1818 name.c_str(), 1820 name.c_str(),
1819 (skTag >> 24) & 0xFF, 1821 (skTag >> 24) & 0xFF,
1820 (skTag >> 16) & 0xFF, 1822 (skTag >> 16) & 0xFF,
1821 (skTag >> 8) & 0xFF, 1823 (skTag >> 8) & 0xFF,
1822 (skTag) & 0xFF)); 1824 (skTag) & 0xFF));
1823 } 1825 }
1824 } 1826 }
1825 ) 1827 )
1826 } 1828 }
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