diff options
Diffstat (limited to 'src/sksl/SkSLUtil.h')
-rw-r--r-- | src/sksl/SkSLUtil.h | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h index ad8287e39f..ede21830e5 100644 --- a/src/sksl/SkSLUtil.h +++ b/src/sksl/SkSLUtil.h @@ -8,12 +8,12 @@ #ifndef SKSL_UTIL #define SKSL_UTIL +#include <iomanip> +#include <string> +#include <sstream> #include "stdlib.h" #include "assert.h" -#include "SkOpts.h" #include "SkRefCnt.h" -#include "SkStream.h" -#include "SkString.h" #include "SkTypes.h" #include "glsl/GrGLSLCaps.h" #include "GrContextOptions.h" @@ -73,47 +73,40 @@ public: } }; -void write_data(const SkData& d, SkWStream& out); +// our own definitions of certain std:: functions, because they are not always present on Android -SkString operator+(const SkString& s, const char* c); +std::string to_string(double value); -SkString operator+(const char* c, const SkString& s); +std::string to_string(int32_t value); -SkString operator+(const SkString& s1, const SkString& s2); +std::string to_string(uint32_t value); -bool operator==(const SkString& s1, const char* s2); +std::string to_string(int64_t value); -bool operator!=(const SkString& s1, const char* s2); - -bool operator!=(const char* s1, const SkString& s2); - -SkString to_string(double value); - -SkString to_string(int32_t value); - -SkString to_string(uint32_t value); - -SkString to_string(int64_t value); - -SkString to_string(uint64_t value); +std::string to_string(uint64_t value); #if _MSC_VER #define NORETURN __declspec(noreturn) #else #define NORETURN __attribute__((__noreturn__)) #endif -int stoi(SkString s); +int stoi(std::string s); -double stod(SkString s); +double stod(std::string s); -long stol(SkString s); +long stol(std::string s); NORETURN void sksl_abort(); } // namespace -#define ASSERT(x) SkASSERT(x) -#define ASSERT_RESULT(x) SkAssertResult(x); +#ifdef DEBUG +#define ASSERT(x) assert(x) +#define ASSERT_RESULT(x) ASSERT(x); +#else +#define ASSERT(x) +#define ASSERT_RESULT(x) x +#endif #ifdef SKIA #define ABORT(...) { SkDebugf(__VA_ARGS__); sksl_abort(); } @@ -121,11 +114,4 @@ NORETURN void sksl_abort(); #define ABORT(...) { sksl_abort(); } #endif -namespace std { - template<> struct hash<SkString> { - size_t operator()(const SkString& s) const { - return SkOpts::hash_fn(s.c_str(), s.size(), 0); - } - }; -} #endif |