aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureContext.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-14 09:05:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-14 13:33:04 +0000
commit0727f674bded6b81fe50870c2ef342a4c0841d9e (patch)
tree6e1f58afeb5ff7d54606e4705592cd663d6906d9 /src/gpu/GrTextureContext.h
parent0166cfd311bb151af7745fe04fe850ee28b17e0a (diff)
Move GrSurfaceContext.h and GrTextureContext.h to src/gpu from include/gpu
Change-Id: I5b68650d2417018e217a2fef2f852316ebd9de6f Reviewed-on: https://skia-review.googlesource.com/9637 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrTextureContext.h')
-rw-r--r--src/gpu/GrTextureContext.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/gpu/GrTextureContext.h b/src/gpu/GrTextureContext.h
new file mode 100644
index 0000000000..d5e1eb9b7c
--- /dev/null
+++ b/src/gpu/GrTextureContext.h
@@ -0,0 +1,66 @@
+/*
+ * 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 GrTextureContext_DEFINED
+#define GrTextureContext_DEFINED
+
+#include "GrSurfaceContext.h"
+#include "../private/GrTextureProxy.h"
+
+class GrContext;
+class GrDrawingManager;
+class GrSurface;
+class GrTextureOpList;
+class GrTextureProxy;
+struct SkIPoint;
+struct SkIRect;
+
+/**
+ * A helper object to orchestrate commands (currently just copies) for GrSurfaces that are
+ * GrTextures and not GrRenderTargets.
+ */
+class SK_API GrTextureContext : public GrSurfaceContext {
+public:
+ ~GrTextureContext() override;
+
+ GrSurfaceProxy* asSurfaceProxy() override { return fTextureProxy.get(); }
+ const GrSurfaceProxy* asSurfaceProxy() const override { return fTextureProxy.get(); }
+ sk_sp<GrSurfaceProxy> asSurfaceProxyRef() override { return fTextureProxy; }
+
+ GrTextureProxy* asTextureProxy() override { return fTextureProxy.get(); }
+ sk_sp<GrTextureProxy> asTextureProxyRef() override { return fTextureProxy; }
+
+ GrRenderTargetProxy* asRenderTargetProxy() override;
+ sk_sp<GrRenderTargetProxy> asRenderTargetProxyRef() override;
+
+protected:
+ GrTextureContext(GrContext*, GrDrawingManager*, sk_sp<GrTextureProxy>,
+ sk_sp<SkColorSpace>, GrAuditTrail*, GrSingleOwner*);
+
+ SkDEBUGCODE(void validate() const;)
+
+private:
+ friend class GrDrawingManager; // for ctor
+
+ bool onCopy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override;
+ bool onReadPixels(const SkImageInfo& dstInfo, void* dstBuffer,
+ size_t dstRowBytes, int x, int y, uint32_t flags) override;
+ bool onWritePixels(const SkImageInfo& srcInfo, const void* srcBuffer,
+ size_t srcRowBytes, int x, int y, uint32_t flags) override;
+
+ GrTextureOpList* getOpList();
+
+ sk_sp<GrTextureProxy> fTextureProxy;
+
+ // 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