MCPcopy Create free account
hub / github.com/cinder/Cinder / finalize

Method finalize

src/cinder/ImageTargetFileQoi.cpp:122–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void ImageTargetFileQoi::finalize()
123{
124 qoi_desc desc;
125 desc.width = (unsigned int)mWidth;
126 desc.height = (unsigned int)mHeight;
127 desc.channels = mNumComponents;
128 desc.colorspace = QOI_SRGB;
129
130 if( ! mFilePath.empty() ) {
131 if( ! qoiWritePath( mFilePath, mData.get(), &desc ) )
132 throw ImageIoExceptionFailedWrite( "Failed to write QOI image" );
133 }
134 else {
135 // Encode to memory
136 int encodedSize = 0;
137 void *encoded = qoi_encode( mData.get(), &desc, &encodedSize );
138 if( ! encoded )
139 throw ImageIoExceptionFailedWrite( "Failed to encode QOI image" );
140
141 // Write to stream
142 OStream *stream = mDataTarget->getStream().get();
143 stream->writeData( encoded, static_cast<size_t>( encodedSize ) );
144
145 // Free the encoded buffer
146 free( encoded );
147 }
148}
149
150} // namespace cinder

Callers

nothing calls this directly

Calls 6

qoiWritePathFunction · 0.85
qoi_encodeFunction · 0.85
getStreamMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45
writeDataMethod · 0.45

Tested by

no test coverage detected