Skia
2DGraphicsLibrary
|
Public Member Functions | |
SkMemoryStream (size_t length) | |
We allocate (and free) the memory. More... | |
SkMemoryStream (const void *data, size_t length, bool copyData=false) | |
If copyData is true, the stream makes a private copy of the data. More... | |
SkMemoryStream (sk_sp< SkData >) | |
Creates the stream to read from the specified data. | |
virtual void | setMemory (const void *data, size_t length, bool copyData=false) |
Resets the stream to the specified data and length, just like the constructor. More... | |
void | setMemoryOwned (const void *data, size_t length) |
Replace any memory buffer with the specified buffer. More... | |
sk_sp< SkData > | asData () const |
void | setData (sk_sp< SkData >) |
void | skipToAlign4 () |
const void * | getAtPos () |
size_t | read (void *buffer, size_t size) override |
Reads or skips size number of bytes. More... | |
bool | isAtEnd () const override |
Returns true when all the bytes in the stream have been read. More... | |
size_t | peek (void *buffer, size_t size) const override |
Attempt to peek at size bytes. More... | |
bool | rewind () override |
Rewinds to the beginning of the stream. More... | |
SkMemoryStream * | duplicate () const override |
Duplicates this stream. More... | |
size_t | getPosition () const override |
Returns the current position in the stream. More... | |
bool | seek (size_t position) override |
Seeks to an absolute position in the stream. More... | |
bool | move (long offset) override |
Seeks to an relative offset in the stream. More... | |
SkMemoryStream * | fork () const override |
Duplicates this stream. More... | |
size_t | getLength () const override |
Returns the total length of the stream. More... | |
const void * | getMemoryBase () override |
Returns the starting address for the data. More... | |
Public Member Functions inherited from SkStreamAsset | |
bool | hasLength () const override |
Returns true if this stream can report it's total length. More... | |
Public Member Functions inherited from SkStreamSeekable | |
bool | hasPosition () const override |
Returns true if this stream can report it's current position. More... | |
Public Member Functions inherited from SkStream | |
size_t | skip (size_t size) |
Skip size number of bytes. More... | |
int8_t | readS8 () |
int16_t | readS16 () |
int32_t | readS32 () |
uint8_t | readU8 () |
uint16_t | readU16 () |
uint32_t | readU32 () |
bool | readBool () |
SkScalar | readScalar () |
size_t | readPackedUInt () |
Private Types | |
typedef SkStreamMemory | INHERITED |
Private Attributes | |
sk_sp< SkData > | fData |
size_t | fOffset |
Additional Inherited Members | |
Static Public Member Functions inherited from SkStream | |
static std::unique_ptr < SkStreamAsset > | MakeFromFile (const char path[]) |
Attempts to open the specified file as a stream, returns nullptr on failure. | |
SkMemoryStream::SkMemoryStream | ( | size_t | length | ) |
We allocate (and free) the memory.
Write to it via getMemoryBase()
SkMemoryStream::SkMemoryStream | ( | const void * | data, |
size_t | length, | ||
bool | copyData = false |
||
) |
If copyData is true, the stream makes a private copy of the data.
|
overridevirtual |
Duplicates this stream.
If this cannot be done, returns NULL. The returned stream will be positioned at the beginning of its data.
Implements SkStreamMemory.
|
overridevirtual |
Duplicates this stream.
If this cannot be done, returns NULL. The returned stream will be positioned the same as this stream.
Implements SkStreamMemory.
|
overridevirtual |
Returns the total length of the stream.
If this cannot be done, returns 0.
Implements SkStreamAsset.
|
overridevirtual |
Returns the starting address for the data.
If this cannot be done, returns NULL.
Implements SkStreamMemory.
|
overridevirtual |
Returns the current position in the stream.
If this cannot be done, returns 0.
Implements SkStreamSeekable.
|
overridevirtual |
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) or late (after the first unsuccessful read).
Implements SkStream.
|
overridevirtual |
Seeks to an relative offset in the stream.
If this cannot be done, returns false. If an attempt is made to move to a position outside the stream, the position will be set to the closest point within the stream (beginning or end).
Implements SkStreamSeekable.
|
overridevirtual |
Attempt to peek at size bytes.
If this stream supports peeking, copy min(size, peekable bytes) into buffer, and return the number of bytes copied. If the stream does not support peeking, or cannot peek any bytes, return 0 and leave buffer unchanged. The stream is guaranteed to be in the same visible state after this call, regardless of success or failure.
buffer | Must not be NULL, and must be at least size bytes. Destination to copy bytes. |
size | Number of bytes to copy. |
Reimplemented from SkStream.
|
overridevirtual |
Reads or skips size number of bytes.
If buffer == NULL, skip size bytes, return how many were skipped. If buffer != NULL, copy size bytes into buffer, return how many were copied.
buffer | when NULL skip size bytes, otherwise copy size bytes into buffer |
size | the number of bytes to skip or copy |
Implements SkStream.
|
overridevirtual |
Rewinds to the beginning of the stream.
Returns true if the stream is known to be at the beginning after this call returns.
Implements SkStreamRewindable.
|
overridevirtual |
Seeks to an absolute position in the stream.
If this cannot be done, returns false. If an attempt is made to seek past the end of the stream, the position will be set to the end of the stream.
Implements SkStreamSeekable.
|
virtual |
Resets the stream to the specified data and length, just like the constructor.
if copyData is true, the stream makes a private copy of the data
void SkMemoryStream::setMemoryOwned | ( | const void * | data, |
size_t | length | ||
) |
Replace any memory buffer with the specified buffer.
The caller must have allocated data with sk_malloc or sk_realloc, since it will be freed with sk_free.