diff options
-rw-r--r-- | src/gpu/effects/GrConstColorProcessor.h | 2 | ||||
-rw-r--r-- | src/sksl/SkSLString.cpp | 8 | ||||
-rw-r--r-- | src/sksl/SkSLString.h | 1 | ||||
-rw-r--r-- | src/sksl/ir/SkSLSymbolTable.cpp | 4 | ||||
-rw-r--r-- | src/sksl/ir/SkSLSymbolTable.h | 8 |
5 files changed, 16 insertions, 7 deletions
diff --git a/src/gpu/effects/GrConstColorProcessor.h b/src/gpu/effects/GrConstColorProcessor.h index 830240beca..637c67a85f 100644 --- a/src/gpu/effects/GrConstColorProcessor.h +++ b/src/gpu/effects/GrConstColorProcessor.h @@ -16,7 +16,7 @@ #include "GrCoordTransform.h" class GrConstColorProcessor : public GrFragmentProcessor { public: - enum class InputMode { kLast = 2, kModulateA = 2, kIgnore = 0, kModulateRGBA = 1 }; + enum class InputMode { kIgnore = 0, kLast = 2, kModulateA = 2, kModulateRGBA = 1 }; static const int kInputModeCnt = (int)InputMode::kLast + 1; diff --git a/src/sksl/SkSLString.cpp b/src/sksl/SkSLString.cpp index c9242d398e..7581e0cf3c 100644 --- a/src/sksl/SkSLString.cpp +++ b/src/sksl/SkSLString.cpp @@ -165,6 +165,14 @@ bool StringFragment::operator!=(const char* s) const { return 0 != s[fLength]; } +bool StringFragment::operator<(StringFragment other) const { + int comparison = strncmp(fChars, other.fChars, std::min(fLength, other.fLength)); + if (comparison) { + return comparison < 0; + } + return fLength < other.fLength; +} + bool operator==(const char* s1, StringFragment s2) { return s2 == s1; } diff --git a/src/sksl/SkSLString.h b/src/sksl/SkSLString.h index 143f7c6576..417a28b23a 100644 --- a/src/sksl/SkSLString.h +++ b/src/sksl/SkSLString.h @@ -46,6 +46,7 @@ struct StringFragment { bool operator!=(const char* s) const; bool operator==(StringFragment s) const; bool operator!=(StringFragment s) const; + bool operator<(StringFragment s) const; const char* fChars; size_t fLength; diff --git a/src/sksl/ir/SkSLSymbolTable.cpp b/src/sksl/ir/SkSLSymbolTable.cpp index 701eb75cf7..90a1189696 100644 --- a/src/sksl/ir/SkSLSymbolTable.cpp +++ b/src/sksl/ir/SkSLSymbolTable.cpp @@ -120,11 +120,11 @@ void SymbolTable::markAllFunctionsBuiltin() { } } -std::unordered_map<StringFragment, const Symbol*>::iterator SymbolTable::begin() { +std::map<StringFragment, const Symbol*>::iterator SymbolTable::begin() { return fSymbols.begin(); } -std::unordered_map<StringFragment, const Symbol*>::iterator SymbolTable::end() { +std::map<StringFragment, const Symbol*>::iterator SymbolTable::end() { return fSymbols.end(); } diff --git a/src/sksl/ir/SkSLSymbolTable.h b/src/sksl/ir/SkSLSymbolTable.h index f245964c35..0a35912ddf 100644 --- a/src/sksl/ir/SkSLSymbolTable.h +++ b/src/sksl/ir/SkSLSymbolTable.h @@ -8,8 +8,8 @@ #ifndef SKSL_SYMBOLTABLE #define SKSL_SYMBOLTABLE +#include <map> #include <memory> -#include <unordered_map> #include <vector> #include "SkSLErrorReporter.h" #include "SkSLSymbol.h" @@ -43,9 +43,9 @@ public: void markAllFunctionsBuiltin(); - std::unordered_map<StringFragment, const Symbol*>::iterator begin(); + std::map<StringFragment, const Symbol*>::iterator begin(); - std::unordered_map<StringFragment, const Symbol*>::iterator end(); + std::map<StringFragment, const Symbol*>::iterator end(); const std::shared_ptr<SymbolTable> fParent; @@ -56,7 +56,7 @@ private: std::vector<std::unique_ptr<IRNode>> fOwnedNodes; - std::unordered_map<StringFragment, const Symbol*> fSymbols; + std::map<StringFragment, const Symbol*> fSymbols; ErrorReporter& fErrorReporter; }; |