Reland "Remove some GPU-specific methods from SkImage"

This reverts commit f6c1eefd46005871af541940ea36fc000fec5451.

Reason for revert: Fixed clients

Client CLs:
 - https://crrev.com/c/4387338

Original change's description:
> Revert "Remove some GPU-specific methods from SkImage"
>
> This reverts commit 89ea350e87a8f1ecef317e40b6386a138bb8e7b0.
>
> Reason for revert: breaking chrome build around flush() ambiguity
>
> Original change's description:
> > Remove some GPU-specific methods from SkImage
> >
> > The following methods have been moved to static functions defined
> > in //include/gpu/ganesh/SkImageGanesh.h
> >   * getBackendTexture() -> SkImages::GetBackendTextureFromImage()
> >   * makeTextureImage() -> SkImages::TextureFromImage()
> >   * flush() -> GrDirectContext::flush()
> >   * flushAndSubmit() -> GrDirectContext::flushAndSubmit()
> >
> > Additionally, the "old" SkImages::GetBackendTextureFromImage()
> > has been renamed to SkImages::MakeBackendTextureFromImage() to
> > make it clear that this static method will upload a texture if
> > there is not already one where as the Get* version will just
> > return the existing one.
> >
> > Bridge code remains until clients can be migrated off the methods.
> > Making these be functions will make it easier to decouple
> > the GPU backend logic from SkImage and SkImageBase.
> >
> > Additionally, the following methods have been marked as virtual
> > to also accomplish this:
> >   * isTextureBacked()
> >   * textureSize()
> >   * isValid()
> >   * makeTextureImage (the graphite version)
> >
> > In early versions of the CL (e.g. PS 2), I tried making all the
> > affected methods virtual, but this did not accomplish the separation
> > I wanted in a few places. For example makeTextureImage() could
> > not be easily virtualized, as raster images would need to include
> > the GPU backend code to upload themselves. Furthermore, flush()
> > was mostly a no-op but still needed to return a GPU type (I briefly
> > introduced SkSemaphoresSubmitted in include/core, but that felt
> > like the wrong solution. Finally, getBackendTexture, as originally
> > written, always needed to return a GrBackendTexture object, even
> > if it was not supported, requiring raster images to need some
> > GPU code.
> >
> > Suggested Review Order
> >  - RELEASE_NOTES.txt and SkImage.h to get an overview of the changes
> >  - SkImageGanesh.h to see the new APIs. The biggest difference
> >    is that GetExistingBackendTexture now takes in a GrBackendTexture*
> >    and returns a bool, similar to GetBackendTextureFromImage.
> >  - GrDirectContext.* to see where the flush code moved.
> >  - SkImage_GaneshFactories.cpp to see where the other two methods
> >    moved.
> >  - SkImage_GaneshBase.h to see the flush API pushed down here
> >    (from SkImage).
> >  - SkImage_Ganesh* to see no functionality really changed, only
> >    function renames.
> >  - SkImage.cpp to see the bridge code.
> >  - All other files in any order.
> >
> > Change-Id: Icfb7604247cc0a117941355aaeb90af638e0e2d2
> > Bug: skia:13983
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/661676
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Kevin Lubick <kjlubick@google.com>
>
> Bug: skia:13983
> Change-Id: I4e121ff477f2f4499ead51159aac9a82e4bae469
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/664180
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Auto-Submit: Michael Ludwig <michaelludwig@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

Bug: skia:13983
Change-Id: I77bb6e5c5830b1806c025df8df9fda4be4956bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/664477
Reviewed-by: Brian Osman <brianosman@google.com>
47 files changed