aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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 /src
parentfe65943d309dc687f618d16e394dff3baa526426 (diff)
add SkData::NewFromCString()
git-svn-id: http://skia.googlecode.com/svn/trunk@4383 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkData.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index 495da8886e..2653f327c0 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -25,6 +25,14 @@ SkData::~SkData() {
}
}
+bool SkData::equals(const SkData* other) const {
+ if (NULL == other) {
+ return false;
+ }
+
+ return fSize == other->fSize && !memcmp(fPtr, other->fPtr, fSize);
+}
+
size_t SkData::copyRange(size_t offset, size_t length, void* buffer) const {
size_t available = fSize;
if (offset >= available || 0 == length) {
@@ -103,3 +111,11 @@ SkData* SkData::NewSubset(const SkData* src, size_t offset, size_t length) {
const_cast<SkData*>(src));
}
+SkData* SkData::NewWithCString(const char cstr[]) {
+ if (NULL == cstr || 0 == cstr[0]) {
+ return NewEmpty();
+ } else {
+ return NewWithCopy(cstr, strlen(cstr));
+ }
+}
+