MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ktxTexture_constructFromStream

Function ktxTexture_constructFromStream

lib/texture.c:191–215  ·  view source on GitHub ↗

* @memberof ktxTexture @private * @~English * @brief Construct (initialize) the part of a ktxTexture base class that is * not related to the stream contents. * * @param[in] This pointer to a ktxTexture-sized block of memory to * initialize. * * @return KTX_SUCCESS on success, other KTX_* enum values on error. */

Source from the content-addressed store, hash-verified

189 * @return KTX_SUCCESS on success, other KTX_* enum values on error.
190 */
191KTX_error_code
192ktxTexture_constructFromStream(ktxTexture* This, ktxStream* pStream,
193 ktxTextureCreateFlags createFlags)
194{
195 ktxStream* stream;
196 UNUSED(createFlags); // Reference to keep compiler happy.
197
198 assert(This != NULL);
199 assert(pStream->data.mem != NULL);
200 assert(pStream->type == eStreamTypeFile
201 || pStream->type == eStreamTypeMemory
202 || pStream->type == eStreamTypeCustom);
203
204 This->_protected = (struct ktxTexture_protected *)
205 malloc(sizeof(struct ktxTexture_protected));
206 stream = ktxTexture_getStream(This);
207 // Copy stream info into struct for later use.
208 *stream = *pStream;
209
210 This->orientation.x = KTX_ORIENT_X_RIGHT;
211 This->orientation.y = KTX_ORIENT_Y_DOWN;
212 This->orientation.z = KTX_ORIENT_Z_OUT;
213
214 return KTX_SUCCESS;
215}
216
217
218/**

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected