Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: include/private/GrTextureProxy.h

Issue 1937553002: Add Gr*Proxy classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix memory bugs Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/GrSurfaceProxy.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/GrTextureProxy.h
diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb82ca75811ff7a8196ad13efa579ed6141d7d52
--- /dev/null
+++ b/include/private/GrTextureProxy.h
@@ -0,0 +1,49 @@
+/*
+ * 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 GrTextureProxy_DEFINED
+#define GrTextureProxy_DEFINED
+
+#include "GrSurfaceProxy.h"
+#include "GrTexture.h"
+
+class GrTextureProvider;
+
+// This class delays the acquisition of textures until they are actually required
+class GrTextureProxy : public GrSurfaceProxy {
+public:
+ // TODO: need to refine ownership semantics of 'srcData' if we're in completely
+ // deferred mode
+ static sk_sp<GrTextureProxy> Make(const GrSurfaceDesc&, SkBackingFit, SkBudgeted,
+ const void* srcData = nullptr, size_t rowBytes = 0);
+ static sk_sp<GrTextureProxy> Make(sk_sp<GrTexture>);
+
+ // TODO: add asRenderTargetProxy variants
+ GrTextureProxy* asTextureProxy() override { return this; }
+ const GrTextureProxy* asTextureProxy() const override { return this; }
+
+ // Actually instantiate the backing texture, if necessary
+ GrTexture* instantiate(GrTextureProvider* texProvider);
+
+private:
+ GrTextureProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted,
+ const void* /*srcData*/, size_t /*rowBytes*/)
+ : INHERITED(desc, fit, budgeted) {
+ // TODO: Handle 'srcData' here
+ }
+
+ // Wrapped version
+ GrTextureProxy(sk_sp<GrTexture> tex);
+
+ // For wrapped textures we store it here.
+ // For deferred proxies we will fill this in when we need to instantiate the deferred resource
+ sk_sp<GrTexture> fTexture;
+
+ typedef GrSurfaceProxy INHERITED;
+};
+
+#endif
« no previous file with comments | « include/private/GrSurfaceProxy.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698