aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrSurfaceContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/gpu/GrSurfaceContext.h')
-rw-r--r--include/gpu/GrSurfaceContext.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/gpu/GrSurfaceContext.h b/include/gpu/GrSurfaceContext.h
index a05d37fed3..e1c799e3ae 100644
--- a/include/gpu/GrSurfaceContext.h
+++ b/include/gpu/GrSurfaceContext.h
@@ -8,6 +8,8 @@
#ifndef GrSurfaceContext_DEFINED
#define GrSurfaceContext_DEFINED
+#include "../private/GrSurfaceProxy.h"
+
#include "SkRefCnt.h"
class GrAuditTrail;
@@ -24,7 +26,30 @@ class SK_API GrSurfaceContext : public SkRefCnt {
public:
~GrSurfaceContext() override {}
- virtual bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) = 0;
+ /*
+ * 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) {
+ return this->onCopy(src, srcRect, dstPoint);
+ }
+
+ bool copy(GrSurfaceProxy* src) {
+ return this->onCopy(src,
+ SkIRect::MakeWH(src->width(), src->height()),
+ SkIPoint::Make(0, 0));
+ }
+
+ // TODO: this is virtual b.c. this object doesn't have a pointer to the wrapped GrSurfaceProxy?
+ virtual GrSurfaceProxy* asDeferredSurface() = 0;
GrAuditTrail* auditTrail() { return fAuditTrail; }
@@ -38,6 +63,13 @@ protected:
// In debug builds we guard against improper thread handling
SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
+
+private:
+ virtual bool onCopy(GrSurfaceProxy* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) = 0;
+
+ typedef SkRefCnt INHERITED;
};
#endif