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

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

Issue 2211143002: Move to SkDataTable::MakeXXX and sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use bare pointer for global. Created 4 years, 4 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/ports/SkFontConfigInterface_direct.h ('k') | src/ports/SkFontMgr_FontConfigInterface.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 2009-2015 Google Inc. 2 * Copyright 2009-2015 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 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
9 9
10 #include "SkBuffer.h" 10 #include "SkBuffer.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 static bool find_name(const SkTDArray<const char*>& list, const char* str) { 691 static bool find_name(const SkTDArray<const char*>& list, const char* str) {
692 int count = list.count(); 692 int count = list.count();
693 for (int i = 0; i < count; ++i) { 693 for (int i = 0; i < count; ++i) {
694 if (!strcmp(list[i], str)) { 694 if (!strcmp(list[i], str)) {
695 return true; 695 return true;
696 } 696 }
697 } 697 }
698 return false; 698 return false;
699 } 699 }
700 700
701 SkDataTable* SkFontConfigInterfaceDirect::getFamilyNames() { 701 sk_sp<SkDataTable> SkFontConfigInterfaceDirect::getFamilyNames() {
702 FCLocker lock; 702 FCLocker lock;
703 703
704 FcPattern* pat = FcPatternCreate(); 704 FcPattern* pat = FcPatternCreate();
705 SkAutoTCallVProc<FcPattern, FcPatternDestroy> autoDestroyPat(pat); 705 SkAutoTCallVProc<FcPattern, FcPatternDestroy> autoDestroyPat(pat);
706 if (nullptr == pat) { 706 if (nullptr == pat) {
707 return nullptr; 707 return nullptr;
708 } 708 }
709 709
710 FcObjectSet* os = FcObjectSetBuild(FC_FAMILY, (char *)0); 710 FcObjectSet* os = FcObjectSetBuild(FC_FAMILY, (char *)0);
711 SkAutoTCallVProc<FcObjectSet, FcObjectSetDestroy> autoDestroyOs(os); 711 SkAutoTCallVProc<FcObjectSet, FcObjectSetDestroy> autoDestroyOs(os);
(...skipping 11 matching lines...) Expand all
723 SkTDArray<size_t> sizes; 723 SkTDArray<size_t> sizes;
724 for (int i = 0; i < fs->nfont; ++i) { 724 for (int i = 0; i < fs->nfont; ++i) {
725 FcPattern* match = fs->fonts[i]; 725 FcPattern* match = fs->fonts[i];
726 const char* famName = get_name(match, FC_FAMILY); 726 const char* famName = get_name(match, FC_FAMILY);
727 if (famName && !find_name(names, famName)) { 727 if (famName && !find_name(names, famName)) {
728 *names.append() = famName; 728 *names.append() = famName;
729 *sizes.append() = strlen(famName) + 1; 729 *sizes.append() = strlen(famName) + 1;
730 } 730 }
731 } 731 }
732 732
733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(), 733 return SkDataTable::MakeCopyArrays((const void*const*)names.begin(),
734 sizes.begin(), names.count()); 734 sizes.begin(), names.count());
735 } 735 }
OLDNEW
« no previous file with comments | « src/ports/SkFontConfigInterface_direct.h ('k') | src/ports/SkFontMgr_FontConfigInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698