Make sure all uses of SkResources that need codecs register them
MultiFrameImageAsset::Make(SkData) uses SkCodec::MakeFromData which
uses any registered codecs. With the old GN and skia_public build,
these were registered at compile time, but that won't be feasible
with the modular build (since codec modules are independent from
each other and from "generic codec support").
DataURIResourceProviderProxy::loadImageAsset (the base64 decoding case)
and FileResourceProvider::loadImageAsset both call MultiFrameImageAsset::Make,
which means any instantiation of FileResourceProvider or
DataURIResourceProviderProxy would need to register codecs as well.
I went through the Skia codebase and found all usages of those
three classes and made sure that codecs were registered appropriately.
For CanvasKit, I also changed two other implicit uses of these
compile-time codecs, so the skottie WASM code could share the
decoding implementation.
Clients like CanvasKit which are built on top of Skia with zero or
more codecs built in *can* use the defines set by our GN and Bazel
rules to detect if the functionality is available, so this CL does
that where applicable. To do this better, I made the Bazel modules
actually set the defines and made the GN define for GIF support
align to the style of the rest of the defines we set.
With this taken care of, follow-on CLs can migrate client uses of
these APIs too, before migrating them to use the modular build.
To make this work for GN and Bazel, I added defines to the GN build
like SK_CODEC_DECODES_BMP and aligned GIF with the other common
codecs. In the GN build, BMP and WBMP are always built-in, so they
are always defined.
Bug: b/40045064
Change-Id: I3bdf4183b537594245c196f1aaac24105afdf433
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/811816
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
17 files changed