Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkWriter32 Class Reference
Inheritance diagram for SkWriter32:
SkSWriter32< SIZE >

Public Member Functions

 SkWriter32 (void *external=NULL, size_t externalBytes=0)
 The caller can specify an initial block of storage, which the caller manages. More...
 
size_t bytesWritten () const
 
size_t size () const
 
void reset (void *external=NULL, size_t externalBytes=0)
 
uint32_t * reserve (size_t size)
 
template<typename T >
const T & readTAt (size_t offset) const
 Read a T record at offset, which must be a multiple of 4. More...
 
template<typename T >
void overwriteTAt (size_t offset, const T &value)
 Overwrite a T record at offset, which must be a multiple of 4. More...
 
bool writeBool (bool value)
 
void writeInt (int32_t value)
 
void write8 (int32_t value)
 
void write16 (int32_t value)
 
void write32 (int32_t value)
 
void writePtr (void *value)
 
void writeScalar (SkScalar value)
 
void writePoint (const SkPoint &pt)
 
void writePoint3 (const SkPoint3 &pt)
 
void writeRect (const SkRect &rect)
 
void writeIRect (const SkIRect &rect)
 
void writeRRect (const SkRRect &rrect)
 
void writePath (const SkPath &path)
 
void writeMatrix (const SkMatrix &matrix)
 
void writeRegion (const SkRegion &rgn)
 
void writeMul4 (const void *values, size_t size)
 
void write (const void *values, size_t size)
 Write size bytes from values. More...
 
uint32_t * reservePad (size_t size)
 Reserve size bytes. More...
 
void writePad (const void *src, size_t size)
 Write size bytes from src, and pad to 4 byte alignment with zeroes.
 
void writeString (const char *str, size_t len=(size_t)-1)
 Writes a string to the writer, which can be retrieved with SkReader32::readString(). More...
 
void writeData (const SkData *data)
 
void rewindToOffset (size_t offset)
 Move the cursor back to offset bytes from the beginning. More...
 
void flatten (void *dst) const
 
bool writeToStream (SkWStream *stream) const
 
size_t readFromStream (SkStream *stream, size_t length)
 
sk_sp< SkDatasnapshotAsData () const
 Captures a snapshot of the data as it is right now, and return it.
 

Static Public Member Functions

static size_t WriteStringSize (const char *str, size_t len=(size_t)-1)
 Computes the size (aligned to multiple of 4) need to write the string in a call to writeString(). More...
 
static size_t WriteDataSize (const SkData *data)
 

Private Member Functions

void growToAtLeast (size_t size)
 

Private Attributes

uint8_t * fData
 
size_t fCapacity
 
size_t fUsed
 
void * fExternal
 
SkAutoTMalloc< uint8_t > fInternal
 

Constructor & Destructor Documentation

SkWriter32::SkWriter32 ( void *  external = NULL,
size_t  externalBytes = 0 
)
inline

The caller can specify an initial block of storage, which the caller manages.

SkWriter32 will try to back reserve and write calls with this external storage until the first time an allocation doesn't fit. From then it will use dynamically allocated storage. This used to be optional behavior, but pipe now relies on it.

Member Function Documentation

template<typename T >
void SkWriter32::overwriteTAt ( size_t  offset,
const T &  value 
)
inline

Overwrite a T record at offset, which must be a multiple of 4.

Only legal if the record was written atomically using the write methods below.

template<typename T >
const T& SkWriter32::readTAt ( size_t  offset) const
inline

Read a T record at offset, which must be a multiple of 4.

Only legal if the record was written atomically using the write methods below.

uint32_t* SkWriter32::reservePad ( size_t  size)
inline

Reserve size bytes.

Does not need to be 4 byte aligned. The remaining space (if any) will be filled in with zeroes.

void SkWriter32::rewindToOffset ( size_t  offset)
inline

Move the cursor back to offset bytes from the beginning.

offset must be a multiple of 4 no greater than size().

void SkWriter32::write ( const void *  values,
size_t  size 
)
inline

Write size bytes from values.

size must be a multiple of 4, though values need not be 4-byte aligned.

void SkWriter32::writeString ( const char *  str,
size_t  len = (size_t)-1 
)

Writes a string to the writer, which can be retrieved with SkReader32::readString().

The length can be specified, or if -1 is passed, it will be computed by calling strlen(). The length must be < max size_t.

If you write NULL, it will be read as "".

static size_t SkWriter32::WriteStringSize ( const char *  str,
size_t  len = (size_t)-1 
)
static

Computes the size (aligned to multiple of 4) need to write the string in a call to writeString().

If the length is not specified, it will be computed by calling strlen().


The documentation for this class was generated from the following file: