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

Method writeFloatList

src/codec/utils/EncodeStream.cpp:275–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void EncodeStream::writeFloatList(const float* values, uint32_t count, float precision) {
276 if (count == 0) {
277 writeUBits(0, LENGTH_FOR_STORE_NUM_BITS);
278 return;
279 }
280 auto scale = 1 / precision;
281 auto list = new int32_t[count];
282 for (uint32_t i = 0; i < count; i++) {
283 list[i] = static_cast<int32_t>(roundf(values[i] * scale));
284 }
285 writeInt32List(list, count);
286 delete[] list;
287}
288
289void EncodeStream::writePoint2DList(const Point* points, uint32_t count, float precision) {
290 auto list = new float[count * 2 + 1];

Callers 4

writeValueListMethod · 0.80
WritePathInternalFunction · 0.80
WriteTimeEaseFunction · 0.80
WriteSpatialEaseFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected