)]}'
{
  "commit": "de8474c5d27d279828fe45973c28b6d2af085a9f",
  "tree": "2444765a67cece718f3c0589562cd397822fe2bd",
  "parents": [
    "0746c98c8b0ed9ee291c17f56d256be69796317d"
  ],
  "author": {
    "name": "luigi-rosso",
    "email": "hello@rive.app",
    "time": "Mon Sep 19 23:52:57 2022 +0000"
  },
  "committer": {
    "name": "luigi-rosso",
    "email": "hello@rive.app",
    "time": "Mon Sep 19 23:52:57 2022 +0000"
  },
  "message": "Implement a dynamic array (simple vector for marshaling).\n\nWhile working on marshaling the RenderFont abstraction to Dart FFI and WASM, it became clear that dealing with vectors inside of vectors gets tricky.\n\nWe can wrap one single vector into a return struct like:\n```\nstruct EasyToMarshal {\n  std::vector\u003cfloat\u003e* ptrToVector;\n  float* dataInVector;\n  size_t size;\n};\n```\nThis is what we currently do and FFI/WASM is expected to then call in to C++ to delete ptrToVector when it\u0027s done with the data.\n\nThis gets problematic to do when ptrToVector contains types that internally contain more vectors. The size and memory layout of vector isn\u0027t guaranteed across platforms with different STL implementations.\n\nThe result from the shaper was a vector of RenderGlyphRuns:\n```\nstruct RenderGlyphRun {\n    rcp\u003cRenderFont\u003e font;\n    float size;\n\n    std::vector\u003cGlyphID\u003e glyphs;       // [#glyphs]\n    std::vector\u003cuint32_t\u003e textOffsets; // [#glyphs]\n    std::vector\u003cfloat\u003e xpos;           // [#glyphs + 1]\n};\n\nstd::vector\u003cRenderGlyphRun\u003e shapeText(...){}\n```\n\nThis PR introduces a DynamicArray (totally up for renaming this to something less lame) which makes it really easy to marshal DynamicArrays inside of other DynamicArrays as we know the memory layout is just like rive::Span (a pointer and a size).\n\nSeparately, this does make me wonder if we should use uint64_t for size in DynamicArrays so we can guarantee those are always 64 bit (the FFI and WASM tooling doesn\u0027t make it easy to marhsal runtime determined sizes).\n\nDiffs\u003d\ne62737cf9 include cstring for memcpy\n468dd3a2b Add growToFit, assert we didn’t overflow size_t, and in place constructor calls\nf0947d32f Add realloc down to actual used size from capacity.\n516d0fc12 Move resize to builder and rename to simple array.\n091904d22 malloc/realloc version\ne574043f7 More windows fixes\nc1f5b96ec Fix windows compiler warning.\n164911445 Implement a dynamic array (simple vector for marshaling).\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "73ef9889c2f3ae7cd32b964ac070b93b5f5ac4e6",
      "old_mode": 33188,
      "old_path": ".rive_head",
      "new_id": "4f0e5060c3319e721684b2cb1459b1c056cce57c",
      "new_mode": 33188,
      "new_path": ".rive_head"
    },
    {
      "type": "modify",
      "old_id": "202582cf3abd04b79aa3508f3d7870e086a2afc2",
      "old_mode": 33188,
      "old_path": "include/rive/render_text.hpp",
      "new_id": "6c5b70b086286978d7ecfd10689cec7e21631f4f",
      "new_mode": 33188,
      "new_path": "include/rive/render_text.hpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "270a780cc5b2ecd427aed749895fb6def215bc71",
      "new_mode": 33188,
      "new_path": "include/rive/simple_array.hpp"
    },
    {
      "type": "modify",
      "old_id": "124249c258426e06e1a64e40fecdacacf61caa2a",
      "old_mode": 33188,
      "old_path": "skia/renderer/include/renderfont_coretext.hpp",
      "new_id": "9f2b5cb84a3b9e4feb5a82783056ae578eabfb1a",
      "new_mode": 33188,
      "new_path": "skia/renderer/include/renderfont_coretext.hpp"
    },
    {
      "type": "modify",
      "old_id": "dd8ae3e41ea1a1b1e2f957485fb540956cc4138d",
      "old_mode": 33188,
      "old_path": "skia/renderer/include/renderfont_hb.hpp",
      "new_id": "0ebac543a5d09f20091d1d085f412f85fb74e70b",
      "new_mode": 33188,
      "new_path": "skia/renderer/include/renderfont_hb.hpp"
    },
    {
      "type": "modify",
      "old_id": "21d79f52a7e508f527784db1813002155c6f0c2e",
      "old_mode": 33188,
      "old_path": "skia/renderer/src/renderfont_coretext.cpp",
      "new_id": "89dc0cb672894bc240a328ba0b01eba84459bdcc",
      "new_mode": 33188,
      "new_path": "skia/renderer/src/renderfont_coretext.cpp"
    },
    {
      "type": "modify",
      "old_id": "edf6bdef2ab5a5c733e421116476c558ce05a3de",
      "old_mode": 33188,
      "old_path": "skia/renderer/src/renderfont_hb.cpp",
      "new_id": "72b8a5b670dba9f4b9bd8ea4bdbc7392e90f7a71",
      "new_mode": 33188,
      "new_path": "skia/renderer/src/renderfont_hb.cpp"
    },
    {
      "type": "modify",
      "old_id": "45fb4dfc3f679923d5a8743f20fff4606fa2b151",
      "old_mode": 33188,
      "old_path": "src/renderer.cpp",
      "new_id": "4f460238981eae8a50ad33fea4fe7d8e26b70714",
      "new_mode": 33188,
      "new_path": "src/renderer.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ef567d85e43660b8931a9e27ec379b6b9ac0c0ad",
      "new_mode": 33188,
      "new_path": "src/simple_array.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e3847a0916b1de5dfd26a5144e1fe6930ea2331f",
      "new_mode": 33188,
      "new_path": "test/simple_array_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "605c17e272075ec286305b2c3f6995f43e3879fc",
      "old_mode": 33188,
      "old_path": "test/span_test.cpp",
      "new_id": "a4c6ae5178601d2305cb78ccdac0b2498e94b7ba",
      "new_mode": 33188,
      "new_path": "test/span_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "94a9472143319c7859f4ca28ff526694372c7aa4",
      "old_mode": 33188,
      "old_path": "viewer/src/viewer_content/text_content.cpp",
      "new_id": "fc1990cca6ef73fb5bfd5dc2a9b00c54525dcc9e",
      "new_mode": 33188,
      "new_path": "viewer/src/viewer_content/text_content.cpp"
    },
    {
      "type": "modify",
      "old_id": "4495446048c22aa4f3fec4cda2621cb258c35889",
      "old_mode": 33188,
      "old_path": "viewer/src/viewer_content/textpath_content.cpp",
      "new_id": "2870bbd29569db7c0c7e88a44fb89e9fd59a7899",
      "new_mode": 33188,
      "new_path": "viewer/src/viewer_content/textpath_content.cpp"
    }
  ]
}
