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; |
}; |