diff options
author | 2015-06-18 09:12:16 -0700 | |
---|---|---|
committer | 2015-06-18 09:12:17 -0700 | |
commit | 6dc6f5f4a153d33ed91565cb3cd397a310a937d0 (patch) | |
tree | a432ddf0638895a1d1d645876575aa64a9d9d6c7 /include/gpu/GrGpuResource.h | |
parent | 4c58e085b27c4cd9813ed7cad2388194d1d1f089 (diff) |
Add support for creating texture backed images where Skia will delete the texture.
Review URL: https://codereview.chromium.org/1187523005
Diffstat (limited to 'include/gpu/GrGpuResource.h')
-rw-r--r-- | include/gpu/GrGpuResource.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h index 5a35ab794a..6f9855f17c 100644 --- a/include/gpu/GrGpuResource.h +++ b/include/gpu/GrGpuResource.h @@ -150,17 +150,24 @@ public: * The cache may release them whenever there are no refs. */ kCached_LifeCycle, + /** * The resource is uncached. As soon as there are no more refs to it, it is released. Under * the hood the cache may opaquely recycle it as a cached resource. */ kUncached_LifeCycle, + /** * Similar to uncached, but Skia does not manage the lifetime of the underlying backend * 3D API object(s). The client is responsible for freeing those. Used to inject client- * created GPU resources into Skia (e.g. to render to a client-created texture). */ - kWrapped_LifeCycle, + kBorrowed_LifeCycle, + + /** + * An external resource with ownership transfered into Skia. Skia will free the resource. + */ + kAdopted_LifeCycle, }; /** @@ -265,7 +272,12 @@ protected: backend API calls should be made. */ virtual void onAbandon() { } - bool isWrapped() const { return kWrapped_LifeCycle == fLifeCycle; } + bool shouldFreeResources() const { return fLifeCycle != kBorrowed_LifeCycle; } + + bool isExternal() const { + return GrGpuResource::kAdopted_LifeCycle == fLifeCycle || + GrGpuResource::kBorrowed_LifeCycle == fLifeCycle; + } /** * This entry point should be called whenever gpuMemorySize() should report a different size. |