8#ifndef SkReadBuffer_DEFINED
9#define SkReadBuffer_DEFINED
66 return fVersion > 0 && fVersion < targetVersion;
73 SkASSERT(0 == fVersion || version == fVersion);
77 size_t size()
const {
return fStop - fBase; }
78 size_t offset()
const {
return fCurr - fBase; }
79 bool eof() {
return fCurr >= fStop; }
84 template <
typename T>
const T*
skipT() {
85 return static_cast<const T*
>(this->
skip(
sizeof(
T)));
88 return static_cast<const T*
>(this->
skip(count,
sizeof(
T)));
101 if (!this->
validate(value <=
static_cast<uint32_t
>(
max))) {
104 return static_cast<T>(
value);
177 fFactoryArray = array;
178 fFactoryCount =
count;
203 template <
typename T>
220 return static_cast<T>(this->
checkInt(
static_cast<int32_t
>(
min),
221 static_cast<int32_t
>(
max)));
232 bool readArray(
void* value,
size_t size,
size_t elementSize);
236 const char* fCurr =
nullptr;
237 const char* fStop =
nullptr;
238 const char* fBase =
nullptr;
249 int fFactoryCount = 0;
253 static bool IsPtrAlign4(
const void* ptr) {
257 bool fAllowSkSL =
true;
static const int points[]
static constexpr bool SkIsAlign4(T x)
sk_sp< SkFlattenable >(* Factory)(SkReadBuffer &)
static SkPaint Unflatten(SkReadBuffer &buffer)
const T * skipT(size_t count)
bool readColor4fArray(SkColor4f *colors, size_t size)
uint32_t getVersion() const
void readColor4f(SkColor4f *color)
SkLegacyFQ checkFilterQuality()
SkFlattenable * readRawFlattenable()
const void * skipByteArray(size_t *size)
void readMatrix(SkMatrix *matrix)
void setMemory(const void *, size_t)
bool readByteArray(void *value, size_t size)
bool validate(bool isValid)
bool readIntArray(int32_t *values, size_t size)
const void * skip(size_t size)
sk_sp< SkData > readByteArrayAsData()
void readIRect(SkIRect *rect)
void setAllowSkSL(bool allow)
bool validateIndex(int index, int count)
void setDeserialProcs(const SkDeserialProcs &procs)
const SkDeserialProcs & getDeserialProcs() const
void setTypefaceArray(sk_sp< SkTypeface > array[], int count)
SkSamplingOptions readSampling()
sk_sp< SkPathEffect > readPathEffect()
T checkRange(T min, T max)
void setFactoryPlayback(SkFlattenable::Factory array[], int count)
bool readPointArray(SkPoint *points, size_t size)
sk_sp< SkColorFilter > readColorFilter()
sk_sp< SkBlender > readBlender()
sk_sp< SkTypeface > readTypeface()
void readString(SkString *string)
void setVersion(int version)
SkReadBuffer(const void *data, size_t size)
bool readColorArray(SkColor *colors, size_t size)
bool readPad32(void *buffer, size_t bytes)
sk_sp< SkMaskFilter > readMaskFilter()
sk_sp< SkShader > readShader()
int32_t checkInt(int min, int max)
sk_sp< T > readFlattenable()
bool readScalarArray(SkScalar *values, size_t size)
void readPoint3(SkPoint3 *point)
sk_sp< SkImage > readImage()
void readRRect(SkRRect *rrect)
bool validateCanReadN(size_t n)
void readRegion(SkRegion *region)
void readPath(SkPath *path)
sk_sp< SkImageFilter > readImageFilter()
bool isVersionLT(SkPicturePriv::Version targetVersion) const
static const uint8_t buffer[]
static float max(float r, float g, float b)
static float min(float r, float g, float b)