|
Pyrogenesis
13997
|
#include "precompiled.h"#include "tex_codec.h"#include <string.h>#include <stdlib.h>#include "lib/allocators/shared_ptr.h"#include "tex.h"Go to the source code of this file.
Macros | |
| #define | REGISTER_CODEC(name) extern void name##_register(); name##_register() |
Functions | |
| int | tex_codec_register (TexCodecVTbl *c) |
| add this vtbl to the codec list. More... | |
| void | tex_codec_unregister_all () |
| remove all codecs that have been registered. More... | |
| Status | tex_codec_for_filename (const OsPath &extension, const TexCodecVTbl **c) |
| Find codec that recognizes the desired output file extension. More... | |
| Status | tex_codec_for_header (const u8 *file, size_t file_size, const TexCodecVTbl **c) |
| find codec that recognizes the header's magic field. More... | |
| const TexCodecVTbl * | tex_codec_next (const TexCodecVTbl *prev_codec) |
| enumerate all registered codecs. More... | |
| Status | tex_codec_transform (Tex *t, size_t transforms) |
| transform the texture's pixel format. More... | |
| void | tex_codec_register_all () |
| Manually register codecs. More... | |
| std::vector< RowPtr > | tex_codec_alloc_rows (const u8 *data, size_t h, size_t pitch, size_t src_flags, size_t dst_orientation) |
| Status | tex_codec_write (Tex *t, size_t transforms, const void *hdr, size_t hdr_size, DynArray *da) |
| apply transforms and then copy header and image into output buffer. More... | |
Variables | |
| static const TexCodecVTbl * | codecs |
| #define REGISTER_CODEC | ( | name | ) | extern void name##_register(); name##_register() |
| std::vector<RowPtr> tex_codec_alloc_rows | ( | const u8 * | data, |
| size_t | h, | ||
| size_t | pitch, | ||
| size_t | src_flags, | ||
| size_t | dst_orientation | ||
| ) |
Definition at line 154 of file tex_codec.cpp.
| Status tex_codec_for_filename | ( | const OsPath & | extension, |
| const TexCodecVTbl ** | c | ||
| ) |
Find codec that recognizes the desired output file extension.
| extension | |
| c | (out) vtbl of responsible codec |
Definition at line 65 of file tex_codec.cpp.
| Status tex_codec_for_header | ( | const u8 * | data, |
| size_t | data_size, | ||
| const TexCodecVTbl ** | c | ||
| ) |
find codec that recognizes the header's magic field.
| data | typically contents of file, but need only include the (first 4 bytes of) header. |
| data_size | [bytes] |
| c | (out) vtbl of responsible codec |
Definition at line 79 of file tex_codec.cpp.
| const TexCodecVTbl* tex_codec_next | ( | const TexCodecVTbl * | prev_codec | ) |
enumerate all registered codecs.
used by self-test to test each one of them in turn.
| prev_codec | the last codec returned by this function. pass 0 the first time. note: this routine is stateless and therefore reentrant. |
Definition at line 96 of file tex_codec.cpp.
| int tex_codec_register | ( | TexCodecVTbl * | c | ) |
add this vtbl to the codec list.
called at NLSO init time by the TEX_CODEC_REGISTER in each codec file. order in list is unspecified; see TEX_CODEC_REGISTER.
| c | pointer to vtbl. |
Definition at line 44 of file tex_codec.cpp.
| void tex_codec_register_all | ( | ) |
Manually register codecs.
must be called before first use of a codec (e.g. loading a texture).
This would normally be taken care of by TEX_CODEC_REGISTER, but no longer works when building as a static library. Workaround: hard-code a list of codecs in tex_codec.cpp and call their registration functions.
Definition at line 134 of file tex_codec.cpp.
transform the texture's pixel format.
tries each codec's transform method once, or until one indicates success.
| t | texture object |
| transforms,: | OR-ed combination of TEX_* flags that are to be changed. |
Definition at line 107 of file tex_codec.cpp.
| void tex_codec_unregister_all | ( | ) |
remove all codecs that have been registered.
Definition at line 56 of file tex_codec.cpp.
| Status tex_codec_write | ( | Tex * | t, |
| size_t | transforms, | ||
| const void * | hdr, | ||
| size_t | hdr_size, | ||
| DynArray * | da | ||
| ) |
apply transforms and then copy header and image into output buffer.
| t | input texture object |
| transforms | transformations to be applied to pixel format |
| hdr | header data |
| hdr_size | [bytes] |
| da | output data array (will be expanded as necessary) |
Definition at line 176 of file tex_codec.cpp.
|
static |
Definition at line 36 of file tex_codec.cpp.
1.8.5