diff options
author | Robert Phillips <robertphillips@google.com> | 2016-12-13 18:48:08 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-13 18:48:20 +0000 |
commit | 293d696fcfb9f1c83019c4b15c4864cd6649ed78 (patch) | |
tree | 851514d761f33f5c508ddb8009338723cf52f27a /include | |
parent | 3c41773fcd5c8f4462aefcb2a5927aecdb2a1806 (diff) |
Revert "Add a deferred copy surface"
This reverts commit 4431de6af930a8638c194b072558ea3a4b79d908.
Reason for revert: ANGLE errors (at the very least)
Original change's description:
> Add a deferred copy surface
>
> This CL forces all GrSurface copies to go through a GrSurfaceContext (rather than GrContext).
>
> There is a bit of goofiness going on here until read/writePixels is also consolidated in GrSurfaceContext and a proxy-backed SkImage/SkSurface is added.
>
> Change-Id: Iab1867668d8146a766201158a251b9174438ee2b
> Reviewed-on: https://skia-review.googlesource.com/5773
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I61408d9e306b9b1ab32f93ab086e95184e12857f
Reviewed-on: https://skia-review.googlesource.com/5938
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 19 | ||||
-rw-r--r-- | include/gpu/GrRenderTargetContext.h | 8 | ||||
-rw-r--r-- | include/gpu/GrSurfaceContext.h | 34 | ||||
-rw-r--r-- | include/gpu/GrTextureContext.h | 6 | ||||
-rw-r--r-- | include/private/GrRenderTargetProxy.h | 3 | ||||
-rw-r--r-- | include/private/GrSurfaceProxy.h | 14 |
6 files changed, 23 insertions, 61 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 9e9773c73a..9ccda23727 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -302,6 +302,25 @@ public: uint32_t pixelOpsFlags = 0); /** + * Copies a rectangle of texels from src to dst. + * @param dst the surface to copy to. + * @param src the surface to copy from. + * @param srcRect the rectangle of the src that should be copied. + * @param dstPoint the translation applied when writing the srcRect's pixels to the dst. + */ + bool copySurface(GrSurface* dst, + GrSurface* src, + const SkIRect& srcRect, + const SkIPoint& dstPoint); + + /** Helper that copies the whole surface but fails when the two surfaces are not identically + sized. */ + bool copySurface(GrSurface* dst, GrSurface* src) { + return this->copySurface(dst, src, SkIRect::MakeWH(dst->width(), dst->height()), + SkIPoint::Make(0,0)); + } + + /** * After this returns any pending writes to the surface will have been issued to the backend 3D API. */ void flushSurfaceWrites(GrSurface* surface); diff --git a/include/gpu/GrRenderTargetContext.h b/include/gpu/GrRenderTargetContext.h index f6f8cbfb16..ac733cb376 100644 --- a/include/gpu/GrRenderTargetContext.h +++ b/include/gpu/GrRenderTargetContext.h @@ -50,6 +50,8 @@ class SK_API GrRenderTargetContext : public GrSurfaceContext { public: ~GrRenderTargetContext() override; + bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override; + // TODO: it is odd that we need both the SkPaint in the following 3 methods. // We should extract the text parameters from SkPaint and pass them separately // akin to GrStyle (GrTextInfo?) @@ -370,7 +372,6 @@ public: return fRenderTargetProxy->instantiate(fContext->textureProvider()); } - GrSurfaceProxy* asDeferredSurface() override { return fRenderTargetProxy.get(); } GrTextureProxy* asDeferredTexture(); sk_sp<GrTexture> asTexture() { @@ -466,9 +467,6 @@ private: const SkPath&, const GrStyle&); - bool onCopy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override; - - // This entry point allows the GrTextContext-derived classes to add their ops to the GrOpList. void addDrawOp(const GrPipelineBuilder&, const GrClip&, GrDrawOp*); @@ -485,8 +483,6 @@ private: sk_sp<SkColorSpace> fColorSpace; sk_sp<GrColorSpaceXform> fColorXformFromSRGB; SkSurfaceProps fSurfaceProps; - - typedef GrSurfaceContext INHERITED; }; #endif diff --git a/include/gpu/GrSurfaceContext.h b/include/gpu/GrSurfaceContext.h index e1c799e3ae..a05d37fed3 100644 --- a/include/gpu/GrSurfaceContext.h +++ b/include/gpu/GrSurfaceContext.h @@ -8,8 +8,6 @@ #ifndef GrSurfaceContext_DEFINED #define GrSurfaceContext_DEFINED -#include "../private/GrSurfaceProxy.h" - #include "SkRefCnt.h" class GrAuditTrail; @@ -26,30 +24,7 @@ class SK_API GrSurfaceContext : public SkRefCnt { public: ~GrSurfaceContext() override {} - /* - * 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; + virtual bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) = 0; GrAuditTrail* auditTrail() { return fAuditTrail; } @@ -63,13 +38,6 @@ 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 diff --git a/include/gpu/GrTextureContext.h b/include/gpu/GrTextureContext.h index 3052f0ccb5..da71c07c72 100644 --- a/include/gpu/GrTextureContext.h +++ b/include/gpu/GrTextureContext.h @@ -27,7 +27,7 @@ class SK_API GrTextureContext : public GrSurfaceContext { public: ~GrTextureContext() override; - GrSurfaceProxy* asDeferredSurface() override { return fTextureProxy.get(); } + bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override; protected: GrTextureContext(GrContext*, GrDrawingManager*, sk_sp<GrTextureProxy>, GrAuditTrail*, @@ -40,8 +40,6 @@ protected: private: friend class GrDrawingManager; // for ctor - bool onCopy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override; - GrTextureOpList* getOpList(); GrDrawingManager* fDrawingManager; @@ -50,8 +48,6 @@ private: // In MDB-mode the GrOpList can be closed by some other renderTargetContext that has picked // it up. For this reason, the GrOpList should only ever be accessed via 'getOpList'. GrTextureOpList* fOpList; - - typedef GrSurfaceContext INHERITED; }; #endif diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h index 7f026ba726..83107daf61 100644 --- a/include/private/GrRenderTargetProxy.h +++ b/include/private/GrRenderTargetProxy.h @@ -53,9 +53,6 @@ public: GrRenderTarget::Flags testingOnly_getFlags() const; - // TODO: move this to a priv class! - bool refsWrappedObjects() const; - protected: friend class GrSurfaceProxy; // for ctors diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index 12972c21be..731603b2c9 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -266,20 +266,6 @@ public: return fGpuMemorySize; } - // Helper function that creates a temporary SurfaceContext to perform the copy - static sk_sp<GrSurfaceProxy> Copy(GrContext*, GrSurfaceProxy* src, - SkIRect srcRect, SkBudgeted); - - // Copy the entire 'src' - static sk_sp<GrSurfaceProxy> Copy(GrContext* context, GrSurfaceProxy* src, - SkBudgeted budgeted) { - return Copy(context, src, SkIRect::MakeWH(src->width(), src->height()), budgeted); - } - - // Test-only entry point - should decrease in use as proxies propagate - static sk_sp<GrSurfaceProxy> TestCopy(GrContext* context, const GrSurfaceDesc& dstDesc, - GrTexture* srcTexture, SkBudgeted budgeted); - bool isWrapped_ForTesting() const; SkDEBUGCODE(void validate(GrContext*) const;) |