Add GPU perspective support for color emoji

Will also warp orthogonal bitmaps to handle skew and rotate transforms.

Bug: skia:7985
Change-Id: Ib0d5476dd68603354be90c8d404f1e5140d63a0c
Reviewed-on: https://skia-review.googlesource.com/129480
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 1412679..116e223 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -53,7 +53,7 @@
         }
 
         // Setup position
-        this->writeOutputPosition(vertBuilder, gpArgs, btgp.inPosition()->fName);
+        gpArgs->fPositionVar = btgp.inPosition()->asShaderVar();
 
         // emit transforms
         this->emitTransforms(vertBuilder,
@@ -102,7 +102,7 @@
                               GrProcessorKeyBuilder* b) {
         const GrBitmapTextGeoProc& btgp = proc.cast<GrBitmapTextGeoProc>();
         uint32_t key = 0;
-        key |= (btgp.usesLocalCoords() && btgp.localMatrix().hasPerspective()) ? 0x1 : 0x0;
+        key |= btgp.usesW() ? 0x1 : 0x0;
         key |= btgp.maskFormat() << 1;
         b->add32(key);
         b->add32(btgp.numTextureSamplers());
@@ -124,16 +124,20 @@
                                          const sk_sp<GrTextureProxy>* proxies,
                                          int numActiveProxies,
                                          const GrSamplerState& params, GrMaskFormat format,
-                                         const SkMatrix& localMatrix, bool usesLocalCoords)
+                                         const SkMatrix& localMatrix, bool usesW)
         : INHERITED(kGrBitmapTextGeoProc_ClassID)
         , fColor(color)
         , fLocalMatrix(localMatrix)
-        , fUsesLocalCoords(usesLocalCoords)
+        , fUsesW(usesW)
         , fInColor(nullptr)
         , fMaskFormat(format) {
     SkASSERT(numActiveProxies <= kMaxTextures);
 
-    fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+    if (usesW) {
+        fInPosition = &this->addVertexAttrib("inPosition", kFloat3_GrVertexAttribType);
+    } else {
+        fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+    }
 
     bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
                           kA565_GrMaskFormat == fMaskFormat;