ManaPlus
Static Public Member Functions | Data Fields
anonymous_namespace{imageloader.cpp}::DyedImageLoader Struct Reference

Static Public Member Functions

static Resourceload (const void *const v)
 

Data Fields

std::string path
 

Detailed Description

Definition at line 42 of file imageloader.cpp.

Member Function Documentation

◆ load()

static Resource* anonymous_namespace{imageloader.cpp}::DyedImageLoader::load ( const void *const  v)
inlinestatic

Definition at line 47 of file imageloader.cpp.

48  {
49  BLOCK_START("DyedImageLoader::load")
50  if (v == nullptr)
51  {
52  BLOCK_END("DyedImageLoader::load")
53  return nullptr;
54  }
55 
56  const DyedImageLoader *const rl
57  = static_cast<const DyedImageLoader *>(v);
58 
59  std::string path1 = rl->path;
60  const size_t p = path1.find('|');
61  Dye *d = nullptr;
62  if (p != std::string::npos)
63  {
64  d = new Dye(path1.substr(p + 1));
65  path1 = path1.substr(0, p);
66  }
67  SDL_RWops *const rw = VirtFs::rwopsOpenRead(path1);
68  if (rw == nullptr)
69  {
70  delete d;
71  reportAlways("Image loading error: %s", path1.c_str())
72  BLOCK_END("DyedImageLoader::load")
73  return nullptr;
74  }
75  Resource *const res = d != nullptr ? imageHelper->load(rw, *d)
76  : imageHelper->load(rw);
77  delete d;
78  if (res == nullptr)
79  reportAlways("Image loading error: %s", path1.c_str())
80  BLOCK_END("DyedImageLoader::load")
81  return res;
82  }
#define reportAlways(...)
Definition: checkutils.h:253
Definition: dye.h:41
if(!vert) return
ImageHelper * imageHelper
Definition: imagehelper.cpp:44
bool error(InputEvent &event) __attribute__((noreturn))
Definition: actions.cpp:82
bool find(const std::string &key)
SDL_RWops * rwopsOpenRead(const std::string &fname)
Definition: rwops.cpp:107
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79
static Resource * load(const void *const v)
Definition: imageloader.cpp:47

References BLOCK_END, BLOCK_START, imageHelper, ImageHelper::load(), path, reportAlways, and VirtFs::rwopsOpenRead().

Field Documentation

◆ path

std::string anonymous_namespace{imageloader.cpp}::DyedImageLoader::path

Definition at line 46 of file imageloader.cpp.

Referenced by load().


The documentation for this struct was generated from the following file: