Remove backward compatibility shims from SkStream.h.

R=reed@google.com

Review URL: https://codereview.chromium.org/68773009

git-svn-id: http://skia.googlecode.com/svn/trunk@12275 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2013-11-13 19:53:46 +00:00
parent 19caf6d41b
commit 04306921f4

View File

@ -60,22 +60,14 @@ public:
* @return the actual number bytes that could be skipped. * @return the actual number bytes that could be skipped.
*/ */
size_t skip(size_t size) { size_t skip(size_t size) {
//return this->read(NULL, size); return this->read(NULL, size);
//TODO: remove this old logic after updating existing implementations
return 0 == size ? 0 : this->read(NULL, size);
} }
/** Returns true when all the bytes in the stream have been read. /** Returns true when all the bytes in the stream have been read.
* This may return true early (when there are no more bytes to be read) * This may return true early (when there are no more bytes to be read)
* or late (after the first unsuccessful read). * or late (after the first unsuccessful read).
*
* In Progress: do not use until all implementations are updated.
* TODO: after this is implemented everywhere, make pure virtual.
*/ */
virtual bool isAtEnd() const { virtual bool isAtEnd() const = 0;
SkASSERT(false);
return true;
}
int8_t readS8(); int8_t readS8();
int16_t readS16(); int16_t readS16();
@ -133,11 +125,7 @@ public:
/** Returns true if this stream can report it's total length. */ /** Returns true if this stream can report it's total length. */
virtual bool hasLength() const { return false; } virtual bool hasLength() const { return false; }
/** Returns the total length of the stream. If this cannot be done, returns 0. */ /** Returns the total length of the stream. If this cannot be done, returns 0. */
virtual size_t getLength() const { virtual size_t getLength() const { return 0; }
//return 0;
//TODO: remove the following after everyone is updated.
return ((SkStream*)this)->read(NULL, 0);
}
//SkStreamMemory //SkStreamMemory
/** Returns the starting address for the data. If this cannot be done, returns NULL. */ /** Returns the starting address for the data. If this cannot be done, returns NULL. */
@ -151,11 +139,6 @@ private:
/** SkStreamRewindable is a SkStream for which rewind and duplicate are required. */ /** SkStreamRewindable is a SkStream for which rewind and duplicate are required. */
class SK_API SkStreamRewindable : public SkStream { class SK_API SkStreamRewindable : public SkStream {
public: public:
//TODO: remove the following after everyone is updated (ensures new behavior on new classes).
virtual bool isAtEnd() const SK_OVERRIDE = 0;
//TODO: remove the following after everyone is updated (ensures new behavior on new classes).
virtual size_t getLength() const SK_OVERRIDE { return 0; }
virtual bool rewind() SK_OVERRIDE = 0; virtual bool rewind() SK_OVERRIDE = 0;
virtual SkStreamRewindable* duplicate() const SK_OVERRIDE = 0; virtual SkStreamRewindable* duplicate() const SK_OVERRIDE = 0;
}; };