Reland "Migrate GrSurfaceContext readPixels to take direct context"

This reverts commit cf0d08e149cfea45b2bc70ec22181315d33ddb3f.

Reason for revert: fix codegen

Original change's description:
> Revert "Migrate GrSurfaceContext readPixels to take direct context"
>
> This reverts commit d169e1915cba8caaddabb22b3672c7cefa91bfa2.
>
> Reason for revert: broke chrome via code generator
>
> Original change's description:
> > Migrate GrSurfaceContext readPixels to take direct context
> >
> > After this lands we'll proceed up the stack and add the direct
> > context requirement to the public API and SkImage.
> >
> > Bug: skia:104662
> > Change-Id: I4b2d779a7fcd65eec68e631757821ac8e136ddba
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309044
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: I6126f2dca4bc902c903512ac486e22841cc472e5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309281
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

TBR=robertphillips@google.com,adlai@google.com


Bug: skia:104662
Change-Id: If899edab54d031a3619a4bbab90d13738679c037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309319
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 4645630..6a6ef4f 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -75,30 +75,35 @@
 
     /**
      * Reads a rectangle of pixels from the render target context.
+     * @param dContext      The direct context to use
      * @param dstInfo       image info for the destination
      * @param dst           destination pixels for the read
      * @param rowBytes      bytes in a row of 'dst'
      * @param srcPt         offset w/in the surface context from which to read
-     * @param direct        The direct context to use. If null will use our GrRecordingContext if it
      *                      is a GrDirectContext and fail otherwise.
      */
-    bool readPixels(const GrImageInfo& dstInfo, void* dst, size_t rowBytes, SkIPoint srcPt,
-                    GrDirectContext* direct = nullptr);
+    bool readPixels(GrDirectContext* dContext,
+                    const GrImageInfo& dstInfo,
+                    void* dst,
+                    size_t rowBytes,
+                    SkIPoint srcPt);
 
     using ReadPixelsCallback = SkImage::ReadPixelsCallback;
     using ReadPixelsContext  = SkImage::ReadPixelsContext;
     using RescaleGamma       = SkImage::RescaleGamma;
 
     // GPU implementation for SkImage:: and SkSurface::asyncRescaleAndReadPixels.
-    void asyncRescaleAndReadPixels(const SkImageInfo& info,
+    void asyncRescaleAndReadPixels(GrDirectContext*,
+                                   const SkImageInfo& info,
                                    const SkIRect& srcRect,
                                    RescaleGamma rescaleGamma,
                                    SkFilterQuality rescaleQuality,
                                    ReadPixelsCallback callback,
-                                   ReadPixelsContext context);
+                                   ReadPixelsContext callbackContext);
 
     // GPU implementation for SkImage:: and SkSurface::asyncRescaleAndReadPixelsYUV420.
-    void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace,
+    void asyncRescaleAndReadPixelsYUV420(GrDirectContext*,
+                                         SkYUVColorSpace yuvColorSpace,
                                          sk_sp<SkColorSpace> dstColorSpace,
                                          const SkIRect& srcRect,
                                          SkISize dstSize,
@@ -110,15 +115,17 @@
     /**
      * Writes a rectangle of pixels [srcInfo, srcBuffer, srcRowbytes] into the
      * renderTargetContext at the specified position.
+     * @param dContext      The direct context to use
      * @param srcInfo       image info for the source pixels
      * @param src           source for the write
      * @param rowBytes      bytes in a row of 'src'
      * @param dstPt         offset w/in the surface context at which to write
-     * @param direct        The direct context to use. If null will use our GrRecordingContext if it
-     *                      is a GrDirectContext and fail otherwise.
      */
-    bool writePixels(const GrImageInfo& srcInfo, const void* src, size_t rowBytes, SkIPoint dstPt,
-                     GrDirectContext* direct = nullptr);
+    bool writePixels(GrDirectContext* dContext,
+                     const GrImageInfo& srcInfo,
+                     const void* src,
+                     size_t rowBytes,
+                     SkIPoint dstPt);
 
     GrSurfaceProxy* asSurfaceProxy() { return fReadView.proxy(); }
     const GrSurfaceProxy* asSurfaceProxy() const { return fReadView.proxy(); }
@@ -204,10 +211,11 @@
     PixelTransferResult transferPixels(GrColorType colorType, const SkIRect& rect);
 
     // The async read step of asyncRescaleAndReadPixels()
-    void asyncReadPixels(const SkIRect& rect,
-                         SkColorType colorType,
-                         ReadPixelsCallback callback,
-                         ReadPixelsContext context);
+    void asyncReadPixels(GrDirectContext*,
+                         const SkIRect& srcRect,
+                         SkColorType,
+                         ReadPixelsCallback,
+                         ReadPixelsContext);
 
 private:
     friend class GrSurfaceProxy; // for copy