Skip to content

Refactor embedded resources to be embedded as binary blobs

Refactor embedded resources to be embedded as binary blobs

The patch does multiple things:

  1. Introduces KoResourceLoadResult class that encapsulates the result of a linked/embedded resource load operation. It may be in three states:

    • an existing resource has been found in the database
    • a binary blob of the embedded resource has been fetched
    • "link failed" --- the resource links to an unexisting resource, which has not embedded into the parent resource
  2. Makes KoResource::linkedResources and KoResource::embededResources return the list of KoResourceLoadResult objects instead of actual resources

  3. KisResourceLocator parses this list and imports the resources as binary blobs into the storage, therefore keeping resources' md5 unchanged

  4. Implements KisResourceLocator::importResource and KisResourceLocator::exportResource that manipulates with binary blobs

  5. KisDocument and KisResourceBundle now also use import/export API, so MD5 doesn't change on embedding the resources.

Ref T14946

PS: All the related unittests seem to pass with this patch applied :)

Edited by Dmitry Kazakov

Merge request reports