Add platform image encoder for using NDK APIs

Bug: skia:10369

Add SkEncodeImageWithNDK, mirroring the CG and WIC versions, for
encoding with the NDK APIs added to R.

Rename SK_ENABLE_NDK_DECODING to SK_ENABLE_NDK_IMAGES and use it for
both encoding and decoding.

Move code for converting to/from NDK types into a common location.

Update encode_platform.cpp to use NDK encoding APIs when available and
to use both types of webp (lossy and lossless). Add tests specifically
for the new implementation.

Update NdkDecodeTest to use ToolUtils::equal_pixels for comparing
pixels.

Change-Id: Ic62f89af27372ccce90b8e028e01c388a135a68c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308800
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 24decac..12feeff 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -848,10 +848,14 @@
   ]
 }
 
-optional("ndk_decode") {
-  enabled = skia_use_ndk_decode
-  public_defines = [ "SK_ENABLE_NDK_DECODING" ]
-  sources = [ "src/ports/SkImageGeneratorNDK.cpp" ]
+optional("ndk_images") {
+  enabled = skia_use_ndk_images
+  public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
+  sources = [
+    "src/ports/SkImageEncoder_NDK.cpp",
+    "src/ports/SkImageGeneratorNDK.cpp",
+    "src/ports/SkNDKConversions.cpp",
+  ]
   libs = [ "jnigraphics" ]
 }
 
@@ -1079,7 +1083,7 @@
     ":hsw",
     ":jpeg_decode",
     ":jpeg_encode",
-    ":ndk_decode",
+    ":ndk_images",
     ":none",
     ":png_decode",
     ":png_encode",