MCPcopy Create free account
hub / github.com/ddnet/ddnet / ImageInfoToEditorImage

Function ImageInfoToEditorImage

src/game/editor/tile_art.cpp:103–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static std::shared_ptr<CEditorImage> ImageInfoToEditorImage(CEditorMap *pMap, const CImageInfo &Image, const char *pName)
104{
105 std::shared_ptr<CEditorImage> pEditorImage = std::make_shared<CEditorImage>(pMap);
106 pEditorImage->m_Width = Image.m_Width;
107 pEditorImage->m_Height = Image.m_Height;
108 pEditorImage->m_Format = Image.m_Format;
109 pEditorImage->m_pData = Image.m_pData;
110
111 int TextureLoadFlag = pMap->Editor()->Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
112 pEditorImage->m_Texture = pMap->Editor()->Graphics()->LoadTextureRaw(Image, TextureLoadFlag, pName);
113 pEditorImage->m_External = 0;
114 str_copy(pEditorImage->m_aName, pName);
115
116 return pEditorImage;
117}
118
119static std::shared_ptr<CLayerTiles> AddLayerWithImage(CEditorMap *pMap, const std::shared_ptr<CLayerGroup> &pGroup, int Width, int Height, const CImageInfo &Image, const char *pName)
120{

Callers 1

AddLayerWithImageFunction · 0.85

Calls 5

LoadTextureRawMethod · 0.80
str_copyFunction · 0.50
Uses2DTextureArraysMethod · 0.45
GraphicsMethod · 0.45
EditorMethod · 0.45

Tested by

no test coverage detected