Rename encoders to Sk*ImageEncoder

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1836493002
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1836493002
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index b375e59..faeb2f8 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -71,7 +71,7 @@
 endif()
 if (APPLE OR NOT UNIX)
     remove_srcs(../src/gpu/gl/glx/*
-                ../src/images/SkImageDecoder_FactoryDefault.cpp
+                ../src/images/SkMovie_FactoryDefault.cpp
                 ../src/ports/SkFontMgr_fontconfig*.cpp
                 ../src/ports/SkFontMgr_android*.cpp
                 ../src/*FreeType*)
@@ -102,6 +102,7 @@
     ../src/ports/SkFontMgr_empty_factory.cpp
     ../src/ports/SkGlobalInitialization_chromium.cpp
     ../src/ports/SkImageDecoder_empty.cpp
+    ../src/ports/SkImageEncoder_none.cpp
     ../src/ports/SkImageGenerator_none.cpp
     ../src/ports/SkTLS_none.cpp)
 
@@ -171,7 +172,7 @@
     list (APPEND libs             ${GIF_LIBRARIES})
     add_definitions(-DSK_CODEC_DECODES_GIF)
 else()
-    remove_srcs(../src/images/*gif*)
+    remove_srcs(../src/images/*GIF*)
     remove_srcs(../src/codec/*Gif*)
 endif()
 
@@ -180,8 +181,7 @@
     list (APPEND libs             ${JPEG_LIBRARIES})
     add_definitions(-DSK_CODEC_DECODES_JPEG)
 else()
-    remove_srcs(../src/images/*jpeg*)
-    remove_srcs(../src/images/*Jpeg*)
+    remove_srcs(../src/images/*JPEG*)
     remove_srcs(../src/codec/*Jpeg*)
 endif()
 
@@ -199,7 +199,7 @@
     add_definitions(-DPNG_SKIP_SKIA_OPTS)
     add_definitions(-DSK_CODEC_DECODES_PNG)
 else()
-    remove_srcs(../src/images/*png*)
+    remove_srcs(../src/images/*PNG*)
     remove_srcs(../src/codec/*Png*)
     remove_srcs(../src/codec/*Ico*)
 endif()
@@ -218,7 +218,7 @@
     list (APPEND libs             ${WEBP_LIBRARIES})
     add_definitions(-DSK_CODEC_DECODES_WEBP)
 else()
-    remove_srcs(../src/images/*webp*)
+    remove_srcs(../src/images/*WEBP*)
     remove_srcs(../src/codec/*Webp*)
 endif()
 
diff --git a/gyp/codec.gyp b/gyp/codec.gyp
index 81b28fe..a31c1cc 100644
--- a/gyp/codec.gyp
+++ b/gyp/codec.gyp
@@ -44,7 +44,7 @@
         '../src/codec/SkIcoCodec.cpp',
         '../src/codec/SkJpegCodec.cpp',
         '../src/codec/SkJpegDecoderMgr.cpp',
-        '../src/codec/SkJpegUtility_codec.cpp',
+        '../src/codec/SkJpegUtility.cpp',
         '../src/codec/SkMaskSwizzler.cpp',
         '../src/codec/SkMasks.cpp',
         '../src/codec/SkPngCodec.cpp',
diff --git a/gyp/images.gyp b/gyp/images.gyp
index 53f505d..e0e0a89 100644
--- a/gyp/images.gyp
+++ b/gyp/images.gyp
@@ -35,33 +35,33 @@
         '../include/images/SkPageFlipper.h',
 
         '../src/images/SkForceLinking.cpp',
-        '../src/images/SkImageDecoder_FactoryDefault.cpp',
+        '../src/images/SkMovie_FactoryDefault.cpp',
 
         # If encoders are added/removed to/from (all/individual)
         # platform(s), be sure to update SkForceLinking.cpp
         # so the right decoders will be forced to link.
 
-        '../src/images/SkImageDecoder_ktx.cpp',
-        '../src/images/SkImageDecoder_libwebp.cpp',
-        '../src/images/SkImageDecoder_libjpeg.cpp',
-        '../src/images/SkImageDecoder_libpng.cpp',
+        '../src/images/SkKTXImageEncoder.cpp',
+        '../src/images/SkWEBPImageEncoder.cpp',
+        '../src/images/SkJPEGImageEncoder.cpp',
+        '../src/images/SkPNGImageEncoder.cpp',
 
         '../src/images/SkImageEncoder.cpp',
         '../src/images/SkImageEncoder_Factory.cpp',
-        '../src/images/SkImageEncoder_argb.cpp',
-        '../src/images/SkJpegUtility.cpp',
+        '../src/images/SkARGBImageEncoder.cpp',
+        '../src/images/SkJPEGWriteUtility.cpp',
         '../src/images/SkMovie.cpp',
-        '../src/images/SkMovie_gif.cpp',
+        '../src/images/SkGIFMovie.cpp',
         '../src/images/SkPageFlipper.cpp',
 
-        '../src/ports/SkImageDecoder_CG.cpp',
-        '../src/ports/SkImageDecoder_WIC.cpp',
+        '../src/ports/SkImageEncoder_CG.cpp',
+        '../src/ports/SkImageEncoder_WIC.cpp',
       ],
       'conditions': [
         [ 'skia_os == "win"', {
           'sources!': [
-            '../src/images/SkImageDecoder_libpng.cpp',
-            '../src/images/SkMovie_gif.cpp',
+            '../src/images/SkPNGImageEncoder.cpp',
+            '../src/images/SkGIFMovie.cpp',
           ],
           'dependencies!': [
             'giflib.gyp:giflib'
@@ -73,17 +73,17 @@
           },
         },{ #else if skia_os != win
           'sources!': [
-            '../src/ports/SkImageDecoder_WIC.cpp',
+            '../src/ports/SkImageEncoder_WIC.cpp',
           ],
         }],
         [ 'skia_os in ["mac", "ios"]', {
           'sources!': [
-            '../src/images/SkImageDecoder_libpng.cpp',
-            '../src/images/SkMovie_gif.cpp',
+            '../src/images/SkPNGImageEncoder.cpp',
+            '../src/images/SkGIFMovie.cpp',
           ],
         },{ #else if skia_os != mac
           'sources!': [
-            '../src/ports/SkImageDecoder_CG.cpp',
+            '../src/ports/SkImageEncoder_CG.cpp',
           ],
         }],
         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
@@ -104,7 +104,7 @@
               # The android framework disables these decoders as they are of little use to
               # Java applications that can't take advantage of the compressed formats.
               'sources!': [
-                '../src/images/SkImageDecoder_ktx.cpp',
+                '../src/images/SkKTXImageEncoder.cpp',
               ],
             }],
           ],
diff --git a/public.bzl b/public.bzl
index 65d5e03..ba10d31 100644
--- a/public.bzl
+++ b/public.bzl
@@ -165,6 +165,7 @@
         "src/ports/SkFontMgr_fontconfig.cpp",
         "src/ports/SkFontMgr_fontconfig_factory.cpp",
         "src/ports/SkImageDecoder_empty.cpp",
+        "src/ports/SkImageEncoder_none.cpp",
         "src/ports/SkImageGenerator_none.cpp",
         "src/ports/SkTLS_none.cpp",
     ],
@@ -212,6 +213,7 @@
         "src/ports/SkFontMgr_custom_empty_factory.cpp",
         "src/ports/SkFontMgr_empty_factory.cpp",
         "src/ports/SkImageDecoder_empty.cpp",
+        "src/ports/SkImageEncoder_none.cpp",
         "src/ports/SkImageGenerator_none.cpp",
         "src/ports/SkTLS_none.cpp",
     ],
@@ -267,6 +269,7 @@
         "src/ports/SkFontMgr_custom_embedded_factory.cpp",
         "src/ports/SkFontMgr_custom_empty_factory.cpp",
         "src/ports/SkFontMgr_empty_factory.cpp",
+        "src/ports/SkImageDecoder_empty.cpp",
         "src/ports/SkImageGenerator_none.cpp",
         "src/ports/SkTLS_none.cpp",
     ],
@@ -396,14 +399,6 @@
         "tools/ProcStats.h",
         "tools/Resources.cpp",
         "tools/Resources.h",
-        "tools/SkBitmapRegionCanvas.cpp",
-        "tools/SkBitmapRegionCanvas.h",
-        "tools/SkBitmapRegionCodec.cpp",
-        "tools/SkBitmapRegionCodec.h",
-        "tools/SkBitmapRegionDecoder.cpp",
-        "tools/SkBitmapRegionDecoder.h",
-        "tools/SkBitmapRegionSampler.cpp",
-        "tools/SkBitmapRegionSampler.h",
         "tools/flags/*.cpp",
         "tools/flags/*.h",
         "tools/random_parse_path.cpp",
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 2005d1d..76d2ee8 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -9,7 +9,6 @@
 #include "SkMSAN.h"
 #include "SkJpegCodec.h"
 #include "SkJpegDecoderMgr.h"
-#include "SkJpegUtility_codec.h"
 #include "SkCodecPriv.h"
 #include "SkColorPriv.h"
 #include "SkStream.h"
@@ -18,6 +17,7 @@
 
 // stdio is needed for libjpeg-turbo
 #include <stdio.h>
+#include "SkJpegUtility.h"
 
 extern "C" {
     #include "jerror.h"
diff --git a/src/codec/SkJpegDecoderMgr.cpp b/src/codec/SkJpegDecoderMgr.cpp
index cc44f3c..63228bb 100644
--- a/src/codec/SkJpegDecoderMgr.cpp
+++ b/src/codec/SkJpegDecoderMgr.cpp
@@ -6,7 +6,8 @@
  */
 
 #include "SkJpegDecoderMgr.h"
-#include "SkJpegUtility_codec.h"
+
+#include "SkJpegUtility.h"
 
 /*
  * Print information, warning, and error messages
diff --git a/src/codec/SkJpegDecoderMgr.h b/src/codec/SkJpegDecoderMgr.h
index 7d34b67..e1127ba 100644
--- a/src/codec/SkJpegDecoderMgr.h
+++ b/src/codec/SkJpegDecoderMgr.h
@@ -10,10 +10,8 @@
 
 #include "SkCodec.h"
 #include "SkCodecPriv.h"
-#include "SkJpegUtility_codec.h"
-
-// stdio is needed for jpeglib
 #include <stdio.h>
+#include "SkJpegUtility.h"
 
 extern "C" {
     #include "jpeglib.h"
diff --git a/src/codec/SkJpegUtility_codec.cpp b/src/codec/SkJpegUtility.cpp
similarity index 98%
rename from src/codec/SkJpegUtility_codec.cpp
rename to src/codec/SkJpegUtility.cpp
index 19ece5e..2cf36ba 100644
--- a/src/codec/SkJpegUtility_codec.cpp
+++ b/src/codec/SkJpegUtility.cpp
@@ -5,8 +5,9 @@
  * found in the LICENSE file.
  */
 
+#include "SkJpegUtility.h"
+
 #include "SkCodecPriv.h"
-#include "SkJpegUtility_codec.h"
 
 /*
  * Initialize the source manager
diff --git a/src/codec/SkJpegUtility_codec.h b/src/codec/SkJpegUtility.h
similarity index 100%
rename from src/codec/SkJpegUtility_codec.h
rename to src/codec/SkJpegUtility.h
diff --git a/src/images/SkImageEncoder_argb.cpp b/src/images/SkARGBImageEncoder.cpp
similarity index 100%
rename from src/images/SkImageEncoder_argb.cpp
rename to src/images/SkARGBImageEncoder.cpp
diff --git a/src/images/SkForceLinking.cpp b/src/images/SkForceLinking.cpp
index 05fc7e0..78e53f8 100644
--- a/src/images/SkForceLinking.cpp
+++ b/src/images/SkForceLinking.cpp
@@ -9,7 +9,7 @@
 #include "SkForceLinking.h"
 
 // This method is required to fool the linker into not discarding the pre-main
-// initialization and registration of the decoder classes. Passing true will
+// initialization and registration of the encoder classes. Passing true will
 // cause memory leaks.
 int SkForceLinking(bool doNotPassTrue) {
     if (doNotPassTrue) {
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkGIFMovie.cpp
similarity index 100%
rename from src/images/SkMovie_gif.cpp
rename to src/images/SkGIFMovie.cpp
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkJPEGImageEncoder.cpp
similarity index 99%
rename from src/images/SkImageDecoder_libjpeg.cpp
rename to src/images/SkJPEGImageEncoder.cpp
index fd10bdb..e3e7600 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkJPEGImageEncoder.cpp
@@ -7,7 +7,6 @@
 
 
 #include "SkImageEncoder.h"
-#include "SkJpegUtility.h"
 #include "SkColorPriv.h"
 #include "SkDither.h"
 #include "SkStream.h"
@@ -20,6 +19,7 @@
 
 
 #include <stdio.h>
+#include "SkJPEGWriteUtility.h"
 extern "C" {
     #include "jpeglib.h"
     #include "jerror.h"
diff --git a/src/images/SkJpegUtility.cpp b/src/images/SkJPEGWriteUtility.cpp
similarity index 98%
rename from src/images/SkJpegUtility.cpp
rename to src/images/SkJPEGWriteUtility.cpp
index ab8486b..aa0d3ec 100644
--- a/src/images/SkJpegUtility.cpp
+++ b/src/images/SkJPEGWriteUtility.cpp
@@ -6,7 +6,7 @@
  */
 
 
-#include "SkJpegUtility.h"
+#include "SkJPEGWriteUtility.h"
 
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/images/SkJpegUtility.h b/src/images/SkJPEGWriteUtility.h
similarity index 100%
rename from src/images/SkJpegUtility.h
rename to src/images/SkJPEGWriteUtility.h
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkKTXImageEncoder.cpp
similarity index 100%
rename from src/images/SkImageDecoder_ktx.cpp
rename to src/images/SkKTXImageEncoder.cpp
diff --git a/src/images/SkImageDecoder_FactoryDefault.cpp b/src/images/SkMovie_FactoryDefault.cpp
similarity index 100%
rename from src/images/SkImageDecoder_FactoryDefault.cpp
rename to src/images/SkMovie_FactoryDefault.cpp
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkPNGImageEncoder.cpp
similarity index 100%
rename from src/images/SkImageDecoder_libpng.cpp
rename to src/images/SkPNGImageEncoder.cpp
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkWEBPImageEncoder.cpp
similarity index 100%
rename from src/images/SkImageDecoder_libwebp.cpp
rename to src/images/SkWEBPImageEncoder.cpp
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageEncoder_CG.cpp
similarity index 100%
rename from src/ports/SkImageDecoder_CG.cpp
rename to src/ports/SkImageEncoder_CG.cpp
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageEncoder_WIC.cpp
similarity index 100%
rename from src/ports/SkImageDecoder_WIC.cpp
rename to src/ports/SkImageEncoder_WIC.cpp
diff --git a/src/ports/SkImageEncoder_none.cpp b/src/ports/SkImageEncoder_none.cpp
new file mode 100644
index 0000000..33e07ac
--- /dev/null
+++ b/src/ports/SkImageEncoder_none.cpp
@@ -0,0 +1,77 @@
+
+/*
+ * Copyright 2006 The Android Open Source Project
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBitmap.h"
+#include "SkImage.h"
+#include "SkImageEncoder.h"
+#include "SkMovie.h"
+#include "SkPixelSerializer.h"
+#include "SkStream.h"
+
+/////////////////////////////////////////////////////////////////////////
+
+// Empty implementation for SkMovie.
+
+SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
+    return nullptr;
+}
+
+/////////////////////////////////////////////////////////////////////////
+
+// Empty implementations for SkImageEncoder.
+
+SkImageEncoder* SkImageEncoder::Create(Type t) {
+    return nullptr;
+}
+
+bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap&, Type, int quality) {
+    return false;
+}
+
+bool SkImageEncoder::EncodeStream(SkWStream*, const SkBitmap&, SkImageEncoder::Type, int) {
+    return false;
+}
+
+SkData* SkImageEncoder::EncodeData(const SkBitmap&, Type, int quality) {
+    return nullptr;
+}
+
+SkData* SkImageEncoder::EncodeData(const SkImageInfo&, const void* pixels, size_t rowBytes,
+                                   Type, int quality) {
+    return nullptr;
+}
+
+SkData* SkImageEncoder::EncodeData(const SkPixmap&, Type, int) {
+    return nullptr;
+}
+
+bool SkImageEncoder::encodeStream(SkWStream*, const SkBitmap&, int) {
+    return false;
+}
+
+SkData* SkImageEncoder::encodeData(const SkBitmap&, int) {
+    return nullptr;
+}
+
+bool SkImageEncoder::encodeFile(const char file[], const SkBitmap& bm, int quality) {
+    return false;
+}
+
+namespace {
+class ImageEncoderPixelSerializer final : public SkPixelSerializer {
+protected:
+    bool onUseEncodedData(const void*, size_t) override { return true; }
+    SkData* onEncode(const SkPixmap&) override { return nullptr; }
+};
+}  // namespace
+
+SkPixelSerializer* SkImageEncoder::CreatePixelSerializer() {
+    return new ImageEncoderPixelSerializer;
+}
+
+/////////////////////////////////////////////////////////////////////////