MCPcopy Create free account
hub / github.com/axmolengine/axmol / initWithRawData

Method initWithRawData

core/platform/Image.cpp:783–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781}
782
783bool Image::initWithRawData(const uint8_t* data,
784 ssize_t /*dataLen*/,
785 int width,
786 int height,
787 int /*bitsPerComponent*/,
788 bool preMulti)
789{
790 bool ret = false;
791 do
792 {
793 AX_BREAK_IF(0 == width || 0 == height);
794
795 _height = height;
796 _width = width;
797 _hasPremultipliedAlpha = preMulti;
798 _pixelFormat = backend::PixelFormat::RGBA8;
799
800 // only RGBA8888 supported
801 int bytesPerComponent = 4;
802 _dataLen = height * width * bytesPerComponent;
803 _data = static_cast<uint8_t*>(malloc(_dataLen));
804 AX_BREAK_IF(!_data);
805 memcpy(_data, data, _dataLen);
806
807 ret = true;
808 } while (0);
809
810 return ret;
811}
812
813void Image::flipRawData()
814{

Callers 5

getWhiteTextureMethod · 0.80
getDummyTextureMethod · 0.80
TerrainMethod · 0.80
refreshMeshRenderMethod · 0.80
addPackageMethod · 0.80

Calls

no outgoing calls

Tested by 1

refreshMeshRenderMethod · 0.64