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

Function etc2_decode_image

core/base/etc2.cpp:974–1000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

972}
973
974int etc2_decode_image(int format, const etc2_byte* input, etc2_byte* output, etc2_uint32 width, etc2_uint32 height)
975{
976 size_t outputRowPitch = 4 * width;
977 size_t outputDepthPitch = outputRowPitch * height;
978
979 size_t bytesPerPixel = 0;
980 LoadTextureFunction loadTexture = nullptr;
981 switch (format) {
982 case ETC2_RGBA_NO_MIPMAPS:
983 bytesPerPixel = 16;
984 loadTexture = &LoadETC2RGBA8ToRGBA8;
985 break;
986 case ETC2_RGB_NO_MIPMAPS:
987 bytesPerPixel = 8;
988 loadTexture = &LoadETC2RGB8ToRGBA8;
989 break;
990 }
991
992 if (loadTexture) {
993 size_t inputRowPitch = ComputeETC2RowPitch(width, 4 /*blockWidth*/, bytesPerPixel);
994 size_t inputDepthPitch = ComputeETC2DepthPitch(height, 4 /*blockHeight*/, inputRowPitch);
995 loadTexture(width, height, 1, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch);
996 return 0;
997 }
998
999 return -1;
1000}

Callers 3

initWithPVRv3DataMethod · 0.85
initWithETCDataMethod · 0.85
initWithETC2DataMethod · 0.85

Calls 2

ComputeETC2RowPitchFunction · 0.85
ComputeETC2DepthPitchFunction · 0.85

Tested by

no test coverage detected