SkReadBuffer.h revision 968edcafa61442dc4f7f8ed8f89523d0f353e9fb
18b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org/* 28b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * Copyright 2011 Google Inc. 38b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * 48b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be 58b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * found in the LICENSE file. 68b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org */ 78b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 88b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#ifndef SkReadBuffer_DEFINED 98b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#define SkReadBuffer_DEFINED 108b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 118b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkBitmapHeap.h" 128b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkColorFilter.h" 138b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkData.h" 148b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkDrawLooper.h" 158b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkImageFilter.h" 168b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkMaskFilter.h" 178b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkPath.h" 188b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkPathEffect.h" 198b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkPicture.h" 208b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkPixelRef.h" 218b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkRasterizer.h" 228b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkReadBuffer.h" 238b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkReader32.h" 248b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkRefCnt.h" 258b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkShader.h" 268b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkWriteBuffer.h" 278b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#include "SkXfermode.h" 288b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 298b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.orgclass SkBitmap; 308b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 318b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC) 328b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org #define DEBUG_NON_DETERMINISTIC_ASSERT 338b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#endif 348b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 358b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.orgclass SkReadBuffer { 368b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.orgpublic: 378b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkReadBuffer(); 388b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkReadBuffer(const void* data, size_t size); 398b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkReadBuffer(SkStream* stream); 408b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual ~SkReadBuffer(); 418b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 427ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org enum Version { 437ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org kFilterLevelIsEnum_Version = 23, 447ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org kGradientFlippedFlag_Version = 24, 457ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org kDashWritesPhaseIntervals_Version = 25, 467ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org kColorShaderNoBool_Version = 26, 4783f23d87f1d67e6e73873e1ef7cda621c43703a0commit-bot@chromium.org kNoUnitMappers_Version = 27, 48968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org kNoMoreBitmapFlatten_Version = 28, 497ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org }; 507ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org 517ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org /** 527ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org * Returns true IFF the version is older than the specified version. 537ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org */ 547ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org bool isVersionLT(Version targetVersion) const { 557ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org SkASSERT(targetVersion > 0); 567ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org return fVersion > 0 && fVersion < targetVersion; 577ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org } 580943f5f58abcff15c7583faafe44549b9a44f47acommit-bot@chromium.org 590943f5f58abcff15c7583faafe44549b9a44f47acommit-bot@chromium.org /** This may be called at most once; most clients of SkReadBuffer should not mess with it. */ 607ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org void setVersion(int version) { 617ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org SkASSERT(0 == fVersion || version == fVersion); 627ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org fVersion = version; 630943f5f58abcff15c7583faafe44549b9a44f47acommit-bot@chromium.org } 640943f5f58abcff15c7583faafe44549b9a44f47acommit-bot@chromium.org 658b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org enum Flags { 668b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org kCrossProcess_Flag = 1 << 0, 678b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org kScalarIsFloat_Flag = 1 << 1, 688b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org kPtrIs64Bit_Flag = 1 << 2, 698b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org kValidation_Flag = 1 << 3, 708b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org }; 718b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 728b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void setFlags(uint32_t flags) { fFlags = flags; } 738b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org uint32_t getFlags() const { return fFlags; } 748b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 758b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org bool isCrossProcess() const { 768b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org return this->isValidating() || SkToBool(fFlags & kCrossProcess_Flag); 778b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 788b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org bool isScalarFloat() const { return SkToBool(fFlags & kScalarIsFloat_Flag); } 798b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org bool isPtr64Bit() const { return SkToBool(fFlags & kPtrIs64Bit_Flag); } 808b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } 818b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 828b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkReader32* getReader32() { return &fReader; } 838b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 84f117781362ecf673f43f93918781853690f0e145commit-bot@chromium.org size_t size() { return fReader.size(); } 85f117781362ecf673f43f93918781853690f0e145commit-bot@chromium.org size_t offset() { return fReader.offset(); } 868b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org bool eof() { return fReader.eof(); } 878b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org const void* skip(size_t size) { return fReader.skip(size); } 8839426e2bcc8463b88872d22d6ed2729c68323073commit-bot@chromium.org void* readFunctionPtr() { return fReader.readPtr(); } 898b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 908b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // primitives 918b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool readBool(); 928b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual SkColor readColor(); 938b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual SkFixed readFixed(); 948b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual int32_t readInt(); 958b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual SkScalar readScalar(); 968b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual uint32_t readUInt(); 978b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual int32_t read32(); 988b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 998b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // strings -- the caller is responsible for freeing the string contents 1008b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readString(SkString* string); 1018b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void* readEncodedString(size_t* length, SkPaint::TextEncoding encoding); 1028b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1038b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // common data structures 1048b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readPoint(SkPoint* point); 1058b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkPoint readPoint() { SkPoint p; this->readPoint(&p); return p; } 1068b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readMatrix(SkMatrix* matrix); 1078b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readIRect(SkIRect* rect); 1088b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readRect(SkRect* rect); 1098b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readRegion(SkRegion* region); 1108b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual void readPath(SkPath* path); 1118b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void readPaint(SkPaint* paint) { paint->unflatten(*this); } 1128b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1138b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual SkFlattenable* readFlattenable(SkFlattenable::Type); 1148b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org template <typename T> T* readFlattenable() { 1158b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org return (T*) this->readFlattenable(T::GetFlattenableType()); 1168b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1178b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkColorFilter* readColorFilter() { return this->readFlattenable<SkColorFilter>(); } 1188b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkDrawLooper* readDrawLooper() { return this->readFlattenable<SkDrawLooper>(); } 1198b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkImageFilter* readImageFilter() { return this->readFlattenable<SkImageFilter>(); } 1208b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkMaskFilter* readMaskFilter() { return this->readFlattenable<SkMaskFilter>(); } 1218b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkPathEffect* readPathEffect() { return this->readFlattenable<SkPathEffect>(); } 1228b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkPixelRef* readPixelRef() { return this->readFlattenable<SkPixelRef>(); } 1238b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkRasterizer* readRasterizer() { return this->readFlattenable<SkRasterizer>(); } 1248b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkShader* readShader() { return this->readFlattenable<SkShader>(); } 1258b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkXfermode* readXfermode() { return this->readFlattenable<SkXfermode>(); } 1268b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 12783f23d87f1d67e6e73873e1ef7cda621c43703a0commit-bot@chromium.org /** 12883f23d87f1d67e6e73873e1ef7cda621c43703a0commit-bot@chromium.org * Like readFlattenable() but explicitly just skips the data that was written for the 12983f23d87f1d67e6e73873e1ef7cda621c43703a0commit-bot@chromium.org * flattenable (or the sentinel that there wasn't one). 13083f23d87f1d67e6e73873e1ef7cda621c43703a0commit-bot@chromium.org */ 13183f23d87f1d67e6e73873e1ef7cda621c43703a0commit-bot@chromium.org virtual void skipFlattenable(); 1328b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1338b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // binary data and arrays 1348b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool readByteArray(void* value, size_t size); 1358b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool readColorArray(SkColor* colors, size_t size); 1368b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool readIntArray(int32_t* values, size_t size); 1378b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool readPointArray(SkPoint* points, size_t size); 1388b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool readScalarArray(SkScalar* values, size_t size); 1398b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1408b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkData* readByteArrayAsData() { 1418b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org size_t len = this->getArrayCount(); 1428b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org if (!this->validateAvailable(len)) { 1438b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org return SkData::NewEmpty(); 1448b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1458b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void* buffer = sk_malloc_throw(len); 1468b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org this->readByteArray(buffer, len); 1478b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org return SkData::NewFromMalloc(buffer, len); 1488b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1498b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1508b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // helpers to get info about arrays and binary data 1518b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual uint32_t getArrayCount(); 1528b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 153968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org /** 154968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org * Returns false if the bitmap could not be completely read. In that case, it will be set 155968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org * to have width/height, but no pixels. 156968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org */ 157968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org bool readBitmap(SkBitmap* bitmap); 158968edcafa61442dc4f7f8ed8f89523d0f353e9fbcommit-bot@chromium.org 1598b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual SkTypeface* readTypeface(); 1608b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1618b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { 1628b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkRefCnt_SafeAssign(fBitmapStorage, bitmapStorage); 1638b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1648b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1658b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void setTypefaceArray(SkTypeface* array[], int count) { 1668b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fTFArray = array; 1678b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fTFCount = count; 1688b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1698b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1708b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org /** 1718b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * Call this with a pre-loaded array of Factories, in the same order as 1728b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * were created/written by the writer. SkPicture uses this. 1738b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org */ 1748b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void setFactoryPlayback(SkFlattenable::Factory array[], int count) { 1758b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fFactoryTDArray = NULL; 1768b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fFactoryArray = array; 1778b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fFactoryCount = count; 1788b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1798b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1808b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org /** 1818b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * Call this with an initially empty array, so the reader can cache each 1828b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * factory it sees by name. Used by the pipe code in conjunction with 1838b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * SkWriteBuffer::setNamedFactoryRecorder. 1848b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org */ 1858b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void setFactoryArray(SkTDArray<SkFlattenable::Factory>* array) { 1868b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fFactoryTDArray = array; 1878b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fFactoryArray = NULL; 1888b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fFactoryCount = 0; 1898b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1908b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 1918b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org /** 1928b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * Provide a function to decode an SkBitmap from encoded data. Only used if the writer 1938b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * encoded the SkBitmap. If the proper decoder cannot be used, a red bitmap with the 1948b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org * appropriate size will be used. 1958b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org */ 1968b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void setBitmapDecoder(SkPicture::InstallPixelRefProc bitmapDecoder) { 1978b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org fBitmapDecoder = bitmapDecoder; 1988b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org } 1998b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2008b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // Default impelementations don't check anything. 2018b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool validate(bool isValid) { return true; } 2028b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool isValid() const { return true; } 2038b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org virtual bool validateAvailable(size_t size) { return true; } 2048b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2059e5f85e89d03a850d435fc951e74e9861a0c1bddcommit-bot@chromium.orgprotected: 2069e5f85e89d03a850d435fc951e74e9861a0c1bddcommit-bot@chromium.org SkReader32 fReader; 2079e5f85e89d03a850d435fc951e74e9861a0c1bddcommit-bot@chromium.org 2088b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.orgprivate: 2098b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org bool readArray(void* value, size_t size, size_t elementSize); 2108b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2118b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org uint32_t fFlags; 2127ed173b1ebac84671fb0dc1b9bd323a5e6e63771commit-bot@chromium.org int fVersion; 2138b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2148b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org void* fMemoryPtr; 2158b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2168b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkBitmapHeapReader* fBitmapStorage; 2178b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkTypeface** fTFArray; 2188b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org int fTFCount; 2198b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2208b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; 2218b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkFlattenable::Factory* fFactoryArray; 2228b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org int fFactoryCount; 2238b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2248b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org SkPicture::InstallPixelRefProc fBitmapDecoder; 2258b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2268b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#ifdef DEBUG_NON_DETERMINISTIC_ASSERT 2278b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // Debugging counter to keep track of how many bitmaps we 2288b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org // have decoded. 2298b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org int fDecodedBitmapIndex; 2308b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#endif // DEBUG_NON_DETERMINISTIC_ASSERT 2318b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org}; 2328b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org 2338b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org#endif // SkReadBuffer_DEFINED 234