From 45580d3e3024c1536e8e1b2017b704805442b634 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 23 Nov 2016 09:37:01 -0500 Subject: Added GrSurfaceContext and GrTextureContext This lets copy-to-texture to be treated like copy-to-rt. To match current behavior, though, copies to texture are still executed immediately (forcing a flush). Once MDB is enabled, copies to texture will be deferred. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5093 Change-Id: Icc0ce5435507a5f0a237c22eedef879824952367 Reviewed-on: https://skia-review.googlesource.com/5093 Commit-Queue: Brian Osman Reviewed-by: Robert Phillips --- include/gpu/GrSurfaceContext.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/gpu/GrSurfaceContext.h (limited to 'include/gpu/GrSurfaceContext.h') diff --git a/include/gpu/GrSurfaceContext.h b/include/gpu/GrSurfaceContext.h new file mode 100644 index 0000000000..a05d37fed3 --- /dev/null +++ b/include/gpu/GrSurfaceContext.h @@ -0,0 +1,43 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrSurfaceContext_DEFINED +#define GrSurfaceContext_DEFINED + +#include "SkRefCnt.h" + +class GrAuditTrail; +class GrContext; +class GrSingleOwner; +class GrSurface; +struct SkIPoint; +struct SkIRect; + +/** + * A helper object to orchestrate commands for a particular surface + */ +class SK_API GrSurfaceContext : public SkRefCnt { +public: + ~GrSurfaceContext() override {} + + virtual bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) = 0; + + GrAuditTrail* auditTrail() { return fAuditTrail; } + +protected: + GrSurfaceContext(GrContext*, GrAuditTrail*, GrSingleOwner*); + + SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) + + GrContext* fContext; + GrAuditTrail* fAuditTrail; + + // In debug builds we guard against improper thread handling + SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) +}; + +#endif -- cgit v1.2.3