Ultralight icon indicating copy to clipboard operation
Ultralight copied to clipboard

Option to create new ultralight::Buffer with just size

Open p0358 opened this issue 1 year ago • 0 comments

ultralight::Buffer is possible to be created by either adapting existing data and providing custom free function (cumbersome) or by creating a deep copy of existing buffer (not performant):

  static RefPtr<Buffer> Create(void* data, size_t size, void* user_data,
                               DestroyBufferCallback destruction_callback);

  static RefPtr<Buffer> CreateFromCopy(const void* data, size_t size);

There should be a third option to create an empty/unitialized buffer with just size as the parameter, where you could copy the data to directly, with no deep copy and without worrying about freeing it later with callback as the class would still own it...

p0358 avatar Nov 16 '22 01:11 p0358