Convert SkGpuDevice::drawTextureAdjuster to SkGpuDevice::drawTextureProducer

Move createFragmentProcessor to GrTextureProducer base class.

Make non-tiled sw-bitmap draws go through drawTextureProducer.

Review URL: https://codereview.chromium.org/1459433002
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 540edb6..affd6cd 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -285,63 +285,12 @@
     pixelRef->addGenIDChangeListener(new Invalidator(key));
 }
 
-class RasterBitmap_GrTextureMaker : public GrTextureMaker {
-public:
-    RasterBitmap_GrTextureMaker(const SkBitmap& bitmap)
-        : INHERITED(bitmap.width(), bitmap.height())
-        , fBitmap(bitmap)
-    {
-        SkASSERT(!bitmap.getTexture());
-        if (!bitmap.isVolatile()) {
-            SkIPoint origin = bitmap.pixelRefOrigin();
-            SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(),
-                                               bitmap.height());
-            GrMakeKeyFromImageID(&fOriginalKey, bitmap.pixelRef()->getGenerationID(), subset);
-        }
-    }
-
-protected:
-    GrTexture* refOriginalTexture(GrContext* ctx) override {
-        GrTexture* tex;
-
-        if (fOriginalKey.isValid()) {
-            tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(fOriginalKey);
-            if (tex) {
-                return tex;
-            }
-        }
-
-        tex = GrUploadBitmapToTexture(ctx, fBitmap);
-        if (tex && fOriginalKey.isValid()) {
-            tex->resourcePriv().setUniqueKey(fOriginalKey);
-            GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
-        }
-        return tex;
-    }
-
-    void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) override {
-        if (fOriginalKey.isValid()) {
-            MakeCopyKeyFromOrigKey(fOriginalKey, copyParams, copyKey);
-        }
-    }
-
-    void didCacheCopy(const GrUniqueKey& copyKey) override {
-        GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
-    }
-
-private:
-    const SkBitmap  fBitmap;
-    GrUniqueKey     fOriginalKey;
-
-    typedef GrTextureMaker INHERITED;
-};
-
 GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
                                     const GrTextureParams& params) {
     if (bitmap.getTexture()) {
         return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params, nullptr);
     }
-    return RasterBitmap_GrTextureMaker(bitmap).refTextureForParams(ctx, params);
+    return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params);
 }
 
 ///////////////////////////////////////////////////////////////////////////////