aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkWriter32.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-04 16:36:20 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-04 16:36:20 -0800
commitf70b531daaf47db1ee95c70da9843f1dd1f418d3 (patch)
tree85965584497549d7729c301075ff2ec9d1dc2c81 /include/core/SkWriter32.h
parente77875aa425d51cc8db3463343a6308f9d2aadcc (diff)
Move annotations to canvas virtual (patchset #8 id:140001 of https://codereview.chromium.org/1744103002/ )"
Diffstat (limited to 'include/core/SkWriter32.h')
-rw-r--r--include/core/SkWriter32.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h
index 1e7ec6d348..a2c6f5d472 100644
--- a/include/core/SkWriter32.h
+++ b/include/core/SkWriter32.h
@@ -206,6 +206,18 @@ public:
*/
static size_t WriteStringSize(const char* str, size_t len = (size_t)-1);
+ void writeData(const SkData* data) {
+ uint32_t len = data ? SkToU32(data->size()) : 0;
+ this->write32(len);
+ if (data) {
+ this->writePad(data->data(), len);
+ }
+ }
+
+ static size_t WriteDataSize(const SkData* data) {
+ return 4 + SkAlign4(data ? data->size() : 0);
+ }
+
/**
* Move the cursor back to offset bytes from the beginning.
* offset must be a multiple of 4 no greater than size().