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

Method updateStaticTimeRanges

src/base/BitmapComposition.cpp:40–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void BitmapComposition::updateStaticTimeRanges() {
41 staticTimeRanges = {};
42 if (duration <= 1) {
43 return;
44 }
45 if (!sequences.empty()) {
46 Frame start = 0;
47 Frame end = 0;
48 auto sequence = sequences[0];
49 for (size_t i = 1; i < sequences.size(); i++) {
50 auto item = sequences[i];
51 if (item->frameRate > sequence->frameRate) {
52 sequence = item;
53 }
54 }
55 float timeScale = frameRate / sequence->frameRate;
56 for (size_t index = 0; index < sequence->frames.size(); index++) {
57 if (sequence->isEmptyBitmapFrame(index)) {
58 end = index;
59 } else {
60 if (end > start) {
61 auto range = MakeTimeRange(start, end, timeScale);
62 staticTimeRanges.push_back(range);
63 }
64 start = end = index;
65 }
66 }
67 if (end > start) {
68 auto range = MakeTimeRange(start, end, timeScale);
69 staticTimeRanges.push_back(range);
70 }
71 } else {
72 TimeRange range = {0, duration - 1};
73 staticTimeRanges.push_back(range);
74 }
75}
76
77bool BitmapComposition::hasImageContent() const {
78 return true;

Callers

nothing calls this directly

Calls 5

MakeTimeRangeFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.80
isEmptyBitmapFrameMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected