Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/core/SkStream.cpp

Issue 185263012: DM: read image files without an extra copy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: three-lnies Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/core/SkStream.h ('K') | « include/core/SkStream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkStream.cpp
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 3350f82fc18c1e26f0e6797145054e9b3f0e2c48..8b4b82af9a6a7cdd55343d969e66382bee0fb75f 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);
+ }
}
////////////////////////////////////////////////////////////////////////
« include/core/SkStream.h ('K') | « include/core/SkStream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698