Reland "Test all YUVA image factories with different encoded origins."

This reverts commit f1650efc557e75520f810d21f5f574f1ece005fe.

Reason for revert: fix for cpu/ddl configs

Original change's description:
> Revert "Test all YUVA image factories with different encoded origins."
>
> This reverts commit 2ba80af000b7efa1c54616bd12edc627e5cb45af.
>
> Reason for revert: new test fails ddl and cpu configs on imggen
>
> Original change's description:
> > Test all YUVA image factories with different encoded origins.
> >
> > Now that SkImage_GpuYUVA stores a GrYUVATextureProxies it supports
> > encoded origins.
> >
> > Modify wacky_yuv_format GMs to use different origins and remove
> > restriction in SkImage::MakeFromYUVAPixmaps.
> >
> > Bug: skia:10632
> > Change-Id: I02477d592b7baba164944d629eeac48223698c10
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353623
> > Reviewed-by: Jim Van Verth <jvanverth@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=jvanverth@google.com,bsalomon@google.com
>
> Change-Id: If909ee4769cc1c74e1682a5e2870ec85a83f65c5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354661
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=jvanverth@google.com,bsalomon@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:10632
Change-Id: Iafe79ab5b3ce0ff9e3a4007e5d8fbc44edded196
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355630
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tools/gpu/YUVUtils.cpp b/tools/gpu/YUVUtils.cpp
index dbbbd2b..9344998 100644
--- a/tools/gpu/YUVUtils.cpp
+++ b/tools/gpu/YUVUtils.cpp
@@ -33,11 +33,11 @@
     return SkPremultiplyARGBInline(a, r, g, b);
 }
 
-static uint8_t look_up(float x1, float y1, const SkPixmap& pmap, SkColorChannel channel) {
-    SkASSERT(x1 > 0 && x1 < 1.0f);
-    SkASSERT(y1 > 0 && y1 < 1.0f);
-    int x = SkScalarFloorToInt(x1 * pmap.width());
-    int y = SkScalarFloorToInt(y1 * pmap.height());
+static uint8_t look_up(SkPoint normPt, const SkPixmap& pmap, SkColorChannel channel) {
+    SkASSERT(normPt.x() > 0 && normPt.x() < 1.0f);
+    SkASSERT(normPt.y() > 0 && normPt.y() < 1.0f);
+    int x = SkScalarFloorToInt(normPt.x() * pmap.width());
+    int y = SkScalarFloorToInt(normPt.y() * pmap.height());
 
     auto ii = pmap.info().makeColorType(kRGBA_8888_SkColorType).makeWH(1, 1);
     uint32_t pixel;
@@ -69,10 +69,21 @@
             SkYUVAInfo::YUVALocations yuvaLocations = fPixmaps.toYUVALocations();
             SkASSERT(SkYUVAInfo::YUVALocation::AreValidLocations(yuvaLocations));
 
+            SkMatrix om = fPixmaps.yuvaInfo().originMatrix();
+            SkAssertResult(om.invert(&om));
+            float normX = 1.f/info.width();
+            float normY = 1.f/info.height();
+            if (SkEncodedOriginSwapsWidthHeight(fPixmaps.yuvaInfo().origin())) {
+                using std::swap;
+                swap(normX, normY);
+            }
             for (int y = 0; y < info.height(); ++y) {
                 for (int x = 0; x < info.width(); ++x) {
-                    float x1 = (x + 0.5f) / info.width();
-                    float y1 = (y + 0.5f) / info.height();
+                    SkPoint xy1 {(x + 0.5f),
+                                 (y + 0.5f)};
+                    xy1 = om.mapPoint(xy1);
+                    xy1.fX *= normX;
+                    xy1.fY *= normY;
 
                     uint8_t yuva[4] = {0, 0, 0, 255};
 
@@ -80,13 +91,12 @@
                                    SkYUVAInfo::YUVAChannels::kU,
                                    SkYUVAInfo::YUVAChannels::kV}) {
                         const auto& pmap = fPixmaps.plane(yuvaLocations[c].fPlane);
-                        yuva[c] = look_up(x1, y1, pmap, yuvaLocations[c].fChannel);
+                        yuva[c] = look_up(xy1, pmap, yuvaLocations[c].fChannel);
                     }
-                    if (yuvaLocations[SkYUVAInfo::YUVAChannels::kA].fPlane >= 0) {
-                        const auto& pmap =
-                                fPixmaps.plane(yuvaLocations[SkYUVAInfo::YUVAChannels::kA].fPlane);
-                        yuva[3] = look_up(
-                                x1, y1, pmap, yuvaLocations[SkYUVAInfo::YUVAChannels::kA].fChannel);
+                    auto [aPlane, aChan] = yuvaLocations[SkYUVAInfo::YUVAChannels::kA];
+                    if (aPlane >= 0) {
+                        const auto& pmap = fPixmaps.plane(aPlane);
+                        yuva[3] = look_up(xy1, pmap, aChan);
                     }
 
                     // Making premul here.