Reland "Reland "Remove support for copyAsDraw in gpu copySurface.""
This reverts commit 4c6f9b767034c6812d868108516c2580dce3cb56.
Reason for revert: Landing with neuxs 7 and androind one fixes
Original change's description:
> Revert "Reland "Remove support for copyAsDraw in gpu copySurface.""
>
> This reverts commit 84ea04949cabc87a88d06c5c6f6aeb944a745911.
>
> Reason for revert: nexus 7 and android one broken
>
> Original change's description:
> > Reland "Remove support for copyAsDraw in gpu copySurface."
> >
> > This reverts commit c5167c053bd58e6afbad83fe493c0231df3f9704.
> >
> > Reason for revert: fixed
> >
> > Original change's description:
> > > Revert "Remove support for copyAsDraw in gpu copySurface."
> > >
> > > This reverts commit 6565506463db042d3d543a1707f473cdf1ef4e9e.
> > >
> > > Reason for revert: seems to break things?
> > >
> > > Original change's description:
> > > > Remove support for copyAsDraw in gpu copySurface.
> > > >
> > > > The major changes on a higher lever are:
> > > > 1) The majority of all copies now go through GrSurfaceProxy::Copy which
> > > > takes in a proxy and returns a new one with the data copied to it. This
> > > > is the most common use case within Ganesh.
> > > >
> > > > 2) The backend copy calls no longer do draws, require origins to be the
> > > > same, and won't do any swizzling or adjustment of subrects. They are
> > > > all implemented to be dumb copy this data to this other spot.
> > > >
> > > > 3) The GrSurfaceContext copy call has now been moved to priv and renamed
> > > > copyNoDraw, and a new priv copyAsDraw was added to GrRenderTargetContext.
> > > >
> > > > 4) WritePixels and ReplaceRenderTarget both need to specifiy the destination
> > > > of copies. They are the only users (besides the GrSurfaceProxy::Copy) which
> > > > call the priv methods on GrSurfaceContext.
> > > >
> > > > Change-Id: Iaf1eb3a73ccaf39a75af77e281dae594f809186f
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217459
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: Id43aa8aa1451e794342e930441d9975b90e6b59f
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218549
> > > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> >
> > Change-Id: I1a96f85ae2ff7622a6b57406755d478e7fbcf56e
> > No-Presubmit: true
> > No-Tree-Checks: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218797
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: I310930a9df30535f45a065263a40239141e15562
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219384
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I88df4f19aa26ed77b5af4e25d138387cbabd1934
No-Presubmit: true
No-Tree-Checks: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219386
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 3cbb838..e72364c 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -39,26 +39,6 @@
int width() const { return this->asSurfaceProxy()->width(); }
int height() const { return this->asSurfaceProxy()->height(); }
- /*
- * Copy 'src' into the proxy backing this context
- * @param src src of pixels
- * @param srcRect the subset of 'src' to copy
- * @param dstPoint the origin of the 'srcRect' in the destination coordinate space
- * @return true if the copy succeeded; false otherwise
- *
- * Note: Notionally, 'srcRect' is clipped to 'src's extent with 'dstPoint' being adjusted.
- * Then the 'srcRect' offset by 'dstPoint' is clipped against the dst's extent.
- * The end result is only valid src pixels and dst pixels will be touched but the copied
- * regions will not be shifted.
- */
- bool copy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint);
-
- bool copy(GrSurfaceProxy* src) {
- return this->copy(src,
- SkIRect::MakeWH(src->width(), src->height()),
- SkIPoint::Make(0, 0));
- }
-
/**
* These flags can be used with the read/write pixels functions below.
*/
@@ -134,6 +114,17 @@
GrSurfaceContextPriv surfPriv();
const GrSurfaceContextPriv surfPriv() const;
+#if GR_TEST_UTILS
+ bool testCopy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) {
+ return this->copy(src, srcRect, dstPoint);
+ }
+
+ bool testCopy(GrSurfaceProxy* src) {
+ return this->copy(src);
+ }
+#endif
+
+
protected:
friend class GrSurfaceContextPriv;
@@ -150,6 +141,29 @@
GrRecordingContext* fContext;
private:
+ friend class GrSurfaceProxy; // for copy
+
+ /**
+ * Copy 'src' into the proxy backing this context. This call will not do any draw fallback.
+ * Currently only writePixels and replaceRenderTarget call this directly. All other copies
+ * should go through GrSurfaceProxy::Copy.
+ * @param src src of pixels
+ * @param srcRect the subset of 'src' to copy
+ * @param dstPoint the origin of the 'srcRect' in the destination coordinate space
+ * @return true if the copy succeeded; false otherwise
+ *
+ * Note: Notionally, 'srcRect' is clipped to 'src's extent with 'dstPoint' being adjusted.
+ * Then the 'srcRect' offset by 'dstPoint' is clipped against the dst's extent.
+ * The end result is only valid src pixels and dst pixels will be touched but the copied
+ * regions will not be shifted. The 'src' must have the same origin as the backing proxy
+ * of fSurfaceContext.
+ */
+ bool copy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint);
+
+ bool copy(GrSurfaceProxy* src) {
+ return this->copy(src, SkIRect::MakeWH(src->width(), src->height()), SkIPoint::Make(0, 0));
+ }
+
bool writePixelsImpl(GrContext* direct, int left, int top, int width, int height,
GrColorType srcColorType, SkColorSpace* srcColorSpace,
const void* srcBuffer, size_t srcRowBytes, uint32_t pixelOpsFlags);