Changeset View
Changeset View
Standalone View
Standalone View
source/lib/tex/tex_codec.cpp
Show All 30 Lines | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "lib/allocators/shared_ptr.h" // ArrayDeleter | #include "lib/allocators/shared_ptr.h" // ArrayDeleter | ||||
#include "tex.h" | #include "tex.h" | ||||
// Statically allocate all of the codecs... | // Statically allocate all of the codecs... | ||||
TexCodecDds DdsCodec; | TexCodecDds DdsCodec; | ||||
TexCodecPng PngCodec; | TexCodecPng PngCodec; | ||||
TexCodecJpg JpgCodec; | |||||
TexCodecTga TgaCodec; | TexCodecTga TgaCodec; | ||||
TexCodecBmp BmpCodec; | TexCodecBmp BmpCodec; | ||||
// Codecs will be searched in this order | // Codecs will be searched in this order | ||||
static const ITexCodec *codecs[] = {(ITexCodec *)&DdsCodec, (ITexCodec *)&PngCodec, | static const ITexCodec *codecs[] = {(ITexCodec *)&DdsCodec, (ITexCodec *)&PngCodec, | ||||
(ITexCodec *)&TgaCodec, (ITexCodec *)&BmpCodec}; | (ITexCodec *)&JpgCodec, (ITexCodec *)&TgaCodec, (ITexCodec *)&BmpCodec}; | ||||
static const int codecs_len = sizeof(codecs) / sizeof(ITexCodec*); | static const int codecs_len = sizeof(codecs) / sizeof(ITexCodec*); | ||||
// find codec that recognizes the desired output file extension, | // find codec that recognizes the desired output file extension, | ||||
// or return ERR::TEX_UNKNOWN_FORMAT if unknown. | // or return ERR::TEX_UNKNOWN_FORMAT if unknown. | ||||
// note: does not raise a warning because it is used by | // note: does not raise a warning because it is used by | ||||
// tex_is_known_extension. | // tex_is_known_extension. | ||||
Status tex_codec_for_filename(const OsPath& extension, const ITexCodec** c) | Status tex_codec_for_filename(const OsPath& extension, const ITexCodec** c) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator