Remove SK_LEGACY_HEIF_API

Bug: b/78868457
Bug: b/120414514

No longer needed, now that Android has switched over to the new API.

Change-Id: Idd2f2e843311aee11fb8d053e0ad3ccf98e429e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236340
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Chong Zhang <chz@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/src/codec/SkHeifCodec.cpp b/src/codec/SkHeifCodec.cpp
index f3ad2a8..ae452c4 100644
--- a/src/codec/SkHeifCodec.cpp
+++ b/src/codec/SkHeifCodec.cpp
@@ -118,11 +118,9 @@
     std::unique_ptr<SkStream> fStream;
 };
 
-#ifndef SK_LEGACY_HEIF_API
 static void releaseProc(const void* ptr, void* context) {
     delete reinterpret_cast<std::vector<uint8_t>*>(context);
 }
-#endif
 
 std::unique_ptr<SkCodec> SkHeifCodec::MakeFromStream(std::unique_ptr<SkStream> stream,
         SkCodec::SelectionPolicy selectionPolicy, Result* result) {
@@ -138,7 +136,6 @@
         return nullptr;
     }
 
-#ifndef SK_LEGACY_HEIF_API
     size_t frameCount = 1;
     if (selectionPolicy == SkCodec::SelectionPolicy::kPreferAnimation) {
         HeifFrameInfo sequenceInfo;
@@ -147,22 +144,13 @@
             heifInfo = std::move(sequenceInfo);
         }
     }
-#endif
 
     std::unique_ptr<SkEncodedInfo::ICCProfile> profile = nullptr;
-#ifdef SK_LEGACY_HEIF_API
-    if ((heifInfo.mIccSize > 0) && (heifInfo.mIccData != nullptr)) {
-        // FIXME: Would it be possible to use MakeWithoutCopy?
-        auto icc = SkData::MakeWithCopy(heifInfo.mIccData.get(), heifInfo.mIccSize);
-        profile = SkEncodedInfo::ICCProfile::Make(std::move(icc));
-    }
-#else
     if (heifInfo.mIccData.size() > 0) {
         auto iccData = new std::vector<uint8_t>(std::move(heifInfo.mIccData));
         auto icc = SkData::MakeWithProc(iccData->data(), iccData->size(), releaseProc, iccData);
         profile = SkEncodedInfo::ICCProfile::Make(std::move(icc));
     }
-#endif
     if (profile && profile->profile()->data_color_space != skcms_Signature_RGB) {
         // This will result in sRGB.
         profile = nullptr;
@@ -174,28 +162,19 @@
 
     *result = kSuccess;
     return std::unique_ptr<SkCodec>(new SkHeifCodec(
-            std::move(info), heifDecoder.release(), orientation
-#ifndef SK_LEGACY_HEIF_API
-            , frameCount > 1
-#endif
-            ));
+            std::move(info), heifDecoder.release(), orientation, frameCount > 1));
 }
 
 SkHeifCodec::SkHeifCodec(
         SkEncodedInfo&& info,
         HeifDecoder* heifDecoder,
-        SkEncodedOrigin origin
-#ifndef SK_LEGACY_HEIF_API
-        , bool useAnimation
-#endif
-        )
+        SkEncodedOrigin origin,
+        bool useAnimation)
     : INHERITED(std::move(info), skcms_PixelFormat_RGBA_8888, nullptr, origin)
     , fHeifDecoder(heifDecoder)
     , fSwizzleSrcRow(nullptr)
     , fColorXformSrcRow(nullptr)
-#ifndef SK_LEGACY_HEIF_API
     , fUseAnimation(useAnimation)
-#endif
 {}
 
 bool SkHeifCodec::conversionSupported(const SkImageInfo& dstInfo, bool srcIsOpaque,
@@ -286,7 +265,6 @@
     return count;
 }
 
-#ifndef SK_LEGACY_HEIF_API
 int SkHeifCodec::onGetFrameCount() {
     if (!fUseAnimation) {
         return 1;
@@ -357,7 +335,6 @@
 int SkHeifCodec::onGetRepetitionCount() {
     return kRepetitionCountInfinite;
 }
-#endif // SK_LEGACY_HEIF_API
 
 /*
  * Performs the heif decode
@@ -373,11 +350,6 @@
         return kUnimplemented;
     }
 
-#ifdef SK_LEGACY_HEIF_API
-    if (!fHeifDecoder->decode(&fFrameInfo)) {
-        return kInvalidInput;
-    }
-#else
     bool success;
     if (fUseAnimation) {
         success = fHeifDecoder->decodeSequence(options.fFrameIndex, &fFrameInfo);
@@ -388,7 +360,6 @@
     if (!success) {
         return kInvalidInput;
     }
-#endif // SK_LEGACY_HEIF_API
 
     fSwizzler.reset(nullptr);
     this->allocateStorage(dstInfo);
diff --git a/src/codec/SkHeifCodec.h b/src/codec/SkHeifCodec.h
index ad223c2..2391e6f 100644
--- a/src/codec/SkHeifCodec.h
+++ b/src/codec/SkHeifCodec.h
@@ -43,14 +43,12 @@
         return SkEncodedImageFormat::kHEIF;
     }
 
-#ifndef SK_LEGACY_HEIF_API
     int onGetFrameCount() override;
     bool onGetFrameInfo(int, FrameInfo*) const override;
     int onGetRepetitionCount() override;
     const SkFrameHolder* getFrameHolder() const override {
         return &fFrameHolder;
     }
-#endif
 
     bool conversionSupported(const SkImageInfo&, bool, bool) override;
 
@@ -61,11 +59,7 @@
      * Creates an instance of the decoder
      * Called only by NewFromStream
      */
-    SkHeifCodec(SkEncodedInfo&&, HeifDecoder*, SkEncodedOrigin
-#ifndef SK_LEGACY_HEIF_API
-                , bool animation
-#endif
-                );
+    SkHeifCodec(SkEncodedInfo&&, HeifDecoder*, SkEncodedOrigin, bool animation);
 
     void initializeSwizzler(const SkImageInfo& dstInfo, const Options& options);
     void allocateStorage(const SkImageInfo& dstInfo);
@@ -88,7 +82,6 @@
     uint32_t*                          fColorXformSrcRow;
 
     std::unique_ptr<SkSwizzler>        fSwizzler;
-#ifndef SK_LEGACY_HEIF_API
     bool                               fUseAnimation;
 
     class Frame : public SkFrame {
@@ -128,7 +121,6 @@
     };
 
     FrameHolder fFrameHolder;
-#endif // SK_LEGACY_HEIF_API
     typedef SkCodec INHERITED;
 };
 
diff --git a/src/codec/SkStubHeifDecoderAPI.h b/src/codec/SkStubHeifDecoderAPI.h
index 4f93609..413ec62 100644
--- a/src/codec/SkStubHeifDecoderAPI.h
+++ b/src/codec/SkStubHeifDecoderAPI.h
@@ -32,22 +32,12 @@
 };
 
 struct HeifFrameInfo {
-#ifdef SK_LEGACY_HEIF_API
-    int mRotationAngle;
-    int mWidth;
-    int mHeight;
-    int mBytesPerPixel;
-
-    size_t                  mIccSize;
-    std::unique_ptr<char[]> mIccData;
-#else
     uint32_t mWidth;
     uint32_t mHeight;
     int32_t  mRotationAngle;           // Rotation angle, clockwise, should be multiple of 90
     uint32_t mBytesPerPixel;           // Number of bytes for one pixel
     int64_t mDurationUs;               // Duration of the frame in us
     std::vector<uint8_t> mIccData;     // ICC data array
-#endif
 };
 
 struct HeifDecoder {
@@ -56,21 +46,17 @@
         return false;
     }
 
-#ifndef SK_LEGACY_HEIF_API
     bool getSequenceInfo(HeifFrameInfo* frameInfo, size_t *frameCount) {
         return false;
     }
-#endif
 
     bool decode(HeifFrameInfo*) {
         return false;
     }
 
-#ifndef SK_LEGACY_HEIF_API
     bool decodeSequence(int frameIndex, HeifFrameInfo* frameInfo) {
         return false;
     }
-#endif
 
     bool setOutputColor(HeifColorFormat) {
         return false;