skia2/include/core/SkOrderedReadBuffer.h
djsollen@google.com 94e75ee46a Rename the existing flatten(void*) methods.
This change avoids naminc confusion with the SkFlattenable flatten methods and
also changes SkPath to use the void* model instead of taking a SkReader32.
Review URL: https://codereview.appspot.com/6299062

git-svn-id: http://skia.googlecode.com/svn/trunk@4215 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-08 18:30:46 +00:00

63 lines
2.0 KiB
C++

/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkOrderedReadBuffer_DEFINED
#define SkOrderedReadBuffer_DEFINED
#include "SkRefCnt.h"
#include "SkBitmap.h"
#include "SkFlattenable.h"
#include "SkWriter32.h"
#include "SkPath.h"
class SkOrderedReadBuffer : public SkFlattenableReadBuffer {
public:
SkOrderedReadBuffer() : INHERITED() {}
SkOrderedReadBuffer(const void* data, size_t size);
void setMemory(const void* data, size_t size) { fReader.setMemory(data, size); }
uint32_t size() { return fReader.size(); }
const void* base() { return fReader.base(); }
uint32_t offset() { return fReader.offset(); }
bool eof() { return fReader.eof(); }
void rewind() { fReader.rewind(); }
void setOffset(size_t offset) { fReader.setOffset(offset); }
SkReader32* getReader32() { return &fReader; }
virtual uint8_t readU8() { return fReader.readU8(); }
virtual uint16_t readU16() { return fReader.readU16(); }
virtual uint32_t readU32() { return fReader.readU32(); }
virtual void read(void* dst, size_t size) { return fReader.read(dst, size); }
virtual bool readBool() { return fReader.readBool(); }
virtual int32_t readInt() { return fReader.readInt(); }
virtual SkScalar readScalar() { return fReader.readScalar(); }
virtual const void* skip(size_t size) { return fReader.skip(size); }
virtual void readMatrix(SkMatrix* m) { fReader.readMatrix(m); }
virtual void readPath(SkPath* p) { fReader.readPath(p); }
virtual void readPoint(SkPoint* p) {
p->fX = fReader.readScalar();
p->fY = fReader.readScalar();
}
virtual SkTypeface* readTypeface();
virtual SkRefCnt* readRefCnt();
virtual void* readFunctionPtr();
virtual SkFlattenable* readFlattenable();
private:
SkReader32 fReader;
typedef SkFlattenableReadBuffer INHERITED;
};
#endif // SkOrderedReadBuffer_DEFINED