aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-28 15:40:09 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-28 15:40:09 +0000
commitdbc936dff3357f74fc60e124d912a2179b909b0d (patch)
treebe896546a5e7489364f82892bf1b1ab3dc30cdfe /include
parentfe65943d309dc687f618d16e394dff3baa526426 (diff)
add SkData::NewFromCString()
git-svn-id: http://skia.googlecode.com/svn/trunk@4383 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkData.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/core/SkData.h b/include/core/SkData.h
index 8bbe3c89a9..f24cf9c92c 100644
--- a/include/core/SkData.h
+++ b/include/core/SkData.h
@@ -27,6 +27,8 @@ public:
*/
size_t size() const { return fSize; }
+ bool isEmpty() const { return 0 == fSize; }
+
/**
* Returns the ptr to the data.
*/
@@ -49,6 +51,12 @@ public:
size_t copyRange(size_t offset, size_t length, void* buffer) const;
/**
+ * Returns true if these two objects have the same length and contents,
+ * effectively returning 0 == memcmp(...)
+ */
+ bool equals(const SkData* other) const;
+
+ /**
* Function that, if provided, will be called when the SkData goes out
* of scope, allowing for custom allocation/freeing of the data.
*/
@@ -58,7 +66,13 @@ public:
* Create a new dataref by copying the specified data
*/
static SkData* NewWithCopy(const void* data, size_t length);
-
+
+ /**
+ * Create a new dataref by copying the specified c-string
+ * (a null-terminated array of bytes).
+ */
+ static SkData* NewWithCString(const char cstr[]);
+
/**
* Create a new dataref, taking the data ptr as is, and using the
* releaseproc to free it. The proc may be NULL.