MCPcopy Create free account
hub / github.com/Tencent/libpag / readFrameInternal

Method readFrameInternal

src/rendering/PAGDecoder.cpp:173–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173bool PAGDecoder::readFrameInternal(int index, std::shared_ptr<BitmapBuffer> bitmap) {
174 if (bitmap == nullptr) {
175 LOGE("PAGDecoder::readFrame() The specified bitmap buffer is invalid!");
176 return false;
177 }
178 auto composition = getComposition();
179 checkCompositionChange(composition);
180 if (index < 0 || index >= _numFrames) {
181 LOGE("PAGDecoder::readFrame() The index is out of range!");
182 return false;
183 }
184 if (!checkSequenceFile(composition, bitmap->info())) {
185 return false;
186 }
187 auto success = sequenceFile->readFrame(index, bitmap);
188 if (!success) {
189 success = renderFrame(composition, index, bitmap);
190 if (success) {
191 success = sequenceFile->writeFrame(index, bitmap);
192 if (!success) {
193 LOGE("PAGDecoder::readFrame() Failed to write frame to SequenceFile!");
194 }
195 }
196 }
197 if (sequenceFile->isComplete() && composition != nullptr) {
198 if (reader != nullptr) {
199 reader = nullptr;
200 if (composition.use_count() != 1) {
201 container->addLayer(composition);
202 }
203 } else if (composition.use_count() <= 2) {
204 container->removeAllLayers();
205 }
206 }
207 if (success) {
208 lastReadIndex = index;
209 }
210 return success;
211}
212
213bool PAGDecoder::renderFrame(std::shared_ptr<PAGComposition> composition, int index,
214 std::shared_ptr<BitmapBuffer> bitmap) {

Callers

nothing calls this directly

Calls 6

infoMethod · 0.80
writeFrameMethod · 0.80
isCompleteMethod · 0.80
readFrameMethod · 0.45
addLayerMethod · 0.45
removeAllLayersMethod · 0.45

Tested by

no test coverage detected