From bf521ff9415b3bdb1acde7b8d18139df176236e5 Mon Sep 17 00:00:00 2001 From: bungeman Date: Wed, 17 Feb 2016 13:13:44 -0800 Subject: [PATCH] Move SkTArray to include/private. TBR=reed Agreed moving to private is good. Review URL: https://codereview.chromium.org/1702073002 --- bench/ResultsWriter.h | 1 - gyp/core.gypi | 2 +- gyp/flags.gyp | 2 + gyp/kilobench.gyp | 1 + include/core/SkImageFilter.h | 2 +- include/core/SkString.h | 2 +- include/core/SkTextBlob.h | 3 +- include/gpu/GrProcessorUnitTest.h | 2 +- include/gpu/GrProgramElement.h | 2 +- include/gpu/GrTypesPriv.h | 1 - include/gpu/gl/GrGLExtensions.h | 2 +- include/pathops/SkPathOps.h | 2 +- include/ports/SkFontConfigInterface.h | 6 - include/ports/SkFontMgr_indirect.h | 4 +- include/{core => private}/SkTArray.h | 0 include/utils/SkRTConf.h | 4 +- src/ports/SkFontConfigInterface_direct.cpp | 128 --------------------- src/ports/SkFontConfigInterface_direct.h | 3 - tools/ThermalManager.h | 2 +- tools/flags/SkCommandLineFlags.h | 2 +- tools/flags/SkCommonFlags.h | 2 +- 21 files changed, 18 insertions(+), 155 deletions(-) rename include/{core => private}/SkTArray.h (100%) diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h index bf74d47826..f56deae209 100644 --- a/bench/ResultsWriter.h +++ b/bench/ResultsWriter.h @@ -15,7 +15,6 @@ #include "SkOSFile.h" #include "SkStream.h" #include "SkString.h" -#include "SkTArray.h" #include "SkTypes.h" /** diff --git a/gyp/core.gypi b/gyp/core.gypi index 3bafe7b8b7..5af30602ac 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -386,7 +386,6 @@ '<(skia_include_path)/core/SkString.h', '<(skia_include_path)/core/SkStrokeRec.h', '<(skia_include_path)/core/SkSurface.h', - '<(skia_include_path)/core/SkTArray.h', '<(skia_include_path)/core/SkTDArray.h', '<(skia_include_path)/core/SkTDStack.h', '<(skia_include_path)/core/SkTInternalLList.h', @@ -415,6 +414,7 @@ '<(skia_include_path)/private/SkSemaphore.h', '<(skia_include_path)/private/SkSpinlock.h', '<(skia_include_path)/private/SkTemplates.h', + '<(skia_include_path)/private/SkTArray.h', '<(skia_include_path)/private/SkTHash.h', '<(skia_include_path)/private/SkThreadID.h', '<(skia_include_path)/private/SkTDict.h', diff --git a/gyp/flags.gyp b/gyp/flags.gyp index 769a7bdb57..258ca40fab 100644 --- a/gyp/flags.gyp +++ b/gyp/flags.gyp @@ -31,6 +31,7 @@ 'type': 'static_library', 'include_dirs': [ '../include/gpu', + '../include/private', '../src/gpu', ], 'sources': [ @@ -46,6 +47,7 @@ 'direct_dependent_settings': { 'include_dirs': [ '../include/gpu', + '../include/private', '../src/gpu', '../tools/flags', ], diff --git a/gyp/kilobench.gyp b/gyp/kilobench.gyp index fbd766f6dc..2d0ae22c53 100644 --- a/gyp/kilobench.gyp +++ b/gyp/kilobench.gyp @@ -15,6 +15,7 @@ 'include_dirs': [ '../bench', '../gm', + '../include/private', '../src/core', '../tools/VisualBench', ], diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 689d52b827..b5f98d29ba 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -8,6 +8,7 @@ #ifndef SkImageFilter_DEFINED #define SkImageFilter_DEFINED +#include "../private/SkTArray.h" #include "../private/SkTemplates.h" #include "../private/SkMutex.h" #include "SkFilterQuality.h" @@ -15,7 +16,6 @@ #include "SkMatrix.h" #include "SkRect.h" #include "SkSurfaceProps.h" -#include "SkTArray.h" class GrFragmentProcessor; class GrTexture; diff --git a/include/core/SkString.h b/include/core/SkString.h index 4625dd13cc..42466af80b 100644 --- a/include/core/SkString.h +++ b/include/core/SkString.h @@ -10,8 +10,8 @@ #ifndef SkString_DEFINED #define SkString_DEFINED +#include "../private/SkTArray.h" #include "SkScalar.h" -#include "SkTArray.h" #include diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h index b0ab8929e6..e43ff74a85 100644 --- a/include/core/SkTextBlob.h +++ b/include/core/SkTextBlob.h @@ -8,10 +8,9 @@ #ifndef SkTextBlob_DEFINED #define SkTextBlob_DEFINED +#include "../private/SkTemplates.h" #include "SkPaint.h" #include "SkRefCnt.h" -#include "SkTArray.h" -#include "SkTDArray.h" class SkReadBuffer; class SkWriteBuffer; diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h index bb16d69fd5..8442d7ef71 100644 --- a/include/gpu/GrProcessorUnitTest.h +++ b/include/gpu/GrProcessorUnitTest.h @@ -8,8 +8,8 @@ #ifndef GrProcessorUnitTest_DEFINED #define GrProcessorUnitTest_DEFINED +#include "../private/SkTArray.h" #include "GrTestUtils.h" -#include "SkTArray.h" #include "SkTypes.h" class SkMatrix; diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h index 8305c5027b..ba9daf7154 100644 --- a/include/gpu/GrProgramElement.h +++ b/include/gpu/GrProgramElement.h @@ -8,8 +8,8 @@ #ifndef GrProgramElement_DEFINED #define GrProgramElement_DEFINED +#include "../private/SkTArray.h" #include "SkRefCnt.h" -#include "SkTArray.h" class GrGpuResourceRef; diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h index 4646abdd7d..e04a912d3e 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -9,7 +9,6 @@ #define GrTypesPriv_DEFINED #include "GrTypes.h" -#include "SkTArray.h" #include "SkRect.h" /** diff --git a/include/gpu/gl/GrGLExtensions.h b/include/gpu/gl/GrGLExtensions.h index fe3187057c..dd088de671 100644 --- a/include/gpu/gl/GrGLExtensions.h +++ b/include/gpu/gl/GrGLExtensions.h @@ -8,9 +8,9 @@ #ifndef GrGLExtensions_DEFINED #define GrGLExtensions_DEFINED +#include "../../private/SkTArray.h" #include "GrGLFunctions.h" #include "SkString.h" -#include "SkTArray.h" struct GrGLInterface; diff --git a/include/pathops/SkPathOps.h b/include/pathops/SkPathOps.h index 047588b635..18c7952f4a 100644 --- a/include/pathops/SkPathOps.h +++ b/include/pathops/SkPathOps.h @@ -7,8 +7,8 @@ #ifndef SkPathOps_DEFINED #define SkPathOps_DEFINED +#include "../private/SkTArray.h" #include "SkPreConfig.h" -#include "SkTArray.h" #include "SkTDArray.h" class SkPath; diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h index 304961fd78..063cb9d553 100644 --- a/include/ports/SkFontConfigInterface.h +++ b/include/ports/SkFontConfigInterface.h @@ -11,7 +11,6 @@ #include "SkDataTable.h" #include "SkFontStyle.h" #include "SkRefCnt.h" -#include "SkTArray.h" #include "SkTypeface.h" struct SkBaseMutex; @@ -116,11 +115,6 @@ public: // New APIS, which have default impls for now (which do nothing) virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } - virtual bool matchFamilySet(const char[] /*inFamilyName*/, - SkString* /*outFamilyName*/, - SkTArray*) { - return false; - } typedef SkRefCnt INHERITED; }; diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h index 9d96fee687..37502d2404 100644 --- a/include/ports/SkFontMgr_indirect.h +++ b/include/ports/SkFontMgr_indirect.h @@ -8,12 +8,12 @@ #ifndef SkFontMgr_indirect_DEFINED #define SkFontMgr_indirect_DEFINED +#include "../private/SkMutex.h" +#include "../private/SkTArray.h" #include "SkDataTable.h" #include "SkFontMgr.h" -#include "../private/SkMutex.h" #include "SkRefCnt.h" #include "SkRemotableFontMgr.h" -#include "SkTArray.h" #include "SkTypeface.h" #include "SkTypes.h" diff --git a/include/core/SkTArray.h b/include/private/SkTArray.h similarity index 100% rename from include/core/SkTArray.h rename to include/private/SkTArray.h diff --git a/include/utils/SkRTConf.h b/include/utils/SkRTConf.h index 6c7963c64e..80a972c47b 100644 --- a/include/utils/SkRTConf.h +++ b/include/utils/SkRTConf.h @@ -9,10 +9,10 @@ #ifndef SkRTConf_DEFINED #define SkRTConf_DEFINED -#include "SkTArray.h" +#include "../private/SkTDict.h" #include "SkString.h" #include "SkStream.h" -#include "../private/SkTDict.h" +#include "SkTDArray.h" /** \class SkRTConfBase Non-templated base class for the runtime configs diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index a25bfbdc07..f5f494986b 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -582,131 +582,3 @@ SkDataTable* SkFontConfigInterfaceDirect::getFamilyNames() { return SkDataTable::NewCopyArrays((const void*const*)names.begin(), sizes.begin(), names.count()); } - -bool SkFontConfigInterfaceDirect::matchFamilySet(const char inFamilyName[], - SkString* outFamilyName, - SkTArray* ids) { - SkAutoMutexAcquire ac(mutex_); - -#if 0 - SkString familyStr(familyName ? familyName : ""); - if (familyStr.size() > kMaxFontFamilyLength) { - return false; - } - - SkAutoMutexAcquire ac(mutex_); - - FcPattern* pattern = FcPatternCreate(); - - if (familyName) { - FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName); - } - FcPatternAddBool(pattern, FC_SCALABLE, FcTrue); - - FcConfigSubstitute(nullptr, pattern, FcMatchPattern); - FcDefaultSubstitute(pattern); - - // Font matching: - // CSS often specifies a fallback list of families: - // font-family: a, b, c, serif; - // However, fontconfig will always do its best to find *a* font when asked - // for something so we need a way to tell if the match which it has found is - // "good enough" for us. Otherwise, we can return nullptr which gets piped up - // and lets WebKit know to try the next CSS family name. However, fontconfig - // configs allow substitutions (mapping "Arial -> Helvetica" etc) and we - // wish to support that. - // - // Thus, if a specific family is requested we set @family_requested. Then we - // record two strings: the family name after config processing and the - // family name after resolving. If the two are equal, it's a good match. - // - // So consider the case where a user has mapped Arial to Helvetica in their - // config. - // requested family: "Arial" - // post_config_family: "Helvetica" - // post_match_family: "Helvetica" - // -> good match - // - // and for a missing font: - // requested family: "Monaco" - // post_config_family: "Monaco" - // post_match_family: "Times New Roman" - // -> BAD match - // - // However, we special-case fallback fonts; see IsFallbackFontAllowed(). - - const char* post_config_family = get_name(pattern, FC_FAMILY); - - FcResult result; - FcFontSet* font_set = FcFontSort(0, pattern, 0, 0, &result); - if (!font_set) { - FcPatternDestroy(pattern); - return false; - } - - FcPattern* match = this->MatchFont(font_set, post_config_family, familyStr); - if (!match) { - FcPatternDestroy(pattern); - FcFontSetDestroy(font_set); - return false; - } - - FcPatternDestroy(pattern); - - // From here out we just extract our results from 'match' - - if (FcPatternGetString(match, FC_FAMILY, 0, &post_config_family) != FcResultMatch) { - FcFontSetDestroy(font_set); - return false; - } - - FcChar8* c_filename; - if (FcPatternGetString(match, FC_FILE, 0, &c_filename) != FcResultMatch) { - FcFontSetDestroy(font_set); - return false; - } - - int face_index; - if (FcPatternGetInteger(match, FC_INDEX, 0, &face_index) != FcResultMatch) { - FcFontSetDestroy(font_set); - return false; - } - - FcFontSetDestroy(font_set); - - if (outIdentity) { - outIdentity->fTTCIndex = face_index; - outIdentity->fString.set((const char*)c_filename); - } - if (outFamilyName) { - outFamilyName->set((const char*)post_config_family); - } - if (outStyle) { - *outStyle = GetFontStyle(match); - } - return true; - -//////////////////// - - int count; - FcPattern** match = this->MatchFont(font_set, post_config_family, &count); - if (!match) { - FcPatternDestroy(pattern); - FcFontSetDestroy(font_set); - return nullptr; - } - - FcPatternDestroy(pattern); - - SkTDArray trimmedMatches; - for (int i = 0; i < count; ++i) { - const char* justName = find_just_name(get_name(match[i], FC_FILE)); - if (!is_lower(*justName)) { - *trimmedMatches.append() = match[i]; - } - } - - SkFontStyleSet_FC* sset = new SkFontStyleSet_FC (trimmedMatches.begin(), trimmedMatches.count()); -#endif - return false; -} diff --git a/src/ports/SkFontConfigInterface_direct.h b/src/ports/SkFontConfigInterface_direct.h index 450a3f0c31..a048aed7e7 100644 --- a/src/ports/SkFontConfigInterface_direct.h +++ b/src/ports/SkFontConfigInterface_direct.h @@ -26,9 +26,6 @@ public: // new APIs SkDataTable* getFamilyNames() override; - bool matchFamilySet(const char inFamilyName[], - SkString* outFamilyName, - SkTArray*) override; protected: virtual bool isAccessible(const char* filename); diff --git a/tools/ThermalManager.h b/tools/ThermalManager.h index 74e9dd1eac..747cf52691 100644 --- a/tools/ThermalManager.h +++ b/tools/ThermalManager.h @@ -8,8 +8,8 @@ #ifndef ThermalManager_DEFINED #define ThermalManager_DEFINED +#include "../private/SkTArray.h" #include "SkString.h" -#include "SkTArray.h" #if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX) # define THERMAL_MANAGER_SUPPORTED diff --git a/tools/flags/SkCommandLineFlags.h b/tools/flags/SkCommandLineFlags.h index 2c77cbf35e..a2d3ba97e7 100644 --- a/tools/flags/SkCommandLineFlags.h +++ b/tools/flags/SkCommandLineFlags.h @@ -8,8 +8,8 @@ #ifndef SK_COMMAND_LINE_FLAGS_H #define SK_COMMAND_LINE_FLAGS_H +#include "../private/SkTArray.h" #include "SkString.h" -#include "SkTArray.h" #include "SkTDArray.h" /** diff --git a/tools/flags/SkCommonFlags.h b/tools/flags/SkCommonFlags.h index 8e00e7516c..1f7bbffe6e 100644 --- a/tools/flags/SkCommonFlags.h +++ b/tools/flags/SkCommonFlags.h @@ -8,8 +8,8 @@ #ifndef SK_COMMON_FLAGS_H #define SK_COMMON_FLAGS_H +#include "../private/SkTArray.h" #include "SkCommandLineFlags.h" -#include "SkTArray.h" #include "SkString.h" DECLARE_bool(cpu); -- 2.34.1