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

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

Issue 100063002: Need to hold the FT library mutex to use the library. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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 | Annotate | Revision Log
« 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 FT_Set_Transform( fFace, &fMatrix22, NULL); 954 FT_Set_Transform( fFace, &fMatrix22, NULL);
955 } 955 }
956 return err; 956 return err;
957 } 957 }
958 958
959 unsigned SkScalerContext_FreeType::generateGlyphCount() { 959 unsigned SkScalerContext_FreeType::generateGlyphCount() {
960 return fFace->num_glyphs; 960 return fFace->num_glyphs;
961 } 961 }
962 962
963 uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) { 963 uint16_t SkScalerContext_FreeType::generateCharToGlyph(SkUnichar uni) {
964 SkAutoMutexAcquire ac(gFTMutex);
964 return SkToU16(FT_Get_Char_Index( fFace, uni )); 965 return SkToU16(FT_Get_Char_Index( fFace, uni ));
965 } 966 }
966 967
967 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) { 968 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) {
969 SkAutoMutexAcquire ac(gFTMutex);
968 // iterate through each cmap entry, looking for matching glyph indices 970 // iterate through each cmap entry, looking for matching glyph indices
969 FT_UInt glyphIndex; 971 FT_UInt glyphIndex;
970 SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex ); 972 SkUnichar charCode = FT_Get_First_Char( fFace, &glyphIndex );
971 973
972 while (glyphIndex != 0) { 974 while (glyphIndex != 0) {
973 if (glyphIndex == glyph) { 975 if (glyphIndex == glyph) {
974 return charCode; 976 return charCode;
975 } 977 }
976 charCode = FT_Get_Next_Char( fFace, charCode, &glyphIndex ); 978 charCode = FT_Get_Next_Char( fFace, charCode, &glyphIndex );
977 } 979 }
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 *style = (SkTypeface::Style) tempStyle; 1525 *style = (SkTypeface::Style) tempStyle;
1524 } 1526 }
1525 if (isFixedPitch) { 1527 if (isFixedPitch) {
1526 *isFixedPitch = FT_IS_FIXED_WIDTH(face); 1528 *isFixedPitch = FT_IS_FIXED_WIDTH(face);
1527 } 1529 }
1528 1530
1529 FT_Done_Face(face); 1531 FT_Done_Face(face);
1530 FT_Done_FreeType(library); 1532 FT_Done_FreeType(library);
1531 return true; 1533 return true;
1532 } 1534 }
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