Make SkPngEncoder and SkJpegEncoder namespaces, not classes
(SkWebpEncoder was already a namespace). This allows us to have
two (or more) implementations of a Sk*Encoder interface and makes
it easier to switch between those implementations.
To be concrete, we have an implementation of a png encoder
written on top of libpng which now lives in
src/encode/SkPngEncoderImpl.cpp. We can ship with this implementation
or one which uses SkNDKConversions::toDataSpace (in
src/ports/SkImageEncoder_NDK.cpp) or (temporarily) a no-op
implementation in src/encode/SkPngEncoder_none.cpp.
We rely on the build system to only build one of these implementations
and the linker to complain if we configure this wrong. These changes
do not require the use of #defines (such as SK_ENCODE_PNG) to
enable or disable these, which makes it easier to set up using
Bazel (and a modular build setup).
See also:
- https://crrev.com/c/4415176
Change-Id: I21b187940ac54b688b228f7b33a7428e1243d1f6
Bug: skia:13983
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/667298
Owners-Override: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
27 files changed