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>
47 files changed