aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-06 17:16:26 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-06 17:16:26 +0000
commit490fb6b4713463954cc0283a9c30e754c45c6004 (patch)
tree96b45e3e20017eda04c6f6f7e7590eea12726893 /src
parentd7a9fcc61f2c513064f67b125c0b2eb918768bb7 (diff)
Add size_t bytesWritten() const to SkWStream.
BUG=skia: R=reed@google.com, mtklein@google.com, robertphillips@google.com, bungeman@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/187653003 git-svn-id: http://skia.googlecode.com/svn/trunk@13684 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDebug.cpp5
-rw-r--r--src/core/SkStream.cpp2
-rw-r--r--src/utils/SkMD5.h2
-rw-r--r--src/utils/SkSHA1.h2
4 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkDebug.cpp b/src/core/SkDebug.cpp
index d484f5eaff..b705a650ea 100644
--- a/src/core/SkDebug.cpp
+++ b/src/core/SkDebug.cpp
@@ -51,4 +51,9 @@ unsigned SkToUInt(uintmax_t x) {
return (unsigned)x;
}
+size_t SkToSizeT(uintmax_t x) {
+ SkASSERT((size_t)x == x);
+ return (size_t)x;
+}
+
#endif
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 70f97d2f7c..e766a1b35e 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -806,6 +806,7 @@ void SkDebugWStream::newline()
{
#if defined(SK_DEBUG) || defined(SK_DEVELOPER)
SkDebugf("\n");
+ fBytesWritten++;
#endif
}
@@ -817,6 +818,7 @@ bool SkDebugWStream::write(const void* buffer, size_t size)
s[size] = 0;
SkDebugf("%s", s);
delete[] s;
+ fBytesWritten += size+1;
#endif
return true;
}
diff --git a/src/utils/SkMD5.h b/src/utils/SkMD5.h
index 0148641edc..4f504782b6 100644
--- a/src/utils/SkMD5.h
+++ b/src/utils/SkMD5.h
@@ -29,6 +29,8 @@ public:
return true;
}
+ virtual size_t bytesWritten() const SK_OVERRIDE { return SkToSizeT(this->byteCount); }
+
/** Processes input, adding it to the digest. Calling this after finish is undefined. */
void update(const uint8_t* input, size_t length);
diff --git a/src/utils/SkSHA1.h b/src/utils/SkSHA1.h
index cf2cb8c679..df8b9bf1b6 100644
--- a/src/utils/SkSHA1.h
+++ b/src/utils/SkSHA1.h
@@ -29,6 +29,8 @@ public:
return true;
}
+ virtual size_t bytesWritten() const SK_OVERRIDE { return SkToSizeT(this->byteCount); }
+
/** Processes input, adding it to the digest. Calling this after finish is undefined. */
void update(const uint8_t* input, size_t length);