Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
SkTiff::ImageFileDirectory Class Reference

#include <SkTiffUtility.h>

Public Member Functions

uint16_t getNumEntries () const
 
uint32_t nextIfdOffset () const
 
uint16_t getEntryTag (uint16_t entryIndex) const
 
bool getEntryUnsignedShort (uint16_t entryIndex, uint32_t count, uint16_t *values) const
 
bool getEntryUnsignedLong (uint16_t entryIndex, uint32_t count, uint32_t *values) const
 
bool getEntrySignedRational (uint16_t entryIndex, uint32_t count, float *values) const
 
bool getEntryUnsignedRational (uint16_t entryIndex, uint32_t count, float *values) const
 
sk_sp< SkDatagetEntryUndefinedData (uint16_t entryIndex) const
 

Static Public Member Functions

static bool ParseHeader (const SkData *data, bool *outLittleEndian, uint32_t *outIfdOffset)
 
static std::unique_ptr< ImageFileDirectoryMakeFromOffset (sk_sp< SkData > data, bool littleEndian, uint32_t ifdOffset, bool allowTruncated=false)
 

Detailed Description

Definition at line 43 of file SkTiffUtility.h.

Member Function Documentation

◆ getEntrySignedRational()

bool SkTiff::ImageFileDirectory::getEntrySignedRational ( uint16_t  entryIndex,
uint32_t  count,
float *  values 
) const
inline

Definition at line 88 of file SkTiffUtility.h.

88 {
89 return getEntryValuesGeneric(entryIndex, kTypeSignedRational, count, values);
90 }
int count
Definition: FontMgrTest.cpp:50
constexpr uint16_t kTypeSignedRational
Definition: SkTiffUtility.h:35

◆ getEntryTag()

uint16_t SkTiff::ImageFileDirectory::getEntryTag ( uint16_t  entryIndex) const

Definition at line 176 of file SkTiffUtility.cpp.

176 {
177 const uint8_t* entry = get_entry_address(fData.get(), fOffset, entryIndex);
178 return get_endian_short(entry, fLittleEndian);
179}
static uint16_t get_endian_short(const uint8_t *data, bool littleEndian)
Definition: SkCodecPriv.h:194
T * get() const
Definition: SkRefCnt.h:303
static const uint8_t * get_entry_address(const SkData *data, uint32_t ifdOffset, uint16_t entryIndex)

◆ getEntryUndefinedData()

sk_sp< SkData > SkTiff::ImageFileDirectory::getEntryUndefinedData ( uint16_t  entryIndex) const

Definition at line 226 of file SkTiffUtility.cpp.

226 {
227 uint16_t type = 0;
228 uint32_t count = 0;
229 const uint8_t* data = nullptr;
230 size_t size = 0;
231 if (!getEntryRawData(entryIndex, nullptr, &type, &count, &data, &size)) {
232 return nullptr;
233 }
234 if (type != kTypeUndefined) {
235 return nullptr;
236 }
237 return SkData::MakeSubset(fData.get(), data - fData->bytes(), size);
238}
GLenum type
const uint8_t * bytes() const
Definition: SkData.h:43
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
Definition: SkData.cpp:173
constexpr uint16_t kTypeUndefined
Definition: SkTiffUtility.h:32
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ getEntryUnsignedLong()

bool SkTiff::ImageFileDirectory::getEntryUnsignedLong ( uint16_t  entryIndex,
uint32_t  count,
uint32_t *  values 
) const
inline

Definition at line 85 of file SkTiffUtility.h.

85 {
86 return getEntryValuesGeneric(entryIndex, kTypeUnsignedLong, count, values);
87 }
constexpr uint16_t kTypeUnsignedLong
Definition: SkTiffUtility.h:29

◆ getEntryUnsignedRational()

bool SkTiff::ImageFileDirectory::getEntryUnsignedRational ( uint16_t  entryIndex,
uint32_t  count,
float *  values 
) const
inline

Definition at line 91 of file SkTiffUtility.h.

91 {
92 return getEntryValuesGeneric(entryIndex, kTypeUnsignedRational, count, values);
93 }
constexpr uint16_t kTypeUnsignedRational
Definition: SkTiffUtility.h:30

◆ getEntryUnsignedShort()

bool SkTiff::ImageFileDirectory::getEntryUnsignedShort ( uint16_t  entryIndex,
uint32_t  count,
uint16_t *  values 
) const
inline

Definition at line 82 of file SkTiffUtility.h.

82 {
83 return getEntryValuesGeneric(entryIndex, kTypeUnsignedShort, count, values);
84 }
constexpr uint16_t kTypeUnsignedShort
Definition: SkTiffUtility.h:28

◆ getNumEntries()

uint16_t SkTiff::ImageFileDirectory::getNumEntries ( ) const
inline

Definition at line 65 of file SkTiffUtility.h.

65{ return fNumEntries; }

◆ MakeFromOffset()

std::unique_ptr< ImageFileDirectory > SkTiff::ImageFileDirectory::MakeFromOffset ( sk_sp< SkData data,
bool  littleEndian,
uint32_t  ifdOffset,
bool  allowTruncated = false 
)
static

Definition at line 150 of file SkTiffUtility.cpp.

153 {
154 uint16_t numEntries = 0;
155 uint32_t nextOffset = 0;
156 if (!validate_ifd(
157 data.get(), littleEndian, ifdOffset, allowTruncated, &numEntries, &nextOffset)) {
158 SkCodecPrintf("Failed to validate IFD.\n");
159 return nullptr;
160 }
161 return std::unique_ptr<ImageFileDirectory>(new ImageFileDirectory(
162 std::move(data), littleEndian, ifdOffset, numEntries, nextOffset));
163}
#define SkCodecPrintf(...)
Definition: SkCodecPriv.h:23
static bool validate_ifd(const SkData *data, bool littleEndian, uint32_t ifdOffset, bool allowTruncated, uint16_t *outNumEntries, uint32_t *outNextIfdOffset)

◆ nextIfdOffset()

uint32_t SkTiff::ImageFileDirectory::nextIfdOffset ( ) const
inline

Definition at line 70 of file SkTiffUtility.h.

70{ return fNextIfdOffset; }

◆ ParseHeader()

bool SkTiff::ImageFileDirectory::ParseHeader ( const SkData data,
bool *  outLittleEndian,
uint32_t *  outIfdOffset 
)
static

Definition at line 130 of file SkTiffUtility.cpp.

132 {
133 // Read the endianness (4 bytes) and IFD offset (4 bytes).
134 if (data->size() < 8) {
135 SkCodecPrintf("Tiff header must be at least 8 bytes.\n");
136 return false;
137 }
138 if (!is_valid_endian_marker(data->bytes(), outLittleEndian)) {
139 SkCodecPrintf("Tiff header had invalid endian marker 0x%x,0x%x,0x%x,0x%x.\n",
140 data->bytes()[0],
141 data->bytes()[1],
142 data->bytes()[2],
143 data->bytes()[3]);
144 return false;
145 }
146 *outIfdOffset = get_endian_int(data->bytes() + 4, *outLittleEndian);
147 return true;
148}
static uint32_t get_endian_int(const uint8_t *data, bool littleEndian)
Definition: SkCodecPriv.h:202
static bool is_valid_endian_marker(const uint8_t *data, bool *isLittleEndian)
Definition: SkCodecPriv.h:184

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