aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-05 15:37:11 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-05 15:37:11 +0000
commiteef834f2be2f8f97410fd1d897e9bb11597c6a40 (patch)
treed1269d0cd5ee4f5d9058cad32a2e0b406e05affd /src/core
parentc4b3e75a7b5fd2f31e5573914e8344fc1b0bf17a (diff)
DM: read image files without an extra copy
BUG=skia: R=halcanary@google.com, reed@google.com, bsalomon@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/185263012 git-svn-id: http://skia.googlecode.com/svn/trunk@13669 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkStream.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 3350f82fc1..8b4b82af9a 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -433,14 +433,20 @@ SkFILEWStream::SkFILEWStream(const char path[])
SkFILEWStream::~SkFILEWStream()
{
- if (fFILE)
+ if (fFILE) {
sk_fclose(fFILE);
+ }
+}
+
+size_t SkFILEWStream::bytesWritten() const {
+ return sk_ftell(fFILE);
}
bool SkFILEWStream::write(const void* buffer, size_t size)
{
- if (fFILE == NULL)
+ if (fFILE == NULL) {
return false;
+ }
if (sk_fwrite(buffer, size, fFILE) != size)
{
@@ -454,8 +460,9 @@ bool SkFILEWStream::write(const void* buffer, size_t size)
void SkFILEWStream::flush()
{
- if (fFILE)
+ if (fFILE) {
sk_fflush(fFILE);
+ }
}
////////////////////////////////////////////////////////////////////////