GrSurfaceContext::read/writePixels takes GrPixmap
Change readPixels contract to allow unknown->unknown AT reads, but
fail if one side is unknown and the other isn't (and update GPU read
pixels test accordingly).
Also, ProxyUtils::MakeTextureProxyViewFromData takes GrPixmap.
Bug: skia:8862
Change-Id: I771c154833408e666f860413c1a711714696326d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347196
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 60fc978..e8f16f8 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -17,6 +17,7 @@
#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrDataUtils.h"
#include "src/gpu/GrImageInfo.h"
+#include "src/gpu/GrPixmap.h"
#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyView.h"
@@ -92,19 +93,13 @@
const GrCaps* caps() const;
/**
- * Reads a rectangle of pixels from the render target context.
+ * Reads a rectangle of pixels from the surface 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
* is a GrDirectContext and fail otherwise.
*/
- bool readPixels(GrDirectContext* dContext,
- const GrImageInfo& dstInfo,
- void* dst,
- size_t rowBytes,
- SkIPoint srcPt);
+ bool readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoint srcPt);
using ReadPixelsCallback = SkImage::ReadPixelsCallback;
using ReadPixelsContext = SkImage::ReadPixelsContext;
@@ -134,16 +129,10 @@
* Writes a rectangle of pixels [srcInfo, srcBuffer, srcRowbytes] into the
* surfaceDrawContext 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
*/
- bool writePixels(GrDirectContext* dContext,
- const GrImageInfo& srcInfo,
- const void* src,
- size_t rowBytes,
- SkIPoint dstPt);
+ bool writePixels(GrDirectContext* dContext, GrPixmap src, SkIPoint dstPt);
GrSurfaceProxy* asSurfaceProxy() { return fReadView.proxy(); }
const GrSurfaceProxy* asSurfaceProxy() const { return fReadView.proxy(); }
@@ -178,7 +167,7 @@
SkFilterQuality);
/**
- * Like the above but allows the caller ot specify a destination render target context and
+ * Like the above but allows the caller ot specify a destination draw context and
* rect within that context. The dst rect must be contained by the dst or this will fail.
*/
bool rescaleInto(GrSurfaceDrawContext* dst,