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

Side by Side Diff: src/sfnt/SkOTUtils.h

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/sfnt/SkOTTable_name.cpp ('k') | src/sfnt/SkOTUtils.cpp » ('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 2012 Google Inc. 2 * Copyright 2012 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 SkOTUtils_DEFINED 8 #ifndef SkOTUtils_DEFINED
9 #define SkOTUtils_DEFINED 9 #define SkOTUtils_DEFINED
10 10
11 #include "SkOTTableTypes.h" 11 #include "SkOTTableTypes.h"
12 #include "SkOTTable_name.h" 12 #include "SkOTTable_name.h"
13 #include "SkTypeface.h" 13 #include "SkTypeface.h"
14 14
15 class SkData; 15 class SkData;
16 class SkStream; 16 class SkStream;
17 17
18 struct SkOTUtils { 18 struct SkOTUtils {
19 /** 19 /**
20 * Calculates the OpenType checksum for data. 20 * Calculates the OpenType checksum for data.
21 */ 21 */
22 static uint32_t CalcTableChecksum(SK_OT_ULONG *data, size_t length); 22 static uint32_t CalcTableChecksum(SK_OT_ULONG *data, size_t length);
23 23
24 /** 24 /**
25 * Renames an sfnt font. On failure (invalid data or not an sfnt font) 25 * Renames an sfnt font. On failure (invalid data or not an sfnt font)
26 * returns NULL. 26 * returns nullptr.
27 * 27 *
28 * Essentially, this removes any existing 'name' table and replaces it 28 * Essentially, this removes any existing 'name' table and replaces it
29 * with a new one in which FontFamilyName, FontSubfamilyName, 29 * with a new one in which FontFamilyName, FontSubfamilyName,
30 * UniqueFontIdentifier, FullFontName, and PostscriptName are fontName. 30 * UniqueFontIdentifier, FullFontName, and PostscriptName are fontName.
31 * 31 *
32 * The new 'name' table records will be written with the Windows, 32 * The new 'name' table records will be written with the Windows,
33 * UnicodeBMPUCS2, and English_UnitedStates settings. 33 * UnicodeBMPUCS2, and English_UnitedStates settings.
34 * 34 *
35 * fontName and fontNameLen must be specified in terms of ASCII chars. 35 * fontName and fontNameLen must be specified in terms of ASCII chars.
36 * 36 *
37 * Does not affect fontData's ownership. 37 * Does not affect fontData's ownership.
38 */ 38 */
39 static SkData* RenameFont(SkStreamAsset* fontData, const char* fontName, int fontNameLen); 39 static SkData* RenameFont(SkStreamAsset* fontData, const char* fontName, int fontNameLen);
40 40
41 /** An implementation of LocalizedStrings which obtains it's data from a 'na me' table. */ 41 /** An implementation of LocalizedStrings which obtains it's data from a 'na me' table. */
42 class LocalizedStrings_NameTable : public SkTypeface::LocalizedStrings { 42 class LocalizedStrings_NameTable : public SkTypeface::LocalizedStrings {
43 public: 43 public:
44 /** Takes ownership of the nameTableData and will free it with SK_DELETE . */ 44 /** Takes ownership of the nameTableData and will free it with SK_DELETE . */
45 LocalizedStrings_NameTable(SkOTTableName* nameTableData, 45 LocalizedStrings_NameTable(SkOTTableName* nameTableData,
46 SkOTTableName::Record::NameID::Predefined::Va lue types[], 46 SkOTTableName::Record::NameID::Predefined::Va lue types[],
47 int typesCount) 47 int typesCount)
48 : fTypes(types), fTypesCount(typesCount), fTypesIndex(0) 48 : fTypes(types), fTypesCount(typesCount), fTypesIndex(0)
49 , fNameTableData(nameTableData), fFamilyNameIter(*nameTableData, fTy pes[fTypesIndex]) 49 , fNameTableData(nameTableData), fFamilyNameIter(*nameTableData, fTy pes[fTypesIndex])
50 { } 50 { }
51 51
52 /** Creates an iterator over all the family names in the 'name' table of a typeface. 52 /** Creates an iterator over all the family names in the 'name' table of a typeface.
53 * If no valid 'name' table can be found, returns NULL. 53 * If no valid 'name' table can be found, returns nullptr.
54 */ 54 */
55 static LocalizedStrings_NameTable* CreateForFamilyNames(const SkTypeface & typeface); 55 static LocalizedStrings_NameTable* CreateForFamilyNames(const SkTypeface & typeface);
56 56
57 bool next(SkTypeface::LocalizedString* localizedString) override; 57 bool next(SkTypeface::LocalizedString* localizedString) override;
58 private: 58 private:
59 static SkOTTableName::Record::NameID::Predefined::Value familyNameTypes[ 3]; 59 static SkOTTableName::Record::NameID::Predefined::Value familyNameTypes[ 3];
60 60
61 SkOTTableName::Record::NameID::Predefined::Value* fTypes; 61 SkOTTableName::Record::NameID::Predefined::Value* fTypes;
62 int fTypesCount; 62 int fTypesCount;
63 int fTypesIndex; 63 int fTypesIndex;
(...skipping 18 matching lines...) Expand all
82 } 82 }
83 83
84 private: 84 private:
85 SkString fName; 85 SkString fName;
86 SkString fLanguage; 86 SkString fLanguage;
87 bool fHasNext; 87 bool fHasNext;
88 }; 88 };
89 }; 89 };
90 90
91 #endif 91 #endif
OLDNEW
« no previous file with comments | « src/sfnt/SkOTTable_name.cpp ('k') | src/sfnt/SkOTUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698