aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-29 20:13:42 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-29 20:13:42 +0000
commit4b2e1c8807fd1eb8b42e71ec7e29b6fc189d3476 (patch)
tree0e2559d435efbfbccc4f229752720e7773ddc531 /include
parent56315b979b4a10e3f722f63d6e042e217712c6c0 (diff)
parent7b734e08430f6b1d147dfa9f0c2c08d88aa7b714 (diff)
Rebase gpu_dev up to r5182
git-svn-id: http://skia.googlecode.com/svn/branches/gpu_dev@6187 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkOSFile.h21
-rw-r--r--include/core/SkString.h37
-rw-r--r--include/gpu/GrConfig.h9
-rw-r--r--include/gpu/GrUserConfig.h6
4 files changed, 63 insertions, 10 deletions
diff --git a/include/core/SkOSFile.h b/include/core/SkOSFile.h
index b5477cd5cf..79551ae206 100644
--- a/include/core/SkOSFile.h
+++ b/include/core/SkOSFile.h
@@ -7,7 +7,8 @@
*/
-//
+// TODO: add unittests for all these operations
+
#ifndef SkOSFile_DEFINED
#define SkOSFile_DEFINED
@@ -24,6 +25,12 @@ enum SkFILE_Flags {
kWrite_SkFILE_Flag = 0x02
};
+#ifdef _WIN32
+const static char SkPATH_SEPARATOR = '\\';
+#else
+const static char SkPATH_SEPARATOR = '/';
+#endif
+
SkFILE* sk_fopen(const char path[], SkFILE_Flags);
void sk_fclose(SkFILE*);
@@ -39,6 +46,17 @@ void sk_fflush(SkFILE*);
int sk_fseek( SkFILE*, size_t, int );
size_t sk_ftell( SkFILE* );
+// Returns true if something (file, directory, ???) exists at this path.
+bool sk_exists(const char *path);
+
+// Returns true if a directory exists at this path.
+bool sk_isdir(const char *path);
+
+// Create a new directory at this path; returns true if successful.
+// If the directory already existed, this will return true.
+// Description of the error, if any, will be written to stderr.
+bool sk_mkdir(const char* path);
+
class SkOSFile {
public:
class Iter {
@@ -79,4 +97,3 @@ private:
};
#endif
-
diff --git a/include/core/SkString.h b/include/core/SkString.h
index 20f16c4e04..94dcf8b438 100644
--- a/include/core/SkString.h
+++ b/include/core/SkString.h
@@ -15,18 +15,30 @@
/* Some helper functions for C strings
*/
-static bool SkStrStartsWith(const char string[], const char prefix[]) {
+static bool SkStrStartsWith(const char string[], const char prefixStr[]) {
SkASSERT(string);
- SkASSERT(prefix);
- return !strncmp(string, prefix, strlen(prefix));
+ SkASSERT(prefixStr);
+ return !strncmp(string, prefixStr, strlen(prefixStr));
}
-bool SkStrEndsWith(const char string[], const char suffix[]);
+static bool SkStrStartsWith(const char string[], const char prefixChar) {
+ SkASSERT(string);
+ return (prefixChar == *string);
+}
+
+bool SkStrEndsWith(const char string[], const char suffixStr[]);
+bool SkStrEndsWith(const char string[], const char suffixChar);
+
int SkStrStartsWithOneOf(const char string[], const char prefixes[]);
+
static bool SkStrContains(const char string[], const char substring[]) {
SkASSERT(string);
SkASSERT(substring);
return (NULL != strstr(string, substring));
}
+static bool SkStrContains(const char string[], const char subchar) {
+ SkASSERT(string);
+ return (NULL != strchr(string, subchar));
+}
#define SkStrAppendS32_MaxSize 11
char* SkStrAppendS32(char buffer[], int32_t);
@@ -82,15 +94,24 @@ public:
bool equals(const char text[]) const;
bool equals(const char text[], size_t len) const;
- bool startsWith(const char prefix[]) const {
- return SkStrStartsWith(fRec->data(), prefix);
+ bool startsWith(const char prefixStr[]) const {
+ return SkStrStartsWith(fRec->data(), prefixStr);
+ }
+ bool startsWith(const char prefixChar) const {
+ return SkStrStartsWith(fRec->data(), prefixChar);
}
- bool endsWith(const char suffix[]) const {
- return SkStrEndsWith(fRec->data(), suffix);
+ bool endsWith(const char suffixStr[]) const {
+ return SkStrEndsWith(fRec->data(), suffixStr);
+ }
+ bool endsWith(const char suffixChar) const {
+ return SkStrEndsWith(fRec->data(), suffixChar);
}
bool contains(const char substring[]) const {
return SkStrContains(fRec->data(), substring);
}
+ bool contains(const char subchar) const {
+ return SkStrContains(fRec->data(), subchar);
+ }
friend bool operator==(const SkString& a, const SkString& b) {
return a.equals(b);
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index c61c34e193..66d1c97c77 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -369,6 +369,15 @@ inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
#define GR_GEOM_BUFFER_LOCK_THRESHOLD (1 << 15)
#endif
+/**
+ * GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
+ * maximum size of the texture cache in vram. The value is only a default and
+ * can be overridden at runtime.
+ */
+#if !defined(GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
+ #define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// tail section:
//
diff --git a/include/gpu/GrUserConfig.h b/include/gpu/GrUserConfig.h
index d514486d24..7b4e4bb789 100644
--- a/include/gpu/GrUserConfig.h
+++ b/include/gpu/GrUserConfig.h
@@ -54,6 +54,12 @@
*/
//#define GR_GEOM_BUFFER_LOCK_THRESHOLD (1<<15)
+/**
+ * This gives a threshold in megabytes for the maximum size of the texture cache
+ * in vram. The value is only a default and can be overridden at runtime.
+ */
+//#define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
+
///////////////////////////////////////////////////////////////////////////////
// Decide Ganesh types