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

Unified Diff: include/core/SkStream.h

Issue 187653003: Add size_t bytesWritten() const to SkWStream. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add and use SkToSizeT Created 6 years, 9 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
« no previous file with comments | « no previous file | include/core/SkTypes.h » ('j') | src/core/SkStream.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkStream.h
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 29aac1356cbb9ec1c6951e6c53d443b3cedd1c5c..516b036a55e67162227374bf94350eb028ad7327 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -189,6 +189,8 @@ public:
virtual void newline();
virtual void flush();
+ virtual size_t bytesWritten() const = 0;
+
// helpers
bool write8(U8CPU);
@@ -369,9 +371,9 @@ public:
*/
bool isValid() const { return fFILE != NULL; }
- size_t bytesWritten() const;
virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
virtual void flush() SK_OVERRIDE;
+ virtual size_t bytesWritten() const SK_OVERRIDE;
private:
SkFILE* fFILE;
@@ -385,7 +387,7 @@ public:
SkMemoryWStream(void* buffer, size_t size);
virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
- size_t bytesWritten() const { return fBytesWritten; }
+ virtual size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; }
private:
char* fBuffer;
@@ -403,12 +405,12 @@ public:
virtual ~SkDynamicMemoryWStream();
virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
+ virtual size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; }
// random access write
// modifies stream and returns true if offset + size is less than or equal to getOffset()
bool write(const void* buffer, size_t offset, size_t size);
bool read(void* buffer, size_t offset, size_t size);
size_t getOffset() const { return fBytesWritten; }
- size_t bytesWritten() const { return fBytesWritten; }
// copy what has been written to the stream into dst
void copyTo(void* dst) const;
@@ -444,13 +446,16 @@ private:
class SK_API SkDebugWStream : public SkWStream {
public:
+ SkDebugWStream() : fBytesWritten(0) {}
SK_DECLARE_INST_COUNT(SkDebugWStream)
// overrides
virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
virtual void newline() SK_OVERRIDE;
+ virtual size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; }
private:
+ size_t fBytesWritten;
typedef SkWStream INHERITED;
};
« no previous file with comments | « no previous file | include/core/SkTypes.h » ('j') | src/core/SkStream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698