34 int x = thumb->width,
y = thumb->height;
42 memcpy(top, bottom,
x *
sizeof(
uint32_t));
43 memcpy(bottom, line,
x *
sizeof(
uint32_t));
53 memcpy(&
data, bytes, 4);
61 return (file->
read(file, buf, buf_len) == buf_len);
66 if (file->
seek !=
nullptr) {
67 if (file->
seek(file,
len, SEEK_CUR) == -1) {
74 constexpr size_t dummy_data_size = 4096;
77 const size_t len_chunk = std::min(
len, dummy_data_size);
78 if (
size_t(file->
read(file, dummy_data.
data(), len_chunk)) != len_chunk) {
95 if (!bhead.has_value()) {
103 switch (bhead->code) {
104 case MAKE_ID(
'T',
'E',
'S',
'T'): {
106 if (bhead->len <
int64_t(
sizeof(shape)) || !
file_read(file, shape,
sizeof(shape))) {
115 constexpr int max_size = 4096;
116 const size_t data_size = size_t(bhead->len) -
sizeof(shape);
119 thumb->
height > max_size || data_size != expected_size)
130 case MAKE_ID(
'R',
'E',
'N',
'D'): {
151 if (file ==
nullptr) {
156 if (!std::holds_alternative<BlenderHeader>(header_variant)) {
160 const BlenderHeader &header = std::get<BlenderHeader>(header_variant);
File and directory operations.
Wrapper for reading from various sources (e.g. raw files, compressed files, memory....
#define MAKE_ID(a, b, c, d)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void free(Subdiv *subdiv)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings)==CTX_MODE_NUM+1, "Must have a string for each context mode") const char *CTX_data_mode_string(const bContext *C)
eThumbStatus blendthumb_create_thumb_from_file(FileReader *rawfile, Thumbnail *thumb)
FileReader * BLO_file_reader_uncompressed(FileReader *rawfile)
static void thumb_data_vertical_flip(Thumbnail *thumb)
std::optional< BHead > BLO_readfile_read_bhead(FileReader *file, BHeadType type)
static int32_t bytes_to_native_i32(const uint8_t bytes[4])
static bool file_read(FileReader *file, uint8_t *buf, size_t buf_len)
BMesh const char void * data
std::variant< BlenderHeaderInvalid, BlenderHeaderUnknown, BlenderHeader > BlenderHeaderVariant
static bool file_seek(FileReader *file, size_t len)
static eThumbStatus blendthumb_extract_from_file_impl(FileReader *file, Thumbnail *thumb, const BlenderHeader &header)
BlenderHeaderVariant BLO_readfile_blender_header_decode(FileReader *file)