aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
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/gpu
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/gpu')
-rw-r--r--include/gpu/GrRenderTargetContext.h3
-rw-r--r--include/gpu/GrSurfaceContext.h8
-rw-r--r--include/gpu/GrTextureContext.h1
3 files changed, 12 insertions, 0 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;