aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-25 12:10:37 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-25 17:53:10 +0000
commitd46697ac36d5cb3b58571c6129cb5b26fe9d25d7 (patch)
tree5f7efe30049183c3248ce2cb8fe651e62f5c9392 /include
parent74b16edd98e4fd560baaf5655dd7e4ae43f8ae69 (diff)
Use GrSurfaceContext::read/write-Pixels more
Change-Id: I04bcaf91aa7a43e0563e332c1fe2836d762a04d4 Reviewed-on: https://skia-review.googlesource.com/7520 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrRenderTargetContext.h3
-rw-r--r--include/gpu/GrSurfaceContext.h8
-rw-r--r--include/gpu/GrTextureContext.h1
-rw-r--r--include/private/GrSurfaceProxy.h5
4 files changed, 15 insertions, 2 deletions
diff --git a/include/gpu/GrRenderTargetContext.h b/include/gpu/GrRenderTargetContext.h
index aab105087f..b3f15bef47 100644
--- a/include/gpu/GrRenderTargetContext.h
+++ b/include/gpu/GrRenderTargetContext.h
@@ -343,9 +343,12 @@ public:
}
GrSurfaceProxy* asDeferredSurface() override { return fRenderTargetProxy.get(); }
+ const GrSurfaceProxy* asDeferredSurface() const override { return fRenderTargetProxy.get(); }
GrTextureProxy* asDeferredTexture() override;
GrRenderTargetProxy* asDeferredRenderTarget() override { return fRenderTargetProxy.get(); }
+ GrRenderTargetContext* asRenderTargetContext() override { return this; }
+
sk_sp<GrTexture> asTexture() {
if (!this->accessRenderTarget()) {
return nullptr;
diff --git a/include/gpu/GrSurfaceContext.h b/include/gpu/GrSurfaceContext.h
index 6a40f2f8b2..75ee95276e 100644
--- a/include/gpu/GrSurfaceContext.h
+++ b/include/gpu/GrSurfaceContext.h
@@ -14,6 +14,7 @@
class GrAuditTrail;
class GrContext;
+class GrRenderTargetContext;
class GrRenderTargetProxy;
class GrSingleOwner;
class GrSurface;
@@ -34,6 +35,10 @@ public:
sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; }
bool isGammaCorrect() const { return SkToBool(fColorSpace.get()); }
+ // TODO: these two calls would be way cooler if this object had a GrSurfaceProxy pointer
+ int width() const { return this->asDeferredSurface()->width(); }
+ int height() const { return this->asDeferredSurface()->height(); }
+
/*
* Copy 'src' into the proxy backing this context
* @param src src of pixels
@@ -91,9 +96,12 @@ public:
// TODO: this is virtual b.c. this object doesn't have a pointer to the wrapped GrSurfaceProxy?
virtual GrSurfaceProxy* asDeferredSurface() = 0;
+ virtual const GrSurfaceProxy* asDeferredSurface() const = 0;
virtual GrTextureProxy* asDeferredTexture() = 0;
virtual GrRenderTargetProxy* asDeferredRenderTarget() = 0;
+ virtual GrRenderTargetContext* asRenderTargetContext() { return nullptr; }
+
GrAuditTrail* auditTrail() { return fAuditTrail; }
// Provides access to functions that aren't part of the public API.
diff --git a/include/gpu/GrTextureContext.h b/include/gpu/GrTextureContext.h
index b49b27255a..79a1719ac2 100644
--- a/include/gpu/GrTextureContext.h
+++ b/include/gpu/GrTextureContext.h
@@ -28,6 +28,7 @@ public:
~GrTextureContext() override;
GrSurfaceProxy* asDeferredSurface() override { return fTextureProxy.get(); }
+ const GrSurfaceProxy* asDeferredSurface() const override { return fTextureProxy.get(); }
GrTextureProxy* asDeferredTexture() override { return fTextureProxy.get(); }
GrRenderTargetProxy* asDeferredRenderTarget() override;
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 12972c21be..9363b8280b 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -16,6 +16,7 @@
class GrCaps;
class GrRenderTargetOpList;
class GrRenderTargetProxy;
+class GrSurfaceContext;
class GrTextureOpList;
class GrTextureProvider;
class GrTextureProxy;
@@ -277,8 +278,8 @@ public:
}
// 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);
+ static sk_sp<GrSurfaceContext> TestCopy(GrContext* context, const GrSurfaceDesc& dstDesc,
+ GrSurfaceProxy* srcProxy);
bool isWrapped_ForTesting() const;